AFNI program: 3dSurfMask
Output of -help
Usage: 3dSurfMask <-i_TYPE SURFACE> <-prefix PREFIX>
[<-fill_method METH>]
<-grid_parent GRID_VOL> [-sv SURF_VOL] [-mask_only]
Creates 2 volumetric datasets that mark voxel based on their
location relative to the surface.
Voxels in the first volume (named PREFIX.m) label voxel positions
relative to the surface. With -fill_method set to FAST, you get a
a crude mask with voxel values set to the following:
0: Voxel outside surface
1: Voxel just outside the surface. This means the voxel
center is outside the surface but inside the
bounding box of a triangle in the mesh.
2: Voxel intersects the surface (a triangle),
but center lies outside.
3: Voxel contains a surface node.
4: Voxel intersects the surface (a triangle),
center lies inside surface.
5: Voxel just inside the surface. This means the voxel
center is inside the surface and inside the
bounding box of a triangle in the mesh.
6: Voxel inside the surface.
Masks obtained with -fill_method FAST could have holes in them.
To decide on whether a voxel lies inside or outside the surface
you should use the signed distances in PREFIX.d below, or use
-fill_method slow.
With -fill_method set to SLOW you get a better mask with voxels set
to the following:
0: Voxel outside surface
1: Voxel outside the surface but in its bounding box
2: Voxel inside the surface
Voxels values in the second volume (named PREFIX.d) reflect the
shortest distance of voxels in PREFIX.m to the surface.
The distances are signed to reflect whether a voxel is inside
or outsider the surface. Voxels inside the surface have positive
distances, voxels outside have a negative distance.
If the signs appear reversed, use option -flip_orientation.
Mandatory Parameters:
-i_TYPE SURFACE: Specify input surface.
You can also use -t* and -spec and -surf
methods to input surfaces. See below
for more details.
-prefix PREFIX: Prefix of output dataset.
-grid_parent GRID_VOL: Specifies the grid for the
output volume.
Other parameters:
-mask_only: Produce an output dataset where voxels
are 1 inside the surface and 0 outside,
instead of the more nuanced output above.
-flip_orientation: Flip triangle winding of surface mesh.
Use this option when the sign of the distances
in PREFIX.m comes out wrong. Voxels inside
the surface have a positive distance.
This can happen when the winding of the triangles
is reversed.
-fill_method METH: METH can take two values; SLOW, and FAST[default].
FAST can produce holes under certain conditions.
Example: (tcsh syntax)
1- Find distance of voxels around and inside of toy surface:
echo 'Create toy data'
@auto_tlrc -base TT_N27+tlrc -base_copy ToyVolume
CreateIcosahedron -rad 50 -ld 1
sed 's/Anatomical = N/Anatomical = Y/' CreateIco.spec > __ttt
mv __ttt CreateIco.spec
echo 'Do computations'
3dSurfMask -i_fs CreateIco.asc -sv ToyVolume+tlrc \
-prefix ToyMasks -flip_orientation \
-grid_parent ToyVolume+tlrc
echo 'Cut and paste commands below to show you the results'
suma -npb 70 -niml -spec CreateIco.spec -sv ToyVolume+tlrc &
afni -npb 70 -niml -yesplugouts &
DriveSuma -npb 70 -com viewer_cont -key 't'
plugout_drive -npb 70 -com 'SET_OVERLAY A ToyMasks.d' \
-com 'SET_THRESHOLD A.0' \
-com 'SET_PBAR_NUMBER A.10' \
-quit
See also examples in SurfPatch -help
Specifying input surfaces using -i or -i_TYPE options:
-i_TYPE inSurf specifies the input surface,
TYPE is one of the following:
fs: FreeSurfer surface.
If surface name has .asc it is assumed to be
in ASCII format. Otherwise it is assumed to be
in BINARY_BE (Big Endian) format.
Patches in Binary format cannot be read at the moment.
sf: SureFit surface.
You must specify the .coord followed by the .topo file.
vec (or 1D): Simple ascii matrix format.
You must specify the coord (NodeList) file followed by
the topo (FaceSetList) file.
coord contains 3 floats per line, representing
X Y Z vertex coordinates.
topo contains 3 ints per line, representing
v1 v2 v3 triangle vertices.
ply: PLY format, ascii or binary.
Only vertex and triangulation info is preserved.
mni: MNI .obj format, ascii only.
Only vertex, triangulation, and node normals info is preserved.
byu: BYU format, ascii.
Polygons with more than 3 edges are turned into
triangles.
bv: BrainVoyager format.
Only vertex and triangulation info is preserved.
dx: OpenDX ascii mesh format.
Only vertex and triangulation info is preserved.
Requires presence of 3 objects, the one of class
'field' should contain 2 components 'positions'
and 'connections' that point to the two objects
containing node coordinates and topology, respectively.
gii: GIFTI XML surface format.
Note that if the surface filename has the proper extension,
it is enough to use the -i option and let the programs guess
the type from the extension.
Specifying surfaces using -t* options:
-tn TYPE NAME: specify surface type and name.
See below for help on the parameters.
-tsn TYPE STATE NAME: specify surface type state and name.
TYPE: Choose from the following (case sensitive):
1D: 1D format
FS: FreeSurfer ascii format
PLY: ply format
MNI: MNI obj ascii format
BYU: byu format
SF: Caret/SureFit format
BV: BrainVoyager format
GII: GIFTI format
NAME: Name of surface file.
For SF and 1D formats, NAME is composed of two names
the coord file followed by the topo file
STATE: State of the surface.
Default is S1, S2.... for each surface.
Specifying a Surface Volume:
-sv SurfaceVolume [VolParam for sf surfaces]
If you supply a surface volume, the coordinates of the input surface.
are modified to SUMA's convention and aligned with SurfaceVolume.
You must also specify a VolParam file for SureFit surfaces.
Specifying a surface specification (spec) file:
-spec SPEC: specify the name of the SPEC file.
Specifying a surface using -surf_? method:
-surf_A SURFACE: specify the name of the first
surface to load. If the program requires
or allows multiple surfaces, use -surf_B
... -surf_Z .
You need not use _A if only one surface is
expected.
SURFACE is the name of the surface as specified
in the SPEC file. The use of -surf_ option
requires the use of -spec option.
[-novolreg|-noxform]: Ignore any Rotate, Volreg, Tagalign,
or WarpDrive transformations present in
the Surface Volume.
[-setenv "'ENVname=ENVvalue'"]: Set environment variable ENVname
to be ENVvalue. Quotes are necessary.
Example: suma -setenv "'SUMA_BackgroundColor = 1 0 1'"
See also options -update_env, -environment, etc
in the output of 'suma -help'
Common Debugging Options:
[-trace]: Turns on In/Out debug and Memory tracing.
For speeding up the tracing log, I recommend
you redirect stdout to a file when using this option.
For example, if you were running suma you would use:
suma -spec lh.spec -sv ... > TraceFile
This option replaces the old -iodbg and -memdbg.
[-TRACE]: Turns on extreme tracing.
[-nomall]: Turn off memory tracing.
[-yesmall]: Turn on memory tracing (default).
NOTE: For programs that output results to stdout
(that is to your shell/screen), the debugging info
might get mixed up with your results.
Global Options (available to all AFNI/SUMA programs)
-overwrite: Overwrite existing output dataset.
Equivalent to setting env. AFNI_DECONFLICT=OVERWRITE
-ok_1D_text: Zero out uncommented text in 1D file.
Equivalent to setting env. AFNI_1D_ZERO_TEXT=YES
-Dname=val: Set environment variable 'name' to value 'val'
For example: -DAFNI_1D_ZERO_TEXT=YES
-Vname=: Print value of environment variable 'name' to stdout and quit.
This is more reliable that the shell's env query because it would
include envs set in .afnirc files and .sumarc files for SUMA
programs.
For example: -VAFNI_1D_ZERO_TEXT=
-all_opts: Try to identify all options for the program from the
output of its -help option. Some options might be missed
and others misidentified. Use this output for hints only.
-h_find WORD: Look for lines in this programs's -help output that match
(approximately) WORD.
-h_view: Open help in text editor. AFNI will try to find a GUI editor
on your machine. You can control which it should use by
setting environment variable AFNI_GUI_EDITOR.
-h_web: Open help in web browser. AFNI will try to find a browser
on your machine. You can control which it should use by
setting environment variable AFNI_GUI_EDITOR.
-skip_afnirc: Do not read the afni resource (like ~/.afnirc) file.
-pad_to_node NODE: Output a full dset from node 0 to MAX_NODE-1
** Instead of directly setting NODE to an integer you
can set NODE to something like:
ld120 (or rd17) which sets NODE to be the maximum
node index on an Icosahedron with -ld 120. See
CreateIcosahedron for details.
d:DSET.niml.dset which sets NODE to the maximum node found
in dataset DSET.niml.dset.
** This option is for surface-based datasets only.
Some programs may not heed it, so check the output if
you are not sure.
-pif SOMETHING: Does absolutely nothing but provide for a convenient
way to tag a process and find it in the output of ps -a
-echo_edu: Echos the entire command line to stdout (without -echo_edu)
for edification purposes
Compile Date:
May 2 2012
Ziad S. Saad SSCC/NIMH/NIH saadz@mail.nih.gov
This page auto-generated on
Thu May 3 04:28:32 EDT 2012