WB_COMMAND(1)

๐Ÿ“ฆ
version 2.0.1 ยท 5 versions
, in ubuntu resolute, ubuntu stonking

๐ŸŒˆ WB_COMMAND(1) ๐ŸŒˆ

okay so bestie, welcome to wb_command(1) โ€” it's a User Commands page, and it's the command-line program for doing a whole variety of algorithmic tasks on volume, surface, and grayordinate data โœจ. This page is long (like, LONG long), so we're doing it in chunks. Buckle up, hydrate, and let's go ๐Ÿ’…


โœจ NAME โœจ

wb_command โ€” command-line program for performing a variety of algorithmic tasks using volume, surface, and grayordinate data ๐Ÿ’–


๐ŸŒธ SYNOPSIS ๐ŸŒธ

<class-name>

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

okay so this whole section is basically a big ol' menu of the things wb_command can do, one entry at a time. Every single one, no skipping, we're being thorough here ๐Ÿ‘‘


๐ŸŽ€ -add-to-spec-file โ€” ADD A FILE TO A SPECIFICATION FILE

wb_command -add-to-spec-file
  • <specfile> โ€” the specification file to add to
  • <structure> โ€” the structure of the data file
  • <filename> โ€” the path to the file
heads up bestie: the resulting spec file overwrites the existing spec file. no soft-launch, no merge, it just replaces it ๐Ÿ˜ญ

If the spec file doesn't exist, it gets created with default metadata โœจ.

The <structure> argument has to be one of the following, no improvising:

  • CORTEX_LEFT
  • CORTEX_RIGHT
  • CEREBELLUM
  • ACCUMBENS_LEFT
  • ACCUMBENS_RIGHT
  • ALL_GREY_MATTER
  • ALL_WHITE_MATTER
  • AMYGDALA_LEFT
  • AMYGDALA_RIGHT
  • BRAIN_STEM
  • CAUDATE_LEFT
  • CAUDATE_RIGHT
  • CEREBELLAR_WHITE_MATTER_LEFT
  • CEREBELLAR_WHITE_MATTER_RIGHT
  • CEREBELLUM_LEFT
  • CEREBELLUM_RIGHT
  • CEREBRAL_WHITE_MATTER_LEFT
  • CEREBRAL_WHITE_MATTER_RIGHT
  • CORTEX
  • DIENCEPHALON_VENTRAL_LEFT
  • DIENCEPHALON_VENTRAL_RIGHT
  • HIPPOCAMPUS_LEFT
  • HIPPOCAMPUS_RIGHT
  • INVALID
  • OTHER
  • OTHER_GREY_MATTER
  • OTHER_WHITE_MATTER
  • PALLIDUM_LEFT
  • PALLIDUM_RIGHT
  • PUTAMEN_LEFT
  • PUTAMEN_RIGHT
  • THALAMUS_LEFT
  • THALAMUS_RIGHT

๐Ÿงš -annotation-resample โ€” RESAMPLE AN ANNOTATION FILE TO DIFFERENT MESHES

wb_command -annotation-resample
  • <annotation-in> โ€” the annotation file to resample
  • <annotation-out> โ€” name of resampled annotation file
  • [-surface-pair] โ€” repeatable โ€” pair of surfaces for resampling surface annotations for one structure
    • <source-surface> โ€” the midthickness surface of the current mesh the annotations use
    • <target-surface> โ€” the midthickness surface of the mesh the annotations should be transferred to

So what it does: it resamples an annotation file from the source mesh to the target mesh ๐Ÿฆ‹

Only annotations in surface space are modified, no changes are made to annotations in other spaces. And the -surface-pair option may be repeated for additional structures used by surface space annotations, so go wild if you've got multiple structures ๐Ÿ’…


๐Ÿ’€ -backend-average-dense-roi โ€” CONNECTOME DB BACKEND COMMAND FOR CIFTI AVERAGE DENSE ROI

wb_command -backend-average-dense-roi
  • <index-list> โ€” comma separated list of cifti indexes to average
  • <out-file> โ€” file to write the average row to

okay so this command is probably not the one you are looking for, try -cifti-average-dense-roi instead bestie ๐Ÿ˜ญ. It takes the list of cifti files to average from standard input, and writes its output as little endian, 32-bit integer of row size followed by the row as 32-bit floats.


๐Ÿ’€ -backend-average-roi-correlation โ€” CONNECTOME DB BACKEND COMMAND FOR CIFTI AVERAGE ROI CORRELATION

wb_command -backend-average-roi-correlation
  • <index-list> โ€” comma separated list of cifti indexes to average and then correlate
  • <out-file> โ€” file to write the average row to

same energy as above: this command is probably not the one you are looking for, try -cifti-average-roi-correlation ๐ŸŒธ. It takes the list of cifti files to average from standard input, and writes its output as little endian, 32-bit integer of row size followed by the row as 32-bit floats.


๐Ÿ“ -border-export-color-table โ€” WRITE BORDER NAMES AND COLORS AS TEXT

wb_command -border-export-color-table
  • <border-file> โ€” the input border file
  • <table-out> โ€” output โ€” the output text file
  • [-class-colors] โ€” use class colors instead of the name colors

It takes the names and colors of each border, and writes it to the same format as -metric-label-import expects ๐Ÿ‘‘. By default, the borders are colored by border name โ€” specify -class-colors to color them by class instead. The key values start at 1 and follow the order of the borders in the file. slay.


๐Ÿ’œ -border-file-export-to-caret5 โ€” EXPORT BORDER FILE TO CARET5 FILE FORMAT

wb_command -border-file-export-to-caret5
  • <border-file> โ€” workbench border file
  • <output-file-prefix> โ€” prefix for name of output caret5 border/borderproj/bordercolor files
  • [-surface] โ€” repeatable โ€” specify an input surface
    • <surface-in> โ€” a surface file for unprojection of borders

A Workbench border file may contain borders for multiple structures and borders that are both projected and unprojected. It also contains a color table for the borders ๐ŸŒˆ

Caret5 has both border (unprojected) and border projection (projected) files. In addition, each Caret5 border or border projection file typically contains data for a single structure. Caret5 also uses a border color file that associates colors with the names of the borders.

This command will try to output both Caret5 border and border projection files. Each output border/border projection file will contains data for one structure so there may be many files created ๐Ÿ˜ญ. The structure name is included in the name of each border or border projection file that is created.

One Caret5 border color file will also be produced by this command.

Providing surface(s) as input parameters is optional, but recommended โœจ. Surfaces may be needed to create both projected and/or unprojected coordinates of borders. If there is a failure to produce an output border or border projection due to a missing surface with the matching structure, an error message will be displayed and some output files will not be created.

ngl this one's a menace: when writing new files, this command will overwrite a file with the same name ๐Ÿ’€

๐ŸŽ€ -border-length โ€” REPORT LENGTH OF BORDERS

wb_command -border-length
  • <border> โ€” the input border file
  • <surface> โ€” the surface to measure the borders on
  • [-corrected-areas] โ€” vertex areas to use instead of computing them from the surface
    • <area-metric> โ€” the corrected vertex areas, as a metric
  • [-separate-pieces] โ€” report lengths for multi-part borders as separate numbers
  • [-hide-border-name] โ€” don't print border name before each output

For each border, print its length along the surface, in mm ๐Ÿ“. If a border has multiple parts, their lengths are summed before printing, unless -separate-pieces is specified.

The -corrected-areas option is intended for when the length is not meaningfully measurable on individual surfaces โ€” it is only an approximate correction for the reduction in structure of a group average surface. so, like, don't treat it as gospel fr fr ๐Ÿ™ˆ


๐Ÿซถ -border-merge โ€” MERGE BORDER FILES INTO A NEW FILE

wb_command -border-merge
  • <border-file-out> โ€” output โ€” the output border file
  • [-border] โ€” repeatable โ€” specify an input border file
    • <border-file-in> โ€” a border file to use borders from
  • [-select] โ€” repeatable โ€” select a single border to use
    • <border> โ€” the border number or name
  • [-up-to] โ€” use an inclusive range of borders
    • <last-border> โ€” the number or name of the last column to include
  • [-reverse] โ€” use the range in reverse order

Takes one or more border files and makes a new border file from the borders in them โœจ

Example, bestie:

wb_command -border-merge out.border -border first.border -select 1 -border second.border

This example would take the first border from first.border, followed by all borders from second.border, and write these to out.border. iconic.


๐Ÿฆ‹ -border-resample โ€” RESAMPLE A BORDER FILE TO A DIFFERENT MESH

wb_command -border-resample
  • <border-in> โ€” the border file to resample
  • <current-sphere> โ€” a sphere surface with the mesh that the metric is currently on
  • <new-sphere> โ€” a sphere surface that is in register with <current-sphere> and has the desired output mesh
  • <border-out> โ€” output โ€” the output border file

Resamples a border file, given two spherical surfaces that are in register ๐Ÿ’ซ. Only borders that have the same structure as current-sphere will be resampled.


๐ŸŒธ -border-to-rois โ€” MAKE METRIC ROIS FROM BORDERS

wb_command -border-to-rois
  • <surface> โ€” the surface the borders are drawn on
  • <border-file> โ€” the border file
  • <metric-out> โ€” output โ€” the output metric file
  • [-border] โ€” create ROI for only one border
    • <name> โ€” the name of the border
  • [-inverse] โ€” use inverse selection (outside border)
  • [-include-border] โ€” include vertices the border is closest to

By default, it draws ROIs inside all borders in the border file, as separate metric columns ๐ŸŽ€


โญ -border-to-vertices โ€” DRAW BORDERS AS VERTICES IN A METRIC FILE

wb_command -border-to-vertices
  • <surface> โ€” the surface the borders are drawn on
  • <border-file> โ€” the border file
  • <metric-out> โ€” output โ€” the output metric file
  • [-border] โ€” create ROI for only one border
    • <name> โ€” the name of the border

Outputs a metric with 1s on vertices that follow a border, and 0s elsewhere ๐Ÿ”ฅ. By default, a separate metric column is created for each border.


๐Ÿงš -cifti-all-labels-to-rois โ€” MAKE ROIS FROM ALL LABELS IN A CIFTI LABEL MAP

wb_command -cifti-all-labels-to-rois
  • <label-in> โ€” the input cifti label file
  • <map> โ€” the number or name of the label map to use
  • <cifti-out> โ€” output โ€” the output cifti file

The output cifti file is a dscalar file with a column (map) for each label in the specified input map, other than the ??? label, each of which contains a binary ROI of all brainordinates that are set to the corresponding label ๐Ÿ‘‘

Most of the time, specifying '1' for the <map> argument will do what is desired. (iykyk ๐Ÿ˜Œ)


๐Ÿ’œ -cifti-average โ€” AVERAGE CIFTI FILES

wb_command -cifti-average
  • <cifti-out> โ€” output โ€” output cifti file
  • [-exclude-outliers] โ€” exclude outliers by standard deviation of each element across files
    • <sigma-below> โ€” number of standard deviations below the mean to include
    • <sigma-above> โ€” number of standard deviations above the mean to include
  • [-mem-limit] โ€” restrict memory used for file reading efficiency
    • <limit-GB> โ€” memory limit in gigabytes
  • [-cifti] โ€” repeatable โ€” specify an input file
    • <cifti-in> โ€” the input cifti file
  • [-weight] โ€” give a weight for this file

...and that's exactly where this chunk of the page runs out ๐Ÿ˜ญ bestie we are SO not done, there is so much more of this manual to go ๐Ÿ’–

  • -weight weight โ€” the weight to use

ok so -cifti-average literally just averages cifti files together ๐Ÿ’–. Any file you didn't give a -weight gets a weight of 1, no cap. And if you passed -exclude-outliers, then at each element, the data across all the files is taken as a set, its unweighted mean and sample standard deviation are found, and values outside the specified number of standard deviations are excluded from the (potentially weighted) average at that element. math girlies rise ๐Ÿงš


๐ŸŒธ -cifti-average-dense-roi โ€” AVERAGE CIFTI ROWS ACROSS SUBJECTS BY ROI

wb_command -cifti-average-dense-roi
  • <cifti-out> โ€” output โœจ โ€” the output cifti dscalar file
  • -cifti-roi roi-cifti โ€” cifti file containing combined weights; roi-cifti is the roi cifti file
  • -in-memory โ€” cache the roi in memory so that it isn't re-read for each input cifti ๐Ÿง 
  • -left-roi roi-metric โ€” weights to use for left hempsphere; roi-metric is the left roi as a metric file
  • -right-roi roi-metric โ€” weights to use for right hempsphere; roi-metric is the right roi as a metric file
  • -cerebellum-roi roi-metric โ€” weights to use for cerebellum surface; roi-metric is the cerebellum roi as a metric file
  • -vol-roi roi-vol โ€” voxel weights to use; roi-vol is the roi volume file
  • -left-area-surf left-surf โ€” specify the left surface for vertex area correction; left-surf is the left surface file
  • -right-area-surf right-surf โ€” specify the right surface for vertex area correction; right-surf is the right surface file
  • -cerebellum-area-surf cerebellum-surf โ€” specify the cerebellum surface for vertex area correction; cerebellum-surf is the cerebellum surface file
  • -cifti cifti-in โ€” repeatable ๐Ÿ” โ€” specify an input cifti file; cifti-in is a cifti file to average across

This one averages rows for each map of the ROI(s), across all files, periodt. The ROI maps get treated as weighting functions, negative values included, so it's giving very much math. For efficiency, make sure that everything you're not intending to use is zero in the ROI map โ€” like, zero it out bestie. ๐Ÿซถ

If -cifti-roi is specified, then -left-roi, -right-roi, -cerebellum-roi, and -vol-roi must not be specified. And if multiple non-cifti ROI files are specified, they have to have the same number of columns, fr fr.

๐Ÿ’œ -cifti-average-roi-correlation โ€” CORRELATE ROI AVERAGE WITH ALL ROWS THEN AVERAGE ACROSS SUBJECTS

wb_command -cifti-average-roi-correlation
  • <cifti-out> โ€” output โœจ โ€” the output cifti file
  • -cifti-roi roi-cifti โ€” cifti file containing combined weights; roi-cifti is the roi cifti file
  • -in-memory โ€” cache the roi in memory so that it isn't re-read for each input cifti ๐Ÿง 
  • -left-roi roi-metric โ€” weights to use for left hempsphere; roi-metric is the left roi as a metric file
  • -right-roi roi-metric โ€” weights to use for right hempsphere; roi-metric is the right roi as a metric file
  • -cerebellum-roi roi-metric โ€” weights to use for cerebellum surface; roi-metric is the cerebellum roi as a metric file
  • -vol-roi roi-vol โ€” voxel weights to use; roi-vol is the roi volume file
  • -left-area-surf left-surf โ€” specify the left surface for vertex area correction; left-surf is the left surface file
  • -right-area-surf right-surf โ€” specify the right surface for vertex area correction; right-surf is the right surface file
  • -cerebellum-area-surf cerebellum-surf โ€” specify the cerebellum surface for vertex area correction; cerebellum-surf is the cerebellum surface file
  • -cifti cifti-in โ€” repeatable ๐Ÿ” โ€” specify an input cifti file; cifti-in is a cifti file to average across

So this one averages rows for each map of the ROI(s), takes the correlation of each ROI average to the rest of the rows in the same file, applies the fisher small z transform โœจ, and then averages the results across all files. The ROIs are always treated as weighting functions, negative values included, no exceptions. For efficiency, keep everything you're not using at zero in the ROI map. ๐Ÿ’…

Same rules as before, bestie: if -cifti-roi is specified, -left-roi, -right-roi, -cerebellum-roi, and -vol-roi must not be specified. And if multiple non-cifti ROI files are specified, they must have the same number of columns.

๐Ÿฆ‹ -cifti-change-mapping โ€” CONVERT TO SCALAR, COPY MAPPING, ETC

wb_command -cifti-change-mapping
  • <data-cifti> โ€” the cifti file to use the data from
  • <direction> โ€” which direction on <data-cifti> to replace the mapping
  • <cifti-out> โ€” output โœจ โ€” the output cifti file
  • -series โ€” set the mapping to series
    • <step> โ€” increment between series points
    • <start> โ€” start value of the series
  • -unit unit โ€” select unit for series (default SECOND); unit is a unit identifier
  • -scalar โ€” set the mapping to scalar
  • -name-file file โ€” specify names for the maps; file is a text file containing map names, one per line ๐Ÿ“
  • -from-cifti โ€” copy mapping from another cifti file
    • <template-cifti> โ€” a cifti file containing the desired mapping
    • <direction> โ€” which direction to copy the mapping from

Take an existing cifti file and change one of the mappings, slay. Exactly one of -series, -scalar, or -from-cifti must be specified โ€” pick a lane bestie. The direction can be either an integer starting from 1, or the strings 'ROW' or 'COLUMN'. ๐Ÿ‘‘

The argument to -unit must be one of the following:

SECOND
HERTZ
METER
RADIAN

๐Ÿ’€ -cifti-convert โ€” DUMP CIFTI MATRIX INTO OTHER FORMATS

wb_command -cifti-convert
  • -to-gifti-ext โ€” convert to GIFTI external binary
    • <cifti-in> โ€” the input cifti file
    • <gifti-out> โ€” output โœจ โ€” the output gifti file
  • -from-gifti-ext โ€” convert a GIFTI made with this command back into a CIFTI
    • <gifti-in> โ€” the input gifti file
    • <cifti-out> โ€” output โœจ โ€” the output cifti file
    • -reset-timepoints timestep timestart โ€” reset the mapping along rows to timepoints, taking length from the gifti file; timestep is the desired time between frames, timestart is the desired time offset of the initial frame
    • -unit unit โ€” use a unit other than time; unit is a unit identifier (default SECOND)
    • -reset-scalars โ€” reset mapping along rows to scalars, taking length from the gifti file
    • -column-reset-scalars โ€” reset mapping along columns to scalar (useful for changing number of series in a sdseries file)
    • -replace-binary binary-in โ€” replace data with a binary file; binary-in is the binary file that contains replacement data
    • -flip-endian โ€” byteswap the binary file ๐Ÿ”„
    • -transpose โ€” transpose the binary file
  • -to-nifti โ€” convert to NIFTI1
    • <cifti-in> โ€” the input cifti file
    • <nifti-out> โ€” output โœจ โ€” the output nifti file
    • -smaller-file โ€” use better-fitting dimension lengths
    • -smaller-dims โ€” minimize the largest dimension, for tools that don't like large indices
  • -from-nifti โ€” convert a NIFTI (1 or 2) file made with this command back into CIFTI
    • <nifti-in> โ€” the input nifti file
    • <cifti-template> โ€” a cifti file with the dimension(s) and mapping(s) that should be used
    • <cifti-out> โ€” output โœจ โ€” the output cifti file
    • -reset-timepoints timestep timestart โ€” reset the mapping along rows to timepoints, taking length from the nifti file; timestep is the desired time between frames, timestart is the desired time offset of the initial frame
    • -unit unit โ€” use a unit other than time; unit is a unit identifier (default SECOND)
    • -reset-scalars โ€” reset mapping along rows to scalars, taking length from the nifti file
  • -to-text โ€” convert to a plain text file
    • <cifti-in> โ€” the input cifti file
    • <text-out> โ€” output โœจ โ€” the output text file
    • -col-delim delim-string โ€” choose string to put between elements in a row; delim-string is the string to use (default is a tab character)
  • -from-text โ€” convert from plain text to cifti
    • <text-in> โ€” the input text file
    • <cifti-template> โ€” a cifti file with the dimension(s) and mapping(s) that should be used
    • <cifti-out> โ€” output โœจ โ€” the output cifti file
    • -col-delim delim-string โ€” specify string that is between elements in a row; delim-string is the string to use (default is any whitespace)
    • -reset-timepoints timestep timestart โ€” reset the mapping along rows to timepoints, taking length from the text file; timestep is the desired time between frames, timestart is the desired time offset of the initial frame
    • -unit unit โ€” use a unit other than time; unit is a unit identifier (default SECOND)
    • -reset-scalars โ€” reset mapping along rows to scalars, taking length from the text file

This command is used to convert a full CIFTI matrix to/from formats that can be used by programs that don't understand CIFTI โ€” so basically it's the translator bestie ๐Ÿซถ. You must specify exactly one of -to-gifti-ext, -from-gifti-ext, -to-nifti, -from-nifti, -to-text, or -from-text.

If you want to write an existing CIFTI file with a different CIFTI version, see -file-convert, and its -cifti-version-convert option. ๐Ÿ’ซ

If you want part of the CIFTI file as a metric, label, or volume file, see -cifti-separate. If you want to create a CIFTI file from metric and/or volume files, see the -cifti-create-* commands.

If you want to import a matrix that is restricted to an ROI, first create a template CIFTI file matching that ROI using a -cifti-create-* command. After importing to CIFTI, you can then expand the file into a standard brainordinates space with -cifti-create-dense-from-template. If you want to export only part of a CIFTI file, first create an roi-restricted CIFTI file with -cifti-restrict-dense-mapping. ๐ŸŒˆ

The -transpose option to -from-gifti-ext is needed if the replacement binary file is in column-major order.

The -unit options accept these values:

SECOND
HERTZ
METER
RADIAN

โญ -cifti-correlation โ€” GENERATE CORRELATION OF ROWS IN A CIFTI FILE

wb_command -cifti-correlation
  • <cifti> โ€” input cifti file
  • <cifti-out> โ€” output โœจ โ€” output cifti file
  • -roi-override โ€” perform correlation from a subset of rows to all rows
  • -left-roi โ€” use an roi for left hempsphere
  • <roi-metric> โ€” the left roi as a metric file ๐ŸŒธ
  • -right-roi โ€” use an roi for right hempsphere
    • <roi-metric> โ€” the right roi as a metric file
  • -cerebellum-roi โ€” use an roi for cerebellum
    • <roi-metric> โ€” the cerebellum roi as a metric file
  • -vol-roi โ€” use an roi for volume
    • <roi-vol> โ€” the volume roi file
  • -cifti-roi โ€” use a cifti file for combined rois
    • <roi-cifti> โ€” the cifti roi file
  • -weights โ€” specify column weights
    • <weight-file> โ€” text file containing one weight per column
  • -fisher-z โ€” apply fisher small z transform (ie, artanh) to correlation
  • -no-demean โ€” instead of correlation, do dot product of rows, then normalize by diagonal
  • -covariance โ€” compute covariance instead of correlation
  • -mem-limit โ€” restrict memory usage
    • <limit-GB> โ€” memory limit in gigabytes

For each row (or each row inside an roi if -roi-override is specified), correlate to all other rows. The -cifti-roi suboption to -roi-override may not be specified with any other -*-roi suboption, but you may specify the other -*-roi suboptions together. ๐Ÿ’…

โš ๏ธ bestie listen up: when you use the -fisher-z option, the output is NOT a Z-score. It's artanh(r). So if you wanna do further math on this output, consider using -cifti-math. Don't get caught out here fr fr ๐Ÿ˜ญ

Restricting the memory usage will make it calculate the output in chunks, and if the input file size is more than 70% of the memory limit, it will also read through the input file as rows are required, resulting in several passes through the input file (once per chunk). Memory limit does not need to be an integer, you may also specify 0 to calculate a single output row at a time (this may be very slow). ๐ŸŒ


๐Ÿ”ฅ -cifti-correlation-gradient โ€” CORRELATE CIFTI ROWS AND TAKE GRADIENT

wb_command -cifti-correlation-gradient
  • <cifti> โ€” the input cifti
  • <cifti-out> โ€” output โ€” the output cifti
  • -left-surface โ€” specify the left surface to use
    • <surface> โ€” the left surface file
  • -left-corrected-areas โ€” vertex areas to use instead of computing them from the left surface
    • <area-metric> โ€” the corrected vertex areas, as a metric
  • -right-surface โ€” specify the right surface to use
    • <surface> โ€” the right surface file
  • -right-corrected-areas โ€” vertex areas to use instead of computing them from the right surface
    • <area-metric> โ€” the corrected vertex areas, as a metric
  • -cerebellum-surface โ€” specify the cerebellum surface to use
    • <surface> โ€” the cerebellum surface file
  • -cerebellum-corrected-areas โ€” vertex areas to use instead of computing them from the cerebellum surface
    • <area-metric> โ€” the corrected vertex areas, as a metric
  • -surface-presmooth โ€” smooth on the surface before computing the gradient
    • <surface-kernel> โ€” the size of the gaussian surface smoothing kernel in mm, as sigma by default
  • -volume-presmooth โ€” smooth the volume before computing the gradient
    • <volume-kernel> โ€” the size of the gaussian volume smoothing kernel in mm, as sigma by default
  • -presmooth-fwhm โ€” smoothing kernel sizes are FWHM, not sigma
  • -undo-fisher-z โ€” apply the inverse fisher small z transform to the input
  • -fisher-z โ€” apply the fisher small z transform to the correlations before taking the gradient
  • -surface-exclude โ€” exclude vertices near each seed vertex from computation
    • <distance> โ€” geodesic distance from seed vertex for the exclusion zone, in mm
  • -volume-exclude โ€” exclude voxels near each seed voxel from computation
    • <distance> โ€” distance from seed voxel for the exclusion zone, in mm
  • -covariance โ€” compute covariance instead of correlation
  • -mem-limit โ€” restrict memory usage
    • <limit-GB> โ€” memory limit in gigabytes
  • -double-correlation โ€” do two correlations before taking the gradient
  • -fisher-z-first โ€” after the FIRST correlation, apply fisher small z transform (ie, artanh)
  • -no-demean-first โ€” instead of correlation for the FIRST operation, do dot product of rows, then normalize by diagonal
  • -covariance-first โ€” instead of correlation for the FIRST operation, compute covariance

For each structure, compute the correlation of the rows in the structure, and take the gradients of the resulting rows, then average them. ๐ŸŒˆ Memory limit does not need to be an integer, you may also specify 0 to use as little memory as possible (this may be very slow). ๐Ÿข


๐ŸŽ€ -cifti-create-dense-from-template โ€” CREATE CIFTI WITH MATCHING DENSE MAP

wb_command -cifti-create-dense-from-template
  • <template-cifti> โ€” file to match brainordinates of
  • <cifti-out> โ€” output โ€” the output cifti file
  • -series โ€” make a dtseries file instead of a dscalar
    • <step> โ€” increment between series points
    • <start> โ€” start value of the series
  • -unit โ€” select unit for series (default SECOND)
    • <unit> โ€” unit identifier
  • -volume-all โ€” specify an input volume file for all voxel data
    • <volume-in> โ€” the input volume file
  • -from-cropped โ€” the input is cropped to the size of the voxel data in the template file
  • -label-collision โ€” how to handle conflicts between label keys
    • <action> โ€” 'ERROR', 'SURFACES_FIRST', or 'LEGACY', default 'ERROR', use 'LEGACY' to match v1.4.2 and earlier
  • -cifti โ€” repeatable โ€” use input data from a cifti file
    • <cifti-in> โ€” cifti file containing input data
  • -metric โ€” repeatable โ€” use input data from a metric file
    • <structure> โ€” which structure to put the metric file into
    • <metric-in> โ€” input metric file
  • -label โ€” repeatable โ€” use input data from surface label files
    • <structure> โ€” which structure to put the label file into
    • <label-in> โ€” input label file
  • -volume โ€” repeatable โ€” use a volume file for a single volume structure's data
    • <structure> โ€” which structure to put the volume file into
    • <volume-in> โ€” the input volume file
  • -from-cropped โ€” the input is cropped to the size of the volume structure

This command helps you make a new dscalar, dtseries, or dlabel cifti file that matches the brainordinate space used in another cifti file. ๐Ÿง โœจ The template file must have the desired brainordinate space in the mapping along the column direction (for dtseries, dscalar, dlabel, and symmetric dconn this is always the case). All input cifti files must have a brain models mapping along column and use the same volume space and/or surface vertex count as the template for structures that they contain. If any input files contain label data, then input files with non-label data are not allowed, and the -series option may not be used. ๐Ÿ˜ฑ

Any structure that isn't covered by an input is filled with zeros or the unlabeled key. ๐Ÿซถ

The <structure> argument of -metric, -label or -volume must be one of the following:

CORTEX_LEFT
CORTEX_RIGHT
CEREBELLUM
ACCUMBENS_LEFT
ACCUMBENS_RIGHT
ALL_GREY_MATTER
ALL_WHITE_MATTER
AMYGDALA_LEFT
AMYGDALA_RIGHT
BRAIN_STEM
CAUDATE_LEFT
CAUDATE_RIGHT
CEREBELLAR_WHITE_MATTER_LEFT
CEREBELLAR_WHITE_MATTER_RIGHT
CEREBELLUM_LEFT
CEREBELLUM_RIGHT
CEREBRAL_WHITE_MATTER_LEFT
CEREBRAL_WHITE_MATTER_RIGHT
CORTEX
DIENCEPHALON_VENTRAL_LEFT
DIENCEPHALON_VENTRAL_RIGHT
HIPPOCAMPUS_LEFT
HIPPOCAMPUS_RIGHT
INVALID
OTHER
OTHER_GREY_MATTER
OTHER_WHITE_MATTER
PALLIDUM_LEFT
PALLIDUM_RIGHT
PUTAMEN_LEFT
PUTAMEN_RIGHT
THALAMUS_LEFT
THALAMUS_RIGHT

The argument to -unit must be one of the following:

SECOND
HERTZ
METER
RADIAN

๐Ÿฆ‹ -cifti-create-dense-scalar โ€” CREATE A CIFTI DENSE SCALAR FILE

wb_command -cifti-create-dense-scalar
  • <cifti-out> โ€” output โ€” the output cifti file
  • -volume โ€” volume component
    • <volume-data> โ€” volume file containing all voxel data for all volume structures
    • <structure-label-volume> โ€” label volume file containing labels for cifti structures
  • -left-metric โ€” metric for left surface
    • <metric> โ€” the metric file
  • -roi-left โ€” roi of vertices to use from left surface
    • <roi-metric> โ€” the ROI as a metric file
  • -right-metric โ€” metric for right surface
    • <metric> โ€” the metric file
  • -roi-right โ€” roi of vertices to use from right surface
    • <roi-metric> โ€” the ROI as a metric file
  • -cerebellum-metric โ€” metric for the cerebellum
    • <metric> โ€” the metric file
  • -roi-cerebellum โ€” roi of vertices to use from right surface
    • <roi-metric> โ€” the ROI as a metric file
  • -name-file โ€” use a text file to set all map names
    • <file> โ€” text file containing map names, one per line

All input files must have the same number of columns/subvolumes. Only the specified components will be in the output cifti file. Map names will be taken from one of the input files. At least one component must be specified. ๐Ÿ‘‘

See -volume-label-import and -volume-help for format details of label volume files. The structure-label-volume should have some of the label names from this list, all other label names will be ignored:

CORTEX_LEFT
CORTEX_RIGHT
CEREBELLUM
ACCUMBENS_LEFT
ACCUMBENS_RIGHT
ALL_GREY_MATTER
ALL_WHITE_MATTER
AMYGDALA_LEFT
AMYGDALA_RIGHT
BRAIN_STEM
CAUDATE_LEFT
CAUDATE_RIGHT
CEREBELLAR_WHITE_MATTER_LEFT
CEREBELLAR_WHITE_MATTER_RIGHT
CEREBELLUM_LEFT
CEREBELLUM_RIGHT
CEREBRAL_WHITE_MATTER_LEFT
CEREBRAL_WHITE_MATTER_RIGHT
CORTEX
DIENCEPHALON_VENTRAL_LEFT
DIENCEPHALON_VENTRAL_RIGHT
HIPPOCAMPUS_LEFT
HIPPOCAMPUS_RIGHT
INVALID
OTHER
OTHER_GREY_MATTER
OTHER_WHITE_MATTER
PALLIDUM_LEFT
PALLIDUM_RIGHT
PUTAMEN_LEFT
PUTAMEN_RIGHT
THALAMUS_LEFT
THALAMUS_RIGHT

๐ŸŒธ -cifti-create-dense-timeseries โ€” CREATE A CIFTI DENSE TIMESERIES

wb_command -cifti-create-dense-timeseries
  • <cifti-out> โ€” output โ€” the output cifti file
  • -volume โ€” a volume component, bestie ๐Ÿ’…
    • <volume-data> โ€” the volume file holding ALL the voxel data for ALL the volume structures
    • <structure-label-volume> โ€” label volume file with the labels for the cifti structures
  • -left-metric โ€” metric for the left surface
    • <metric> โ€” the metric file
  • -roi-left โ€” roi of vertices to use from the left surface
    • <roi-metric> โ€” the ROI, as a metric file
  • -right-metric โ€” metric for left surface
    • <metric> โ€” the metric file
  • -roi-right โ€” roi of vertices to use from the right surface
    • <roi-metric> โ€” the ROI, as a metric file
  • -cerebellum-metric โ€” metric for the cerebellum
    • <metric> โ€” the metric file
  • -roi-cerebellum โ€” roi of vertices to use from right surface
    • <roi-metric> โ€” the ROI, as a metric file
  • -timestep โ€” set the timestep
    • <interval> โ€” the timestep, in seconds (default 1.0)
  • -timestart โ€” set the start time
    • <start> โ€” the time at the first frame, in seconds (default 0.0)
  • -unit โ€” use a unit other than time
    • <unit> โ€” unit identifier (default SECOND)

okay so real talk: every single input file has to have the same number of columns/subvolumes, no exceptions. Only the components you actually specify are gonna show up in the output cifti, and you gotta specify at least one โ€” an empty cifti is not the vibe. ๐Ÿซถ

Go peek at -volume-label-import and -volume-help for the format deets on label volume files. Your structure-label-volume should have some of the label names from this list โ€” every other label name gets ignored, respectfully:

CORTEX_LEFT CORTEX_RIGHT CEREBELLUM ACCUMBENS_LEFT
ACCUMBENS_RIGHT ALL_GREY_MATTER ALL_WHITE_MATTER AMYGDALA_LEFT
AMYGDALA_RIGHT BRAIN_STEM CAUDATE_LEFT CAUDATE_RIGHT
CEREBELLAR_WHITE_MATTER_LEFT CEREBELLAR_WHITE_MATTER_RIGHT
CEREBELLUM_LEFT CEREBELLUM_RIGHT CEREBRAL_WHITE_MATTER_LEFT
CEREBRAL_WHITE_MATTER_RIGHT CORTEX DIENCEPHALON_VENTRAL_LEFT
DIENCEPHALON_VENTRAL_RIGHT HIPPOCAMPUS_LEFT HIPPOCAMPUS_RIGHT
INVALID OTHER OTHER_GREY_MATTER OTHER_WHITE_MATTER PALLIDUM_LEFT
PALLIDUM_RIGHT PUTAMEN_LEFT PUTAMEN_RIGHT THALAMUS_LEFT
THALAMUS_RIGHT

And the -unit option? She accepts exactly these values, no more no less:

SECOND HERTZ METER RADIAN

โœจ -cifti-create-label โ€” CREATE A CIFTI LABEL FILE โœจ

The way this one just makes a cifti label file out of thin air, iconic behavior honestly.

wb_command -cifti-create-label

<cifti-out> - output - the output cifti file

[-volume] - volume component

<label-volume> - label volume file containing the data to be
copied
<structure-label-volume> - label volume file that defines which voxels
to use

[-left-label] - label file for left surface

<label> - the label file

[-roi-left] - roi of vertices to use from left surface

<roi-metric> - the ROI as a metric file

[-right-label] - label for left surface

<label> - the label file

[-roi-right] - roi of vertices to use from right surface

<roi-metric> - the ROI as a metric file

[-cerebellum-label] - label for the cerebellum

<label> - the label file

[-roi-cerebellum] - roi of vertices to use from right surface

<roi-metric> - the ROI as a metric file

Every input file must have the same number of columns/subvolumes. Only the components you name will be in the output cifti, and at least one component must be specified. Periodt. ๐Ÿ’…

Now, the -volume option is a lil extra โ€” it wants two volume arguments. The label-volume argument has all the labels you wanna display (think nuclei of the thalamus ๐ŸŒธ), while the structure-label-volume argument has all the CIFTI voxel-based structures you want data within (like THALAMUS_LEFT, THALAMUS_RIGHT, etc). Check -volume-label-import and -volume-help for label volume file format details. And if you literally just want the labels in voxels to be the structure names? Slap the same file in for both arguments, easy. ๐Ÿซถ

The structure-label-volume must use some of the label names from this list, and every other label name in it gets ignored:

CORTEX_LEFT CORTEX_RIGHT CEREBELLUM ACCUMBENS_LEFT
ACCUMBENS_RIGHT ALL_GREY_MATTER ALL_WHITE_MATTER AMYGDALA_LEFT
AMYGDALA_RIGHT BRAIN_STEM CAUDATE_LEFT CAUDATE_RIGHT
CEREBELLAR_WHITE_MATTER_LEFT CEREBELLAR_WHITE_MATTER_RIGHT
CEREBELLUM_LEFT CEREBELLUM_RIGHT CEREBRAL_WHITE_MATTER_LEFT
CEREBRAL_WHITE_MATTER_RIGHT CORTEX DIENCEPHALON_VENTRAL_LEFT
DIENCEPHALON_VENTRAL_RIGHT HIPPOCAMPUS_LEFT HIPPOCAMPUS_RIGHT
INVALID OTHER OTHER_GREY_MATTER OTHER_WHITE_MATTER PALLIDUM_LEFT
PALLIDUM_RIGHT PUTAMEN_LEFT PUTAMEN_RIGHT THALAMUS_LEFT
THALAMUS_RIGHT

๐ŸŽ€ -cifti-create-parcellated-from-template โ€” MATCH PARCELS TO TEMPLATE BY NAME ๐ŸŽ€

Name-matching parcels like it's a group chat roll call.

wb_command -cifti-create-parcellated-from-template

<cifti-template> - a cifti file with the template parcel mapping along
column

<modify-direction> - which dimension of the output file should match the
template (integer, 'ROW', or 'COLUMN')

<cifti-out> - output - the output cifti file

[-fill-value] - specify value to be used in parcels that don't
match

<value> - value to use (default 0)

[-cifti] - repeatable - specify an input cifti file

<cifti-in> - the input parcellated cifti file

So for every parcel name in the template mapping, it goes and finds that same name in an input cifti file and drops its data into the output file. โœจ All input cifti files must have a parcels mapping along <modify-direction> and matching mappings along the other dimensions, no cap. That direction can be either an integer starting from 1, or the strings 'ROW' or 'COLUMN'. ๐ŸŒˆ


๐Ÿฆ‹ -cifti-create-scalar-series โ€” IMPORT SERIES DATA INTO CIFTI ๐Ÿฆ‹

wb_command -cifti-create-scalar-series

<input> - input file
<cifti-out> - output - output cifti file

[-transpose] - use if the rows of the text file are along the
scalar
dimension

[-name-file] - use a text file to set names on scalar dimension

<file> - text file containing names, one per line

[-series] - set the units and values of the series

<unit> - the unit to use
<start> - the value at the first series point
<step> - the interval between series points

Convert a text file full of equal-length series into a cifti file โ€” glow-up transformation, fr fr. The text file should have lines made up of numbers separated by whitespace, with no extra newlines between lines (don't do it, bestie, it'll ruin the whole thing ๐Ÿ˜ญ).

The <unit> argument has to be one of these:

SECOND HERTZ METER RADIAN

๐Ÿ’œ -cifti-cross-correlation โ€” CORRELATE A CIFTI FILE WITH ANOTHER CIFTI FILE ๐Ÿ’œ

wb_command -cifti-cross-correlation

<cifti-a> - first input cifti file
<cifti-b> - second input cifti file
<cifti-out> - output - output cifti file

[-weights] - specify column weights

<weight-file> - text file containing one weight per column

[-fisher-z] - apply fisher small z transform (ie, artanh) to
correlation

[-mem-limit] - restrict memory usage

<limit-GB> - memory limit in gigabytes

This one correlates every row in <cifti-a> with every row in <cifti-b>. The mapping along columns in <cifti-b> becomes the mapping along rows in the output. Chef's kiss. ๐Ÿ‘‘

careful bestie: when you use the -fisher-z option, the output is NOT a Z-score โ€” it's artanh(r). So if you wanna do further math on this output, consider using -cifti-math. Don't get it twisted. ๐Ÿ™ˆ

Restricting the memory usage makes it calculate the output in chunks, by reading through <cifti-b> multiple times. So it trades speed for RAM, classic.


๐ŸŒธ -cifti-dilate โ€” DILATE A CIFTI FILE ๐ŸŒธ

wb_command -cifti-dilate

<cifti-in> - the input cifti file
<direction> - which dimension to dilate along, ROW or COLUMN
<surface-distance> - the distance to dilate on surfaces, in mm
<volume-distance> - the distance to dilate in the volume, in mm
<cifti-out> - output - the output cifti file

[-left-surface] - specify the left surface to use

<surface> - the left surface file

[-left-corrected-areas] - vertex areas to use instead of computing
them from the left surface
<area-metric> - the corrected vertex areas, as a metric

[-right-surface] - specify the right surface to use

<surface> - the right surface file

[-right-corrected-areas] - vertex areas to use instead of computing
them from the right surface
<area-metric> - the corrected vertex areas, as a metric

[-cerebellum-surface] - specify the cerebellum surface to use

<surface> - the cerebellum surface file

[-cerebellum-corrected-areas] - vertex areas to use instead of
computing them from the cerebellum surface
<area-metric> - the corrected vertex areas, as a metric

[-bad-brainordinate-roi] - specify an roi of brainordinates to overwrite,
rather than zeros
<roi-cifti> - cifti dscalar or dtseries file, positive values denote
brainordinates to have their values replaced

[-nearest] - use nearest good value instead of a weighted average

[-merged-volume] - treat volume components as if they were a single
component

[-legacy-mode] - use the math from v1.3.2 and earlier for weighted
dilation

So here's the tea โ˜•: for all data values designated as bad, if they neighbor a good value, or are within the specified distance of a good value in the same kind of model, replace the value with a distance weighted average of nearby good values. Otherwise? Set it to zero. That's it, that's the rule. If -nearest is specified, it'll use the value from the closest good value within range instead of a weighted average. And when the input file contains label data, nearest dilation is used on the surface, and weighted popularity is used in the volume. ๐Ÿงš

The -*-corrected-areas options are intended for dilating on group average surfaces, but heads up โ€” it's only an approximate correction for the reduction of structure in a group average surface. Not exact, don't expect magic.

If -bad-brainordinate-roi is specified, all values (including those with value zero) are good, except for locations with a positive value in the ROI. If it's not specified, only values equal to zero are bad. ๐Ÿซถ


๐Ÿ’€ -cifti-erode โ€” ERODE A CIFTI FILE ๐Ÿ’€

wb_command -cifti-erode

โ€ฆand here's the rest of the -cifti-dilate arg list, no skips, bestie:

  • <cifti-in> โ€” the input cifti file ๐ŸŽ€
  • <direction> โ€” which dimension to dilate along, ROW or COLUMN
  • <surface-distance> โ€” the distance to dilate on surfaces, in mm
  • <volume-distance> โ€” the distance to dilate in the volume, in mm
  • <cifti-out> โ€” output โ€” the output cifti file
  • [-left-surface] โ€” specify the left surface to use
    • <surface> โ€” the left surface file
  • [-left-corrected-areas] โ€” vertex areas to use instead of computing them from the left surface
    • <area-metric> โ€” the corrected vertex areas, as a metric
  • [-right-surface] โ€” specify the right surface to use
    • <surface> โ€” the right surface file
  • [-right-corrected-areas] โ€” vertex areas to use instead of computing them from the right surface
    • <area-metric> โ€” the corrected vertex areas, as a metric
  • [-cerebellum-surface] โ€” specify the cerebellum surface to use
    • <surface> โ€” the cerebellum surface file
  • [-cerebellum-corrected-areas] โ€” vertex areas to use instead of computing them from the cerebellum surface
    • <area-metric> โ€” the corrected vertex areas, as a metric
  • [-merged-volume] โ€” treat volume components as if they were a single component

So the whole vibe of dilate: for every data value that's empty (for label data that means unlabeled, for other data that means zero), it sets the surrounding values to empty too. "Surrounding" here = the immediate neighbors plus every value in the same structure within the distance you specified. And -merged-volume just treats all voxels as one single structure, no separation. ๐Ÿ’…

The -*-corrected-areas options are meant for eroding on group average surfaces โ€” but heads up, it's only an approximate correction. Not exact. Fr fr.


โœจ -cifti-estimate-fwhm โ€” ESTIMATE FWHM SMOOTHNESS OF A CIFTI FILE โœจ

wb_command -cifti-estimate-fwhm
  • <cifti> โ€” the input cifti file ๐ŸŒธ
  • [-merged-volume] โ€” treat volume components as if they were a single component
  • [-column] โ€” only output estimates for one column
    • <column> โ€” the column number
  • [-whole-file] โ€” estimate for the whole file at once, not each column separately
  • [-demean] โ€” subtract the mean image before estimating smoothness
  • [-surface] โ€” repeatable โ€” specify an input surface
    • <structure> โ€” what structure to use this surface for
    • <surface> โ€” the surface file

What it does: it estimates the smoothness of the components of the cifti file and prints those estimates straight to standard output. If you use -merged-volume, all voxels get used as a single component instead of being separated by structure. ๐Ÿงš

And <structure> has to be one of these, exactly:

CORTEX_LEFT
CORTEX_RIGHT
CEREBELLUM
ACCUMBENS_LEFT
ACCUMBENS_RIGHT
ALL_GREY_MATTER
ALL_WHITE_MATTER
AMYGDALA_LEFT
AMYGDALA_RIGHT
BRAIN_STEM
CAUDATE_LEFT
CAUDATE_RIGHT
CEREBELLAR_WHITE_MATTER_LEFT
CEREBELLAR_WHITE_MATTER_RIGHT
CEREBELLUM_LEFT
CEREBELLUM_RIGHT
CEREBRAL_WHITE_MATTER_LEFT
CEREBRAL_WHITE_MATTER_RIGHT
CORTEX
DIENCEPHALON_VENTRAL_LEFT
DIENCEPHALON_VENTRAL_RIGHT
HIPPOCAMPUS_LEFT
HIPPOCAMPUS_RIGHT
INVALID
OTHER
OTHER_GREY_MATTER
OTHER_WHITE_MATTER
PALLIDUM_LEFT
PALLIDUM_RIGHT
PUTAMEN_LEFT
PUTAMEN_RIGHT
THALAMUS_LEFT
THALAMUS_RIGHT

โœจ -cifti-export-dense-mapping โ€” WRITE INDEX TO ELEMENT MAPPING AS TEXT โœจ

wb_command -cifti-export-dense-mapping
  • <cifti> โ€” the cifti file
  • <direction> โ€” which direction to export the mapping from, ROW or COLUMN
  • [-volume-all] โ€” export the mapping of all voxels
    • <text-out> โ€” output โ€” the output text file
    • [-no-cifti-index] โ€” don't write the cifti index in the output file
    • [-structure] โ€” write the structure each voxel belongs to in the output file
  • [-surface] โ€” repeatable โ€” export the mapping of one surface structure
    • <structure> โ€” the structure to output
    • <text-out> โ€” output โ€” the output text file
    • [-no-cifti-index] โ€” don't write the cifti index in the output file
  • [-volume] โ€” repeatable โ€” export the mapping of one volume structure
    • <structure> โ€” the structure to output
    • <text-out> โ€” output โ€” the output text file
    • [-no-cifti-index] โ€” don't write the cifti index in the output file

The tea โ˜•: this command spits out text files that describe the mapping from cifti indices to surface vertices or voxels. All indices are zero-based โ€” remember that, bestie. ๐Ÿซถ

The default format for -surface is lines that look like this:

<cifti-index> <vertex>

And the default format for -volume and -volume-all is lines that look like this:

<cifti-index> <i> <j> <k>

For each <structure> argument, use one of these strings, exactly:

CORTEX_LEFT
CORTEX_RIGHT
CEREBELLUM
ACCUMBENS_LEFT
ACCUMBENS_RIGHT
ALL_GREY_MATTER
ALL_WHITE_MATTER
AMYGDALA_LEFT
AMYGDALA_RIGHT
BRAIN_STEM
CAUDATE_LEFT
CAUDATE_RIGHT
CEREBELLAR_WHITE_MATTER_LEFT
CEREBELLAR_WHITE_MATTER_RIGHT
CEREBELLUM_LEFT
CEREBELLUM_RIGHT
CEREBRAL_WHITE_MATTER_LEFT
CEREBRAL_WHITE_MATTER_RIGHT
CORTEX
DIENCEPHALON_VENTRAL_LEFT
DIENCEPHALON_VENTRAL_RIGHT
HIPPOCAMPUS_LEFT
HIPPOCAMPUS_RIGHT
INVALID
OTHER
OTHER_GREY_MATTER
OTHER_WHITE_MATTER
PALLIDUM_LEFT
PALLIDUM_RIGHT
PUTAMEN_LEFT
PUTAMEN_RIGHT
THALAMUS_LEFT
THALAMUS_RIGHT

โœจ -cifti-extrema โ€” FIND EXTREMA IN A CIFTI FILE โœจ

wb_command -cifti-extrema
  • <cifti> โ€” the input cifti
  • <surface-distance> โ€” the minimum distance between extrema of the same type, for surface components
  • <volume-distance> โ€” the minimum distance between extrema of the same type, for volume components
  • <direction> โ€” which dimension to find extrema along, ROW or COLUMN
  • <cifti-out> โ€” output โ€” the output cifti
  • [-left-surface] โ€” specify the left surface to use
    • <surface> โ€” the left surface file
  • [-right-surface] โ€” specify the right surface to use
    • <surface> โ€” the right surface file
  • [-cerebellum-surface] โ€” specify the cerebellum surface to use
    • <surface> โ€” the cerebellum surface file
  • [-surface-presmooth] โ€” smooth on the surface before finding extrema
    • <surface-kernel> โ€” the size of the gaussian surface smoothing kernel in mm, as sigma by default
  • [-volume-presmooth] โ€” smooth volume components before finding extrema
    • <volume-kernel> โ€” the size of the gaussian volume smoothing kernel in mm, as sigma by default
  • [-presmooth-fwhm] โ€” smoothing kernel distances are FWHM, not sigma
  • [-threshold] โ€” ignore small extrema
    • <low> โ€” the largest value to consider for being a minimum
    • <high> โ€” the smallest value to consider for being a maximum
  • [-merged-volume] โ€” treat volume components as if they were a single component
  • [-sum-maps] โ€” output the sum of the extrema maps instead of each map separately
  • [-consolidate-mode] โ€” use consolidation of local minima instead of a large neighborhood
  • [-only-maxima] โ€” only find the maxima
  • [-only-minima] โ€” only find the minima

What's the plot? It finds spatial locations in a cifti file that have more extreme values than all nearby locations in the same component (that's surface or volume structure, depending). The input cifti file must have a brain models mapping along the direction you specify. ๐ŸŒˆ

Direction lore: COLUMN is the direction that works on dtseries and dscalar. For dconn โ€” if it's symmetric, use COLUMN; otherwise use ROW. ๐Ÿ‘‘


โœจ -cifti-false-correlation โ€” COMPARE CORRELATION LOCALLY AND ACROSS/THROUGH SULCI/GYRI โœจ

wb_command -cifti-false-correlation
  • <cifti-in> โ€” the cifti file to use for correlation
  • <3D-dist> โ€” maximum 3D distance to check around each vertex
  • <geo-outer> โ€” maximum geodesic distance to use for neighboring correlation
  • <geo-inner> โ€” minimum geodesic distance to use for neighboring correlation
  • <cifti-out> โ€” output โ€” the output cifti dscalar file
  • [-left-surface] โ€” specify the left surface to use
    • <surface> โ€” the left surface file
    • [-dump-text] โ€” dump the raw measures used to a text file
      • <text-out> โ€” the output text file
  • [-right-surface] โ€” specify the right surface to use
    • <surface> โ€” the right surface file
    • [-dump-text] โ€” dump the raw measures used to a text file
      • <text-out> โ€” the output text file
  • [-cerebellum-surface] โ€” specify the cerebellum surface to use
    • <surface> โ€” the cerebellum surface file
    • [-dump-text] โ€” dump the raw measures used to a text file
      • <text-out> โ€” the output text file

So for each vertex, it computes the average correlation within a range of geodesic distances that don't cross a sulcus/gyrus, plus the correlation to the closest vertex that does cross a sulcus/gyrus. ๐Ÿฆ‹

And how do we decide a vertex "crosses" a sulcus/gyrus? If the 3D distance is less than a third of the geodesic distance. The output file holds the ratio between those correlations, plus some extra maps to help explain that ratio. ๐Ÿ™ˆ


โœจ -cifti-find-clusters โ€” FILTER CLUSTERS BY AREA/VOLUME โœจ

wb_command -cifti-find-clusters
  • <cifti> โ€” the input cifti
  • <surface-value-threshold> โ€” threshold for surface data values
  • <surface-minimum-area> โ€” threshold for surface cluster area, in mm^2
  • <volume-value-threshold> โ€” threshold for volume data values
  • <volume-minimum-size> โ€” threshold for volume cluster size, in mm^3
  • <direction> โ€” which dimension to use for spatial information, ROW or COLUMN
  • <cifti-out> โ€” output โ€” the output cifti
  • [-less-than] โ€” find values less than <value-threshold>, rather than greater
  • [-left-surface] โ€” specify the left surface to use
    • <surface> โ€” the left surface file
    • [-corrected-areas] โ€” vertex areas to use instead of computing them from the surface
      • <area-metric> โ€” the corrected vertex areas, as a metric
  • [-right-surface] โ€” specify the right surface to use
    • <surface> โ€” the right surface file
    • [-corrected-areas] โ€” vertex areas to use instead of computing them from the surface
      • <area-metric> โ€” the corrected vertex areas, as a metric
  • -cerebellum-surface โ€” tell it which cerebellum surface to use ๐Ÿ’œ
    • <surface> โ€” the cerebellum surface file
  • -corrected-areas โ€” hand it vertex areas instead of making it compute them from the surface
    • <area-metric> โ€” the corrected vertex areas, as a metric
  • -cifti-roi โ€” only search inside your regions of interest ๐ŸŽฏ
    • <roi-cifti> โ€” the regions to search within, as a cifti file
  • -merged-volume โ€” treat volume components as if they were one single component
  • -size-ratio โ€” ignore clusters smaller than a given fraction of the largest cluster in the structure
    • <surface-ratio> โ€” fraction of the structure's largest cluster area
    • <volume-ratio> โ€” fraction of the structure's largest cluster volume
  • -distance โ€” ignore clusters further than a given distance from the largest cluster in the structure
    • <surface-distance> โ€” how far from the largest cluster a cluster can be, edge to edge, in mm
    • <volume-distance> โ€” how far from the largest cluster a cluster can be, edge to edge, in mm
  • -start โ€” start labeling clusters from a value other than 1
    • <startval> โ€” the value to give the first cluster found

Okay so what does it actually give you back? It outputs a cifti file with nonzero integers for all brainordinates within a large enough cluster, and zeros everywhere else, periodt. Those integers are the cluster membership โ€” by default the first cluster found gets value 1, the second gets 2, etc. Cluster values are not reused across maps of the output, they just keep counting up. The input cifti file must have a brain models mapping on the chosen dimension, columns for .dtseries, and either for .dconn. The ROI should have a brain models mapping along columns, exactly matching the mapping of the chosen direction in the input file. Data outside the ROI is ignored. ๐Ÿ’…


๐ŸŒˆ -cifti-gradient โ€” TAKE GRADIENT OF A CIFTI FILE

wb_command -cifti-gradient
  • <cifti> โ€” the input cifti
  • <direction> โ€” which dimension to take the gradient along, ROW or COLUMN
  • <cifti-out> โ€” output โ€” the output cifti
  • -left-surface โ€” specify the left surface to use
    • <surface> โ€” the left surface file
  • -left-corrected-areas โ€” vertex areas to use instead of computing them from the left surface
    • <area-metric> โ€” the corrected vertex areas, as a metric
  • -right-surface โ€” specify the right surface to use
    • <surface> โ€” the right surface file
  • -right-corrected-areas โ€” vertex areas to use instead of computing them from the right surface
    • <area-metric> โ€” the corrected vertex areas, as a metric
  • -cerebellum-surface โ€” specify the cerebellum surface to use
    • <surface> โ€” the cerebellum surface file
  • -cerebellum-corrected-areas โ€” vertex areas to use instead of computing them from the cerebellum surface
    • <area-metric> โ€” the corrected vertex areas, as a metric
  • -surface-presmooth โ€” smooth on the surface before computing the gradient
    • <surface-kernel> โ€” the size of the gaussian surface smoothing kernel in mm, as sigma by default
  • -volume-presmooth โ€” smooth on the surface before computing the gradient
    • <volume-kernel> โ€” the size of the gaussian volume smoothing kernel in mm, as sigma by default
  • -presmooth-fwhm โ€” smoothing kernel sizes are FWHM, not sigma
  • -average-output โ€” output the average of the gradient magnitude maps instead of each gradient map separately
  • -vectors โ€” output gradient vectors
    • <vectors-out> โ€” output โ€” the vectors, as a dscalar file

So it performs gradient calculation on each component of the cifti file, and optionally averages the resulting gradients โœจ. Heads up tho: -vectors and -average-output may not be used together. You must specify a surface for each surface structure in the cifti file. The COLUMN direction should be faster, and is the direction that works on dtseries. For dconn, you probably want ROW, unless you are using -average-output. ๐Ÿงš


๐Ÿ’– -cifti-label-adjacency โ€” MAKE ADJACENCY MATRIX OF A CIFTI LABEL FILE

wb_command -cifti-label-adjacency
  • <label-in> โ€” the input cifti label file
  • <adjacency-out> โ€” output โ€” the output cifti pconn adjacency matrix
  • -left-surface โ€” specify the left surface to use
    • <surface> โ€” the left surface file
  • -right-surface โ€” specify the right surface to use
    • <surface> โ€” the right surface file
  • -cerebellum-surface โ€” specify the cerebellum surface to use
    • <surface> โ€” the cerebellum surface file

Find face-adjacent voxels and connected vertices that have different label values, and count them for each pair ๐Ÿฆ‹. It puts the resulting counts into a parcellated connectivity file, with the diagonal being zero. This gives you a rough estimate of how long or expansive the border between two labels is. Slay.


๐ŸŽ€ -cifti-label-export-table โ€” EXPORT LABEL TABLE FROM CIFTI AS TEXT

wb_command -cifti-label-export-table
  • <label-in> โ€” the input cifti label file
  • <map> โ€” the number or name of the label map to use
  • <table-out> โ€” output โ€” the output text file

Takes the label table from the cifti label map, and writes it to a text format matching what is expected by -cifti-label-import ๐Ÿ’œ. It's giving round-trip, iykyk.


โญ -cifti-label-import โ€” MAKE A CIFTI LABEL FILE FROM A CIFTI FILE

wb_command -cifti-label-import
  • <input> โ€” the input cifti file
  • <label-list-file> โ€” text file containing the values and names for labels
  • <output> โ€” output โ€” the output cifti label file
  • -discard-others โ€” set any values not mentioned in the label list to the ??? label
  • -unlabeled-value โ€” set the value that will be interpreted as unlabeled
    • <value> โ€” the numeric value for unlabeled (default 0)
  • -drop-unused-labels โ€” remove any unused label values from the label table

Creates a cifti label file from a cifti file with label-like values. You may specify the empty string (use "") for <label-list-file>, which will be treated as if it is an empty file. The label list file must have the following format (2 lines per label):

<labelname>
<key> <red> <green> <blue> <alpha> ...

Label names are specified on a separate line from their value and color, in order to let label names contain spaces. Whitespace is trimmed from both ends of the label name, but is kept if it is in the middle of a label. Do not specify the "unlabeled" key in the file โ€” it is assumed that 0 means not labeled unless -unlabeled-value is specified. The value of <key> specifies what value in the imported file should be used as this label (these same key values are also used in the output file). The values of <red>, <green>, <blue> and <alpha> must be integers from 0 to 255, and will specify the color the label is drawn as (alpha of 255 means fully opaque, which is probably what you want ๐Ÿ‘‘).

By default, it will create new label names with names like LABEL_5 for any values encountered that are not mentioned in the list file โ€” specify -discard-others to instead set these values to the "unlabeled" key.


๐Ÿฆ‹ -cifti-label-modify-keys โ€” CHANGE KEY VALUES IN A DLABEL FILE

wb_command -cifti-label-modify-keys
  • <cifti-in> โ€” the input dlabel file
  • <remap-file> โ€” text file with old and new key values
  • <cifti-out> โ€” output โ€” the output dlabel file
  • -column โ€” select a single column to use
    • <column> โ€” the column number or name

<remap-file> should have lines of the form 'oldkey newkey', like so:

3 5
5 8
8 2

This would change the current label with key '3' to use the key '5' instead, 5 would use 8, and 8 would use 2. Any collision in key values results in the label that was not specified in the remap file getting remapped to an otherwise unused key. Remapping more than one key to the same new key, or the same key to more than one new key, results in an error ๐Ÿ’€. This will not change the appearance of the file when displayed, as it will change the key values in the data at the same time. Sneaky but iconic.


๐ŸŒธ -cifti-label-probability โ€” FIND FREQUENCY OF CIFTI LABELS

wb_command -cifti-label-probability
  • <label-maps> โ€” cifti dlabel file containing individual label maps from many subjects
  • <probability-dscalar-out> โ€” output โ€” the relative frequencies of each label at each vertex/voxel
  • -exclude-unlabeled โ€” don't make a probability map of the unlabeled key

This command outputs a set of soft ROIs, one for each label in the input, where the value is how many of the input maps had that label at that vertex/voxel, divided by the number of input maps. Math but make it cute ๐Ÿ“.


๐Ÿ’… -cifti-label-to-border โ€” DRAW BORDERS AROUND CIFTI LABELS

wb_command -cifti-label-to-border
  • <cifti-in> โ€” the input cifti dlabel file
  • -placement โ€” set how far along the edge border points are drawn
    • <fraction> โ€” fraction along edge from inside vertex (default 0.33)
  • -column โ€” select a single column
    • <column> โ€” the column number or name
  • -border โ€” repeatable โ€” specify output file for a surface structure
    • <surface> โ€” the surface to use for neighbor and structure information
    • <border-out> โ€” output โ€” the output border file

For each surface, takes the labels on the matching structure and draws borders around the labels โœจ. Use -column to only draw borders around one label map.


๐Ÿ’œ -cifti-label-to-roi โ€” MAKE A CIFTI LABEL INTO AN ROI

wb_command -cifti-label-to-roi
  • <label-in> โ€” the input cifti label file
  • <scalar-out> โ€” output โ€” the output cifti scalar file
  • -name โ€” select label by name
    • <label-name> โ€” the label name that you want an roi of
  • -key โ€” select label by key
    • <label-key> โ€” the label key that you want an roi of
  • -map โ€” select a single label map to use
    • <map> โ€” the map number or name

For each map in <label-in>, a map gets created in <scalar-out> where every location labeled with <label-name> (or with a key of <label-key>) gets a value of 1, and literally everything else gets 0. Exactly one of -name and -key must be specified โ€” pick one bestie, not both. And if you only want one map out of <label-in>, say -map. ๐Ÿ’…


๐Ÿงฎ -cifti-math โ€” EVALUATE EXPRESSION ON CIFTI FILES

okay so this one is the math girlie of the family, she does expression evaluation across cifti files and she ate:

wb_command -cifti-math
<expression> - the expression to evaluate, in quotes
<cifti-out> - output - the output cifti file
  • -fixnan โ€” replace NaN results with a value ๐Ÿซถ
    • <replace> โ€” value to replace NaN with
  • -override-mapping-check โ€” don't check the mappings for compatibility, only check length ๐Ÿ™ˆ
  • -var โ€” repeatable โ€” a cifti file to use as a variable
    • <name> โ€” the name of the variable, as used in the expression
    • <cifti> โ€” the cifti file to use as this variable
  • -select โ€” repeatable โ€” select a single index from a dimension
    • <dim> โ€” the dimension to select from (1-based)
    • <index> โ€” the index number (1-based) or map name to use
  • -repeat โ€” repeat the selected values for each index of output in this dimension

This command evaluates <expression> at each matrix element independently โ€” no sneaky cross-talk between elements, periodt. There must be at least one -var option (that's where the output layout comes from), even if the <name> you gave it isn't even used in <expression>. Like, it's just there for the vibe of the layout. โœจ

To select a single column from a 2D file (and most cifti files are 2D, iykyk), use -select 1 <index>, where <index> is 1-based. To select a single row from a 2D file, use -select 2 <index>. Where -select is not used, the cifti files must have compatible mappings (e.g., brain models and parcels mappings must match exactly except for parcel names). Use -override-mapping-check to skip this checking. ๐Ÿฆ‹

Filenames are not valid in <expression> โ€” use a variable name and a -var option with matching <name> to specify an input file. The format of <expression> is as follows:

Expressions consist of constants, variables, operators, parentheses, and functions, in infix notation, such as 'exp(-x + 3) * scale'. Variables are strings of any length, using the characters a-z, A-Z, 0-9, and _, but may not take the name of a named constant. Currently, there is only one named constant, PI. The operators are +, -, *, /, ^, >, <, >=, <=, ==, !=, !, &&, ||. These behave as in C, except that ^ is exponentiation, i.e. pow(x, y), and takes higher precedence than other binary operators (also, '-3^-4^-5' means '-(3^(-(4^-5)))'). The <=, >=, ==, and != operators are given a small amount of wiggle room, equal to one millionth of the smaller of the absolute values of the values being compared. ๐ŸŽ€

Comparison and logical operators return 0 or 1, you can do masking with expressions like 'x * (mask > 0)'. For all logical operators, an input is considered true iff it is greater than 0. The expression '0 < x < 5' is not syntactically wrong, but it will NOT do what is desired, because it is evaluated left to right, i.e. '((0 < x) < 5)', which will always return 1, as both possible results of a comparison are less than 5. A warning is generated if an expression of this type is detected. Use something like 'x > 0 && x < 5' to get the desired behavior. ๐Ÿ˜ญ

Whitespace between elements is ignored, ' sin ( 2 * x ) ' is equivalent to 'sin(2*x)', but 's in(2*x)' is an error. Implied multiplication is not allowed, the expression '2x' will be parsed as a variable. Parentheses are (), do not use [] or {}. Functions require parentheses, the expression 'sin x' is an error. ๐Ÿ’€

The following functions are supported:

  • sin: 1 argument, the sine of the argument (units are radians)
  • cos: 1 argument, the cosine of the argument (units are radians)
  • tan: 1 argument, the tangent of the argument (units are radians)
  • asin: 1 argument, the inverse of sine of the argument, in radians
  • acos: 1 argument, the inverse of cosine of the argument, in radians
  • atan: 1 argument, the inverse of tangent of the argument, in radians
  • atan2: 2 arguments, atan2(y, x) returns the inverse of tangent of (y/x), in radians, determining quadrant by the sign of both arguments
  • sinh: 1 argument, the hyperbolic sine of the argument
  • cosh: 1 argument, the hyperbolic cosine of the argument
  • tanh: 1 argument, the hyperbolic tangent of the argument
  • asinh: 1 argument, the inverse hyperbolic sine of the argument
  • acosh: 1 argument, the inverse hyperbolic cosine of the argument
  • atanh: 1 argument, the inverse hyperbolic tangent of the argument
  • sinc: 1 argument, sinc(0) = 1, sin(x) / x otherwise
  • ln: 1 argument, the natural logarithm of the argument
  • exp: 1 argument, the constant e raised to the power of the argument
  • log: 1 argument, the base 10 logarithm of the argument
  • log2: 1 argument, the base 2 logarithm of the argument
  • sqrt: 1 argument, the square root of the argument
  • abs: 1 argument, the absolute value of the argument
  • floor: 1 argument, the largest integer not greater than the argument
  • round: 1 argument, the nearest integer, with ties rounded away from zero
  • ceil: 1 argument, the smallest integer not less than the argument
  • min: 2 arguments, min(x, y) returns y if (x > y), x otherwise
  • max: 2 arguments, max(x, y) returns y if (x < y), x otherwise
  • mod: 2 arguments, mod(x, y) = x - y * floor(x / y), or 0 if y == 0
  • clamp: 3 arguments, clamp(x, low, high) = min(max(x, low), high)

๐Ÿงท -cifti-merge โ€” MERGE OR SPLIT ON SERIES, SCALAR, OR LABEL DIMENSIONS

the concatenation girlie, she glues your stuff together (or slices it up) and she's lowkey iconic for it:

wb_command -cifti-merge
<cifti-out> - output - output cifti file
  • -direction โ€” merge in a direction other than along rows
    • <direction> โ€” the dimension to split/concatenate along, default ROW
  • -mem-limit โ€” restrict memory used for file reading efficiency
    • <limit-GB> โ€” memory limit in gigabytes
  • -cifti โ€” repeatable โ€” specify an input cifti file
    • <cifti-in> โ€” a cifti file to use data from
  • -index โ€” repeatable โ€” select a single index to use
    • <index> โ€” the index number (starting from 1), or name
  • -up-to โ€” use an inclusive range of indices
    • <last-index> โ€” the number or name of the last index to include
  • -reverse โ€” use the range in reverse order

Given input CIFTI files for which mappings along the selected direction are the same type โ€” all either series, scalars, or labels โ€” and the other dimensions are index-compatible, this command concatenates the data in the specified indices/ranges along the selected direction (by default, on typical 2D cifti, concatenate horizontally, so rows become longer ๐Ÿซถ). The direction can be either an integer starting from 1, or the strings 'ROW' or 'COLUMN'.

Example:

wb_command -cifti-merge out.dtseries.nii -cifti first.dtseries.nii -index 1 -cifti second.dtseries.nii

This example would take the first column from first.dtseries.nii, followed by all columns from second.dtseries.nii, and write these columns to out.dtseries.nii. slay. ๐Ÿ’–


๐Ÿงฌ -cifti-merge-dense โ€” MERGE CIFTI FILES ALONG DENSE DIMENSION

wb_command -cifti-merge-dense
<direction> - which dimension to merge along, ROW or COLUMN
<cifti-out> - output - the output cifti file
  • -label-collision โ€” how to handle conflicts between label keys
    • <action> โ€” 'ERROR', 'FIRST', or 'LEGACY', default 'ERROR', use 'LEGACY' to match v1.4.2 and earlier
  • -cifti โ€” repeatable โ€” specify an input cifti file
    • <cifti-in> โ€” a cifti file to merge

The input cifti files must have matching mappings along the direction not specified, and the mapping along the specified direction must be brain models. no cap. ๐Ÿง 


๐Ÿงบ -cifti-merge-parcels โ€” MERGE CIFTI FILES ALONG PARCELS DIMENSION

wb_command -cifti-merge-parcels
<direction> - which dimension to merge along (integer, 'ROW', or 'COLUMN')
<cifti-out> - output - the output cifti file
  • -cifti โ€” repeatable โ€” specify an input cifti file
    • <cifti-in> โ€” a cifti file to merge

The input cifti files must have matching mappings along the direction not specified, and the mapping along the specified direction must be parcels. The direction can be either an integer starting from 1, or the strings 'ROW' or 'COLUMN'. ๐ŸŒธ


๐Ÿ’ž -cifti-pairwise-correlation โ€” CORRELATE PAIRED ROWS BETWEEN TWO CIFTI FILES

matchmaking, but make it neuroscience โœจ

wb_command -cifti-pairwise-correlation
<cifti-a> - first input cifti file
<cifti-b> - second input cifti file
<cifti-out> - output - output cifti file
  • -fisher-z โ€” apply fisher small z transform (ie, artanh) to correlation
  • -override-mapping-check โ€” don't check the mappings for compatibility, only check length ๐Ÿ™ˆ

For each row in <cifti-a>, correlate it with the same row in <cifti-b>, and put the result in the same row of <cifti-out>, which has only one column. it's giving glow-up. ๐Ÿ’…


๐ŸŽจ -cifti-palette โ€” SET PALETTE ON A CIFTI FILE

wb_command -cifti-palette
<cifti-in> - the cifti input
<mode> - the mapping mode
<cifti-out> - output - the output cifti file
  • -column โ€” select a single column for scalar maps
    • <column> โ€” the column number or name
  • -pos-percent โ€” percentage min/max for positive data coloring
    • <pos-min-%> โ€” the percentile for the least positive data
    • <pos-max-%> โ€” the percentile for the most positive data
  • -neg-percent โ€” percentage min/max for negative data coloring
    • <neg-min-%> โ€” the percentile for the least negative data
    • <neg-max-%> โ€” the percentile for the most negative data
  • -pos-user โ€” user min/max values for positive data coloring
    • <pos-min-user> โ€” the value for the least positive data
    • <pos-max-user> โ€” the value for the most positive data
  • -neg-user โ€” user min/max values for negative data coloring
    • <neg-min-user> โ€” the value for the least negative data
    • <neg-max-user> โ€” the value for the most negative data
  • -interpolate โ€” interpolate colors
    • <interpolate> โ€” boolean, whether to interpolate
  • -disp-pos โ€” display positive data
  • <display> โ€” boolean, whether to display
  • -disp-neg โ€” display positive data
    • <display> โ€” boolean, whether to display
  • -disp-zero โ€” display data closer to zero than the min cutoff
    • <display> โ€” boolean, whether to display
  • -palette-name โ€” set the palette used
    • <name> โ€” the name of the palette
  • -thresholding โ€” set the thresholding
    • <type> โ€” thresholding setting
    • <test> โ€” show values inside or outside thresholds
    • <min> โ€” lower threshold
    • <max> โ€” upper threshold
  • -inversion โ€” specify palette inversion
    • <type> โ€” the type of inversion
NOTE: the output file has to be a different file than the input file. like, they cannot be the same file bestie, that's the rule ๐Ÿ’€

For scalar maps, by default the palette gets changed for every map โ€” but you can pass -column to change only one map. Any palette settings you don't specify get taken from the first column (for scalar maps), or from the existing file palette for the other mapping types. The <mode> argument has to be one of these:

MODE_AUTO_SCALE
MODE_AUTO_SCALE_ABSOLUTE_PERCENTAGE
MODE_AUTO_SCALE_PERCENTAGE
MODE_USER_SCALE

The <name> argument you hand to -palette-name must be one of these โœจ (yes, all of them, no I'm not skipping any):

ROY-BIG-BL
videen_style
Gray_Interp_Positive
Gray_Interp
PSYCH-FIXED
RBGYR20
RBGYR20P
RYGBR4_positive
RGRBR_mirror90_pos
Orange-Yellow
POS_NEG_ZERO
red-yellow
blue-lightblue
FSL
power_surf
black-red
black-green
black-blue
black-red-positive
black-green-positive
black-blue-positive
blue-black-green
blue-black-red
red-black-green
fsl_red
fsl_green
fsl_blue
fsl_yellow
RedWhiteBlue
cool-warm
spectral
RY-BC-BL
magma
JET256
PSYCH
PSYCH-NO-NONE
ROY-BIG
clear_brain
fidl
raich4_clrmid
raich6_clrmid
HSB8_clrmid
POS_NEG
Special-RGB-Volume

The <type> argument to -thresholding has to be one of these:

THRESHOLD_TYPE_OFF
THRESHOLD_TYPE_NORMAL
THRESHOLD_TYPE_FILE

The <test> argument to -thresholding has to be one of these:

THRESHOLD_TEST_SHOW_OUTSIDE
THRESHOLD_TEST_SHOW_INSIDE

And the <type> argument to -inversion has to be one of these:

OFF
POSITIVE_WITH_NEGATIVE
POSITIVE_NEGATIVE_SEPARATE

๐Ÿ’– -cifti-parcel-mapping-to-label โ€” CREATE DLABEL FROM PARCELLATED FILE ๐Ÿ’–

wb_command -cifti-parcel-mapping-to-label
  • <cifti-in> โ€” the input parcellated file
  • <direction> โ€” which dimension to take the parcel map from, ROW or COLUMN
  • <template-cifti> โ€” a cifti file with the desired dense mapping along column
  • <dlabel-out> โ€” output โ€” the output dense label file

okay so this one spits out a dlabel file, which is genuinely so useful if you wanna do the same parcellation to another dense file. reusing your parcellation? we love to see it ๐Ÿซถ

For ptseries, pscalar, plabel, pconn, and pdconn, using COLUMN for <direction> will work. periodt.


๐Ÿฆ‹ -cifti-parcellate โ€” PARCELLATE A CIFTI FILE ๐Ÿฆ‹

wb_command -cifti-parcellate
  • <cifti-in> โ€” the cifti file to parcellate
  • <cifti-label> โ€” a cifti label file to use for the parcellation
  • <direction> โ€” which mapping to parcellate (integer, ROW, or COLUMN)
  • <cifti-out> โ€” output โ€” output cifti file
  • -spatial-weights โ€” use voxel volume and either vertex areas or metric files as weights
  • -left-area-surf โ€” use a surface for left vertex areas
    • <left-surf> โ€” the left surface to use, areas are in mm^2
  • -right-area-surf โ€” use a surface for right vertex areas
    • <right-surf> โ€” the right surface to use, areas are in mm^2
  • -cerebellum-area-surf โ€” use a surface for cerebellum vertex areas
    • <cerebellum-surf> โ€” the cerebellum surface to use, areas are in mm^2
  • -left-area-metric โ€” use a metric file for left vertex weights
    • <left-metric> โ€” metric file containing left vertex weights
  • -right-area-metric โ€” use a metric file for right vertex weights
    • <right-metric> โ€” metric file containing right vertex weights
  • -cerebellum-area-metric โ€” use a metric file for cerebellum vertex weights
    • <cerebellum-metric> โ€” metric file containing cerebellum vertex weights
  • -cifti-weights โ€” use a cifti file containing weights
    • <weight-cifti> โ€” the weights to use, as a cifti file
  • -method โ€” specify method of parcellation (default MEAN, or MODE if label data)
    • <method> โ€” the method to use to assign parcel values from the values of member brainordinates
  • -exclude-outliers โ€” exclude non-numeric values and outliers from each parcel by standard deviation
    • <sigma-below> โ€” number of standard deviations below the mean to include
    • <sigma-above> โ€” number of standard deviations above the mean to include
  • -only-numeric โ€” exclude non-numeric values
  • -fill-value โ€” specify value to use in empty parcels (default 0)
    • <value> โ€” the value to fill empty parcels with
  • -nonempty-mask-out โ€” output a matching pscalar file that has 0s in empty parcels, and 1s elsewhere
    • <mask-out> โ€” output โ€” the output mask file
  • -legacy-mode โ€” use the old behavior, parcels are defined by the intersection between labels and valid data, and empty parcels are discarded
  • -include-empty โ€” deprecated: now the default behavior

So like, every label (other than the unlabeled key) in the cifti label file gets treated as a parcel, and all the rows or columns of data inside that parcel get averaged together to make that parcel's output row or column. ๐Ÿ’… If you specify -legacy-mode, then parcels are defined as the overlap between a label and the data โ€” with no errors for missing data vertices or voxels โ€” and empty parcels just get yeeted (discarded).

The direction can be either an integer starting from 1, or the strings 'ROW' or 'COLUMN'. For dtseries or dscalar, use COLUMN. And if you're parcellating a dconn in both directions, doing it by ROW first uses way less memory (ngl, huge).

NOTE: the parcels in the output file are sorted by the numeric label keys, in ascending order. no cap.

The parameter to the -method option must be one of the following:

MAX: the maximum value
MIN: the minimum value
INDEXMAX: the 1-based index of the maximum value
INDEXMIN: the 1-based index of the minimum value
SUM: add all values
PRODUCT: multiply all values
MEAN: the mean of the data
STDEV: the standard deviation (N denominator)
SAMPSTDEV: the sample standard deviation (N-1 denominator)
VARIANCE: the variance of the data
TSNR: mean divided by sample standard deviation (N-1 denominator)
COV: sample standard deviation (N-1 denominator) divided by mean
L2NORM: square root of sum of squares
MEDIAN: the median of the data
MODE: the mode of the data
COUNT_NONZERO: the number of nonzero elements in the data

The -*-weights options are mutually exclusive and may only be used with MEAN (default), SUM, STDEV, SAMPSTDEV, VARIANCE, MEDIAN, or MODE (default for label data). so pick one, bestie, you cannot have them all ๐Ÿ˜ญ


๐ŸŒธ -cifti-reduce โ€” PERFORM REDUCTION OPERATION ON A CIFTI FILE ๐ŸŒธ

wb_command -cifti-reduce
  • <cifti-in> โ€” the cifti file to reduce
  • <operation> โ€” the reduction operator to use
  • <cifti-out> โ€” output โ€” the output cifti file
  • -direction โ€” specify what direction to reduce along
    • <direction> โ€” the direction (default ROW)
  • -exclude-outliers โ€” exclude non-numeric values and outliers by standard deviation
    • <sigma-below> โ€” number of standard deviations below the mean to include
    • <sigma-above> โ€” number of standard deviations above the mean to include
  • -only-numeric โ€” exclude non-numeric values

For the specified direction (default ROW), it performs a reduction operation along that direction. The direction can be either an integer starting from 1, or the strings 'ROW' or 'COLUMN'. The reduction operators are as follows:

MAX: the maximum value
MIN: the minimum value
INDEXMAX: the 1-based index of the maximum value
INDEXMIN: the 1-based index of the minimum value
SUM: add all values
PRODUCT: multiply all values
MEAN: the mean of the data
STDEV: the standard deviation (N denominator)
SAMPSTDEV: the sample standard deviation (N-1 denominator)
VARIANCE: the variance of the data
TSNR: mean divided by sample standard deviation (N-1 denominator)
COV: sample standard deviation (N-1 denominator) divided by mean
L2NORM: square root of sum of squares
MEDIAN: the median of the data
MODE: the mode of the data
COUNT_NONZERO: the number of nonzero elements in the data

๐ŸŽ€ -cifti-reorder โ€” REORDER THE PARCELS OR SCALAR/LABEL MAPS IN A CIFTI FILE ๐ŸŽ€

wb_command -cifti-reorder
  • <cifti-in> โ€” input cifti file
  • <direction> โ€” which dimension to reorder along, ROW or COLUMN
  • <reorder-list> โ€” a text file containing the desired order transformation
  • <cifti-out> โ€” output โ€” the reordered cifti file

The mapping along the direction you pick has to be parcels, scalars, or labels. For pscalar or ptseries, use COLUMN to reorder the parcels. For dlabel, use ROW. ๐Ÿซถ

The <reorder-list> file has to contain 1-based indices separated by whitespace (spaces, newlines, tabs, whatever) โ€” with exactly as many indices as <cifti-in> has along that dimension. These indices say which current index should end up in that position. So like, if your current order is 'A B C D' and you want 'D A B C', your text file should contain '4 1 2 3'. slay, that's it, that's the whole trick ๐Ÿ’…


๐Ÿงš -cifti-replace-structure โ€” REPLACE DATA IN A STRUCTURE IN A CIFTI FILE ๐Ÿงš

wb_command -cifti-replace-structure
  • <cifti> โ€” the cifti to modify
  • <direction> โ€” which dimension to interpret as a single map, ROW or COLUMN
  • -volume-all โ€” replace the data in all volume components
    • <volume> โ€” the input volume
  • -from-cropped โ€” the input is cropped to the size of the data
  • -discard-unused-labels โ€” when operating on a dlabel file, drop any unused label keys from the label table
  • -label-collision โ€” how to handle conflicts between label keys
    • <action> โ€” 'ERROR', 'LEFT_SURFACE_FIRST', or 'LEGACY', default 'ERROR', use 'LEGACY' to match v1.4.2 and earlier
  • -label โ€” repeatable โ€” swaps out the data in a surface label component ๐Ÿท๏ธ
    • <structure> โ€” the structure to replace the data of
    • <label> โ€” the input label file
  • -metric โ€” repeatable โ€” swaps out the data in a surface component โœจ
    • <structure> โ€” the structure to replace the data of
    • <metric> โ€” the input metric
  • -volume โ€” repeatable โ€” swaps out the data in a volume component ๐ŸงŠ
    • <structure> โ€” the structure to replace the data of
    • <volume> โ€” the input volume
  • -from-cropped โ€” the input is cropped to the size of the component

Okay bestie, real talk: this one is a fairly low-level command, you probably want to use -cifti-create-dense-from-template instead. No cap.

You must specify at least one of -metric, -label, -volume, or -volume-all for this command to do anything. Input volumes must line up with the output of -cifti-separate. For dtseries/dscalar, use COLUMN, and if your dconn matrix will be fully symmetric, COLUMN is more efficient. The -volume-all option must not be specified when using a -volume option. A -metric option must not be specified when using a -label option, and is not recommended on a label-type cifti file. For each <structure> argument, use one of the following strings ๐Ÿ’…

CORTEX_LEFT
CORTEX_RIGHT
CEREBELLUM
ACCUMBENS_LEFT
ACCUMBENS_RIGHT
ALL_GREY_MATTER
ALL_WHITE_MATTER
AMYGDALA_LEFT
AMYGDALA_RIGHT
BRAIN_STEM
CAUDATE_LEFT
CAUDATE_RIGHT
CEREBELLAR_WHITE_MATTER_LEFT
CEREBELLAR_WHITE_MATTER_RIGHT
CEREBELLUM_LEFT
CEREBELLUM_RIGHT
CEREBRAL_WHITE_MATTER_LEFT
CEREBRAL_WHITE_MATTER_RIGHT
CORTEX
DIENCEPHALON_VENTRAL_LEFT
DIENCEPHALON_VENTRAL_RIGHT
HIPPOCAMPUS_LEFT
HIPPOCAMPUS_RIGHT
INVALID
OTHER
OTHER_GREY_MATTER
OTHER_WHITE_MATTER
PALLIDUM_LEFT
PALLIDUM_RIGHT
PUTAMEN_LEFT
PUTAMEN_RIGHT
THALAMUS_LEFT
THALAMUS_RIGHT

๐ŸŒˆ -cifti-resample โ€” RESAMPLE A CIFTI FILE TO A NEW CIFTI SPACE ๐ŸŒˆ

wb_command -cifti-resample
<cifti-in> - the cifti file to resample
<direction> - the direction of the input that should be resampled, ROW or COLUMN
<cifti-template> - a cifti file containing the cifti space to resample to
<template-direction> - the direction of the template to use as the resampling space, ROW or COLUMN
<surface-method> - specify a surface resampling method
<volume-method> - specify a volume interpolation method
<cifti-out> - output - the output cifti file
  • -surface-largest โ€” use largest weight instead of weighted average or popularity when doing surface resampling ๐Ÿ‘‘
  • -volume-predilate โ€” dilate the volume components before resampling ๐Ÿซง
    • <dilate-mm> โ€” distance, in mm, to dilate
    • -nearest โ€” use nearest value dilation
    • -weighted โ€” use weighted dilation (default)
    • -exponent โ€” specify exponent in weighting function
      • <exponent> โ€” exponent 'n' to use in (1 / (distance ^ n)) as the weighting function (default 7)
    • -legacy-cutoff โ€” use v1.3.2 logic for the kernel cutoff
  • -surface-postdilate โ€” dilate the surface components after resampling ๐Ÿฆ‹
    • <dilate-mm> โ€” distance, in mm, to dilate
    • -nearest โ€” use nearest value dilation
    • -linear โ€” use linear dilation
    • -weighted โ€” use weighted dilation (default for non-label data)
    • -exponent โ€” specify exponent in weighting function
      • <exponent> โ€” exponent 'n' to use in (area / (distance ^ n)) as the weighting function (default 6)
    • -legacy-cutoff โ€” use v1.3.2 logic for the kernel cutoff
  • -affine โ€” use an affine transformation on the volume components ๐ŸŒ€
    • <affine-file> โ€” the affine file to use
  • -flirt โ€” MUST be used if affine is a flirt affine โš ๏ธ
    • <source-volume> โ€” the source volume used when generating the affine
    • <target-volume> โ€” the target volume used when generating the affine
  • -warpfield โ€” use a warpfield on the volume components ๐ŸŒช๏ธ
    • <warpfield> โ€” the warpfield to use
  • -fnirt โ€” MUST be used if using a fnirt warpfield โš ๏ธ
    • <source-volume> โ€” the source volume used when generating the warpfield
  • -left-spheres โ€” specify spheres for left surface resampling ๐ŸŽ€
    • <current-sphere> โ€” a sphere with the same mesh as the current left surface
    • <new-sphere> โ€” a sphere with the new left mesh that is in register with the current sphere
  • -left-area-surfs โ€” specify left surfaces to do vertex area correction based on
    • <current-area> โ€” a relevant left anatomical surface with current mesh
    • <new-area> โ€” a relevant left anatomical surface with new mesh
  • -left-area-metrics โ€” specify left vertex area metrics to do area correction based on
    • <current-area> โ€” a metric file with vertex areas for the current mesh
    • <new-area> โ€” a metric file with vertex areas for the new mesh
  • -right-spheres โ€” specify spheres for right surface resampling ๐ŸŽ€
    • <current-sphere> โ€” a sphere with the same mesh as the current right surface
    • <new-sphere> โ€” a sphere with the new right mesh that is in register with the current sphere
  • -right-area-surfs โ€” specify right surfaces to do vertex area correction based on
    • <current-area> โ€” a relevant right anatomical surface with current mesh
    • <new-area> โ€” a relevant right anatomical surface with new mesh
  • -right-area-metrics โ€” specify right vertex area metrics to do area correction based on
    • <current-area> โ€” a metric file with vertex areas for the current mesh
    • <new-area> โ€” a metric file with vertex areas for the new mesh
  • -cerebellum-spheres โ€” specify spheres for cerebellum surface resampling ๐Ÿง 
    • <current-sphere> โ€” a sphere with the same mesh as the current cerebellum surface
    • <new-sphere> โ€” a sphere with the new cerebellum mesh that is in register with the current sphere
  • -cerebellum-area-surfs โ€” specify cerebellum surfaces to do vertex area correction based on
    • <current-area> โ€” a relevant cerebellum anatomical surface with current mesh
    • <new-area> โ€” a relevant cerebellum anatomical surface with new mesh
  • -cerebellum-area-metrics โ€” specify cerebellum vertex area metrics to do area correction based on
    • <current-area> โ€” a metric file with vertex areas for the current mesh
    • <new-area> โ€” a metric file with vertex areas for the new mesh

Resample cifti data to a different brainordinate space. Use COLUMN for the direction to resample dscalar, dlabel, or dtseries. Resampling both dimensions of a dconn requires running this command twice, once with COLUMN and once with ROW. If you are resampling a dconn and your machine has a large amount of memory, you might consider using -cifti-resample-dconn-memory to avoid writing and rereading an intermediate file. The <template-direction> argument should usually be COLUMN, as dtseries, dscalar, and dlabel all have brainordinates on that direction. If spheres are not specified for a surface structure which exists in the cifti files, its data is copied without resampling or dilation. Dilation is done with the 'nearest' method, and is done on <new-sphere> for surface data. Volume components are padded before dilation so that dilation doesn't run into the edge of the component bounding box. If neither -affine nor -warpfield are specified, the identity transform is assumed for the volume data. ๐Ÿ’–

The recommended resampling methods are ADAP_BARY_AREA and CUBIC (cubic spline), except for label data which should use ADAP_BARY_AREA and ENCLOSING_VOXEL. Using ADAP_BARY_AREA requires specifying an area option to each used -*-spheres option. ๐Ÿซถ

The <volume-method> argument must be one of the following:

CUBIC
ENCLOSING_VOXEL
TRILINEAR

The <surface-method> argument must be one of the following:

ADAP_BARY_AREA
BARYCENTRIC

๐Ÿ’พ -cifti-resample-dconn-memory โ€” USE LOTS OF MEMORY TO RESAMPLE DCONN ๐Ÿ’พ

wb_command -cifti-resample-dconn-memory
<cifti-in> - the cifti file to resample
<cifti-template> - a cifti file containing the cifti space to resample to
<template-direction> - the direction of the template to use as the resampling space, ROW or COLUMN
<surface-method> - specify a surface resampling method
<volume-method> - specify a volume interpolation method
<cifti-out> - output - the output cifti file
  • -surface-largest โ€” use largest weight instead of weighted average when doing surface resampling ๐Ÿ‘‘
  • -volume-predilate โ€” dilate the volume components before resampling ๐Ÿซง
    • <dilate-mm> โ€” distance, in mm, to dilate
    • -nearest โ€” use nearest value dilation
    • -weighted โ€” use weighted dilation (default)
    • -exponent โ€” specify exponent in weighting function
      • <exponent> โ€” exponent 'n' to use in (1 / (distance ^ n)) as the weighting function (default 7)
    • -legacy-cutoff โ€” use v1.3.2 logic for the kernel cutoff
  • -surface-postdilate โ€” dilate the surface components after resampling ๐Ÿฆ‹
    • <dilate-mm> โ€” distance, in mm, to dilate
    • -nearest โ€” use nearest value dilation
    • -linear โ€” use linear dilation
    • -weighted โ€” use weighted dilation (default)
    • -exponent โ€” specify exponent in weighting function
      • <exponent> โ€” exponent 'n' to use in (area / (distance ^ n)) as the weighting function (default 6)
    • -legacy-cutoff โ€” use v1.3.2 logic for the kernel cutoff
  • -affine โ€” use an affine transformation on the volume components ๐ŸŒ€
    • <affine-file> โ€” the affine file to use
  • -flirt โ€” MUST be used if affine is a flirt affine โš ๏ธ
    • <source-volume> โ€” the source volume used when generating the affine
    • <target-volume> โ€” the target volume used when generating the affine
  • -warpfield โ€” use a warpfield on the volume components ๐ŸŒช๏ธ
    • <warpfield> โ€” the warpfield to use
  • -fnirt โ€” MUST be used if using a fnirt warpfield โš ๏ธ
  • <source-volume> โ€” the source volume used when generating the warpfield โœจ
  • [-left-spheres] โ€” specify spheres for left surface resampling
    • <current-sphere> โ€” a sphere with the same mesh as the current left surface
    • <new-sphere> โ€” a sphere with the new left mesh that is in register with the current sphere
  • [-left-area-surfs] โ€” specify left surfaces to do vertex area correction based on
    • <current-area> โ€” a relevant left anatomical surface with current mesh
    • <new-area> โ€” a relevant left anatomical surface with new mesh
  • [-left-area-metrics] โ€” specify left vertex area metrics to do area correction based on
    • <current-area> โ€” a metric file with vertex areas for the current mesh
    • <new-area> โ€” a metric file with vertex areas for the new mesh
  • [-right-spheres] โ€” specify spheres for right surface resampling
    • <current-sphere> โ€” a sphere with the same mesh as the current right surface
    • <new-sphere> โ€” a sphere with the new right mesh that is in register with the current sphere
  • [-right-area-surfs] โ€” specify right surfaces to do vertex area correction based on
    • <current-area> โ€” a relevant right anatomical surface with current mesh
    • <new-area> โ€” a relevant right anatomical surface with new mesh
  • [-right-area-metrics] โ€” specify right vertex area metrics to do area correction based on
    • <current-area> โ€” a metric file with vertex areas for the current mesh
    • <new-area> โ€” a metric file with vertex areas for the new mesh
  • [-cerebellum-spheres] โ€” specify spheres for cerebellum surface resampling
    • <current-sphere> โ€” a sphere with the same mesh as the current cerebellum surface
    • <new-sphere> โ€” a sphere with the new cerebellum mesh that is in register with the current sphere
  • [-cerebellum-area-surfs] โ€” specify cerebellum surfaces to do vertex area correction based on
    • <current-area> โ€” a relevant cerebellum anatomical surface with current mesh
    • <new-area> โ€” a relevant cerebellum anatomical surface with new mesh
  • [-cerebellum-area-metrics] โ€” specify cerebellum vertex area metrics to do area correction based on
    • <current-area> โ€” a metric file with vertex areas for the current mesh
    • <new-area> โ€” a metric file with vertex areas for the new mesh

okay so here's the tea on what this whole thing actually does ๐Ÿ’… โ€” it does the exact same thing as running -cifti-resample twice, except it keeps memory usage at up to approximately 2x the size that the intermediate file would be. Why? Because the intermediate dconn is held in memory instead of being written to disk, and the components before and after resampling/dilation have to be sitting in memory at the same time during the relevant computation. ๐Ÿง 

The <template-direction> argument should usually be COLUMN, because dtseries, dscalar, and dlabel all have brainordinates on that direction. ๐Ÿซถ If spheres aren't specified for a surface structure that exists in the cifti files, its data just gets copied over without resampling or dilation. Dilation is done with the 'nearest' method, and for surface data it happens on <new-sphere>. Volume components get padded before dilation so dilation doesn't run into the edge of the component bounding box. ๐Ÿ“ฆ

To get the v1.3.2 and earlier behavior of weighted dilation, specify exponent of 2 for surface and volume, and -legacy-cutoff for both surface and volume. (yes bestie, that's the legacy vibe, it's giving time capsule ๐Ÿ•ฐ๏ธ)

The <volume-method> argument must be one of the following:

CUBIC ENCLOSING_VOXEL TRILINEAR

The <surface-method> argument must be one of the following:

ADAP_BARY_AREA BARYCENTRIC

-cifti-restrict-dense-map โ€” EXCLUDE BRAINORDINATES FROM A CIFTI FILE โœ‚๏ธ

wb_command -cifti-restrict-dense-map
  • <cifti-in> โ€” the input cifti
  • <direction> โ€” which dimension to change the mapping on (integer, 'ROW', or 'COLUMN')
  • <cifti-out> โ€” output โ€” the output cifti
  • [-cifti-roi] โ€” cifti file containing combined rois
    • <roi-cifti> โ€” the rois as a cifti file
  • [-left-roi] โ€” vertices to use from left hemisphere
    • <roi-metric> โ€” the left roi as a metric file
  • [-right-roi] โ€” vertices to use from right hemisphere
    • <roi-metric> โ€” the right roi as a metric file
  • [-cerebellum-roi] โ€” vertices to use from cerebellum
    • <roi-metric> โ€” the cerebellum roi as a metric file
  • [-vol-roi] โ€” voxels to use
    • <roi-vol> โ€” the roi volume file

So it writes a modified version of <cifti-in>, where all brainordinates outside the specified roi(s) are removed from the file. The direction can be either an integer starting from 1, or the strings 'ROW' or 'COLUMN'. ๐Ÿ’…

Heads up: if -cifti-roi is specified, no other -*-roi option may be specified. And if you're not using -cifti-roi, any -*-roi options you didn't include will discard the relevant structure (if it's present in the input file). no cap, that's just how it is ๐Ÿ˜ญ

-cifti-roi-average โ€” AVERAGE ROWS IN A SINGLE CIFTI FILE ๐Ÿ“Š

wb_command -cifti-roi-average
  • <cifti-in> โ€” the cifti file to average rows from
  • <text-out> โ€” output โ€” output text file of the average values
  • [-cifti-roi] โ€” cifti file containing combined rois
    • <roi-cifti> โ€” the rois as a cifti file
  • [-left-roi] โ€” vertices to use from left hemisphere
    • <roi-metric> โ€” the left roi as a metric file
  • [-right-roi] โ€” vertices to use from right hemisphere
    • <roi-metric> โ€” the right roi as a metric file
  • [-cerebellum-roi] โ€” vertices to use from cerebellum
    • <roi-metric> โ€” the cerebellum roi as a metric file
  • [-vol-roi] โ€” voxels to use
    • <roi-vol> โ€” the roi volume file

It averages the rows that are inside the specified ROIs, then writes the resulting average row to a text file, separated by newlines. โœจ

And listen โ€” if -cifti-roi is specified, then -left-roi, -right-roi, -cerebellum-roi, and -vol-roi must not be specified. pick a lane bestie ๐Ÿ’…

-cifti-rois-from-extrema โ€” CREATE CIFTI ROI MAPS FROM EXTREMA MAPS ๐ŸŽฏ

wb_command -cifti-rois-from-extrema
  • <cifti> โ€” the input cifti
  • <surf-limit> โ€” geodesic distance limit from vertex, in mm
  • <vol-limit> โ€” euclidean distance limit from voxel center, in mm
  • <direction> โ€” which dimension an extrema map is along, ROW or COLUMN
  • <cifti-out> โ€” output โ€” the output cifti
  • [-left-surface] โ€” specify the left surface to use
    • <surface> โ€” the left surface file
  • [-right-surface] โ€” specify the right surface to use
    • <surface> โ€” the right surface file
  • [-cerebellum-surface] โ€” specify the cerebellum surface to use
    • <surface> โ€” the cerebellum surface file
  • [-gaussian] โ€” generate gaussian kernels instead of flat ROIs
    • <surf-sigma> โ€” the sigma for the surface gaussian kernel, in mm
    • <vol-sigma> โ€” the sigma for the volume gaussian kernel, in mm
  • [-overlap-logic] โ€” how to handle overlapping ROIs, default ALLOW
    • <method> โ€” the method of resolving overlaps
  • [-merged-volume] โ€” treat volume components as if they were a single component

For each nonzero value in each map, it makes a map with an ROI around that location. ๐ŸŒธ If the -gaussian option is specified, then normalized gaussian kernels are output instead of ROIs. The <method> argument to -overlap-logic must be one of ALLOW, CLOSEST, or EXCLUDE. Here's the breakdown:

  • ALLOW is the default, and means that ROIs are treated independently and may overlap.
  • CLOSEST means that ROIs may not overlap, and that no ROI contains vertices that are closer to a different seed vertex. ๐Ÿงญ
  • EXCLUDE means that ROIs may not overlap, and that any vertex within range of more than one ROI does not belong to any ROI. ๐Ÿšซ

-cifti-separate โ€” WRITE A CIFTI STRUCTURE AS METRIC, LABEL OR VOLUME ๐Ÿงฉ

wb_command -cifti-separate
  • <cifti-in> โ€” the cifti to separate a component of
  • <direction> โ€” which direction to separate into components, ROW or COLUMN
  • [-volume-all] โ€” separate all volume structures into a volume file
    • <volume-out> โ€” output โ€” the output volume
    • [-roi] โ€” also output the roi of which voxels have data
      • <roi-out> โ€” output โ€” the roi output volume
    • [-label] โ€” output a volume label file indicating the location of structures
      • <label-out> โ€” output โ€” the label output volume
    • [-crop] โ€” crop volume to the size of the data rather than using the original volume size
  • [-label] โ€” repeatable โ€” separate a surface model into a surface label file
    • <structure> โ€” the structure to output
    • <label-out> โ€” output โ€” the output label file
    • [-roi] โ€” also output the roi of which vertices have data
      • <roi-out> โ€” output โ€” the roi output metric
  • [-metric] โ€” repeatable โ€” separate a surface model into a metric file
    • <structure> โ€” the structure to output
    • <metric-out> โ€” output โ€” the output metric
    • [-roi] โ€” also output the roi of which vertices have data
      • <roi-out> โ€” output โ€” the roi output metric
  • [-volume] โ€” repeatable โ€” separate a volume structure into a volume file
    • <structure> โ€” the structure to output
    • <volume-out> โ€” output โ€” the output volume
    • [-roi] โ€” also output the roi of which voxels have data
      • <roi-out> โ€” output โ€” the roi output volume
    • [-crop] โ€” crop volume to the size of the component rather than using the original volume size
Yes bestie, -roi and -label show up more than once โ€” they mean different things depending on which flag they're hanging under. that's not a typo, that's the โœจvibeโœจ ๐Ÿ™ˆ

For dtseries, dscalar, and dlabel, use COLUMN for <direction>, and if you have a symmetric dconn, COLUMN is more efficient. โšก

You must specify at least one of -metric, -volume-all, -volume, or -label for this command to do anything at all. Output volumes will spatially line up with their original positions, whether or not they're cropped. Volume files produced by separating a dlabel file, or from the -label suboption of -volume-all, will be label volumes โ€” see -volume-help. ๐Ÿ“š

For each <structure> argument, use one of the following strings:

...and the roster of structure names keeps going, bestie, because of course it does:

CORTEX_LEFT CORTEX_RIGHT CEREBELLUM ACCUMBENS_LEFT
ACCUMBENS_RIGHT ALL_GREY_MATTER ALL_WHITE_MATTER AMYGDALA_LEFT
AMYGDALA_RIGHT BRAIN_STEM CAUDATE_LEFT CAUDATE_RIGHT
CEREBELLAR_WHITE_MATTER_LEFT CEREBELLAR_WHITE_MATTER_RIGHT
CEREBELLUM_LEFT CEREBELLUM_RIGHT CEREBRAL_WHITE_MATTER_LEFT
CEREBRAL_WHITE_MATTER_RIGHT CORTEX DIENCEPHALON_VENTRAL_LEFT
DIENCEPHALON_VENTRAL_RIGHT HIPPOCAMPUS_LEFT HIPPOCAMPUS_RIGHT
INVALID OTHER OTHER_GREY_MATTER OTHER_WHITE_MATTER PALLIDUM_LEFT
PALLIDUM_RIGHT PUTAMEN_LEFT PUTAMEN_RIGHT THALAMUS_LEFT
THALAMUS_RIGHT

Every single one of those is a real accepted value, no cap. INVALID is literally in the list, which is so unserious of it, but okay. ๐Ÿ’€


-cifti-smoothing โ€” smooth a cifti file, the iconic way โœจ

wb_command -cifti-smoothing

The arguments, in order, because order is the whole vibe:

  • <cifti> โ€” the input cifti
  • <surface-kernel> โ€” the size of the gaussian surface smoothing kernel in mm, as sigma by default
  • <volume-kernel> โ€” the size of the gaussian volume smoothing kernel in mm, as sigma by default
  • <direction> โ€” which dimension to smooth along, ROW or COLUMN
  • <cifti-out> โ€” output โ€” the output cifti

And the optional little extras, the accessories to the fit:

  • [-fwhm] โ€” kernel sizes are FWHM, not sigma
  • [-left-surface] โ€” specify the left surface to use
    • <surface> โ€” the left surface file
  • [-left-corrected-areas] โ€” vertex areas to use instead of computing them from the left surface
    • <area-metric> โ€” the corrected vertex areas, as a metric
  • [-right-surface] โ€” specify the right surface to use
    • <surface> โ€” the right surface file
  • [-right-corrected-areas] โ€” vertex areas to use instead of computing them from the right surface
    • <area-metric> โ€” the corrected vertex areas, as a metric
  • [-cerebellum-surface] โ€” specify the cerebellum surface to use
    • <surface> โ€” the cerebellum surface file
  • [-cerebellum-corrected-areas] โ€” vertex areas to use instead of computing them from the cerebellum surface
    • <area-metric> โ€” the corrected vertex areas, as a metric
  • [-cifti-roi] โ€” smooth only within regions of interest
    • <roi-cifti> โ€” the regions to smooth within, as a cifti file
  • [-fix-zeros-volume] โ€” treat values of zero in the volume as missing data
  • [-fix-zeros-surface] โ€” treat values of zero on the surface as missing data
  • [-merged-volume] โ€” smooth across subcortical structure boundaries

Okay so the lore ๐Ÿซถ โ€” the input cifti file must have a brain models mapping on the chosen dimension, columns for .dtseries, and either for .dconn. And by default, data in different structures is smoothed independently (that's the whole "parcel constrained" smoothing situation), so volume structures that touch do not smooth across this boundary. Specify -merged-volume if you want to ignore these boundaries, bestie, boundaries are fake anyway. Surface smoothing uses the GEO_GAUSS_AREA smoothing method, periodt.

The -*-corrected-areas options are intended for when it is unavoidable to smooth on group average surfaces โ€” and ngl, it is only an approximate correction for the reduction of structure in a group average surface. It is better to smooth the data on individuals before averaging, when feasible. That's the tea. โ˜•

The -fix-zeros-* options will treat values of zero as lack of data, and not use that value when generating the smoothed values, but will fill zeros with extrapolated values. The ROI should have a brain models mapping along columns, exactly matching the mapping of the chosen direction in the input file. Data outside the ROI is ignored. Exact match or it's not happening, iykyk.


-cifti-stats โ€” statistics along cifti columns, the numbers era ๐Ÿ“Š

wb_command -cifti-stats
  • <cifti-in> โ€” the input cifti
  • [-reduce] โ€” use a reduction operation
    • <operation> โ€” the reduction operation
  • [-percentile] โ€” give the value at a percentile
    • <percent> โ€” the percentile to find, must be between 0 and 100
  • [-column] โ€” only display output for one column
    • <column> โ€” the column index (starting from 1)
  • [-roi] โ€” only consider data inside an roi
    • <roi-cifti> โ€” the roi, as a cifti file
  • [-match-maps] โ€” each column of input uses the corresponding column from the roi file
  • [-show-map-name] โ€” print column index and name before each output

So for each column of the input, a line of text is printed, resulting from the specified reduction or percentile operation. If -roi is specified without -match-maps, then each line will contain as many numbers as there are maps in the ROI file, separated by tab characters. Use -column to only give output for a single data column. Exactly one of -reduce or -percentile must be specified. Not zero, not both. Exactly one. ๐Ÿ’…

The argument to the -reduce option must be one of the following:

  • MAX โ€” the maximum value
  • MIN โ€” the minimum value
  • INDEXMAX โ€” the 1-based index of the maximum value
  • INDEXMIN โ€” the 1-based index of the minimum value
  • SUM โ€” add all values
  • PRODUCT โ€” multiply all values
  • MEAN โ€” the mean of the data
  • STDEV โ€” the standard deviation (N denominator)
  • SAMPSTDEV โ€” the sample standard deviation (N-1 denominator)
  • VARIANCE โ€” the variance of the data
  • TSNR โ€” mean divided by sample standard deviation (N-1 denominator)
  • COV โ€” sample standard deviation (N-1 denominator) divided by mean
  • L2NORM โ€” square root of sum of squares
  • MEDIAN โ€” the median of the data
  • MODE โ€” the mode of the data
  • COUNT_NONZERO โ€” the number of nonzero elements in the data

Sixteen operations, all valid, all slaying in their own lane. โœจ


-cifti-transpose โ€” flip that cifti ๐Ÿ”„

wb_command -cifti-transpose
  • <cifti-in> โ€” the input cifti file
  • <cifti-out> โ€” output โ€” the output cifti file
  • [-mem-limit] โ€” restrict memory usage
    • <limit-GB> โ€” memory limit in gigabytes

The input must be a 2-dimensional cifti file. The output is a cifti file where every row in the input is a column in the output. It's giving rotation, but make it neuroscience. ๐Ÿฆ‹


-cifti-vector-operation โ€” do a vector operation on cifti files ๐Ÿงฎ

wb_command -cifti-vector-operation
  • <vectors-a> โ€” first vector input file
  • <vectors-b> โ€” second vector input file
  • <operation> โ€” what vector operation to do
  • <cifti-out> โ€” output โ€” the output file
  • [-normalize-a] โ€” normalize vectors of first input
  • [-normalize-b] โ€” normalize vectors of second input
  • [-normalize-output] โ€” normalize output vectors (not valid for dot product)
  • [-magnitude] โ€” output the magnitude of the result (not valid for dot product)

Does a vector operation on two cifti files (that must have a multiple of 3 columns). Either of the inputs may have multiple vectors (more than 3 columns), but not both (at least one must have exactly 3 columns). The -magnitude and -normalize-output options may not be specified together, or with an operation that returns a scalar (dot product). So like, read the room before you combine flags, bestie. ๐Ÿ™ˆ

The <operation> parameter must be one of the following:

DOT CROSS ADD SUBTRACT

-cifti-weighted-stats โ€” weighted statistics along cifti columns โš–๏ธ

wb_command -cifti-weighted-stats
  • <cifti-in> โ€” the input cifti
  • [-spatial-weights] โ€” use vertex area and voxel volume as weights
  • [-left-area-surf] โ€” use a surface for left vertex areas
    • <left-surf> โ€” the left surface to use, areas are in mm^2
  • [-right-area-surf] โ€” use a surface for right vertex areas
    • <right-surf> โ€” the right surface to use, areas are in mm^2
  • [-cerebellum-area-surf] โ€” use a surface for cerebellum vertex areas
    • <cerebellum-surf> โ€” the cerebellum surface to use, areas are in mm^2
  • [-left-area-metric] โ€” use a metric file for left vertex areas
    • <left-metric> โ€” metric file containing left vertex areas
  • [-right-area-metric] โ€” use a metric file for right vertex areas
    • <right-metric> โ€” metric file containing right vertex areas
  • [-cerebellum-area-metric] โ€” use a metric file for cerebellum vertex areas
    • <cerebellum-metric> โ€” metric file containing cerebellum vertex areas
  • [-cifti-weights] โ€” use a cifti file containing weights
    • <weight-cifti> โ€” the weights to use, as a cifti file
  • [-column] โ€” only display output for one column
    • <column> โ€” the column to use (1-based)
  • [-roi] โ€” only consider data inside an roi
    • <roi-cifti> โ€” the roi, as a cifti file
  • [-match-maps] โ€” each column of input uses the corresponding column from the roi file
  • [-mean] โ€” compute weighted mean
  • [-stdev] โ€” compute weighted standard deviation
  • [-sample] โ€” estimate population stdev from the sample
  • [-percentile] โ€” compute weighted percentile
    • <percent> โ€” the percentile to find, must be between 0 and 100
  • [-sum] โ€” compute weighted sum
  • [-show-map-name] โ€” print map index and name before each output

So here's the deal ๐ŸŽ€ โ€” if the mapping along column is brain models, for each column of the input, the specified operation is done on each surface and across all voxels, and the results are printed on separate lines. For other mapping types, the operation is done on each column, and one line per map is printed. Exactly one of -spatial-weights or -cifti-weights must be specified. Use -column to only give output for a single column. If the -roi option is used without -match-maps, then each line will contain as many numbers as there are maps in the ROI file, separated by tab characters. And exactly one of -mean, -stdev, -percentile or -sum must be specified. Two whole "exactly one" rules in one option, she's demanding but she's worth it. ๐Ÿ‘‘

Using -sum with -spatial-weights (or with -cifti-weights and a cifti containing weights of similar meaning) is equivalent to integrating with respect to area and volume. When the input is binary ROIs, this will therefore output the area or volume of each ROI. Math is mathing. โœจ


-class-add-member โ€” add members to class header (.h) and implementation (.cxx) files ๐Ÿงš

[-add-to-files] [-m <member-name> <data-type> <description>]...

If the -add-to-files is not specified, the code for the header and implementation files is printed to the terminal. Preview mode, love that for you.

If the -add-to-files is specified, the class files are expected to be in the current directory and named <class-name>.h and <class-name>.cxx. The header file must contain this text in its private section:

// ADD_NEW_MEMBERS_HERE

The implementation file must contain this text in its public section:

// ADD_NEW_METHODS_HERE
Fr fr, if those exact marker comments aren't chilling in the right sections of the right files, this is not going to work out. It's a whole scavenger hunt and the markers are the only clue. ๐Ÿ’€

If either of these text strings is missing, the code that would have been added to the file(s) just gets printed to your terminal instead. (Like, it shows you the receipt of what it was gonna do. ๐Ÿงพ)

For each member you've gotta hand over three text strings separated by a space, and they are, in this order: the name of the member, its data type, and a description of the member. If the description has spaces in it, you MUST wrap the description in double quotes (""). No exceptions bestie, it will not parse otherwise. ๐Ÿ˜ญ

If the data type begins with a capital letter, it's assumed to be the name of a class. In that case, both const and non-const getters are created, but no setter is created. Otherwise, the data type is expected to be a primitive type, and both a getter and a setter are created. Also FYI โ€” AString and QString are treated as primitive types. ๐Ÿ‘‘


-class-create ๐ŸŽ€

Create class header (.h) and implementation (.cxx) files. Literally the whole class, generated for you. Slay.

Usage:

<class-name>
       [-copy] [-equal] [-event-class <event-type-enum>]
       [-event-listener] [-no-parent] [-parent <parent-class-name>]
       [-scene] [-scene-sub-class]

โœจ OPTIONS โœจ

  • -copy โ€” Adds copy constructor and assignment operator.
  • -equal โ€” Adds equality operator.
  • -event-class <event-type-enum> โ€” When you're creating an Event subclass, using this option will automatically set the parent class to Event and place the given event enumerated type value into the parameter for the Event class constructor.

For the <event-type-enum> there's no need to prepend it with "EventTypeEnum::". (We got you. ๐Ÿซถ)

  • -event-listener โ€” Implement the EventListenerInterface so that the class may listen for events.
  • -no-parent โ€” The created class is not derived from any other class. By default, the parent class is CaretObject.
  • -parent <parent-class-name> โ€” Specify the parent (derived from) class. By default, the parent class is CaretObject.
  • -scene โ€” Implement the SceneableInterface so that instances of the class can be restored from and saved to scenes.
  • -scene-sub-class โ€” Adds methods that can be called by the superclass so that this sub-class can save and restore data to and from scenes.
This option should only be used when creating a class whose super class implements the SceneableInterface.

-class-create-algorithm ๐Ÿงš

Create Algorithm Class header (.h) and implementation (.cxx) files.

Usage:

<algorithm-class-name>
       <command-line-switch> <short-description>
  • algorithm-class-name โ€” Required name of the algorithm class that MUST start with "Algorithm".
  • command-line-switch โ€” Required command line switch for the algorithm.
  • short-description โ€” Required short description, within double quotes.

-class-create-enum ๐ŸŒˆ

Create enumerated type header (.h) and implementation (.cxx) files.

Usage:

<enum-class-name>
       <number-of-values> <auto-number>
  • enum-class-name โ€” Name of the enumerated type. Must end in "Enum".
  • number-of-values โ€” Number of values in the enumerated type.
  • auto-number โ€” Automatically generated integer codes corresponding to the enumerated values. The values for this parameter are "true" and "false".
  • [enum-name-1] [enum-name-2]...[enum-name-N] โ€” Optional names for the enumerated values.

If the number of names listed is greater than the number-of-values parameter, the number-of-values will become the number of names. If the number of names is less than the number-of-values, empty entries will be created.


-class-create-operation ๐Ÿ’œ

Create Operation Class header (.h) and implementation (.cxx) files.

Usage:

<operation-class-name>
       <command-line-switch> <short-description> [-no-parameters]
  • operation-class-name โ€” Required name of the operation class that MUST start with "Operation".
  • command-line-switch โ€” Required command line switch for the operation.
  • short-description โ€” Required short description, within double quotes.
  • -no-parameters โ€” Optional parameter if the operation does not use parameters.

-convert-affine โ€” CONVERT AN AFFINE FILE BETWEEN CONVENTIONS ๐Ÿ”„

wb_command -convert-affine
  [-from-world] - input is a NIFTI 'world' affine
    <input> - the input affine
  [-inverse] - for files that use 'target to source' convention
  [-from-itk] - input is an ITK matrix
    <input> - the input affine
  [-from-flirt] - input is a flirt matrix
    <input> - the input affine <source-volume> - the source volume used when generating the input affine
    <target-volume> - the target volume used when generating the input affine
  [-to-world] - write output as a NIFTI 'world' affine
    <output> - output - the output affine
  [-inverse] - write file using 'target to source' convention
  [-to-itk] - write output as an ITK affine
    <output> - output - the output affine
  [-to-flirt] - repeatable - write output as a flirt matrix
    <output> - output - the output affine <source-volume> - the volume you want to apply the transform to <target-volume> - the target space you want the transformed volume to match

NIFTI world matrices can be used directly on mm coordinates via matrix multiplication. They use the NIFTI coordinate system, that is: positive X is right, positive Y is anterior, and positive Z is superior. ๐Ÿ“

Note that wb_command assumes that world matrices transform source coordinates to target coordinates, while other tools may use affines that transform target coordinates to source coordinates. So likeโ€ฆ check your assumptions, bestie. ๐Ÿ˜ญ

The ITK format is used by ANTS.

You must specify exactly one -from option, but you may specify multiple -to options, and -to-flirt may be specified more than once.


-convert-fiber-orientations โ€” CONVERT BINGHAM PARAMETER VOLUMES TO FIBER ORIENTATION FILE ๐Ÿฆ‹

wb_command -convert-fiber-orientations
  <label-volume> - volume of cifti structure labels
  <fiber-out> - output - the output fiber orientation file
  [-fiber] - repeatable - specify the parameter volumes for a fiber
    <mean-f> - mean fiber strength
    <stdev-f> - standard deviation of fiber strength
    <theta> - theta angle
    <phi> - phi angle
    <psi> - psi angle
    <ka> - ka bingham parameter
    <kb> - kb bingham parameter

Takes precomputed bingham parameters from volume files and converts them to the format workbench uses for display. The <label-volume> argument must be a label volume, where the labels use these strings:

CORTEX_LEFT
CORTEX_RIGHT
CEREBELLUM
ACCUMBENS_LEFT
ACCUMBENS_RIGHT
ALL_GREY_MATTER
ALL_WHITE_MATTER
AMYGDALA_LEFT
AMYGDALA_RIGHT
BRAIN_STEM
CAUDATE_LEFT
CAUDATE_RIGHT
CEREBELLAR_WHITE_MATTER_LEFT
CEREBELLAR_WHITE_MATTER_RIGHT
CEREBELLUM_LEFT
CEREBELLUM_RIGHT
CEREBRAL_WHITE_MATTER_LEFT
CEREBRAL_WHITE_MATTER_RIGHT
CORTEX
DIENCEPHALON_VENTRAL_LEFT
DIENCEPHALON_VENTRAL_RIGHT
HIPPOCAMPUS_LEFT
HIPPOCAMPUS_RIGHT
INVALID
OTHER
OTHER_GREY_MATTER
OTHER_WHITE_MATTER
PALLIDUM_LEFT
PALLIDUM_RIGHT
PUTAMEN_LEFT
PUTAMEN_RIGHT
THALAMUS_LEFT
THALAMUS_RIGHT

-convert-matrix4-to-matrix2 โ€” GENERATES A MATRIX2 CIFTI FROM MATRIX4 WBSPARSE ๐Ÿ’ซ

wb_command -convert-matrix4-to-matrix2
  <matrix4-wbsparse> - a wbsparse matrix4 file
  <counts-out> - output - the total fiber counts, as a cifti file
  [-distances] - output average trajectory distance
    <distance-out> - output - the distances, as a cifti file
  [-individual-fibers] - output files for each fiber direction
    <fiber-1> - output - output file for first fiber
    <fiber-2> - output - output file for second fiber
    <fiber-3> - output - output file for third fiber

This command makes a cifti file from the fiber counts in a matrix4 wbsparse file, and optionally a second cifti file from the distances. ๐Ÿ“Š

Note that while the total count is stored exactly, the per-fiber counts are stored as approximate fractions, so the output of -individual-fibers will contain nonintegers. Not a bug, that's just how it is. ๐Ÿ’€

-convert-matrix4-to-workbench-sparse โ€” CONVERT A 3-FILE MATRIX4 TO A WORKBENCH SPARSE FILE ๐ŸŒธ

wb_command -convert-matrix4-to-workbench-sparse
  <matrix4_1> - the first matrix4 file
  <matrix4_2> - the second matrix4 file
  <matrix4_3> - the third matrix4 file
  <orientation-file> - the .fiberTEMP.nii file this trajectory file applies to
  <voxel-list> - list of white matter voxel index triplets as used in the trajectory matrix
  <wb-sparse-out> - output - the output workbench sparse file
  [-surface-seeds] - specify the surface seed space
    <seed-roi> - metric roi file of all vertices used in the seed space
  [-volume-seeds] - specify the volume seed space
    <cifti-template> - cifti file to use the volume mappings from
    <direction> - dimension along the cifti file to take the mapping from, ROW or COLUMN

Converts the matrix 4 output of probtrackx to workbench sparse file format. Exactly one of -surface-seeds and -volume-seeds must be specified. Pick one, bestie, you can't have both. ๐Ÿ™ˆ


-convert-warpfield โ€” CONVERT A WARPFIELD BETWEEN CONVENTIONS ๐ŸŒ€

wb_command -convert-warpfield
  [-from-world] - input is a NIFTI 'world' warpfield
    <input> - the input warpfield
  [-absolute] - warpfield was written in absolute convention, rather than relative
  [-from-itk] - input is an ITK warpfield
    <input> - the input warpfield
  [-from-fnirt] - input is a fnirt warpfield
    <input> - the input warpfield <source-volume> - the source volume used when generating the input warpfield
  [-absolute] - warpfield was written in absolute convention, rather than relative
  [-to-world] - write output as a NIFTI 'world' warpfield
    <output> - output - the output warpfield
  [-to-itk] - write output as an ITK warpfield
    <output> - output - the output warpfield
  [-to-fnirt] - repeatable - write output as a fnirt warpfield
    <output> - output - the output warpfield <source-volume> - the volume you want to apply the warpfield to

NIFTI world warpfields can be used directly on mm coordinates via sampling the three subvolumes at the coordinate and adding the sampled values to the coordinate vector. They use the NIFTI coordinate system, that is, X is left to right, Y is posterior to anterior, and Z is inferior to superior.

NOTE: this command does not invert the warpfield, and to warp a surface, you must use the inverse of the warpfield that warps the corresponding volume. ๐Ÿ’€ like, do not skip this step bestie.

The ITK format is used by ANTS.

You must specify exactly one -from option, but you may specify multiple -to options, and -to-fnirt may be specified more than once. exactly one, we said what we said ๐Ÿ’…


  • -create-signed-distance-volume โ€” CREATE SIGNED DISTANCE VOLUME FROM SURFACE โœจ
wb_command -create-signed-distance-volume
<surface> - the input surface <refspace> - a volume in the
desired output space (dims, spacing, origin) <outvol> - output -
the output volume

okay so the pieces, one by one:

  • <surface> โ€” the input surface
  • <refspace> โ€” a volume in the desired output space (dims, spacing, origin)
  • <outvol> โ€” output โ€” the output volume
  • -roi-out โ€” output an roi volume of where the output has a computed value
    • <roi-vol> โ€” output โ€” the output roi volume
  • -fill-value โ€” specify a value to put in all voxels that don't get assigned a distance
    • <value> โ€” value to fill with (default 0)
  • -exact-limit โ€” specify distance for exact output
    • <dist> โ€” distance in mm (default 5)
  • -approx-limit โ€” specify distance for approximate output
    • <dist> โ€” distance in mm (default 20)
  • -approx-neighborhood โ€” voxel neighborhood for approximate calculation
    • <num> โ€” size of neighborhood cube measured from center to face, in voxels (default 2 = 5x5x5)
  • -winding โ€” winding method for point inside surface test
    • <method> โ€” name of the method (default EVEN_ODD)

Computes the signed distance function of the surface. Exact distance is calculated by finding the closest point on any surface triangle to the center of the voxel. Approximate distance is calculated starting with these distances, using dijkstra's method with a neighborhood of voxels. Specifying too small of an exact distance may produce unexpected results. ๐Ÿ™ˆ so like, don't be stingy with it.

Valid specifiers for winding methods are as follows:

EVEN_ODD (default) NEGATIVE NONZERO NORMALS

The NORMALS method uses the normals of triangles and edges, or the closest triangle hit by a ray from the point. This method may be slightly faster, but is only reliable for a closed surface that does not cross through itself. All other methods count entry (positive) and exit (negative) crossings of a vertical ray from the point, then counts as inside if the total is odd, negative, or nonzero, respectively. iykyk ๐ŸŒธ

  • -estimate-fiber-binghams โ€” ESTIMATE FIBER ORIENTATION DISTRIBUTIONS FROM BEDPOSTX SAMPLES ๐Ÿงš
wb_command -estimate-fiber-binghams
<merged_f1samples> - fiber 1 strength samples <merged_th1samples>
- fiber 1 theta samples <merged_ph1samples> - fiber 1 phi samples
<merged_f2samples> - fiber 2 strength samples <merged_th2samples>
- fiber 2 theta samples <merged_ph2samples> - fiber 2 phi samples
<merged_f3samples> - fiber 3 strength samples <merged_th3samples>
- fiber 3 theta samples <merged_ph3samples> - fiber 3 phi samples
<label-volume> - volume of cifti structure labels <cifti-out> -
output - output cifti fiber distributons file
  • <merged_f1samples> โ€” fiber 1 strength samples
  • <merged_th1samples> โ€” fiber 1 theta samples
  • <merged_ph1samples> โ€” fiber 1 phi samples
  • <merged_f2samples> โ€” fiber 2 strength samples
  • <merged_th2samples> โ€” fiber 2 theta samples
  • <merged_ph2samples> โ€” fiber 2 phi samples
  • <merged_f3samples> โ€” fiber 3 strength samples
  • <merged_th3samples> โ€” fiber 3 theta samples
  • <merged_ph3samples> โ€” fiber 3 phi samples
  • <label-volume> โ€” volume of cifti structure labels
  • <cifti-out> โ€” output โ€” output cifti fiber distributons file

This command does an estimation of a bingham distribution for each fiber orientation in each voxel which is labeled a structure identifier. These labelings come from the <label-volume> argument, which must have labels that match the following strings: no vibes allowed if your labels are custom, they gotta match fr fr

CORTEX_LEFT CORTEX_RIGHT CEREBELLUM ACCUMBENS_LEFT
ACCUMBENS_RIGHT ALL_GREY_MATTER ALL_WHITE_MATTER AMYGDALA_LEFT
AMYGDALA_RIGHT BRAIN_STEM CAUDATE_LEFT CAUDATE_RIGHT
CEREBELLAR_WHITE_MATTER_LEFT CEREBELLAR_WHITE_MATTER_RIGHT
CEREBELLUM_LEFT CEREBELLUM_RIGHT CEREBRAL_WHITE_MATTER_LEFT
CEREBRAL_WHITE_MATTER_RIGHT CORTEX DIENCEPHALON_VENTRAL_LEFT
DIENCEPHALON_VENTRAL_RIGHT HIPPOCAMPUS_LEFT HIPPOCAMPUS_RIGHT
INVALID OTHER OTHER_GREY_MATTER OTHER_WHITE_MATTER PALLIDUM_LEFT
PALLIDUM_RIGHT PUTAMEN_LEFT PUTAMEN_RIGHT THALAMUS_LEFT
THALAMUS_RIGHT
  • -fiber-dot-products โ€” COMPUTE DOT PRODUCTS OF FIBER ORIENTATIONS WITH SURFACE NORMALS ๐Ÿ’ซ
wb_command -fiber-dot-products
<white-surf> - the white/gray boundary surface <fiber-file> - the
fiber orientation file <max-dist> - the maximum distance from any
surface vertex a fiber
population may be, in mm
<direction> - test against surface for whether a fiber population
should
be used
<dot-metric> - output - the metric of dot products <f-metric> -
output - a metric of the f values of the fiber distributions
  • <white-surf> โ€” the white/gray boundary surface
  • <fiber-file> โ€” the fiber orientation file
  • <max-dist> โ€” the maximum distance from any surface vertex a fiber population may be, in mm
  • <direction> โ€” test against surface for whether a fiber population should be used
  • <dot-metric> โ€” output โ€” the metric of dot products
  • <f-metric> โ€” output โ€” a metric of the f values of the fiber distributions

For each vertex, this command finds the closest fiber population that satisfies the <direction> test, and computes the absolute value of the dot product of the surface normal and the normalized mean direction of each fiber. The <direction> test must be one of INSIDE, OUTSIDE, or ANY, which causes the command to only use fiber populations that are inside the surface, outside the surface, or to not care which direction it is from the surface. Each fiber population is output in a separate metric column. one column per fiber pop, slay โœจ

  • -file-convert โ€” CHANGE VERSION OF FILE FORMAT ๐Ÿ”„
wb_command -file-convert
[-border-version-convert] - write a border file with a different
version
<border-in> - the input border file <out-version> - the format
version to write as, 1 or 3 (2 doesn't
exist)
<border-out> - output - the output border file
[-surface] - must be specified if the input is version 1
<surface> - use this surface file for structure and number of
vertices, ignore borders on other structures
[-nifti-version-convert] - write a nifti file with a different
version
<input> - the input nifti file <version> - the nifti version to
write as <output> - output - the output nifti file
[-cifti-version-convert] - write a cifti file with a different
version
<cifti-in> - the input cifti file <version> - the cifti version to
write as <cifti-out> - output - the output cifti file

breaking it down, bestie:

  • -border-version-convert โ€” write a border file with a different version
    • <border-in> โ€” the input border file
    • <out-version> โ€” the format version to write as, 1 or 3 (2 doesn't exist) yes really, 2 is not a thing, it simply does not exist ๐Ÿ™ˆ
    • <border-out> โ€” output โ€” the output border file
  • -surface โ€” must be specified if the input is version 1
    • <surface> โ€” use this surface file for structure and number of vertices, ignore borders on other structures
  • -nifti-version-convert โ€” write a nifti file with a different version
    • <input> โ€” the input nifti file
    • <version> โ€” the nifti version to write as
    • <output> โ€” output โ€” the output nifti file
  • -cifti-version-convert โ€” write a cifti file with a different version
    • <cifti-in> โ€” the input cifti file
    • <version> โ€” the cifti version to write as
    • <cifti-out> โ€” output โ€” the output cifti file

You may only specify one top-level option. one. just one. pick your fave ๐Ÿ’…

  • -file-information โ€” LIST INFORMATION ABOUT A FILE'S CONTENT ๐Ÿ”
wb_command -file-information
<data-file> - data file
[-no-map-info] - do not show map information for files that
support maps
[-only-step-interval] - suppress normal output, print the
interval
between maps
[-only-number-of-maps] - suppress normal output, print the number
of maps
[-only-map-names] - suppress normal output, print the names of
all maps
[-only-metadata] - suppress normal output, print file metadata
[-key] - only print the metadata for one key, with no formatting
<key> - the metadata key
[-only-cifti-xml] - suppress normal output, print the cifti xml
if the
file type has it
[-czi] - For a CZI file, show information from the libCZI Info
Command
instead of the Workbench CZI File
[-czi-all-sub-blocks] - show all sub-blocks in CZI file (may
produce long
output)
[-czi-xml] - show XML from CZI file

the tea โ˜•:

  • <data-file> โ€” data file
  • -no-map-info โ€” do not show map information for files that support maps
  • -only-step-interval โ€” suppress normal output, print the interval between maps
  • -only-number-of-maps โ€” suppress normal output, print the number of maps
  • -only-map-names โ€” suppress normal output, print the names of all maps
  • -only-metadata โ€” suppress normal output, print file metadata
  • -key โ€” only print the metadata for one key, with no formatting
    • <key> โ€” the metadata key
  • -only-cifti-xml โ€” suppress normal output, print the cifti xml if the file type has it
  • -czi โ€” For a CZI file, show information from the libCZI Info Command instead of the Workbench CZI File
  • -czi-all-sub-blocks โ€” show all sub-blocks in CZI file (may produce long output)
  • -czi-xml โ€” show XML from CZI file

List information about the content of a data file. Only one -only option may be specified. The information listed when no -only option is present is dependent upon the type of data file.

Library paths: bookmark these, they come up i promise

/usr/lib/x86_64-linux-gnu/qt5/plugins
/build/connectome-workbench-Ltkb5s/connectome-workbench-2.0.1/debian/tmp-
/usr/bin

File and extensions for reading and writing โ€” the whole roster, no skips:

  • Annotation: wb_annot
  • Annotation Text Substitution: wb_annsub.csv
  • Border: border, wb_border
  • CIFTI - Dense: dconn.nii
  • CIFTI - Dense Label: dlabel.nii
  • CIFTI - Dense Parcel: dpconn.nii
  • CIFTI - Dense Scalar: dscalar.nii
  • CIFTI - Dense Data Series: dtseries.nii
  • CIFTI - Fiber Orientations TEMPORARY: fiberTEMP.nii
  • CIFTI - Fiber Trajectory TEMPORARY: trajTEMP.wbsparse
  • CIFTI - Parcel: pconn.nii
  • CIFTI - Parcel Dense: pdconn.nii
  • CIFTI - Parcel Label: plabel.nii
  • CIFTI - Parcel Scalar: pscalar.nii
  • CIFTI - Parcel Series: ptseries.nii
  • CIFTI - Scalar Data Series: sdseries.nii
  • CZI Image: czi
  • Foci: foci, wb_foci
  • Histology Slices: metaczi, meta-image
  • Image Read: bmp, gif, jpeg, jpg, png, ppm
  • Write: bmp, jpeg, jpg, png, ppm
  • Label: label.gii
  • Metric: func.gii, shape.gii
  • Palette: palette, wb_palette
  • RGBA: rgba.gii
  • Samples: wb_samples
  • Scene: scene, wb_scene
  • Specification: spec, wb_spec
  • Surface: surf.gii
  • Volume: nii, nii.gz
  • -foci-create โ€” CREATE A FOCI FILE ๐ŸŽ€
wb_command -foci-create
<output> - output - the output foci file
[-class] - repeatable - specify class input data
<class-name> - name of class <foci-list-file> - text file
containing foci names, coordinates, and
colors
<surface> - surface file for projection of foci list file
  • <output> โ€” output โ€” the output foci file
  • -class โ€” repeatable โ€” specify class input data
    • <class-name> โ€” name of class
    • <foci-list-file> โ€” text file containing foci names, coordinates, and colors
    • <surface> โ€” surface file for projection of foci list file

Creates a foci file from names, coordinates, and RGB values in a text file. The text file must have the following format (2 lines per focus):

<focus-name>
<red> <green> <blue> <x> <y> <z> ...

Foci names are specified on a separate line from their coordinates and color, in order to let foci names contain spaces. Whitespace is trimmed from both ends of the foci name, but is kept if it is in the middle of a name. The values of <red>, <green>, <blue> and must be integers from 0 to 255, and will specify the color the foci is drawn as. middle spaces survive, edge spaces get the boot ๐Ÿซถ

Foci are grouped into classes and the name for the class is specified using the <class-name> parameter.

All foci within one text file must be associated with the structure contained in the <surface> parameter and are projected to that surface. must. no mixing structures in one file, that's the rule ๐Ÿ˜ญ

  • -foci-get-projection-vertex โ€” GET PROJECTION VERTEX FOR FOCI ๐Ÿ“
wb_command -foci-get-projection-vertex
<foci> - the foci file <surface> - the surface related to the
foci file <metric-out> - output - the output metric file
  • <foci> โ€” the foci file
  • <surface> โ€” the surface related to the foci file
  • <metric-out> โ€” output โ€” the output metric file
  • [-name] โ€” select a focus by name
    • <name> โ€” the name of the focus

For each focus, a column gets created in <metric-out>, and the vertex with the most influence on its projection is assigned a value of 1 in that column, while all the other vertices get 0. If you use -name, only one focus will be used. ๐Ÿ’…

  • -foci-list-coords โ€” output foci coords in a text file ๐Ÿ“
wb_command -foci-list-coords
  • <foci-file> โ€” input foci file
  • <coord-file-out> โ€” output, the output coordinate text file
  • [-names-out] โ€” output the foci names
    • <names-file-out> โ€” output, text file to put foci names in

This one outputs the coordinates for every single focus in the foci file, and if you want, the focus names in a second text file. Bestie, it's giving "dump my coordinates please". โœจ

  • -foci-resample โ€” project foci to a different surface ๐Ÿฆ‹
wb_command -foci-resample
  • <foci-in> โ€” the input foci file
  • <foci-out> โ€” output, the output foci file
  • [-left-surfaces] โ€” the left surfaces for resampling
    • <current-surf> โ€” the surface the foci are currently projected on
    • <new-surf> โ€” the surface to project the foci onto
  • [-right-surfaces] โ€” the right surfaces for resampling
    • <current-surf> โ€” the surface the foci are currently projected on
    • <new-surf> โ€” the surface to project the foci onto
  • [-cerebellum-surfaces] โ€” the cerebellum surfaces for resampling
    • <current-surf> โ€” the surface the foci are currently projected on
    • <new-surf> โ€” the surface to project the foci onto
  • [-discard-distance-from-surface] โ€” ignore the distance the foci are above or below the current surface
  • [-restore-xyz] โ€” put the original xyz coordinates into the foci, rather than the coordinates obtained from unprojection

So what happens is: it unprojects the foci from the <current-surf> for the structure, then projects them onto <new-surf>. If the foci have meaningful distances above or below the surface, use anatomical surfaces. And if the foci should be on the surface, use registered spheres plus the options -discard-distance-from-surface and -restore-xyz. Two totally different vibes, pick accordingly ๐Ÿ’œ

  • -gifti-all-labels-to-rois โ€” make ROIs from all labels in a GIFTI column ๐ŸŒˆ
wb_command -gifti-all-labels-to-rois
  • <label-in> โ€” the input gifti label file
  • <map> โ€” the number or name of the label map to use
  • <metric-out> โ€” output, the output metric file

The output metric file has a column for each label in the specified input map โ€” other than the ??? label, obvs โ€” and each one contains an ROI of all vertices that are set to the corresponding label. No cap, one column per label. ๐ŸŽ€

  • -gifti-convert โ€” convert a GIFTI file to a different encoding ๐Ÿ”„
wb_command -gifti-convert
  • <gifti-encoding> โ€” what the output encoding should be
  • <input-gifti-file> โ€” the input gifti file
  • <output-gifti-file> โ€” output, the output gifti file

The value of <gifti-encoding> must be one of the following:

ASCII
BASE64_BINARY
GZIP_BASE64_BINARY
EXTERNAL_FILE_BINARY
  • -gifti-label-add-prefix โ€” add prefix to all label names in a GIFTI label file ๐Ÿท๏ธ
wb_command -gifti-label-add-prefix
  • <label-in> โ€” the input label file
  • <prefix> โ€” the prefix string to add
  • <label-out> โ€” output, the output label file

For each label other than '???', it prepends <prefix> to the label name. Like a little name tag for every label, slay. โœจ

  • -gifti-label-to-roi โ€” make a GIFTI label into an ROI metric ๐ŸŽฏ
wb_command -gifti-label-to-roi
  • <label-in> โ€” the input gifti label file
  • <metric-out> โ€” output, the output metric file
  • [-name] โ€” select label by name
    • <label-name> โ€” the label name that you want an roi of
  • [-key] โ€” select label by key
    • <label-key> โ€” the label key that you want an roi of
  • [-map] โ€” select a single label map to use
    • <map> โ€” the map number or name

For every map in <label-in>, a map gets created in <metric-out> where all locations labeled with <label-name> or with a key of <label-key> are given a value of 1, and all the other locations get 0. Exactly one of -name and -key must be specified โ€” you don't get to do both, periodt. And if you want just one map from <label-in>, specify -map.

  • -label-dilate โ€” dilate a label file ๐Ÿซง
wb_command -label-dilate
  • <label> โ€” the input label
  • <surface> โ€” the surface to dilate on
  • <dilate-dist> โ€” distance in mm to dilate the labels
  • <label-out> โ€” output, the output label file
  • [-bad-vertex-roi] โ€” specify an roi of vertices to overwrite, rather than vertices with the unlabeled key
    • <roi-metric> โ€” metric file, positive values denote vertices to have their values replaced
  • [-column] โ€” select a single column to dilate
    • <column> โ€” the column number or name
  • [-corrected-areas] โ€” vertex areas to use instead of computing them from the surface
    • <area-metric> โ€” the corrected vertex areas, as a metric

What it does: fills in label information for all vertices designated as bad, up to the specified distance away from other labels. If -bad-vertex-roi is specified, then all vertices โ€” including the ones with the unlabeled key โ€” are good, except for vertices with a positive value in the ROI. If it's not specified, only vertices with the unlabeled key are bad. Choose wisely bestie ๐Ÿ˜ญ

  • -label-erode โ€” erode a label file ๐Ÿ“
wb_command -label-erode
  • <label> โ€” the input label
  • <surface> โ€” the surface to erode on
  • <erode-dist> โ€” distance in mm to erode the labels
  • <label-out> โ€” output, the output label file
  • [-roi] โ€” assume values outside this roi are labeled
    • <roi-metric> โ€” metric file, positive values denote vertices that have data
  • [-column] โ€” select a single column to erode
    • <column> โ€” the column number or name
  • [-corrected-areas] โ€” vertex areas to use instead of computing them from the surface
    • <area-metric> โ€” the corrected vertex areas, as a metric

Around each vertex that's unlabeled, it sets the surrounding vertices to unlabeled. "Surrounding" here means all immediate neighbors and all vertices within the specified distance.

Heads up: the -corrected-areas option uses an approximate correction for distance along the surface. Approximate!! Don't come for me, it's in the docs. ๐Ÿ’€
  • -label-export-table โ€” export label table from GIFTI as text ๐Ÿ“
wb_command -label-export-table
  • <label-in> โ€” the input label file
  • <table-out> โ€” output, the output text file

It takes the label table from the gifti label file and writes it out to a text format that matches what -metric-label-import expects. Perfect little handoff, we love compatibility. ๐Ÿซถ

  • -label-mask โ€” mask a label file ๐ŸŽญ
wb_command -label-mask
  • <label> โ€” the label file to mask
  • <mask> โ€” the mask metric
  • <label-out> โ€” output, the output label file
  • [-column] โ€” select a single column
    • <column> โ€” the column number or name

By default the output label is a copy of the input label, but with the 'unused' label wherever the mask metric is zero or negative. And if -column is specified, the output contains only one column: the masked version of the specified input column. Clean, minimal, iconic. ๐Ÿ’…

  • -label-merge โ€” merge label files into a new file ๐Ÿงฌ
wb_command -label-merge
  • <label-out> โ€” output, the output label
  • [-label] โ€” repeatable โ€” specify an input label
    • <label-in> โ€” a label file to use columns from
  • [-column] โ€” repeatable โ€” select a single column to use
    • <column> โ€” the column number or name
  • [-up-to] โ€” use an inclusive range of columns
    • <last-column> โ€” the number or name of the last column to include
  • [-reverse] โ€” use the range in reverse order

Takes one or more label files and constructs a new label file by concatenating columns from them. The input files must have the same number of vertices and the same structure โ€” no mixing and matching, bestie.

Example:

wb_command -label-merge out.label.gii -label first.label.gii -column 1 -label second.label.gii

This example would take the first column from first.label.gii and all subvolumes from second.label.gii, and write these to out.label.gii. See how it eats? ๐Ÿ”ฅ

  • -label-modify-keys โ€” change key values in a label file ๐Ÿ”‘
wb_command -label-modify-keys
  • <label-in> โ€” the input label file
  • <remap-file> โ€” text file with old and new key values
  • <label-out> โ€” output, output label file
  • [-column] โ€” select a single column to use
    • <column> โ€” the column number or name

<remap-file> should have lines of the form 'oldkey newkey', like so:

3 5 5 8 8 2

This would change the current label with key '3' to use the key '5' instead, 5 would use 8, and 8 would use 2. Any collision in key values results in the label that was not specified in the remap file getting remapped to an otherwise unused key. Remapping more than one key to the same new key, or the same key to more than one new key, results in an error. And important: this will not change the appearance of the file when displayed, since it changes the key values in the data at the same time. Sneaky but consistent. ๐Ÿ˜Œ

  • -label-probability โ€” find frequency of surface labels ๐Ÿ“Š
wb_command -label-probability
  • <label-maps> โ€” label file containing individual label maps from many subjects
  • <probability-metric-out> โ€” output, the relative frequencies of each label at each vertex
  • [-exclude-unlabeled] โ€” don't make a probability map of the unlabeled key

This command outputs a set of soft ROIs, one for each label in the input, where the value is how many of the input maps had that label at that vertex, divided by the number of input maps. Math girlies rise ๐Ÿงšโœจ

  • -label-resample โ€” resample a label file to a different mesh ๐ŸŒ
wb_command -label-resample
  • <label-in> โ€” the label file to resample
  • <current-sphere> โ€” a sphere surface with the mesh that the label file is currently on
  • <new-sphere> โ€” a sphere surface that is in register with <current-sphere> and has the desired output mesh
  • <method> โ€” the method name
  • <label-out> โ€” output, the output label file
  • [-area-surfs] โ€” specify surfaces to do vertex area correction based on
    • <current-area> โ€” a relevant anatomical surface with <current-sphere> mesh
    • <new-area> โ€” a relevant anatomical surface with <new-sphere> mesh
  • [-area-metrics] โ€” specify vertex area metrics to do area correction based
  • <current-area> โ€” a metric file with vertex areas for the <current-sphere> mesh
    • <new-area> โ€” a metric file with vertex areas for the <new-sphere> mesh
    • -current-roi โ€” use an input roi on the current mesh to exclude non-data vertices
      • <roi-metric> โ€” the roi, as a metric file
    • -valid-roi-out โ€” output the ROI of vertices that got data from valid source vertices
      • <roi-out> โ€” output โ€” the output roi as a metric
    • -largest โ€” use only the label of the vertex with the largest weight
    • -bypass-sphere-check โ€” ADVANCED: allow the current and new 'spheres' to have arbitrary shape as long as they follow the same contour

okay so what this whole thing does: it resamples a label file, given two spherical surfaces that are in register. ๐Ÿ’ซ And here's the โœจsituationโœจ: if ADAP_BARY_AREA is used, exactly one of -area-surfs or -area-metrics must be specified. (yeah, exactly one, no more no less, bestie)

The ADAP_BARY_AREA method is recommended for label data, because it should be better at resolving vertices that are near multiple labels, or in case of downsampling. Midthickness surfaces are recommended for the vertex areas for most data. ๐Ÿง 

The -largest option results in nearest vertex behavior when used with BARYCENTRIC, as it uses the value of the source vertex that has the largest weight. ๐Ÿ‘‘

When -largest is not specified, the vertex weights are summed according to which label they correspond to, and the label with the largest sum is used. Math but make it fashion. ๐Ÿ’…

The <method> argument must be one of the following:

  • ADAP_BARY_AREA
  • BARYCENTRIC

๐Ÿ’– -label-to-border โ€” DRAW BORDERS AROUND LABELS ๐Ÿ’–

wb_command -label-to-border
<surface> - the surface to use for neighbor information
<label-in> - the input label file
<border-out> - output - the output border file
[-placement] - set how far along the edge border points are drawn
<fraction> - fraction along edge from inside vertex (default 0.33)
[-column] - select a single column
<column> - the column number or name

So for each label, it finds all edges on the mesh that cross the boundary of the label, and draws borders through them. ๐ŸŽ€ By default this is done on all columns in the input file, using the map name as the class name for the border. Slay.


๐Ÿฆ‹ -label-to-volume-mapping โ€” MAP LABEL FILE TO VOLUME ๐Ÿฆ‹

wb_command -label-to-volume-mapping
<label> - the input label file
<surface> - the surface to use coordinates from
<volume-space> - a volume file in the desired output volume space
<volume-out> - output - the output volume file
[-nearest-vertex] - use the label from the vertex closest to the voxel center
<distance> - how far from the surface to map labels to voxels, in mm
[-ribbon-constrained] - use ribbon constrained mapping algorithm
<inner-surf> - the inner surface of the ribbon
<outer-surf> - the outer surface of the ribbon
[-voxel-subdiv] - voxel divisions while estimating voxel weights
<subdiv-num> - number of subdivisions, default 3
[-greedy] - also put labels in voxels with less than 50% partial volume (legacy behavior)
[-thick-columns] - use overlapping columns (legacy method)

This one maps labels from a gifti label file into a volume file. ๐Ÿซถ You must specify exactly one mapping method option.

The -nearest-vertex method uses the label from the vertex closest to the voxel center. The -ribbon-constrained method uses the same method as in -volume-to-surface-mapping, then uses the weights in reverse, with popularity logic to decide on a label to use. (popularity contest but for voxels, iconic honestly ๐Ÿ†)


๐ŸŒธ -metadata-remove-provenance โ€” REMOVE PROVENANCE INFORMATION FROM FILE METADATA ๐ŸŒธ

wb_command -metadata-remove-provenance
<input-file> - the file to remove provenance information from
<output-file> - output - the name to save the modified file as

Removes the provenance metadata fields added by workbench during processing. bye bye paper trail ๐Ÿซก


โœจ -metadata-string-replace โ€” REPLACE A STRING IN ALL METADATA OF A FILE โœจ

wb_command -metadata-string-replace
<input-file> - the file to replace metadata in
<find-string> - the string to find
<replace-string> - the string to replace <find-string> with
<output-file> - output - the name to save the modified file as
[-case-insensitive] - match with case variation also

Replaces all occurrences of <find-string> in the metadata and map names of <input-file> with <replace-string>. find & replace but make it neuroimaging ๐Ÿ’–


๐ŸŽ€ -metric-convert โ€” CONVERT METRIC FILE TO FAKE NIFTI ๐ŸŽ€

wb_command -metric-convert
[-to-nifti] - convert metric to nifti
<metric-in> - the metric to convert
<nifti-out> - output - the output nifti file
[-from-nifti] - convert nifti to metric
<nifti-in> - the nifti file to convert
<surface-in> - surface file to use number of vertices and structure from
<metric-out> - output - the output metric file

The purpose of this command is to convert between metric files and nifti1 so that gifti-unaware programs can operate on the data. ๐Ÿ‘€ You must specify exactly one of the options.


๐Ÿ’œ -metric-dilate โ€” DILATE A METRIC FILE ๐Ÿ’œ

wb_command -metric-dilate
<metric> - the metric to dilate
<surface> - the surface to compute on
<distance> - distance in mm to dilate
<metric-out> - output - the output metric
[-bad-vertex-roi] - specify an roi of vertices to overwrite, rather than
vertices with value zero
<roi-metric> - metric file, positive values denote vertices to have
their values replaced
[-data-roi] - specify an roi of where there is data
<roi-metric> - metric file, positive values denote vertices that have
data
[-column] - select a single column to dilate
<column> - the column number or name
[-nearest] - use the nearest good value instead of a weighted average
[-linear] - fill in values with linear interpolation along strongest
gradient
[-exponent] - use a different exponent in the weighting function
<exponent> - exponent 'n' to use in (area / (distance ^ n)) as the
weighting function (default 6)
[-corrected-areas] - vertex areas to use instead of computing them from
the surface
<area-metric> - the corrected vertex areas, as a metric
[-legacy-cutoff] - use the v1.3.2 method of choosing how many vertices to
use when calulating the dilated value with weighted method

For all metric vertices that are designated as bad, if they neighbor a non-bad vertex with data or are within the specified distance of such a vertex, replace the value with a distance-based weighted average of nearby non-bad vertices that have data, otherwise set the value to zero. ๐ŸŒˆ No matter how small <distance> is, dilation will always use at least the immediate neighbor vertices. If -nearest is specified, it will use the value from the closest non-bad vertex with data within range instead of a weighted average. (nearest, not average, got it? ๐Ÿ’…)

If -bad-vertex-roi is specified, all vertices with a positive ROI value are bad. If it is not specified, only vertices that have data, with a value of zero, are bad. If -data-roi is not specified, all vertices are assumed to have data.

Note that the -corrected-areas option uses an approximate correction for the change in distances along a group average surface.

To get the behavior of version 1.3.2 or earlier, use '-legacy-cutoff -exponent 2'.


๐Ÿ’€ -metric-erode โ€” ERODE A METRIC FILE ๐Ÿ’€

wb_command -metric-erode
<metric> - the metric file to erode
<surface> - the surface to compute on
<distance> - distance in mm to erode
<metric-out> - output - the output metric
[-roi] - assume values outside this roi are nonzero
<roi-metric> - metric file, positive values denote vertices that have
data
[-column] - select a single column to erode
<column> - the column number or name
[-corrected-areas] - vertex areas to use instead of computing them from
the surface
<area-metric> - the corrected vertex areas, as a metric

Around each vertex with a value of zero, set surrounding vertices to zero. ๐Ÿ˜ญ The surrounding vertices are all immediate neighbors and all vertices within the specified distance.

Note that the -corrected-areas option uses an approximate correction for distance along the surface.

๐Ÿงš -metric-estimate-fwhm โ€” ESTIMATE FWHM SMOOTHNESS OF A METRIC FILE ๐Ÿงš

wb_command -metric-estimate-fwhm
<surface> - the surface to use for distance and neighbor information
<metric-in> - the input metric
[-roi] - use only data within an ROI
<roi-metric> - the metric file to use as an ROI
[-column] - select a single column to estimate smoothness of
<column> - the column number or name
[-whole-file] - estimate for the whole file at once, not each column
separately
[-demean] - subtract the mean image before estimating smoothness

Estimates the smoothness of the metric columns, printing the estimates to standard output. ๐Ÿ“ข Heads up bestie: these estimates ignore variation in vertex spacing. ๐Ÿ™ˆ


๐Ÿ“ -metric-extrema โ€” FIND EXTREMA IN A METRIC FILE ๐Ÿ“

wb_command -metric-extrema
<surface> - the surface to use for distance information
<metric-in> - the metric to find the extrema of
<distance> - the minimum distance between identified extrema of the same
type
<metric-out> - output - the output extrema metric
[-presmooth] - smooth the metric before finding extrema
<kernel> - the size of the gaussian smoothing kernel in mm, as sigma
by default
[-fwhm] - kernel size is FWHM, not sigma
[-roi] - ignore values outside the selected area
<roi-metric> - the area to find extrema in, as a metric
[-threshold] - ignore small extrema
<low> - the largest value to consider for being a minimum
<high> - the smallest value to consider for being a maximum
[-sum-columns] - output the sum of the extrema columns instead of each

<purple>โ€ฆcolumn separately</purple> ๐Ÿ’…

- **`-consolidate-mode`** โ€” use consolidation of local minima instead of a large neighborhood
- **`-only-maxima`** โ€” only find the maxima
- **`-only-minima`** โ€” only find the minima
- **`-column`** โ€” select a single column to find extrema in
  - `<column>` โ€” the column number or name

Okay so what does it actually do ๐Ÿ‘€ It finds extrema in a metric file, with the rule that no two extrema of the same type can be within `<distance>` of each other. The extrema get labeled as <green>`-1`</green> for minima, <green>`1`</green> for maxima, and <green>`0`</green> otherwise. If you pass `-only-maxima` or `-only-minima`, it'll just ignore extrema that aren't the type you asked for. And heads up bestie โ€” these two options are <red>mutually exclusive</red>, so pick one, not both, okay? ๐Ÿซถ

If `-roi` is specified, it's not just that data outside the roi doesn't get used โ€” any vertex sitting on the *edge* of the ROI will never be counted as an extrema, because if the ROI cuts across a gradient it would otherwise generate extrema where there shouldn't be any. Iconic protective behaviour honestly. ๐Ÿ›ก๏ธ

If `-sum-columns` is specified, these extrema columns get summed, and the output has a single column with that result.

By default, a datapoint is an extrema only if it's more extreme than *every* other datapoint within `<distance>` of it. If you use `-consolidate-mode`, it instead starts by finding all datapoints that are more extreme than their immediate neighbors, then while there are any extrema within `<distance>` of each other, it takes the two extrema closest to each other and merges them into one by a weighted average based on how many original extrema have been merged into each.

By default, all input columns are used with no smoothing. Use `-column` to specify a single column to use, and `-presmooth` to smooth the input before finding the extrema. โœจ

---

## ๐ŸŒธ `-metric-false-correlation` โ€” <hotpink>COMPARE CORRELATION LOCALLY AND ACROSS/THROUGH SULCI/GYRI</hotpink>

wb_command -metric-false-correlation


- `<surface>` โ€” the surface to compute geodesic and 3D distance with
- `<metric-in>` โ€” the metric to correlate
- `<3D-dist>` โ€” maximum 3D distance to check around each vertex
- `<geo-outer>` โ€” maximum geodesic distance to use for neighboring correlation
- `<geo-inner>` โ€” minimum geodesic distance to use for neighboring correlation
- `<metric-out>` โ€” **output** โ€” the output metric
- `-roi` โ€” select a region of interest that has data
  - `<roi-metric>` โ€” the region, as a metric file
- `-dump-text` โ€” dump the raw measures used to a text file
  - `<text-out>` โ€” the output text file

So for each vertex, it computes the average correlation within a range of geodesic distances that <green>don't cross a sulcus/gyrus</green>, plus the correlation to the closest vertex that *does* cross a sulcus/gyrus. A vertex counts as crossing a sulcus/gyrus if the 3D distance is less than <yellow>a third</yellow> of the geodesic distance. The output file holds the ratio between those correlations, plus some extra maps to help explain the ratio. ๐Ÿง 

---

## ๐Ÿฆ‹ `-metric-fill-holes` โ€” <hotpink>FILL HOLES IN AN ROI METRIC</hotpink>

wb_command -metric-fill-holes


- `<surface>` โ€” the surface to use for neighbor information
- `<metric-in>` โ€” the input ROI metric
- `<metric-out>` โ€” **output** โ€” the output ROI metric
- `-corrected-areas` โ€” vertex areas to use instead of computing them from the surface
  - `<area-metric>` โ€” the corrected vertex areas, as a metric

It finds all the connected areas that are *not* included in the ROI, and writes ones into all but the largest one, in terms of surface area. Basically it patches the little holes and leaves the big void alone, no cap. ๐Ÿ•ณ๏ธโžก๏ธโœจ

---

## ๐Ÿ’œ `-metric-find-clusters` โ€” <hotpink>FILTER CLUSTERS BY SURFACE AREA</hotpink>

wb_command -metric-find-clusters


- `<surface>` โ€” the surface to compute on
- `<metric-in>` โ€” the input metric
- `<value-threshold>` โ€” threshold for data values
- `<minimum-area>` โ€” threshold for cluster area, in `mm^2`
- `<metric-out>` โ€” **output** โ€” the output metric
- `-less-than` โ€” find values less than `<value-threshold>`, rather than greater
- `-roi` โ€” select a region of interest
  - `<roi-metric>` โ€” the roi, as a metric
- `-corrected-areas` โ€” vertex areas to use instead of computing them from the surface
  - `<area-metric>` โ€” the corrected vertex areas, as a metric
- `-column` โ€” select a single column
  - `<column>` โ€” the column number or name
- `-size-ratio` โ€” ignore clusters smaller than a given fraction of the largest cluster in map
  - `<ratio>` โ€” fraction of the largest cluster's area
- `-distance` โ€” ignore clusters further than a given distance from the largest cluster
  - `<distance>` โ€” how far from the largest cluster a cluster can be, edge to edge, in mm
- `-start` โ€” start labeling clusters from a value other than `1`
  - `<startval>` โ€” the value to give the first cluster found

It outputs a metric with nonzero integers for all vertices inside a large enough cluster, and zeros everywhere else. The integers denote cluster membership โ€” by default the first cluster found uses value `1`, the second uses `2`, etc. And important: cluster values are <red>not reused</red> across maps of the output, they just keep counting up. ๐Ÿ“ˆ

By default, values greater than `<value-threshold>` are considered to be in a cluster; use `-less-than` to test for values *less* than the threshold instead. If you wanna apply this as a mask to the data, or do more complicated thresholding, go see `-metric-math`. ๐Ÿ’…

---

## ๐ŸŒˆ `-metric-gradient` โ€” <hotpink>SURFACE GRADIENT OF A METRIC FILE</hotpink>

wb_command -metric-gradient


- `<surface>` โ€” the surface to compute the gradient on
- `<metric-in>` โ€” the metric to compute the gradient of
- `<metric-out>` โ€” **output** โ€” the magnitude of the gradient
- `-presmooth` โ€” smooth the metric before computing the gradient
  - `<kernel>` โ€” the size of the gaussian smoothing kernel in mm, as sigma by default
- `-fwhm` โ€” kernel size is FWHM, not sigma
- `-roi` โ€” select a region of interest to take the gradient of
  - `<roi-metric>` โ€” the area to take the gradient within, as a metric
- `-match-columns` โ€” for each input column, use the corresponding column from the roi
- `-vectors` โ€” output gradient vectors
  - `<vector-metric-out>` โ€” **output** โ€” the vectors as a metric file
- `-column` โ€” select a single column to compute the gradient of
  - `<column>` โ€” the column number or name
- `-corrected-areas` โ€” vertex areas to use instead of computing them from the surface
  - `<area-metric>` โ€” the corrected vertex areas, as a metric
- `-average-normals` โ€” average the normals of each vertex with its neighbors before using them to compute the gradient

Okay so at each vertex, the immediate neighbors get unfolded onto a plane tangent to the surface at that vertex โ€” specifically, perpendicular to the normal. The gradient is computed using a regression between the unfolded positions of the vertices and their values, and then the gradient is given by the slopes of that regression and reconstructed as a 3D gradient vector. ๐Ÿ“

By default it takes the gradient of all columns, with no presmoothing, across the whole surface, without averaging the normals of the surface among neighbors.

> When using `-corrected-areas`, note that it is an **approximate** correction. Doing smoothing on individual surfaces before averaging/gradient is preferred, when possible, in order to make use of the original surface structure. โš ๏ธ

Specifying an ROI will restrict the gradient to only use data from where the ROI metric is positive, and output zeros anywhere the ROI metric is not positive.

By default, the first column of the roi metric is used for all input columns. When `-match-columns` is specified to the `-roi` option, the input and roi metrics must have the same number of columns, and for each input column's index, the same column index is used in the roi metric. If the `-match-columns` option to `-roi` is used while the `-column` option is also used, the number of columns of the roi metric must match the input metric, and it will use the roi column with the index of the selected input column. ๐ŸŽฏ

The vector output metric is organized such that the X, Y, and Z components from a single input column are consecutive columns. ๐Ÿ“ฆ

---

## ๐ŸŽ€ `-metric-label-import` โ€” <hotpink>IMPORT A GIFTI LABEL FILE FROM A METRIC FILE</hotpink>

wb_command -metric-label-import


- `<input>` โ€” the input metric file
- `<label-list-file>` โ€” text file containing the values and names for labels
- `<output>` โ€” **output** โ€” the output gifti label file
- `-discard-others` โ€” set any values not mentioned in the label list to the `???` label
- `-unlabeled-value` โ€” set the value that will be interpreted as unlabeled
  - `<value>` โ€” the numeric value for unlabeled (default `0`)
- `-column` โ€” select a single column to import
  - `<column>` โ€” the column number or name
- `-drop-unused-labels` โ€” remove any unused label values from the label table

Creates a gifti label file from a metric file with label-like values. You may specify the empty string (use `""`) for `<label-list-file>`, which will be treated as if it is an empty file. ๐Ÿซง

The label list file must have the following format (2 lines per label):

<labelname> <key> <alpha> ...


Label names are specified on a separate line from their value and color, so that label names can contain spaces. Whitespace is trimmed from both ends of the label name, but is kept if it's in the middle of a label. Do **not** specify the `"unlabeled"` key in the file โ€” it's assumed that `0` means not labeled unless `-unlabeled-value` is specified. The value of `<key>` specifies what value in the imported file should be used as this label (these same key values are also used in the output file). The values of `<red>`, `<green>`, `<blue>` and `<alpha>` must be integers from `0` to `255`, and will specify the color the label is drawn as (alpha of `255` means fully opaque, which is probably what you want). ๐ŸŒˆ

By default, it will create new label names with names like `LABEL_5` for any values encountered that are not mentioned in the list file. Specify `-discard-others` to instead set these values to the `"unlabeled"` key. โœจ

### ๐ŸŽ€ **`-metric-mask`** `MASK A METRIC FILE`

wb_command -metric-mask


- **`<metric>`** โ€” the input metric
- **`<mask>`** โ€” the mask metric
- **`<metric-out>`** โ€” output โ€” the output metric

- **`[-column]`** โ€” select a single column
  - **`<column>`** โ€” the column number or name

okay bestie so by default the output metric is literally just a copy of the input metric, but with zeros <pink>wherever</pink> the mask metric is zero or negative ๐Ÿ’…. And if you pass `-column`, the output only keeps one column โ€” the masked version of the input column you picked. <purple>iconic, lowkey surgical.</purple>

---

### ๐Ÿงฎ **`-metric-math`** `EVALUATE EXPRESSION ON METRIC FILES`

wb_command -metric-math


- **`<expression>`** โ€” the expression to evaluate, in quotes
- **`<metric-out>`** โ€” output โ€” the output metric

- **`[-fixnan]`** โ€” replace NaN results with a value
  - **`<replace>`** โ€” value to replace NaN with

- **`[-var]`** โ€” repeatable โ€” a metric to use as a variable
  - **`<name>`** โ€” the name of the variable, as used in the expression
  - **`<metric>`** โ€” the metric file to use as this variable

- **`[-column]`** โ€” select a single column
  - **`<column>`** โ€” the column number or name

- **`[-repeat]`** โ€” reuse a single column for each column of calculation

This command evaluates `<expression>` at each surface vertex independently, fr fr. There <hotpink>must</hotpink> be at least one `-var` option (that's how it gets the structure, the number of vertices, and the number of columns from), even if the `<name>` you gave it isn't actually used in `<expression>`. All metrics have to have the same number of vertices. <yellow>Filenames are NOT valid inside `<expression>`</yellow> โ€” use a variable name and a `-var` option with a matching `<name>` to point at an input file. If the `-column` option is given to any `-var` option, only one column gets used from that file. If `-repeat` is specified, the file must either have only one column, or have the `-column` option specified. All files that <red>don't</red> use `-repeat` must have the same number of columns requested to be used. The format of `<expression>` is as follows:

Expressions are made of constants, variables, operators, parentheses, and functions, in infix notation, like `'exp(-x + 3) * scale'`. Variables are strings of any length, using the characters `a-z`, `A-Z`, `0-9`, and `_`, but they can't take the name of a named constant. Currently there's only one named constant, `PI`. The operators are `+`, `-`, `*`, `/`, `^`, `>`, `<`, `>=`, `<=`, `==`, `!=`, `!`, `&&`, `||`. These behave as in C, except that `^` is exponentiation, i.e. `pow(x, y)`, and takes higher precedence than other binary operators (also, `'-3^-4^-5'` means `'-(3^(-(4^-5)))'`). The `<=`, `>=`, `==`, and `!=` operators are given a small amount of wiggle room, equal to one millionth of the smaller of the absolute values of the values being compared. โœจ

Comparison and logical operators return `0` or `1`, so you can do masking with expressions like `'x * (mask > 0)'`. For all logical operators, an input is considered true iff it's greater than `0`. The expression `'0 < x < 5'` is not syntactically wrong, but it will <red>NOT</red> do what you want, because it's evaluated left to right, i.e. `'((0 < x) < 5)'`, which will always return `1`, since both possible results of a comparison are less than `5`. A warning gets generated if an expression of this type is detected. Use something like `'x > 0 && x < 5'` to get the behavior you actually want. <purple>learned that the hard way, no cap.</purple>

Whitespace between elements is ignored โ€” `' sin ( 2 * x ) '` is equivalent to `'sin(2*x)'`, but `'s in(2*x)'` is an error. Implied multiplication is not allowed, so the expression `'2x'` gets parsed as a variable. Parentheses are `()`, do <red>not</red> use `[]` or `{}`. Functions require parentheses, so the expression `'sin x'` is an error.

The following functions are supported:

- `sin`: 1 argument, the sine of the argument (units are radians)
- `cos`: 1 argument, the cosine of the argument (units are radians)
- `tan`: 1 argument, the tangent of the argument (units are radians)
- `asin`: 1 argument, the inverse of sine of the argument, in radians
- `acos`: 1 argument, the inverse of cosine of the argument, in radians
- `atan`: 1 argument, the inverse of tangent of the argument, in radians
- `atan2`: 2 arguments, `atan2(y, x)` returns the inverse of tangent of `(y/x)`, in radians, determining quadrant by the sign of both arguments
- `sinh`: 1 argument, the hyperbolic sine of the argument
- `cosh`: 1 argument, the hyperbolic cosine of the argument
- `tanh`: 1 argument, the hyperbolic tangent of the argument
- `asinh`: 1 argument, the inverse hyperbolic sine of the argument
- `acosh`: 1 argument, the inverse hyperbolic cosine of the argument
- `atanh`: 1 argument, the inverse hyperbolic tangent of the argument
- `sinc`: 1 argument, `sinc(0) = 1`, `sin(x) / x` otherwise
- `ln`: 1 argument, the natural logarithm of the argument
- `exp`: 1 argument, the constant `e` raised to the power of the argument
- `log`: 1 argument, the base 10 logarithm of the argument
- `log2`: 1 argument, the base 2 logarithm of the argument
- `sqrt`: 1 argument, the square root of the argument
- `abs`: 1 argument, the absolute value of the argument
- `floor`: 1 argument, the largest integer not greater than the argument
- `round`: 1 argument, the nearest integer, with ties rounded away from zero
- `ceil`: 1 argument, the smallest integer not less than the argument
- `min`: 2 arguments, `min(x, y)` returns `y` if `(x > y)`, `x` otherwise
- `max`: 2 arguments, `max(x, y)` returns `y` if `(x < y)`, `x` otherwise
- `mod`: 2 arguments, `mod(x, y) = x - y * floor(x / y)`, or `0` if `y == 0`
- `clamp`: 3 arguments, `clamp(x, low, high) = min(max(x, low), high)`

---

### ๐Ÿ”— **`-metric-merge`** `MERGE METRIC FILES INTO A NEW FILE`

wb_command -metric-merge


- **`<metric-out>`** โ€” output โ€” the output metric

- **`[-metric]`** โ€” repeatable โ€” specify an input metric
  - **`<metric-in>`** โ€” a metric file to use columns from

- **`[-column]`** โ€” repeatable โ€” select a single column to use
  - **`<column>`** โ€” the column number or name

- **`[-up-to]`** โ€” use an inclusive range of columns
  - **`<last-column>`** โ€” the number or name of the last column to include

- **`[-reverse]`** โ€” use the range in reverse order

Takes one or more metric files and builds a new metric file by concatenating columns from them. The input metric files must have the same number of vertices and the same structure. ๐Ÿ’ซ

Example:

wb_command -metric-merge out.func.gii -metric first.func.gii -column 1 -metric second.func.gii


This example would take the first column from `first.func.gii`, followed by all columns from `second.func.gii`, and write these columns to `out.func.gii`. <mint>clean, efficient, ate.</mint>

---

### ๐ŸŽจ **`-metric-palette`** `SET THE PALETTE OF A METRIC FILE`

wb_command -metric-palette


- **`<metric>`** โ€” the metric to modify
- **`<mode>`** โ€” the mapping mode

- **`[-column]`** โ€” select a single column
  - **`<column>`** โ€” the column number or name

- **`[-pos-percent]`** โ€” percentage min/max for positive data coloring
  - **`<pos-min-%>`** โ€” the percentile for the least positive data
  - **`<pos-max-%>`** โ€” the percentile for the most positive data

- **`[-neg-percent]`** โ€” percentage min/max for negative data coloring
  - **`<neg-min-%>`** โ€” the percentile for the least negative data
  - **`<neg-max-%>`** โ€” the percentile for the most negative data

- **`[-pos-user]`** โ€” user min/max values for positive data coloring
  - **`<pos-min-user>`** โ€” the value for the least positive data
  - **`<pos-max-user>`** โ€” the value for the most positive data

- **`[-neg-user]`** โ€” user min/max values for negative data coloring
  - **`<neg-min-user>`** โ€” the value for the least negative data
  - **`<neg-max-user>`** โ€” the value for the most negative data

- **`[-interpolate]`** โ€” interpolate colors
  - **`<interpolate>`** โ€” boolean, whether to interpolate

- **`[-disp-pos]`** โ€” display positive data
  - **`<display>`** โ€” boolean, whether to display

- **`[-disp-neg]`** โ€” display positive data
  - **`<display>`** โ€” boolean, whether to display

- **`[-disp-zero]`** โ€” display data closer to zero than the min cutoff
  - **`<display>`** โ€” boolean, whether to display

- **`[-palette-name]`** โ€” set the palette used
  - **`<name>`** โ€” the name of the palette

- **`[-thresholding]`** โ€” set the thresholding
  - **`<type>`** โ€” thresholding setting
  - **`<test>`** โ€” show values inside or outside thresholds
  - **`<min>`** โ€” lower threshold
  - **`<max>`** โ€” upper threshold

- **`[-inversion]`** โ€” specify palette inversion
  - **`<type>`** โ€” the type of inversion

The original metric file <red>gets overwritten</red> with the modified version. <yellow>no undo, bestie, be careful.</yellow> By default, all columns of the metric file are adjusted to the new settings โ€” use the `-column` option to change only one column. Mapping settings not specified in options are taken from the first column. The `<mode>` argument must be one of the following:

- `MODE_AUTO_SCALE`
- `MODE_AUTO_SCALE_ABSOLUTE_PERCENTAGE`
- `MODE_AUTO_SCALE_PERCENTAGE`
- `MODE_USER_SCALE`

The `<name>` argument to `-palette-name` must be one of the following:

- `ROY-BIG-BL`
- `videen_style`
- `Gray_Interp_Positive`
- `Gray_Interp`
- `PSYCH-FIXED`
- `RBGYR20`
- `RBGYR20P`
- `RYGBR4_positive`
- `RGRBR_mirror90_pos`
- `Orange-Yellow`
- `POS_NEG_ZERO`
- `red-yellow`
- `blue-lightblue`
- `FSL`
- `power_surf`
- `black-red`
- `black-green`
- `black-blue`
- `black-red-positive`
- `black-green-positive`
- `black-blue-positive`
- `blue-black-green`
- `blue-black-red`
- `red-black-green`
- `fsl_red`
- `fsl_green`
- `fsl_blue`
- `fsl_yellow`
- `RedWhiteBlue`
- `cool-warm`
- `spectral`
- `RY-BC-BL`
- `magma`
- `JET256`
- `PSYCH`
- `PSYCH-NO-NONE`
- `ROY-BIG`
- `clear_brain`
- `fidl`
- `raich4_clrmid`
- `raich6_clrmid`
- `HSB8_clrmid`
- `POS_NEG`
- `Special-RGB-Volume`

The `<type>` argument to `-thresholding` must be one of the following:

- `THRESHOLD_TYPE_OFF`
- `THRESHOLD_TYPE_NORMAL`
- `THRESHOLD_TYPE_FILE`

The `<test>` argument to `-thresholding` must be one of the following:

- `THRESHOLD_TEST_SHOW_OUTSIDE`
- `THRESHOLD_TEST_SHOW_INSIDE`

The `<type>` argument to `-inversion` must be one of the following:

- `OFF`
- `POSITIVE_WITH_NEGATIVE`
- `POSITIVE_NEGATIVE_SEPARATE`

---

### ๐Ÿ“‰ **`-metric-reduce`** `PERFORM REDUCTION OPERATION ACROSS METRIC COLUMNS`

wb_command -metric-reduce


- **`<metric-in>`** โ€” the metric to reduce
- **`<operation>`** โ€” the reduction operator to use
- **`<metric-out>`** โ€” output โ€” the output metric

- **`[-exclude-outliers]`** โ€” exclude non-numeric values and outliers by standard deviation
  - **`<sigma-below>`** โ€” number of standard deviations below the mean to include
  - **`<sigma-above>`** โ€” number of standard deviations above the mean to

- **`-only-numeric`** โ€” <cyan>exclude non-numeric values</cyan>

Okay so picture this, bestie: for every single surface vertex it grabs the data across the columns as a vector, runs whatever reduction you asked for on it, and drops the result into the one output column at that vertex. ๐Ÿซถ The reduction operators include:

- **`MAX`** โ€” the maximum value
- **`MIN`** โ€” the minimum value
- **`INDEXMAX`** โ€” the 1-based index of the maximum value
- **`INDEXMIN`** โ€” the 1-based index of the minimum value
- **`SUM`** โ€” add all values
- **`PRODUCT`** โ€” multiply all values
- **`MEAN`** โ€” the mean of the data
- **`STDEV`** โ€” the standard deviation (N denominator)
- **`SAMPSTDEV`** โ€” the sample standard deviation (N-1 denominator)
- **`VARIANCE`** โ€” the variance of the data
- **`TSNR`** โ€” mean divided by sample standard deviation (N-1 denominator)
- **`COV`** โ€” sample standard deviation (N-1 denominator) divided by mean
- **`L2NORM`** โ€” square root of sum of squares
- **`MEDIAN`** โ€” the median of the data
- **`MODE`** โ€” the mode of the data
- **`COUNT_NONZERO`** โ€” the number of nonzero elements in the data

---

- **`-metric-regression`** โ€” <hotpink>regress spatial map out of a metric file</hotpink> ๐Ÿงš

wb_command -metric-regression <metric-in> - the metric to regress from <metric-out> - output - the output metric [-roi] - only regress inside an roi <roi-metric> - the area to use for regression, as a metric [-column] - select a single column to regress from <column> - the column number or name [-remove] - repeatable - specify a metric to regress out <metric> - the metric file to use [-remove-column] - select a column to use, rather than all <column> - the column number or name [-keep] - repeatable - specify a metric to include in regression, but not remove <metric> - the metric file to use [-keep-column] - select a column to use, rather than all <column> - the column number or name


So here's the tea, bestie ๐Ÿ’… โ€” for each regressor, its mean across the surface gets subtracted from its data. Then every input map gets regressed against those, plus a constant term. And then? The resulting regressed slopes of all the regressors you named with `-remove` get multiplied with their own respective regressor maps, and those get subtracted from the input map. Math girlies stay winning. โœจ

---

- **`-metric-remove-islands`** โ€” <hotpink>remove islands from an ROI metric</hotpink> ๐ŸŒธ

wb_command -metric-remove-islands <surface> - the surface to use for neighbor information <metric-in> - the input ROI metric <metric-out> - output - the output ROI metric [-corrected-areas] - vertex areas to use instead of computing them from the surface <area-metric> - the corrected vertex areas, as a metric


It finds **all** the connected areas in the ROI and zeros out every single one except the biggest โ€” and we're measuring "biggest" in terms of surface area, no cap. ๐Ÿ‘‘

---

- **`-metric-resample`** โ€” <hotpink>resample a metric file to a different mesh</hotpink> ๐Ÿฆ‹

wb_command -metric-resample <metric-in> - the metric file to resample <current-sphere> - a sphere surface with the mesh that the metric is currently on <new-sphere> - a sphere surface that is in register with <current-sphere> and has the desired output mesh <method> - the method name <metric-out> - output - the output metric [-area-surfs] - specify surfaces to do vertex area correction based on <current-area> - a relevant anatomical surface with <current-sphere> mesh <new-area> - a relevant anatomical surface with <new-sphere> mesh [-area-metrics] - specify vertex area metrics to do area correction based on <current-area> - a metric file with vertex areas for <current-sphere> mesh <new-area> - a metric file with vertex areas for <new-sphere> mesh [-current-roi] - use an input roi on the current mesh to exclude non-data vertices <roi-metric> - the roi, as a metric file [-valid-roi-out] - output the ROI of vertices that got data from valid source vertices <roi-out> - output - the output roi as a metric [-largest] - use only the value of the vertex with the largest weight [-bypass-sphere-check] - ADVANCED: allow the current and new 'spheres' to have arbitrary shape as long as they follow the same contour


This one resamples a metric file, given two spherical surfaces that are in register. And listen โ€” if you're using `ADAP_BARY_AREA`, then <yellow>exactly one</yellow> of `-area-surfs` or `-area-metrics` must be specified. Not zero, not both. One. ๐Ÿ˜ค

`ADAP_BARY_AREA` is the method I'm recommending for ordinary metric data, because it should use all the data while downsampling, unlike `BARYCENTRIC`. And the areas option that's giving for most data? Individual midthicknesses for individual data, and averaged vertex area metrics from individual midthicknesses for group average data. ๐ŸŒˆ

Heads up though: the `-current-roi` option <red>only masks the input</red>, so the output may be slightly dilated in comparison. Consider using `-metric-mask` on the output when you're using `-current-roi`. ๐Ÿ’€

The `-largest` option gives you nearest vertex behavior when it's used with `BARYCENTRIC`. And when you're resampling a binary metric, consider thresholding at `0.5` after resampling rather than reaching for `-largest`. โœจ

The `<method>` argument must be one of the following:

- **`ADAP_BARY_AREA`**
- **`BARYCENTRIC`**

---

- **`-metric-rois-from-extrema`** โ€” <hotpink>create metric ROI maps from extrema maps</hotpink> ๐ŸŽ€

wb_command -metric-rois-from-extrema <surface> - the surface to use for geodesic distance <metric> - the input metric file <limit> - geodesic distance limit from vertex, in mm <metric-out> - output - the output metric file [-gaussian] - generate a gaussian kernel instead of a flat ROI <sigma> - the sigma for the gaussian kernel, in mm [-roi] - select a region of interest to use <roi-metric> - the area to use, as a metric [-overlap-logic] - how to handle overlapping ROIs, default ALLOW <method> - the method of resolving overlaps [-column] - select a single input column to use <column> - the column number or name


For every nonzero value in every map, it makes a map with an ROI around that location. And if you threw in the `-gaussian` option, then normalized gaussian kernels get output instead of ROIs. ๐Ÿงš

The `<method>` argument to `-overlap-logic` must be one of `ALLOW`, `CLOSEST`, or `EXCLUDE`. Let me break that down:

- **`ALLOW`** โ€” the default, and it means ROIs are treated independently and may overlap
- **`CLOSEST`** โ€” ROIs may not overlap, and no ROI contains vertices that are closer to a different seed vertex
- **`EXCLUDE`** โ€” ROIs may not overlap, and any vertex within range of more than one ROI does not belong to any ROI

---

- **`-metric-rois-to-border`** โ€” <hotpink>draw borders around metric ROIs</hotpink> ๐Ÿ’œ

wb_command -metric-rois-to-border <surface> - the surface to use for neighbor information <metric> - the input metric containing ROIs <class-name> - the name to use for the class of the output borders <border-out> - output - the output border file [-placement] - set how far along the edge border points are drawn <fraction> - fraction along edge from inside vertex (default 0.33) [-column] - select a single column <column> - the column number or name


For each ROI column it finds every edge on the mesh that crosses the boundary of the ROI, and draws borders through them. By default this happens on <purple>all</purple> columns in the input file, using the map name as the name for the border. ๐Ÿฆ‹

---

- **`-metric-smoothing`** โ€” <hotpink>smooth a metric file</hotpink> โญ

wb_command -metric-smoothing <surface> - the surface to smooth on <metric-in> - the metric to smooth <smoothing-kernel> - the size of the gaussian smoothing kernel in mm, as sigma by default <metric-out> - output - the output metric [-fwhm] - kernel size is FWHM, not sigma [-roi] - select a region of interest to smooth <roi-metric> - the roi to smooth within, as a metric [-match-columns] - for each input column, use the corresponding column from the roi [-fix-zeros] - treat zero values as not being data [-column] - select a single column to smooth <column> - the column number or name [-corrected-areas] - vertex areas to use instead of computing them from the surface <area-metric> - the corrected vertex areas, as a metric [-method] - select smoothing method, default GEO_GAUSS_AREA <method> - the name of the smoothing method


Okay so it smooths a metric file on a surface. By default it smooths <rainbow>all</rainbow> the input columns on the entire surface โ€” but you can specify `-column` to use only one input column, and `-roi` to smooth only where the roi metric is greater than `0`, outputting zeros everywhere else. ๐Ÿซถ

When you're using `-roi`, input data outside the ROI is **not** used to compute the smoothed values. By default, the first column of the roi metric is used for all input columns. And when `-match-columns` is specified to the `-roi` option, the input and roi metrics must have the same number of columns, and for each input column's index, the same column index is used in the roi metric. If the `-match-columns` option to `-roi` is used while the `-column` option is also used, the number of columns must match between the roi and input metric, and it will use the roi column with the index of the selected input column. ๐Ÿ˜Œ

The `-fix-zeros` option makes the smoothing not use an input value if it's zero, but still write a smoothed value to the vertex. This is useful for zeros that indicate lack of information โ€” it keeps them from pulling down the intensity of nearby vertices, while giving the zero an extrapolated value. Obsessed with a zero that knows its worth. ๐Ÿ’–

The `-corrected-areas` option is intended for when it's <red>unavoidable</red> to smooth on a group average surface. It's only an approximate correction for the reduction of structure in a group average surface. It's better to smooth the data on individuals before averaging, when feasible. fr fr. ๐Ÿ™ˆ

Valid values for `<method>` are:

- **`GEO_GAUSS_AREA`** โ€” uses a geodesic gaussian kernel, and normalizes based on vertex area in order to work more reliably on irregular surfaces
- **`GEO_GAUSS_EQUAL`** โ€” uses a geodesic gaussian kernel, and normalizes assuming each vertex has equal importance

- <pink>**`GEO_GAUSS`**</pink> โ€” matches geodesic gaussian smoothing from caret5, but does not check kernels for having unequal importance

<purple>The `GEO_GAUSS_AREA` method is the default</purple> because it is usually the correct choice. <mint>`GEO_GAUSS_EQUAL`</mint> may be the correct choice when the sum of vertex values is more meaningful then the surface integral (sum of values .* areas), for instance when smoothing vertex areas (the sum is the total surface area, while the surface integral is the sum of squares of the vertex areas). The <red>`GEO_GAUSS`</red> method is not recommended, it exists mainly to replicate methods of studies done with caret5's geodesic smoothing. It's giving legacy energy, ngl.

---

## <rainbow>โœจ `-metric-stats` โ€” SPATIAL STATISTICS ON A METRIC FILE โœจ</rainbow>

wb_command -metric-stats


- <pink>**`<metric-in>`**</pink> โ€” the input metric

- <pink>**`[-reduce]`**</pink> โ€” use a reduction operation
  - `<operation>` โ€” the reduction operation

- <pink>**`[-percentile]`**</pink> โ€” give the value at a percentile
  - `<percent>` โ€” the percentile to find, must be between 0 and 100

- <pink>**`[-column]`**</pink> โ€” only display output for one column
  - `<column>` โ€” the column number or name

- <pink>**`[-roi]`**</pink> โ€” only consider data inside an roi
  - `<roi-metric>` โ€” the roi, as a metric file

- <pink>**`[-match-maps]`**</pink> โ€” each column of input uses the corresponding column from the roi file

- <pink>**`[-show-map-name]`**</pink> โ€” print map index and name before each output

<purple>Okay bestie, for each column of the input, a line of text is printed</purple>, resulting from the specified reduction or percentile operation. Use `-column` to only give output for a single column. If the `-roi` option is used without `-match-maps`, then each line will contain as many numbers as there are maps in the ROI file, separated by tab characters. <yellow>Exactly one of `-reduce` or `-percentile` must be specified.</yellow> Periodt.

The argument to the `-reduce` option must be one of the following:

- <mint>**`MAX`**</mint> โ€” the maximum value
- <mint>**`MIN`**</mint> โ€” the minimum value
- <mint>**`INDEXMAX`**</mint> โ€” the 1-based index of the maximum value
- <mint>**`INDEXMIN`**</mint> โ€” the 1-based index of the minimum value
- <mint>**`SUM`**</mint> โ€” add all values
- <mint>**`PRODUCT`**</mint> โ€” multiply all values
- <mint>**`MEAN`**</mint> โ€” the mean of the data
- <mint>**`STDEV`**</mint> โ€” the standard deviation (N denominator)
- <mint>**`SAMPSTDEV`**</mint> โ€” the sample standard deviation (N-1 denominator)
- <mint>**`VARIANCE`**</mint> โ€” the variance of the data
- <mint>**`TSNR`**</mint> โ€” mean divided by sample standard deviation (N-1 denominator)
- <mint>**`COV`**</mint> โ€” sample standard deviation (N-1 denominator) divided by mean
- <mint>**`L2NORM`**</mint> โ€” square root of sum of squares
- <mint>**`MEDIAN`**</mint> โ€” the median of the data
- <mint>**`MODE`**</mint> โ€” the mode of the data
- <mint>**`COUNT_NONZERO`**</mint> โ€” the number of nonzero elements in the data

---

## <rainbow>โœจ `-metric-tfce` โ€” DO TFCE ON A METRIC FILE โœจ</rainbow>

wb_command -metric-tfce


- <pink>**`<surface>`**</pink> โ€” the surface to compute on
- <pink>**`<metric-in>`**</pink> โ€” the metric to run TFCE on
- <pink>**`<metric-out>`**</pink> โ€” output โ€” the output metric

- <pink>**`[-presmooth]`**</pink> โ€” smooth the metric before running TFCE
  - `<kernel>` โ€” the size of the gaussian smoothing kernel in mm, as sigma by default

- <pink>**`[-fwhm]`**</pink> โ€” kernel size is FWHM, not sigma

- <pink>**`[-roi]`**</pink> โ€” select a region of interest to run TFCE on
  - `<roi-metric>` โ€” the area to run TFCE on, as a metric

- <pink>**`[-parameters]`**</pink> โ€” set parameters for TFCE integral
  - `<E>` โ€” exponent for cluster area (default 1.0)
  - `<H>` โ€” exponent for threshold value (default 2.0)

- <pink>**`[-column]`**</pink> โ€” select a single column
  - `<column>` โ€” the column number or name

- <pink>**`[-corrected-areas]`**</pink> โ€” vertex areas to use instead of computing them from the surface
  - `<area-metric>` โ€” the corrected vertex areas, as a metric

> <red>โš ๏ธ This command does not do any statistical analysis.</red> Please use something like PALM if you are just trying to do statistics on your data. Not me telling you to use PALM, but like, actually.

Threshold-free cluster enhancement is a method to increase the relative value of regions that would form clusters in a standard thresholding test. This is accomplished by evaluating the integral of:

e(h, p)^E * h^H * dh


at each vertex `p`, where `h` ranges from 0 to the maximum value in the data, and `e(h, p)` is the extent of the cluster containing vertex `p` at threshold `h`. Negative values are similarly enhanced by negating the data, running the same process, and negating the result.

When using `-presmooth` with `-corrected-areas`, note that it is an approximate correction within the smoothing algorithm (the TFCE correction is exact). Doing smoothing on individual surfaces before averaging/TFCE is preferred, when possible, in order to better tie the smoothing kernel size to the original feature size.

The TFCE method is explained in: Smith SM, Nichols TE., "Threshold-free cluster enhancement: addressing problems of smoothing, threshold dependence and localisation in cluster inference." Neuroimage. 2009 Jan 1;44(1):83-98. PMID: 18501637

---

## <rainbow>โœจ `-metric-to-volume-mapping` โ€” MAP METRIC FILE TO VOLUME โœจ</rainbow>

wb_command -metric-to-volume-mapping


- <pink>**`<metric>`**</pink> โ€” the input metric file
- <pink>**`<surface>`**</pink> โ€” the surface to use coordinates from
- <pink>**`<volume-space>`**</pink> โ€” a volume file in the desired output volume space
- <pink>**`<volume-out>`**</pink> โ€” output โ€” the output volume file

- <pink>**`[-nearest-vertex]`**</pink> โ€” use the value from the vertex closest to the voxel center
  - `<distance>` โ€” how far from the surface to map values to voxels, in mm

- <pink>**`[-ribbon-constrained]`**</pink> โ€” use ribbon constrained mapping algorithm
  - `<inner-surf>` โ€” the inner surface of the ribbon
  - `<outer-surf>` โ€” the outer surface of the ribbon

- <pink>**`[-voxel-subdiv]`**</pink> โ€” voxel divisions while estimating voxel weights
  - `<subdiv-num>` โ€” number of subdivisions, default 3

- <pink>**`[-greedy]`**</pink> โ€” instead of antialiasing partial-volumed voxels, put full metric values (legacy behavior)

- <pink>**`[-thick-columns]`**</pink> โ€” use overlapping columns (legacy method)

Maps values from a metric file into a volume file. <yellow>You must specify exactly one mapping method option.</yellow> No cap. The `-nearest-vertex` method uses the value from the vertex closest to the voxel center (useful for integer values). The `-ribbon-constrained` method uses the same method as in `-volume-to-surface-mapping`, then uses the weights in reverse. Mapping to lower resolutions than the mesh may require a larger `-voxel-subdiv` value in order to have all of the surface data participate.

---

## <rainbow>โœจ `-metric-vector-operation` โ€” DO A VECTOR OPERATION ON METRIC FILES โœจ</rainbow>

wb_command -metric-vector-operation


- <pink>**`<vectors-a>`**</pink> โ€” first vector input file
- <pink>**`<vectors-b>`**</pink> โ€” second vector input file
- <pink>**`<operation>`**</pink> โ€” what vector operation to do
- <pink>**`<metric-out>`**</pink> โ€” output โ€” the output file

- <pink>**`[-normalize-a]`**</pink> โ€” normalize vectors of first input

- <pink>**`[-normalize-b]`**</pink> โ€” normalize vectors of second input

- <pink>**`[-normalize-output]`**</pink> โ€” normalize output vectors (not valid for dot product)

- <pink>**`[-magnitude]`**</pink> โ€” output the magnitude of the result (not valid for dot product)

Does a vector operation on two metric files (that must have a multiple of 3 columns). Either of the inputs may have multiple vectors (more than 3 columns), but not both (at least one must have exactly 3 columns). The `-magnitude` and `-normalize-output` options may not be specified together, or with an operation that returns a scalar (dot product). It's giving boundaries, bestie. The `<operation>` parameter must be one of the following:

- `DOT`
- `CROSS`
- `ADD`
- `SUBTRACT`

---

## <rainbow>โœจ `-metric-vector-toward-roi` โ€” FIND IF VECTORS POINT TOWARD AN ROI โœจ</rainbow>

wb_command -metric-vector-toward-roi


- <pink>**`<surface>`**</pink> โ€” the surface to compute on
- <pink>**`<target-roi>`**</pink> โ€” the roi to find the shortest path to
- <pink>**`<metric-out>`**</pink> โ€” output โ€” the output metric

- <pink>**`[-roi]`**</pink> โ€” don't compute for vertices outside an roi
  - `<roi-metric>` โ€” the region to compute inside, as a metric

At each vertex, compute the vector along the start of the shortest path to the ROI.

---

## <rainbow>โœจ `-metric-weighted-stats` โ€” WEIGHTED SPATIAL STATISTICS ON A METRIC FILE โœจ</rainbow>

wb_command -metric-weighted-stats


- <pink>**`<metric-in>`**</pink> โ€” the input metric

- <pink>**`[-area-surface]`**</pink> โ€” use vertex areas as weights
  - `<area-surface>` โ€” the surface to use for vertex areas

- <pink>**`[-weight-metric]`**</pink> โ€” use weights from a metric file
  - `<weight-metric>` โ€” metric file containing the weights

- <pink>**`[-column]`**</pink> โ€” only display output for one column
  - `<column>` โ€” the column number or name

- <pink>**`[-roi]`**</pink> โ€” only consider data inside an roi
  - `<roi-metric>` โ€” the roi, as a metric file

- <pink>**`[-match-maps]`**</pink> โ€” each column of input uses the corresponding column from the roi file

- <pink>**`[-mean]`**</pink> โ€” compute weighted mean

- <pink>**`[-stdev]`**</pink> โ€” compute weighted standard deviation

- <pink>**`[-sample]`**</pink> โ€” estimate population stdev from the sample

- <pink>**`[-percentile]`**</pink> โ€” compute weighted percentile
  - `<percent>` โ€” the percentile to find, must be between 0 and 100

- <pink>**`[-sum]`**</pink> โ€” compute weighted sum

- <pink>**`[-show-map-name]`**</pink> โ€” print map index and name before each output

For each column of the input, a line of text is printed, resulting from the specified operation. <yellow>You must specify exactly one of `-area-surface` or `-weight-metric`.</yellow> Choose wisely, queen. Use `-column` to only give output for a single column. If the `-roi` option is used without `-match-maps`, then each line will contain as many numbers as there are maps in the ROI file, separated by tab characters. <yellow>Exactly one of `-mean`, `-stdev`, `-percentile` or `-sum` must be specified.</yellow>

Using `-sum` with `-area-surface` (or `-weight-metric` with a metric containing similar data) is equivalent to integrating with respect to surface area. For example, if you want to find the surface area within an roi, do this:

$ wb_command -metric-weighted-stats roi.func.gii -sum -area-surface midthickness.surf.gii


---

## <rainbow>โœจ `-nifti-information` โ€” DISPLAY INFORMATION ABOUT A NIFTI/CIFTI FILE โœจ</rainbow>

wb_command -nifti-information


- <pink>**`<nifti-file>`**</pink> โ€” the nifti/cifti file to examine

- <pink>**`[-print-header]`**</pink> โ€” display the header contents

- <pink>**`[-allow-truncated]`**</pink> โ€” print the header even if the data is truncated

- <pink>**`[-print-matrix]`**</pink> โ€” output the values in the matrix (cifti only)

- <pink>**`[-print-xml]`**</pink> โ€” print the cifti XML (cifti only)

- <pink>**`[-version]`**</pink> โ€” convert the XML to a specific CIFTI version (default is the file's cifti version)
  - `<version>` โ€” the CIFTI version to use

<yellow>You must specify at least one `-print-*` option.</yellow>

- <pink>**`-probtrackx-dot-convert`**</pink> โ€” bestie, this one takes a `.dot` file from `probtrackx` and turns it into a CIFTI file. it's giving โœจconversion eraโœจ

wb_command -probtrackx-dot-convert


- `<dot-file>` โ€” the input `.dot` file ๐Ÿ’œ
- `<cifti-out>` โ€” output โ€” the output cifti file ๐ŸŽ€

- <cyan>**`-row-voxels`**</cyan> โ€” the output mapping along a **row** is gonna be voxels
  - `<voxel-list-file>` โ€” a text file holding the IJK indices for the voxels used
  - `<label-vol>` โ€” a label volume with the dimensions and sform used, with structure labels
- <cyan>**`-row-surface`**</cyan> โ€” the output mapping along a **row** is gonna be surface vertices
  - `<roi-metric>` โ€” a metric file with positive values on all vertices used
- <cyan>**`-row-cifti`**</cyan> โ€” take the mapping along a **row** from a cifti file
  - `<cifti>` โ€” the cifti file to take the mapping from
  - `<direction>` โ€” which dimension to take the mapping along, `ROW` or `COLUMN`
- <cyan>**`-col-voxels`**</cyan> โ€” the output mapping along a **column** is gonna be voxels
  - `<voxel-list-file>` โ€” a text file holding the IJK indices for the voxels used
  - `<label-vol>` โ€” a label volume with the dimensions and sform used, with structure labels
- <cyan>**`-col-surface`**</cyan> โ€” the output mapping along a **column** is gonna be surface vertices
  - `<roi-metric>` โ€” a metric file with positive values on all vertices used
- <cyan>**`-col-cifti`**</cyan> โ€” take the mapping along a **column** from a cifti file
  - `<cifti>` โ€” the cifti file to take the mapping from
  - `<direction>` โ€” which dimension to take the mapping along, `ROW` or `COLUMN`
- <cyan>**`-transpose`**</cyan> โ€” transpose the input matrix ๐Ÿ”„
- <cyan>**`-make-symmetric`**</cyan> โ€” transform half-square input into full matrix output

> โš ๏ธ no cap: **exactly one `-row` option and one `-col` option must be used.** that's the vibe check, and you will not pass it any other way.

<lavender>okay so if the input file doesn't have its indexes sorted in the correct ordering, this command may take **longer than expected** ๐Ÿ˜ญ</lavender> and specifying `-transpose` will transpose the input matrix before it tries to put its values into the cifti file โ€” which is currently needed for at least `matrix2` in order to display it as intended. how the cifti file is displayed is based on which `-row` option you specified: if `-row-voxels` is specified, then it will display data on volume slices. ๐Ÿงš

<peach>the label names in the label volume(s) **must** have the following names, other names are ignored:</peach>

CORTEX_LEFT CORTEX_RIGHT CEREBELLUM ACCUMBENS_LEFT ACCUMBENS_RIGHT ALL_GREY_MATTER ALL_WHITE_MATTER AMYGDALA_LEFT AMYGDALA_RIGHT BRAIN_STEM CAUDATE_LEFT CAUDATE_RIGHT CEREBELLAR_WHITE_MATTER_LEFT CEREBELLAR_WHITE_MATTER_RIGHT CEREBELLUM_LEFT CEREBELLUM_RIGHT CEREBRAL_WHITE_MATTER_LEFT CEREBRAL_WHITE_MATTER_RIGHT CORTEX DIENCEPHALON_VENTRAL_LEFT DIENCEPHALON_VENTRAL_RIGHT HIPPOCAMPUS_LEFT HIPPOCAMPUS_RIGHT INVALID OTHER OTHER_GREY_MATTER OTHER_WHITE_MATTER PALLIDUM_LEFT PALLIDUM_RIGHT PUTAMEN_LEFT PUTAMEN_RIGHT THALAMUS_LEFT THALAMUS_RIGHT


---

- <pink>**`-scene-capture-image`**</pink> โ€” offscreen rendering of a scene straight to an image file ๐Ÿ–ผ๏ธโœจ

wb_command -scene-capture-image


- `<scene-file>` โ€” scene file
- `<scene-name-or-number>` โ€” name or number (starting at one) of the scene in the scene file
- `<image-file-name>` โ€” output โ€” image file name

<cyan>the file name must end with a valid extension that identifies the image file format.</cyan> valid extensions on this system are: (`.bmp` `.jpeg` `.jpg` `.png` `.ppm`). ๐ŸŽ€

<lavender>if there's more than one window in the scene, multiple image files are output, with the window's number inserted into the name of the image file immediately before the image file's extension.</lavender> multi-window moment fr fr ๐Ÿฆ‹

- **`-size-window`** โ€” output image is size of window's graphics region from when scene was created
- **`-size-capture`** โ€” output image uses size from Capture Dialog when scene was created
- **`-size-width-height`** โ€” width and height for output image
  - `<width>` โ€” width for output image
  - `<height>` โ€” height for output image
- **`-size-width`** โ€” width for output image. height is computed using the aspect ratio from the window's width and height saved in the scene.
  - `<width>` โ€” width for output image
- **`-size-height`** โ€” height for output image. width is computed using the aspect ratio from the window's width and height saved in the scene.
  - `<height>` โ€” height for output image
- **`-units`** โ€” units for image width/height. default is `PIXELS`
  - `<units>` โ€” name of units for image width/height. valid units are: `INCHES` `CENTIMETERS` `MILLIMETERS` `METERS` `PIXELS`
- **`-resolution`** โ€” image resolution (number pixels per size unit). default is `300 PIXELS_PER_INCH`
  - `<Number of pixels>` โ€” number of pixels
  - `<Units Name>` โ€” name of resolution units. valid resolution unit names are: `PIXELS_PER_INCH` `PIXELS_PER_CENTIMETER` `PIXELS_PER_METER` `PIXELS_PER_MILLIMETER`
- **`-margin`** โ€” add a margin to sides of the image using the window's background color.
  - `<size>` โ€” size of margin, in pixels, added to all sides of output image
- **`-no-scene-colors`** โ€” do not use background and foreground colors in scene
- **`-set-map-yoke`** โ€” override selected map index for a map yoking group. ๐Ÿ‘‘
  - `<map yoking roman numeral>` โ€” roman numeral identifying the map yoking group (`I`, `II`, `III`, `IV`, `V`, `VI`, `VII`, `VIII`, `IX`, `X`)
  - `<map undex>` โ€” map index for yoking group. indices start at 1 (one)
- **`-conn-db-login`** โ€” login for scenes with files in Connectome Database. if this option is not specified, the login and password stored in the user's preferences is used.
  - `<username>` โ€” Connectome DB Username
  - `<password>` โ€” Connectome DB Password
- **`-show-capture-settings`** โ€” print settings from Capture Dialog only, **DO NOT** create image file(s) ๐Ÿ™ˆ
- **`-renderer`** โ€” select renderer for drawing image
  - `<Renderer>` โ€” name of renderer to use for drawing image. available renderers are (first is default): `OSMesa` - Mesa3D OSMesa software renderer
- **`-print-image-info`** โ€” print the size and other information about output images only and **DO NOT** create any output images ๐Ÿ’…

---

<hotpink>render content of browser windows displayed in a scene into image file(s).</hotpink> ๐Ÿ–ผ๏ธ

if none of the `-size` options are specified, the default is `-size-window` (output image is size of the window that was saved in the scene).

for the `-size` options that accept a width and/or height, the values default to number of pixels. to express the width and/or height in physical units (inches, centimeters, etc.), use the `-units` option. when physical units are used, the pixel width and height are derived using the physical width/height and the image resolution (see the `-resolution` option). ๐Ÿ“

> โš ๏ธ note that scenes created prior to version **1.2 (May 2016)** do **not** contain information about the size of the window. therefore, one **must** use the `-size-width-height` option. iykyk ๐Ÿ˜ญ

<mint>examples:</mint>

generate an image of the second scene. width and height of image is width and height of window saved in the scene.

wb_command -scene-capture-image myscene.scene 2 image2.jpg


generate an image of the second scene with a margin around sides of the image. width and height of image is width and height of window saved in the scene.

wb_command -scene-capture-image myscene.scene 2 image2.jpg -margin 10


generate an image of the second scene that is 6 inches width with 300 pixels per inch. the resulting width is 1800 pixels. the resulting height of the image is a function of the width and the aspect ratio (height divided by width) of the window size saved in the scene.

wb_command -scene-capture-image myscene.scene 2 image21.jpg \ -size-width 6 -units INCHES -resolution 300 PIXELS_PER_INCH


print information about the size of the output image for the second scene (no image file is created) using a width of 4.5 centimeters.

wb_command -scene-capture-image myscene.scene 2 test.jpg \ -size-width 4.5 -units CENTIMETERS -print-image-info


---

- <pink>**`-scene-file-merge`**</pink> โ€” rearrange scenes into a brand new file ๐ŸŒˆโœจ

wb_command -scene-file-merge


- `<scene-file-out>` โ€” output โ€” the output scene file
- **`-scene-file`** โ€” repeatable โ€” specify a scene file to use scenes from
  - `<scene-file>` โ€” the input scene file
- **`-scene`** โ€” repeatable โ€” specify a scene to use
  - `<scene>` โ€” the scene number or name
- **`-up-to`** โ€” use an inclusive range of scenes
  - `<last-column>` โ€” the number or name of the last scene to include
- **`-reverse`** โ€” use the range in reverse order ๐Ÿ”„

<lavender>takes one or more scene files and constructs a new scene file by concatenating specified scenes from them.</lavender>

<mint>example:</mint>

wb_command -scene-file-merge out.scene -scene-file first.scene -scene 1 -scene-file second.scene


this example would take the first scene from `first.scene`, followed by **all** scenes from `second.scene`, and write these scenes to `out.scene`. ๐Ÿซถ

---

- <pink>**`-scene-file-relocate`**</pink> โ€” recreate a scene file in a new location ๐Ÿงš

wb_command -scene-file-relocate


- `<input-scene>` โ€” the scene file to use
- `<output-scene>` โ€” output โ€” the new scene file to create

<peach>scene files contain internal relative paths, such that moving or copying a scene file will cause it to lose track of the files it refers to. ๐Ÿ˜ญ</peach> this command makes a modified copy of the scene file, changing the relative paths to refer to the new relative locations of the files. slay ๐Ÿ’…

---

- <pink>**`-scene-file-update`**</pink> โ€” update scene file โญ

wb_command -scene-file-update


- `<input-scene-file>` โ€” the input scene file
- `<output-scene-file>` โ€” the new scene file to create
- `<scene-name-or-number>` โ€” name or number (starting at one) of the scene in the scene file

- **`-fix-map-palette-settings`** โ€” fix palette settings for files with change in number of maps ๐ŸŽจ
- **`-remove-missing-files`** โ€” remove missing files from SpecFile
- **`-error`** โ€” abort command if there is an error performing any of the operations on the scene file
- **`-verbose`** โ€” print names of files that have palettes updated

- **`-copy-map-one-palette`** โ€” repeatable โ€” copy the palette settings from the first map to all maps in a data file.

`<Data File Name Suffix>` โ€” name of the palette mapped data file (`cifti`, `metric`, `volume`).

- **`-data-file-add`** โ€” repeatable โ€” add a data file to the scene's loaded files.

`<Name of data file>` โ€” name of data file. If a data file isn't in the current directory, bestie, it is <hotpink>best</hotpink> to use an absolute path (a relative path <yellow>may</yellow> work). Instead of a data file, this value may be the name of a text file (must end in `.txt`) that contains the names of one or more data files, one per line.

Example on UNIX to create a text file containing all CIFTI scalar files in the current directory with absolute paths:

ls -d $PWD/*dscalar.nii > file.txt


- **`-data-file-remove`** โ€” repeatable โ€” remove a data file from the scene's loaded files.

  `<Name of data file>` โ€” name of data file. If a data file isn't in the current directory, it is <hotpink>best</hotpink> to use an absolute path (a relative path <yellow>may</yellow> work). Instead of a data file, this value may be the name of a text file (must end in `.txt`) that contains the names of one or more data files, one per line.

  Example on UNIX to create a text file containing all CIFTI scalar files in the current directory with absolute paths:

ls -d $PWD/*dscalar.nii > file.txt


---

<cyan>Okay so this command will update a scene for specific changes in data files, and honestly it's giving "glow up your scene file" energy.</cyan> ๐Ÿ’…

- **`-fix-map-palette-settings`** will find all data files that have had a change in the number of maps since the scene was created. If the file has its "Apply to All Maps" property enabled, the palette setting in the first map is copied to all maps in the file. <red>Note:</red> this modifies the palette settings for the file in the scene (the data file is <bold>NOT</bold> modified).

- **`-copy-map-one-palette`** will copy the palette settings from the first map to all other maps in a data file. This option is typically used when the number of maps in a data file changes. It changes the palette settings in the scene that are applied to the data file when the scene is loaded (the data file is not modified). The name of the data file specified on the command line is matched to the end of file names in the scene. This allows matching multiple files if their names end with the same characters. It also allows including a relative path when there is more than one file with the same name but in different paths, and only one of the files is to be updated. <pink>iykyk</pink> โœจ

- **`-remove-missing-files`** โ€” any files that fail to load when the scene is read will be removed from the scene. So if you delete files prior to running with this option, the deleted files get removed from the scene too. bye bestie ๐Ÿ‘‹

- **`-error`** โ€” if this option is provided and there is an error while performing any of the scene operations, the command will <red>immediately cease processing</red> and the output scene file will <red>not</red> be created. Otherwise any errors will be listed after the command finishes.

---

## ๐ŸŒธ -set-map-names โ€” SET THE NAME OF ONE OR MORE MAPS IN A FILE ๐ŸŒธ

wb_command -set-map-names


- `<data-file>` โ€” the file to set the map names of
- **`-name-file`** โ€” use a text file to replace all map names
  - `<file>` โ€” text file containing map names, one per line
- **`-from-data-file`** โ€” use the map names from another data file
  - `<file>` โ€” a data file with the same number of maps
- **`-map`** โ€” repeatable โ€” specify a map to set the name of
  - `<index>` โ€” the map index to change the name of
  - `<new-name>` โ€” the name to set for the map

Sets the name of one or more maps for `metric`, `shape`, `label`, `volume`, `cifti scalar` or `cifti label` files. You <hotpink>must</hotpink> specify either `-name-file`, or `-from-data-file`, or at least one `-map` option. The three option types are <purple>mutually exclusive</purple> โ€” pick one lane, bestie. ๐ŸŽ€

---

## ๐Ÿฆ‹ -set-structure โ€” SET STRUCTURE OF A DATA FILE ๐Ÿฆ‹

wb_command -set-structure


- `<data-file>` โ€” the file to set the structure of
- `<structure>` โ€” the structure to set the file to
- **`-surface-type`** โ€” set the type of a surface (only used if the file is a surface file)
  - `<type>` โ€” name of surface type
- **`-surface-secondary-type`** โ€” set the secondary type of a surface (only used if the file is a surface file)
  - `<secondary type>` โ€” name of surface secondary type

The existing file is modified and rewritten to the same filename. Valid values for the structure name are:

`CORTEX_LEFT` `CORTEX_RIGHT` `CEREBELLUM` `ACCUMBENS_LEFT` `ACCUMBENS_RIGHT` `ALL_GREY_MATTER` `ALL_WHITE_MATTER` `AMYGDALA_LEFT` `AMYGDALA_RIGHT` `BRAIN_STEM` `CAUDATE_LEFT` `CAUDATE_RIGHT` `CEREBELLAR_WHITE_MATTER_LEFT` `CEREBELLAR_WHITE_MATTER_RIGHT` `CEREBELLUM_LEFT` `CEREBELLUM_RIGHT` `CEREBRAL_WHITE_MATTER_LEFT` `CEREBRAL_WHITE_MATTER_RIGHT` `CORTEX` `DIENCEPHALON_VENTRAL_LEFT` `DIENCEPHALON_VENTRAL_RIGHT` `HIPPOCAMPUS_LEFT` `HIPPOCAMPUS_RIGHT` `INVALID` `OTHER` `OTHER_GREY_MATTER` `OTHER_WHITE_MATTER` `PALLIDUM_LEFT` `PALLIDUM_RIGHT` `PUTAMEN_LEFT` `PUTAMEN_RIGHT` `THALAMUS_LEFT` `THALAMUS_RIGHT`

Valid names for the surface type are:

`UNKNOWN` `RECONSTRUCTION` `ANATOMICAL` `INFLATED` `VERY_INFLATED` `SPHERICAL` `SEMI_SPHERICAL` `ELLIPSOID` `FLAT` `HULL`

Valid names for the surface secondary type are:

`INVALID` `GRAY_WHITE` `MIDTHICKNESS` `PIAL`

---

## ๐Ÿ’– -signed-distance-to-surface โ€” COMPUTE SIGNED DISTANCE FROM ONE SURFACE TO ANOTHER ๐Ÿ’–

wb_command -signed-distance-to-surface


- `<surface-comp>` โ€” the comparison surface to measure the signed distance on
- `<surface-ref>` โ€” the reference surface that defines the signed distance function
- `<metric>` โ€” output โ€” the output metric
- **`-winding`** โ€” winding method for point inside surface test
  - `<method>` โ€” name of the method (default `EVEN_ODD`)

Compute the signed distance function of the reference surface at every vertex on the comparison surface. <red>NOTE:</red> this relation is <bold>NOT</bold> symmetric โ€” the line from a vertex to the closest point on the `'ref'` surface (the one that defines the signed distance function) will only align with the normal of the `'ref'` surface. Valid specifiers for winding methods are as follows:

`EVEN_ODD` (default) `NEGATIVE` `NONZERO` `NORMALS`

The `NORMALS` method uses the normals of triangles and edges, or the closest triangle hit by a ray from the point. This method may be slightly faster, but is only reliable for a closed surface that does not cross through itself. All other methods count entry (positive) and exit (negative) crossings of a vertical ray from the point, then counts as inside if the total is odd, negative, or nonzero, respectively. <lavender>math queen things</lavender> ๐Ÿ‘‘

---

## โœจ -spec-file-merge โ€” MERGE TWO SPEC FILES INTO ONE โœจ

wb_command -spec-file-merge


- `<spec-1>` โ€” first spec file to merge
- `<spec-2>` โ€” second spec file to merge
- `<out-spec>` โ€” output โ€” output spec file

The output spec file contains every file that is in <purple>either</purple> of the input spec files. two become one, iconic ๐Ÿซถ

---

## ๐ŸŽ€ -spec-file-relocate โ€” RECREATE SPEC FILE IN NEW LOCATION ๐ŸŽ€

wb_command -spec-file-relocate


- `<input-spec>` โ€” the spec file to use
- `<output-spec>` โ€” output โ€” the new spec file to create

Spec files contain internal relative paths, such that moving or copying a spec file will cause it to <red>lose track of the files it refers to</red> ๐Ÿ˜ญ. This command makes a modified copy of the spec file, changing the relative paths to refer to the new relative locations of the files. glow up complete โœจ

---

## ๐ŸŒˆ -surface-affine-regression โ€” REGRESS THE AFFINE TRANSFORM BETWEEN SURFACES ON THE SAME MESH ๐ŸŒˆ

wb_command -surface-affine-regression


- `<source>` โ€” the surface to warp
- `<target>` โ€” the surface to match the coordinates of
- `<affine-out>` โ€” output โ€” the output affine file

Use linear regression to compute an affine that minimizes the sum of squares of the coordinate differences between the target surface and the warped source surface. Note that this has a <yellow>bias to shrink the surface that is being warped</yellow>. The output is written as a NIFTI `'world'` matrix, see `-convert-affine` to convert it for use in other software.

---

## ๐Ÿ’œ -surface-apply-affine โ€” APPLY AFFINE TRANSFORM TO SURFACE FILE ๐Ÿ’œ

wb_command -surface-apply-affine


- `<in-surf>` โ€” the surface to transform
- `<affine>` โ€” the affine file
- `<out-surf>` โ€” output โ€” the output transformed surface
- **`-flirt`** โ€” <red>MUST</red> be used if affine is a flirt affine
  - `<source-volume>` โ€” the source volume used when generating the affine
  - `<target-volume>` โ€” the target volume used when generating the affine

For flirt matrices, you <hotpink>must</hotpink> use the `-flirt` option, because flirt matrices are not a complete description of the coordinate transform they represent. If the `-flirt` option is not present, the affine must be a nifti `'world'` affine, which can be obtained with the `-convert-affine` command, or `aff_conv` from the 4dfp suite.

---

## ๐Ÿ”ฅ -surface-apply-warpfield โ€” APPLY WARPFIELD TO SURFACE FILE ๐Ÿ”ฅ

wb_command -surface-apply-warpfield


- `<in-surf>` โ€” the surface to transform
- `<warpfield>` โ€” the <bold>INVERSE</bold> warpfield
- `<out-surf>` โ€” output โ€” the output transformed surface
- **`-fnirt`** โ€” <red>MUST</red> be used if using a fnirt warpfield
  - `<forward-warp>` โ€” the forward warpfield

<red>NOTE:</red> warping a surface requires the <bold>INVERSE</bold> of the warpfield used to warp the volume it lines up with. The header of the forward warp is needed by the `-fnirt` option in order to correctly interpret the displacements in the fnirt warpfield. bestie do not skip that part ๐Ÿ˜ญ

If the `-fnirt` option is not present, the warpfield must be a nifti `'world'` warpfield, which can be obtained with the `-convert-warpfield` command.

---

## ๐ŸŒธ -surface-average โ€” AVERAGE SURFACE FILES TOGETHER ๐ŸŒธ

wb_command -surface-average


- `<surface-out>` โ€” output โ€” the output averaged surface
- **`-stddev`** โ€” compute 3D sample standard deviation
  - `<stddev-metric-out>` โ€” output โ€” the output metric for 3D sample standard deviation
- **`-uncertainty`** โ€” compute caret5 `'uncertainty'`
  - `<uncert-metric-out>` โ€” output โ€” the output metric for uncertainty
- **`-surf`** โ€” repeatable โ€” specify a surface to include in the average
  - `<surface>` โ€” a surface file to average
- **`-weight`** โ€” specify a weighted average

- **`<weight>`** โ€” the weight to use (default `1`)

<purple>The 3D sample standard deviation</purple> is computed as `'sqrt(sum(squaredlength(xyz - mean(xyz)))/(n - 1))'`.

<purple>Uncertainty</purple> is a legacy measure used in caret5, and is computed as `'sum(length(xyz - mean(xyz)))/n'`.

When weights are used, the 3D sample standard deviation treats them as <cyan>reliability weights</cyan>. Bestie, that's a whole thing, but it's the real thing. โœจ

---

## **`-surface-closest-vertex`** โ€” FIND CLOSEST SURFACE VERTEX TO COORDINATES ๐ŸŽฏ

wb_command -surface-closest-vertex


- **`<surface>`** โ€” the surface to use
- **`<coord-list-file>`** โ€” text file with coordinates
- **`<vertex-list-out>`** โ€” *output* โ€” the output text file with vertex numbers

For each coordinate XYZ triple, it finds the closest vertex in the surface and drops its vertex number into a text file. The input file should <hotpink>only</hotpink> use whitespace to separate coordinates (spaces, newlines, tabs), like for instance:

20 30 25 30 -20 10


---

## **`-surface-coordinates-to-metric`** โ€” MAKE METRIC FILE OF SURFACE COORDINATES ๐Ÿ“

wb_command -surface-coordinates-to-metric


- **`<surface>`** โ€” the surface to use the coordinates of
- **`<metric-out>`** โ€” *output* โ€” the output metric

Puts the coordinates of the surface into a <mint>3-map</mint> metric file, as x, y, z. Three maps, three letters, iconic. ๐Ÿ’…

---

## **`-surface-cortex-layer`** โ€” CREATE SURFACE APPROXIMATING A CORTICAL LAYER ๐Ÿง 

wb_command -surface-cortex-layer


- **`<white-surface>`** โ€” the white matter surface
- **`<pial-surface>`** โ€” the pial surface
- **`<location>`** โ€” what volume fraction to place the layer at
- **`<out-surface>`** โ€” *output* โ€” the output surface
- **`[-placement-out]`** โ€” output the placement as a volume fraction from pial to white
- **`<placement-metric>`** โ€” *output* โ€” output metric

> The input surfaces **must** have vertex correspondence. No cap.

The output surface is generated by placing vertices between the two surfaces such that the enclosed volume within any small patch of the new and white surfaces is the given fraction of the volume of the same patch between the pial and white surfaces โ€” i.e., specifying `0` would give the white surface, `1` would give the pial surface. Lowkey the cleanest mental model ever. ๐Ÿฆ‹

---

## **`-surface-create-sphere`** โ€” GENERATE A SPHERE WITH CONSISTENT VERTEX AREAS ๐ŸŒ

wb_command -surface-create-sphere


- **`<num-vertices>`** โ€” desired number of vertices
- **`<sphere-out>`** โ€” *output* โ€” the output sphere

Generates a sphere by regularly dividing the triangles of an icosahedron, to come as close to the desired number of vertices as possible, and modifying it to have <green>very similar vertex areas</green> for all vertices. To generate a pair of vertex-matched left and right spheres, use this command, then `-surface-flip-lr` to generate the other sphere, then `-set-structure` on each. For example:

$ wb_command -surface-create-sphere 6000 Sphere.6k.R.surf.gii $ wb_command -surface-flip-lr Sphere.6k.R.surf.gii Sphere.6k.L.surf.gii $ wb_command -set-structure Sphere.6k.R.surf.gii CORTEX_RIGHT $ wb_command -set-structure Sphere.6k.L.surf.gii CORTEX_LEFT


Four commands and you've got a matched pair. Ate. ๐Ÿ”ฅ

---

## **`-surface-curvature`** โ€” CALCULATE CURVATURE OF SURFACE ๐ŸŒ€

wb_command -surface-curvature


- **`<surface>`** โ€” the surface to compute the curvature of
- **`[-mean]`** โ€” output mean curvature
- **`<mean-out>`** โ€” *output* โ€” mean curvature metric
- **`[-gauss]`** โ€” output gaussian curvature
- **`<gauss-out>`** โ€” *output* โ€” gaussian curvature metric

Computes the curvature of the surface, using the method from: <lavender>*Interactive Texture Mapping*</lavender> by J. Maillot, Yahia, and Verroust, 1993. `ACM-0-98791-601-8/93/008`. Yes bestie, that's the whole citation, every digit, we respect the 1993 girlies. ๐ŸŽ€

---

## **`-surface-cut-resample`** โ€” RESAMPLE A CUT SURFACE โœ‚๏ธ

wb_command -surface-cut-resample


- **`<surface-in>`** โ€” the surface file to resample
- **`<current-sphere>`** โ€” a sphere surface with the mesh that the input surface is currently on
- **`<new-sphere>`** โ€” a sphere surface that is in register with `<current-sphere>` and has the desired output mesh
- **`<surface-out>`** โ€” *output* โ€” the output surface file

Resamples a surface file, given two spherical surfaces that are in register. <cyan>Barycentric resampling</cyan> is used, because it is usually better for resampling surfaces, and because it is needed to figure out the new topology anyway. Two birds, one gorgeous algorithm. ๐Ÿฆ๐Ÿฆ

---

## **`-surface-distortion`** โ€” MEASURE DISTORTION BETWEEN SURFACES ๐Ÿซ 

wb_command -surface-distortion


- **`<surface-reference>`** โ€” the reference surface
- **`<surface-distorted>`** โ€” the distorted surface
- **`<metric-out>`** โ€” *output* โ€” the output distortion metric
- **`[-smooth]`** โ€” smooth the area data
- **`<sigma>`** โ€” the size of the smoothing kernel in mm, as sigma by default
- **`[-fwhm]`** โ€” kernel size is FWHM, not sigma
- **`[-caret5-method]`** โ€” use the surface distortion method from caret5
- **`[-edge-method]`** โ€” calculate distortion of edge lengths rather than areas
- **`[-local-affine-method]`** โ€” calculate distortion by the local affines between triangles
- **`[-log2]`** โ€” apply base-2 log transform

This command, when **not** using `-caret5-method`, `-edge-method`, or `-local-affine-method`, is equivalent to using `-surface-vertex-areas` on each surface, smoothing both output metrics with the `GEO_GAUSS_EQUAL` method on the surface they came from if `-smooth` is specified, and then using the formula `'ln(distorted/reference)/ln(2)'` on the smoothed results.

When using `-caret5-method`, it uses the surface distortion method from caret5, which takes the base 2 log of the ratio of tile areas, then averages those results at each vertex, and then smooths the result on the reference surface.

When using `-edge-method`, the `-smooth` option is <red>ignored</red>, and the output at each vertex is the average of `'abs(ln(refEdge/distortEdge)/ln(2))'` over all edges connected to the vertex.

When using `-local-affine-method`, the `-smooth` option is <red>ignored</red>. The output is <yellow>two columns</yellow> โ€” the first is the area distortion ratio, and the second is anisotropic strain. These are calculated by an affine transform between matching triangles, and then averaged across the triangles of a vertex. Two columns, two moods. ๐Ÿ’€

---

## **`-surface-flip-lr`** โ€” MIRROR A SURFACE THROUGH THE YZ PLANE ๐Ÿชž

wb_command -surface-flip-lr


- **`<surface>`** โ€” the surface to flip
- **`<surface-out>`** โ€” *output* โ€” the output flipped surface

This command negates the <hotpink>x</hotpink> coordinate of each vertex, and flips the surface normals, so that you have a surface of opposite handedness with the same features and vertex correspondence, with normals consistent with the original surface. That is, if the input surface has normals facing outward, the output surface will also have normals facing outward. Mirror mirror on the wall, who's the most consistent normal of them all. ๐Ÿ‘‘

---

## **`-surface-flip-normals`** โ€” FLIP ALL TILES ON A SURFACE ๐Ÿ”„

wb_command -surface-flip-normals


- **`<surface>`** โ€” the surface to flip the normals of
- **`<surface-out>`** โ€” *output* โ€” the output surface

Flips all triangles on a surface, resulting in surface normals being flipped the other direction (inward vs outward). If you transform a surface with an affine that has <purple>negative determinant</purple>, or a warpfield that similarly flips the surface, you may end up with a surface that has normals pointing <red>inwards</red>, which may have display problems. Using this command will solve that problem. Fixer of vibes, solver of problems. ๐Ÿ› ๏ธ

---

## **`-surface-generate-inflated`** โ€” SURFACE GENERATE INFLATED ๐ŸŽˆ

wb_command -surface-generate-inflated


- **`<anatomical-surface-in>`** โ€” the anatomical surface
- **`<inflated-surface-out>`** โ€” *output* โ€” the output inflated surface
- **`<very-inflated-surface-out>`** โ€” *output* โ€” the output very inflated surface
- **`[-iterations-scale]`** โ€” optional iterations scaling
- **`<iterations-scale-value>`** โ€” iterations-scale value

Generates inflated and very inflated surfaces. The output surfaces are <mint>'matched'</mint> (have same XYZ range) to the anatomical surface. In most cases, an `iterations-scale` of `1.0` (default) is sufficient. However, if the surface contains a large number of vertices (`150,000`), try an `iterations-scale` of `2.5`. Big surface, big scale, bestie math. โœจ

---

## **`-surface-geodesic-distance`** โ€” COMPUTE GEODESIC DISTANCE FROM ONE VERTEX TO THE ENTIRE SURFACE ๐Ÿงญ

wb_command -surface-geodesic-distance


- **`<surface>`** โ€” the surface to compute on
- **`<vertex>`** โ€” the vertex to compute geodesic distance from
- **`<metric-out>`** โ€” *output* โ€” the output metric
- **`[-naive]`** โ€” use only neighbors, don't crawl triangles (not recommended)
- **`[-limit]`** โ€” stop at a certain distance
- **`<limit-mm>`** โ€” distance in mm to stop at
- **`[-corrected-areas]`** โ€” vertex areas to use instead of computing them from the surface
- **`<area-metric>`** โ€” the corrected vertex areas, as a metric

Unless `-limit` is specified, computes the geodesic distance from the specified vertex to <rainbow>all others</rainbow>. The result is output as a <yellow>single column</yellow> metric file, with a value of `-1` for vertices that the distance was not computed for.

The `-corrected-areas` option should be used when the input is a <lavender>group average surface</lavender> โ€” group average surfaces have significantly less surface area than individual surfaces do, and therefore distances measured on them would be smaller than measuring them on individual surfaces. In this case, the input to this option should be a group average of the output of `-surface-vertex-areas` for each subject.

If `-naive` is not specified, the algorithm uses not just immediate neighbors, but also neighbors derived from crawling across pairs of triangles that share an edge. Crawling, bestie, it literally crawls. ๐Ÿฆ‹

---

## **`-surface-geodesic-distance-all-to-all`** โ€” COMPUTE GEODESIC DISTANCES FROM ALL VERTICES ๐ŸŒˆ

wb_command -surface-geodesic-distance-all-to-all


- **`<surface>`** โ€” the surface to compute on
- **`<cifti-out>`** โ€” *output* โ€” single-hemisphere dconn containing the distances
- **`[-roi]`** โ€” only output distances for vertices inside an ROI
- **`<roi-metric>`** โ€” the ROI as a metric file
- **`[-limit]`** โ€” stop at a specified distance
- **`<limit-mm>`** โ€” distance in mm to stop at
- **`[-corrected-areas]`** โ€” vertex areas to use instead of computing them from the surface
- **`<area-metric>`** โ€” the corrected vertex areas, as a metric
- **`[-naive]`** โ€” use only neighbors, don't crawl triangles (not recommended)

<pink>okay so</pink> this one is giving **all the geodesic distances** from every vertex to every vertex, and it outputs a single-hemisphere `dconn` file. if youโ€™re only interested in a few vertices, go see `-surface-geodesic-distance` instead. when `-limit` is specified, any vertex beyond the limit gets assigned the value `-1`.

the `-roi` option makes the output file smaller by not outputting distances to or from vertices outside the ROI, but bestie, paths are still allowed to go outside the ROI when finding distances to other vertices.

the `-corrected-areas` option should be used when the input is a group average surface โ€” group average surfaces have significantly less surface area than individual surfaces do, and therefore distances measured on them would be smaller than measuring them on individual surfaces. in this case, the input to this option should be a group average of the output of `-surface-vertex-areas` for each subject.

if `-naive` is not specified, the algorithm uses not just immediate neighbors, but also neighbors derived from crawling across pairs of triangles that share an edge. no cap.

---

## ๐ŸŽ€ `-surface-geodesic-rois` โ€” DRAW GEODESIC LIMITED ROIS AT VERTICES ๐ŸŽ€

wb_command -surface-geodesic-rois


- **`<surface>`** โ€” the surface to draw on
- **`<limit>`** โ€” geodesic distance limit from vertex, in mm
- **`<vertex-list-file>`** โ€” a text file containing the vertices to draw ROIs around
- **`<metric-out>`** โ€” output โ€” the output metric
- **`[-gaussian]`** โ€” generate a gaussian kernel instead of a flat ROI
  - **`<sigma>`** โ€” the sigma for the gaussian kernel, in mm
- **`[-overlap-logic]`** โ€” how to handle overlapping ROIs, default `ALLOW`
  - **`<method>`** โ€” the method of resolving overlaps
- **`[-names]`** โ€” name the columns from text file
  - **`<name-list-file>`** โ€” a text file containing column names, one per line
- **`[-corrected-areas]`** โ€” vertex areas to use instead of computing them from the surface
  - **`<area-metric>`** โ€” the corrected vertex areas, as a metric

for each vertex in the list file, a column in the output metric is created, and an ROI around that vertex is drawn in that column. each metric column will have zeros outside the geodesic distance specified by `<limit>`, and by default will have a value of `1.0` inside it. if the `-gaussian` option is specified, the values inside the ROI will instead form a gaussian with the specified value of sigma, normalized so that the sum of the nonzero values in the metric column is `1.0`. the `<method>` argument to `-overlap-logic` must be one of `ALLOW`, `CLOSEST`, or `EXCLUDE`. `ALLOW` is the default, and means that ROIs are treated independently and may overlap. `CLOSEST` means that ROIs may not overlap, and that no ROI contains vertices that are closer to a different seed vertex. `EXCLUDE` means that ROIs may not overlap, and that any vertex within range of more than one ROI does not belong to any ROI.

---

## ๐Ÿฆ‹ `-surface-inflation` โ€” SURFACE INFLATION ๐Ÿฆ‹

wb_command -surface-inflation


- **`<anatomical-surface-in>`** โ€” the anatomical surface
- **`<surface-in>`** โ€” the surface file to inflate
- **`<number-of-smoothing-cycles>`** โ€” number of smoothing cycles
- **`<smoothing-strength>`** โ€” smoothing strength (ranges `[0.0 - 1.0]`)
- **`<smoothing-iterations>`** โ€” smoothing iterations
- **`<inflation-factor>`** โ€” inflation factor
- **`<surface-out>`** โ€” output โ€” output surface file

inflate a surface by performing cycles that consist of smoothing followed by inflation (to correct shrinkage caused by smoothing). itโ€™s giving glow-up energy.

---

## โœจ `-surface-information` โ€” DISPLAY INFORMATION ABOUT A SURFACE โœจ

wb_command -surface-information


- **`<Surface File>`** โ€” Surface for which information is displayed

information about surface is displayed including vertices, triangles, bounding box, and spacing. so nosy, and we love that.

---

## ๐Ÿ’… `-surface-match` โ€” SURFACE MATCH ๐Ÿ’…

wb_command -surface-match


- **`<Match Surface File>`** โ€” Match (Reference) Surface
- **`<Input Surface File>`** โ€” File containing surface that will be transformed
- **`<Output Surface Name>`** โ€” Surface File after transformation

the Input Surface File will be transformed so that its coordinate ranges (bounding box) match that of the Match Surface File. itโ€™s giving matching outfits, but for brains.

---

## ๐ŸŒธ `-surface-modify-sphere` โ€” CHANGE RADIUS AND OPTIONALLY RECENTER A SPHERE ๐ŸŒธ

wb_command -surface-modify-sphere


- **`<sphere-in>`** โ€” the sphere to modify
- **`<radius>`** โ€” the radius the output sphere should have
- **`<sphere-out>`** โ€” output โ€” the output sphere
- **`[-recenter]`** โ€” recenter the sphere by means of the bounding box

this command may be useful if you have used `-surface-resample` to resample a sphere, which can suffer from problems generally not present in `-surface-sphere-project-unproject`. if the sphere should already be centered around the origin, using `-recenter` may still shift it slightly before changing the radius, which is likely to be undesirable.

if `<sphere-in>` is not close to spherical, or not centered around the origin and `-recenter` is not used, a warning is printed. periodt.

---

## ๐Ÿงš `-surface-normals` โ€” OUTPUT VERTEX NORMALS AS METRIC FILE ๐Ÿงš

wb_command -surface-normals


- **`<surface>`** โ€” the surface to output the normals of
- **`<metric-out>`** โ€” output โ€” the normal vectors

computes the normal vectors of the surface file, and outputs them as a 3 column metric file. iconic.

---

## ๐Ÿ”ฅ `-surface-resample` โ€” RESAMPLE A SURFACE TO A DIFFERENT MESH ๐Ÿ”ฅ

wb_command -surface-resample


- **`<surface-in>`** โ€” the surface file to resample
- **`<current-sphere>`** โ€” a sphere surface with the mesh that the input surface is currently on
- **`<new-sphere>`** โ€” a sphere surface that is in register with `<current-sphere>` and has the desired output mesh
- **`<method>`** โ€” the method name
- **`<surface-out>`** โ€” output โ€” the output surface file
- **`[-area-surfs]`** โ€” specify surfaces to do vertex area correction based on
  - **`<current-area>`** โ€” a relevant surface with `<current-sphere>` mesh
  - **`<new-area>`** โ€” a relevant surface with `<new-sphere>` mesh
- **`[-area-metrics]`** โ€” specify vertex area metrics to do area correction based on
  - **`<current-area>`** โ€” a metric file with vertex areas for `<current-sphere>` mesh
  - **`<new-area>`** โ€” a metric file with vertex areas for `<new-sphere>` mesh
- **`[-bypass-sphere-check]`** โ€” ADVANCED: allow the current and new 'spheres' to have arbitrary shape as long as they follow the same contour

resamples a surface file, given two spherical surfaces that are in register. if `ADAP_BARY_AREA` is used, exactly one of `-area-surfs` or `-area-metrics` must be specified. this method is not generally recommended for surface resampling, but is provided for completeness.

the `BARYCENTRIC` method is generally recommended for anatomical surfaces, in order to minimize smoothing.

for cut surfaces (including flatmaps), use `-surface-cut-resample`.

instead of resampling a spherical surface, the `-surface-sphere-project-unproject` command is recommended.

the `<method>` argument must be one of the following:

- `ADAP_BARY_AREA`
- `BARYCENTRIC`

---

## ๐Ÿ“ `-surface-set-coordinates` โ€” MODIFY COORDINATES OF A SURFACE ๐Ÿ“

wb_command -surface-set-coordinates


- **`<surface-in>`** โ€” the surface to use for the topology
- **`<coord-metric>`** โ€” the new coordinates, as a 3-column metric file
- **`<surface-out>`** โ€” output โ€” the new surface

takes the topology from an existing surface file, and uses values from a metric file as coordinates to construct a new surface file.

see `-surface-coordinates-to-metric` for how to get surface coordinates as a metric file, such that you can then modify them via metric commands, etc. the way that this is so useful? obsessed.

---

## ๐Ÿ’– `-surface-smoothing` โ€” SURFACE SMOOTHING ๐Ÿ’–

wb_command -surface-smoothing


- **`<surface-in>`** โ€” the surface file to smooth
- **`<smoothing-strength>`** โ€” smoothing strength (ranges `[0.0 - 1.0]`)
- **`<smoothing-iterations>`** โ€” smoothing iterations
- **`<surface-out>`** โ€” output โ€” output surface file

smooths a surface by averaging vertex coordinates with those of the neighboring vertices. itโ€™s giving soft launch, but for geometry.

---

## ๐ŸŒˆ `-surface-sphere-project-unproject` โ€” COPY REGISTRATION DEFORMATIONS TO DIFFERENT SPHERE ๐ŸŒˆ

wb_command -surface-sphere-project-unproject


- **`<sphere-in>`** โ€” a sphere with the desired output mesh
- **`<sphere-project-to>`** โ€” a sphere that aligns with sphere-in
- **`<sphere-unproject-from>`** โ€” `<sphere-project-to>` deformed to the desired output space
- **`<sphere-out>`** โ€” output โ€” the output sphere

Background: a surface registration starts with an input sphere, and moves its vertices around on the sphere until it matches the template data. this means that the registration deformation is actually represented as the difference between two separate files โ€” the starting sphere, and the registered sphere. since the starting sphere of the registration may not have vertex correspondence to any other sphere (often, it is a native sphere), it can be inconvenient to manipulate or compare these deformations across subjects, etc.

the purpose of this command is to be able to apply these deformations onto a new sphere of the userโ€™s choice, to make it easier to compare or manipulate them. common uses are to concatenate two successive separate registrations (e.g. Human to Chimpanzee, and then Chimpanzee to Macaque) or inversion (for dedrifting or symmetric registration schemes).

`<sphere-in>` must already be considered to be in alignment with one of the two ends of the registration (if your registration is Human to Chimpanzee, `<sphere-in>` must be in register with either Human or Chimpanzee). the 'project-to' sphere must be the side of the registration that is aligned with `<sphere-in>` (if your registration is Human to Chimpanzee, and `<sphere-in>` is aligned with Human, then 'project-to' should be the original Human sphere). the 'unproject-from' sphere must be the remaining sphere of the registration (original vs deformed/registered). the output is as if you had run the same registration with `<sphere-in>` as the starting sphere, in the direction of deforming 'project-to' sphere to create the 'unproject-from' sphere.

<pink>okay so real talk bestie</pink> โ€” this command **cannot** check for you which spheres are actually aligned with each other. So if you hand it the wrong spheres, or the right spheres in the wrong order, it will not necessarily throw an error message at you. It'll just do the thing. ๐Ÿ™ˆ In some cases it's genuinely useful to feed it a brand-new, arbitrary sphere as the input โ€” and you can make one of those with the `-surface-create-sphere` command. ๐Ÿซถ

**Example 1:** you've got a Human to Chimpanzee registration, and a Chimpanzee to Macaque registration, and you want to smoosh them together. Use the Human sphere registered to Chimpanzee as `sphere-in`, the Chimpanzee standard sphere as `project-to`, and the Chimpanzee sphere registered to Macaque as `unproject-from` โ€” boom, your output is the Human sphere in register with the Macaque. โœจ

**Example 2:** you've got a Human to Chimpanzee registration, but what you *actually* want is the inverse โ€” the sphere as if you'd run the registration Chimpanzee to Human. Use the Chimpanzee standard sphere as `sphere-in`, the Human sphere registered to Chimpanzee as `project-to`, and the standard Human sphere as `unproject-from` โ€” output is the Chimpanzee sphere in register with the Human. ๐Ÿ’…

**Technical details:** each vertex of `<sphere-in>` is projected to a triangle of `<sphere-project-to>`, and its new position is determined by the position of the corresponding triangle in `<sphere-unproject-from>`. The output is a sphere with the topology of `<sphere-in>`, but coordinates shifted by the deformation from `<sphere-project-to>` to `<sphere-unproject-from>`. <yellow>`<sphere-project-to>`</yellow> and <yellow>`<sphere-unproject-from>`</yellow> **must** have the same topology as each other, but `<sphere-in>` may have any topology. no cap.

---

## ๐Ÿฆ‹ `-surface-sphere-triangular-patches` โ€” DIVIDE STANDARD SPHERE INTO PATCHES

wb_command -surface-sphere-triangular-patches


- **`<sphere>`** โ€” an undistorted, regularly divided icosahedral sphere
- **`<divisions>`** โ€” how many pieces to divide each icosahedral edge into, must divide perfectly into the given sphere
- **`<text-out>`** โ€” *output* โ€” text file for the vertex numbers of the patches

So basically: divide the given undistorted sphere into equally-sized triangular patches. And the patches overlap by a border of 1 vertex, which is lowkey the important part. ๐ŸŽ€

---

## ๐ŸŒˆ `-surface-to-surface-3d-distance` โ€” COMPUTE DISTANCE BETWEEN CORRESPONDING VERTICES

wb_command -surface-to-surface-3d-distance


- **`<surface-comp>`** โ€” the surface to compare to the reference
- **`<surface-ref>`** โ€” the surface to use as the reference
- **`<dists-out>`** โ€” *output* โ€” the output distances
- **`[-vectors]`** โ€” output the displacement vectors
  - **`<vectors-out>`** โ€” *output* โ€” the output vectors

It computes the vector difference between the vertices of each surface with the same index, as `(comp - ref)`, and outputs the magnitudes โ€” and optionally the displacement vectors too. iconic behavior honestly. ๐Ÿ‘‘

---

## ๐ŸŒธ `-surface-vertex-areas` โ€” MEASURE SURFACE AREA EACH VERTEX IS RESPONSIBLE FOR

wb_command -surface-vertex-areas


- **`<surface>`** โ€” the surface to measure
- **`<metric>`** โ€” *output* โ€” the output metric

Every vertex gets one third of the area of each triangle it is a part of. Units are `mm^2`, and yes that's `mm^2` exactly, don't come for me. ๐Ÿ’–

---

## ๐Ÿงš `-surface-wedge-volume` โ€” MEASURE PER-VERTEX VOLUME BETWEEN SURFACES

wb_command -surface-wedge-volume


- **`<inner-surface>`** โ€” the inner surface
- **`<outer-surface>`** โ€” the outer surface
- **`<metric>`** โ€” *output* โ€” the output metric

Computes the volume of each vertex's area from one surface to another. <hotpink>Heads up:</hotpink> the surfaces **must** have vertex correspondence, and have consistent triangle orientation. Don't skip that part bestie, it's not a suggestion. ๐Ÿ˜ญ

---

## โœจ `-unit-test`

That's it. That's the whole entry. The manpage gives it literally nothing else โ€” no arguments, no description. It's giving mysterious main character energy and honestly? respect. ๐Ÿ’€

---

## ๐Ÿ’œ `-volume-all-labels-to-rois` โ€” MAKE ROIS FROM ALL LABELS IN A VOLUME FRAME

wb_command -volume-all-labels-to-rois


- **`<label-in>`** โ€” the input volume label file
- **`<map>`** โ€” the number or name of the label map to use
- **`<volume-out>`** โ€” *output* โ€” the output volume file

The output volume has a frame for each label in the specified input frame, **other than the `???` label** โ€” each of those frames contains an ROI of all voxels that are set to the corresponding label. so many little frames, so much slay. ๐ŸŽ€

---

## ๐Ÿ”ฅ `-volume-capture-plane` โ€” INTERPOLATE IMAGE FROM PLANE THROUGH VOLUME

wb_command -volume-capture-plane


- **`<volume>`** โ€” the volume file to interpolate from
- **`<subvolume>`** โ€” the name or number of the subvolume to use
- **`<interp>`** โ€” interpolation type
- **`<h-dim>`** โ€” width of output image, in pixels
- **`<v-dim>`** โ€” height of output image, in pixels
- **`<scale-min>`** โ€” value to render as black
- **`<scale-max>`** โ€” value to render as white
- **`<bottom-left-x>`** โ€” x-coordinate of the bottom left of the output image
- **`<bottom-left-y>`** โ€” y-coordinate of the bottom left of the output image
- **`<bottom-left-z>`** โ€” z-coordinate of the bottom left of the output image
- **`<bottom-right-x>`** โ€” x-coordinate of the bottom right of the output image
- **`<bottom-right-y>`** โ€” y-coordinate of the bottom right of the output image
- **`<bottom-right-z>`** โ€” z-coordinate of the bottom right of the output image
- **`<top-left-x>`** โ€” x-coordinate of the top left of the output image
- **`<top-left-y>`** โ€” y-coordinate of the top left of the output image
- **`<top-left-z>`** โ€” z-coordinate of the top left of the output image
- **`<image>`** โ€” *output* โ€” the output image

> <cyan>NOTE:</cyan> if you want to generate an image with **all** of the capabilities of the GUI rendering, go look at `-show-scene` instead. this one is the simpler girlie.

Renders an image of an arbitrary plane through the volume file, with a simple linear grayscale palette. The parameter `<interp>` must be one of:

CUBIC ENCLOSING_VOXEL TRILINEAR


---

## ๐ŸŒŸ `-volume-components-to-frames` โ€” CONVERT RGB/COMPLEX VOLUME TO FRAMES

wb_command -volume-components-to-frames


- **`<input>`** โ€” the RGB/complex-type volume
- **`<output>`** โ€” *output* โ€” the input volume converted to multiple frames of scalar type

RGB and complex datatypes are not always well supported, so this command lets you separate them into standard subvolumes for better support. it's giving "we can't all be scalar, so let me break myself into pieces for you." ๐Ÿ’…

---

## ๐Ÿซถ `-volume-copy-extensions` โ€” COPY EXTENDED DATA TO ANOTHER VOLUME FILE

wb_command -volume-copy-extensions


- **`<data-volume>`** โ€” the volume file containing the voxel data to use
- **`<extension-volume>`** โ€” the volume file containing the extensions to use
- **`<volume-out>`** โ€” *output* โ€” the output volume
- **`[-drop-unknown]`** โ€” don't copy extensions that workbench doesn't understand

This command copies the information in a volume file that isn't a critical part of the standard header or data matrix โ€” think map names, palette settings, label tables. ๐Ÿ‘‘ And if `-drop-unknown` is **not** specified, it also copies similar kinds of information set by other software. so it's inclusive like that.

---

## ๐Ÿ’– `-volume-create` โ€” CREATE A BLANK VOLUME FILE

wb_command -volume-create


- **`<i-dim>`** โ€” length of first dimension
- **`<j-dim>`** โ€” length of second dimension
- **`<k-dim>`** โ€” length of third dimension
- **`<volume-out>`** โ€” *output* โ€” the output volume
- **`[-plumb]`** โ€” set via axis order and spacing/offset
  - **`<axis-order>`** โ€” a string like `'XYZ'` that specifies which index is along which spatial dimension
  - **`<x-spacing>`** โ€” change in x-coordinate from incrementing the relevant index
  - **`<y-spacing>`** โ€” change in y-coordinate from incrementing the relevant index
  - **`<z-spacing>`** โ€” change in z-coordinate from incrementing the relevant index
  - **`<x-offset>`** โ€” the x-coordinate of the center of the first voxel
  - **`<y-offset>`** โ€” the y-coordinate of the center of the first voxel
  - **`<z-offset>`** โ€” the z-coordinate of the center of the first voxel
- **`[-sform]`** โ€” set via a nifti sform
  - **`<xi-spacing>`** โ€” increase in x coordinate from incrementing the i index
  - **`<xj-spacing>`** โ€” increase in x coordinate from incrementing the j index
  - **`<xk-spacing>`** โ€” increase in x coordinate from incrementing the k index
  - **`<x-offset>`** โ€” x coordinate of first voxel
  - **`<yi-spacing>`** โ€” increase in y coordinate from incrementing the i index
  - **`<yj-spacing>`** โ€” increase in y coordinate from incrementing the j index
  - **`<yk-spacing>`** โ€” increase in y coordinate from incrementing the k index
  - **`<y-offset>`** โ€” y coordinate of first voxel
  - **`<zi-spacing>`** โ€” increase in z coordinate from incrementing the i index
  - **`<zj-spacing>`** โ€” increase in z coordinate from incrementing the j index
  - **`<zk-spacing>`** โ€” increase in z coordinate from incrementing the k index
  - **`<z-offset>`** โ€” z coordinate of first voxel

Creates a volume file full of zeros. โœจ

> <red>Important:</red> exactly **one** of `-plumb` or `-sform` **must** be specified. not zero, not both. pick a lane bestie. ๐Ÿ˜ค

---

## ๐Ÿ“ `-volume-dilate` โ€” DILATE A VOLUME FILE

wb_command -volume-dilate


- **`<volume>`** โ€” the volume to dilate
- **`<distance>`** โ€” distance in mm to dilate
- **`<method>`** โ€” dilation method to use
- **`<volume-out>`** โ€” *output* โ€” the output volume
- **`[-exponent]`** โ€” use a different exponent in the weighting function
  - **`<exponent>`** โ€” exponent `'n'` to use in `(1 / (distance ^ n))` as the weighting function (default `7`)
- **`[-bad-voxel-roi]`** โ€” specify an roi of voxels to overwrite, rather than voxels with value zero
  - **`<roi-volume>`** โ€” volume file, positive values denote voxels to have their values replaced
- **`[-data-roi]`** โ€” specify an roi of where there is data
  - **`<roi-volume>`** โ€” volume file, positive values denote voxels that have data
- **`[-subvolume]`** โ€” select a single subvolume to dilate
  - **`<subvol>`** โ€” the subvolume number or name
- **`[-legacy-cutoff]`** โ€” use the v1.3.2 method of excluding voxels further than the dilation distance when calculating the dilated value
- **`[-grad-extrapolate]`** โ€” additionally use the gradient to extrapolate, intended to be used with `WEIGHTED`
- **`[-presmooth]`** โ€” apply presmoothing before computing gradient vectors, **not recommended**
  - **`<kernel>`** โ€” the size of gaussian smoothing kernel in mm, as sigma by default
- **`[-fwhm]`** โ€” kernel size is FWHM, not sigma

Here's the vibe: for all voxels that are designated as bad, if they neighbor a non-bad voxel with data, **or** are within the specified distance of such a voxel, replace the value in the bad voxel with a value calculated from nearby non-bad voxels that have data โ€” otherwise set the value to zero.

> <purple>And fr fr:</purple> no matter how small `<distance>` is, dilation will **always** use at least the face neighbor voxels. so don't think you can sneak a tiny number in there and get nothing. ๐Ÿ’…

...and lowkey this is the important bit: by default, any voxel that has data with the value `0` counts as **bad**. If you only want voxels to count as bad when they're picked out by the roi, pass `-bad-voxel-roi`. And if `-data-roi` isn't specified, we just assume *every* voxel has data, no questions asked. โœจ

Want the old-school behavior from version 1.3.2 or earlier? Say it with me: `'-legacy-cutoff -exponent 2'`. That's the whole trick. ๐ŸŽ€

The valid values for *`<method>`* are:

- `NEAREST` โ€” use the value from the nearest good voxel
- `WEIGHTED` โ€” use a weighted average based on distance

---

- **`-volume-distortion`** โ€” CALCULATE VOLUME WARPFIELD DISTORTION

wb_command -volume-distortion

<warpfield> - the warpfield to compute the distortion of <volume-out> - output - the output distortion measures

[-fnirt] - MUST be used if using a fnirt warpfield

<source-volume> - the source volume used when generating the warpfield

[-circular] - use the circle-based formula for the anisotropic measure

[-log2] - apply base-2 log transform


<pink>Okay bestie, this one is genuinely so cool.</pink> It calculates isotropic and anisotropic distortions in the volume warpfield. At each voxel, it computes the gradient of the absolute warpfield to get the local affine transforms for each voxel (those are the **jacobian matrices**), and then strain tensors get derived from them. The isotropic component (aka the volumetric expansion ratio) is the product of the three principal strains. The default measure (`'elongation'`) for the anisotropic component is the largest principal strain divided by the smallest. ๐Ÿฆ‹

And then `-circular` does something kind of galaxy-brained: instead of the usual thing, it calculates the anisotropic component by transforming the principal strains into log space, treating them as x-values of points on a circle 120 degrees apart, finds that circle's diameter, and transforms it back to a ratio. Like?? The math is mathing. ๐Ÿ˜ญ

---

- **`-volume-erode`** โ€” ERODE A VOLUME FILE

wb_command -volume-erode

<volume> - the volume to erode <distance> - distance in mm to erode <volume-out> - output - the output volume

[-roi] - assume voxels outside this roi are nonzero

<roi-volume> - volume file, positive values denote voxels that have data

[-subvolume] - select a single subvolume to dilate

<subvol> - the subvolume number or name


Around each voxel with a value of zero, it sets the surrounding voxels to zero. And "surrounding" here means all the face neighbors **and** all voxels within the specified distance (that's center to center, so it's not vibes-based, it's measured ๐Ÿ’…).

---

- **`-volume-estimate-fwhm`** โ€” ESTIMATE FWHM SMOOTHNESS OF A VOLUME

wb_command -volume-estimate-fwhm

<volume> - the input volume

[-roi] - use only data within an ROI

<roivol> - the volume to use as an ROI

[-subvolume] - select a single subvolume to estimate smoothness of

<subvol> - the subvolume number or name

[-whole-file] - estimate for the whole file at once, not each subvolume separately

[-demean] - subtract the mean image before estimating smoothness


This estimates the smoothness of the input volume in X, Y, and Z directions <purple>separately</purple>, printing the estimates to standard output, in mm as FWHM. And heads up: if you don't give it `-subvolume` or `-whole-file`, it estimates and displays each subvolume separately. Every single one. One at a time. She's thorough. ๐ŸŒธ

---

- **`-volume-extrema`** โ€” FIND EXTREMA IN A VOLUME FILE

wb_command -volume-extrema

<volume-in> - volume file to find the extrema of <distance> - the minimum distance between identified extrema of the same type <volume-out> - output - the output extrema volume

[-presmooth] - smooth the volume before finding extrema

<kernel> - the size of the gaussian smoothing kernel in mm, as sigma by default

[-fwhm] - kernel size is FWHM, not sigma

[-roi] - ignore values outside the selected area

<roi-volume> - the area to find extrema in

[-threshold] - ignore small extrema

<low> - the largest value to consider for being a minimum <high> - the smallest value to consider for being a maximum

[-sum-subvols] - output the sum of the extrema subvolumes instead of each subvolume separately

[-consolidate-mode] - use consolidation of local minima instead of a large neighborhood

[-only-maxima] - only find the maxima

[-only-minima] - only find the minima

[-subvolume] - select a single subvolume to find extrema in

<subvolume> - the subvolume number or name


Finds extrema in a volume file, such that no two extrema of the same type are within *`<distance>`* of each other. The extrema get labeled as `-1` for minima, `1` for maxima, and `0` otherwise. ๐ŸŽฏ If you say `-only-maxima` or `-only-minima`, it'll ignore extrema that aren't the type you asked for. And <red>these two options are mutually exclusive</red> โ€” pick a lane, bestie.

If `-sum-subvols` is specified, those extrema subvolumes get summed, and the output has a single subvolume with that result.

By default, a datapoint is an extrema only if it's more extreme than **every** other datapoint within *`<distance>`* from it. If you use `-consolidate-mode`, it does something different instead: it starts by finding all datapoints that are more extreme than their immediate neighbors, then while there are any extrema within *`<distance>`* of each other, it takes the two extrema closest to each other and merges them into one, by a weighted average based on how many original extrema have been merged into each. So it's giving โœจdiplomatic mergeโœจ.

And by default, all input subvolumes are used with no smoothing โ€” use `-subvolume` to specify a single subvolume to use, and `-presmooth` to smooth the input before finding the extrema.

---

- **`-volume-fill-holes`** โ€” FILL HOLES IN AN ROI VOLUME

wb_command -volume-fill-holes

<volume-in> - the input ROI volume <volume-out> - output - the output ROI volume


It finds all the face-connected parts that are **not** included in the ROI, and fills all but the largest one with ones. Simple, iconic, does exactly what it says on the tin. ๐Ÿ’–

---

- **`-volume-find-clusters`** โ€” FILTER CLUSTERS BY VOLUME

wb_command -volume-find-clusters

<volume-in> - the input volume <value-threshold> - threshold for data values <minimum-volume> - threshold for cluster volume, in mm^3 <volume-out> - output - the output volume

[-less-than] - find values less than <value-threshold>, rather than greater

[-roi] - select a region of interest

<roi-volume> - the roi, as a volume file

[-subvolume] - select a single subvolume

<subvol> - the subvolume number or name

[-size-ratio] - ignore clusters smaller than a given fraction of the largest cluster in map

<ratio> - fraction of the largest cluster's volume

[-distance] - ignore clusters further than a given distance from the largest cluster

<distance> - how far from the largest cluster a cluster can be, edge to edge, in mm

[-start] - start labeling clusters from a value other than 1

<startval> - the value to give the first cluster found


Outputs a volume with nonzero integers for all voxels within a large enough cluster, and zeros elsewhere. The integers denote cluster membership โ€” by default, the first cluster found uses value `1`, the second uses `2`, etc. ๐Ÿ‘‘

Important detail: cluster values are **not reused** across frames of the output, they just keep counting up. By default, values greater than *`<value-threshold>`* are considered to be in a cluster โ€” use `-less-than` to test for values **less** than the threshold instead. And if you want to apply this as a mask to the data, or do more complicated thresholding, go see `-volume-math`. ๐Ÿงฎ

---

- **`-volume-gradient`** โ€” GRADIENT OF A VOLUME FILE

wb_command -volume-gradient

<volume-in> - the input volume <volume-out> - output - the output gradient magnitude volume

[-presmooth] - smooth the volume before computing the gradient

<kernel> - the size of the gaussian smoothing kernel in mm, as sigma by default

[-fwhm] - kernel size is FWHM, not sigma

[-roi] - select a region of interest to take the gradient of

<roi-volume> - the region to take the gradient within

[-vectors] - output vectors

<vector-volume-out> - output - the vectors as a volume file

[-subvolume] - select a single subvolume to take the gradient of

<subvol> - the subvolume number or name


Computes the gradient of the volume by doing linear regressions for each voxel, considering only its face neighbors โ€” unless too few face neighbors exist, in which case it widens the net. The gradient vector is constructed from the partial derivatives of the resulting linear function, and the magnitude of this vector is the output. ๐Ÿ“ˆ If you specify it, the volume vector output is arranged with the x, y, and z components from a subvolume as consecutive subvolumes.

---

- **`-volume-label-export-table`** โ€” EXPORT LABEL TABLE FROM VOLUME AS TEXT

wb_command -volume-label-export-table

<label-in> - the input volume label file <map> - the number or name of the label map to use <table-out> - output - the output text file


Takes the label table from the volume label map, and writes it out to a text format matching what `-volume-label-import` expects. Round trip, babes. ๐Ÿ”

---

- **`-volume-label-import`** โ€” IMPORT A LABEL VOLUME TO WORKBENCH FORMAT

wb_command -volume-label-import

<input> - the input volume file <label-list-file> - text file containing the values and names for labels <output> - output - the output workbench label volume

[-discard-others] - set any voxels with values not mentioned in the label list to the ??? label

[-unlabeled-value] - set the value that will be interpreted as unlabeled

<value> - the numeric value for unlabeled (default 0)

[-subvolume] - select a single subvolume to import

<subvol> - the subvolume number or name

[-drop-unused-labels] - remove any unused label values from the label table


Creates a label volume from an integer-valued volume file. The label

<pink>...the name and color info</pink> gets stored in the volume header inside a nifti extension, in a format that's basically the same as caret5's โ€” peep `-volume-help` for the deets. Also you can literally hand it the empty string (use `""`) for `<label-list-file>` and it'll be treated like an empty file, no biggie. ๐Ÿ’… The label list file has GOT to look like this (2 lines per label, bestie):

<labelname> <key> <alpha> ...


Label names get their own line, separate from their value and color, and that's on purpose so label names can contain spaces ๐Ÿซถ. Whitespace is trimmed off both ends of the label name, but it's kept if it's chillin' in the middle of a label. Do <red>NOT</red> put the `"unlabeled"` key in the file โ€” it's assumed that `0` means not labeled unless you pass `-unlabeled-value`. The value of `<key>` says which value in the imported file should be used as this label (those same key values also get used in the output file). And `<red>`, `<green>`, `<blue>` and `<alpha>` have to be integers from 0 to 255, and they set the color the label is drawn as (alpha of 255 means fully opaque, which is probably the vibe you want ๐Ÿ’–).

By default it'll cook up brand new label names like `LABEL_5` for any values it bumps into that aren't mentioned in the list file โ€” pass `-discard-others` if you'd rather set those values to the `"unlabeled"` key instead.

---

- **`-volume-label-modify-keys`** โ€” <purple>CHANGE KEY VALUES IN A VOLUME LABEL FILE</purple> ๐Ÿ”‘

wb_command -volume-label-modify-keys <volume-in> <remap-file> <volume-out> [-subvolume] <subvolume>


  - `<volume-in>` โ€” the input volume label file
  - `<remap-file>` โ€” text file with old and new key values
  - `<volume-out>` โ€” output โ€” the output volume label file
  - `[-subvolume]` โ€” select a single subvolume
    - `<subvolume>` โ€” the subvolume number or name

  `<remap-file>` should have lines of the form `'oldkey newkey'`, like so:

3 5 5 8 8 2


  This would change the current label with key `'3'` to use the key `'5'` instead, `5` would use `8`, and `8` would use `2`. <yellow>Any collision in key values</yellow> results in the label that was *not* specified in the remap file getting remapped to an otherwise unused key. Remapping more than one key to the same new key, or the same key to more than one new key, results in an <red>error</red> ๐Ÿ˜ญ. And this will <hotpink>not</hotpink> change how the file looks when displayed, since it changes the key values in the data at the same time. Iconic.

---

- **`-volume-label-probability`** โ€” <purple>FIND FREQUENCY OF VOLUME LABELS</purple> ๐Ÿ“Š

wb_command -volume-label-probability <label-maps> <probability-out> [-exclude-unlabeled]


  - `<label-maps>` โ€” volume label file containing individual label maps from many subjects
  - `<probability-out>` โ€” output โ€” the relative frequencies of each label at each voxel
  - `[-exclude-unlabeled]` โ€” don't make a probability map of the unlabeled key

  This command outputs a set of soft ROIs, one for each label in the input, where the value is how many of the input maps had that label at that voxel, divided by the number of input maps. Math girlies rise up โœจ

---

- **`-volume-label-to-roi`** โ€” <purple>MAKE A VOLUME LABEL INTO AN ROI VOLUME</purple> ๐ŸŽฏ

wb_command -volume-label-to-roi <label-in> <volume-out> [-name <label-name>] [-key <label-key>] [-map <map>]


  - `<label-in>` โ€” the input volume label file
  - `<volume-out>` โ€” output โ€” the output volume file
  - `[-name]` โ€” select label by name
    - `<label-name>` โ€” the label name that you want an roi of
  - `[-key]` โ€” select label by key
    - `<label-key>` โ€” the label key that you want an roi of
  - `[-map]` โ€” select a single label map to use
    - `<map>` โ€” the map number or name

  For each map in `<label-in>`, a map is created in `<volume-out>` where all locations labeled with `<label-name>` or with a key of `<label-key>` get a value of `1`, and all other locations get `0`. <hotpink>Exactly one</hotpink> of `-name` and `-key` must be specified, fr fr. Specify `-map` to use only one map from `<label-in>`.

---

- **`-volume-label-to-surface-mapping`** โ€” <purple>MAP A LABEL VOLUME TO A SURFACE LABEL FILE</purple> ๐Ÿฆ‹

wb_command -volume-label-to-surface-mapping <volume> <surface> <label-out> [-ribbon-constrained <inner-surf> <outer-surf>] [-volume-roi <roi-volume>] [-voxel-subdiv <subdiv-num>] [-thin-columns] [-subvol-select <subvol>]


  - `<volume>` โ€” the volume to map data from
  - `<surface>` โ€” the surface to map the data onto
  - `<label-out>` โ€” output โ€” the output gifti label file
  - `[-ribbon-constrained]` โ€” use ribbon constrained mapping algorithm
    - `<inner-surf>` โ€” the inner surface of the ribbon
    - `<outer-surf>` โ€” the outer surface of the ribbon
  - `[-volume-roi]` โ€” use a volume roi
    - `<roi-volume>` โ€” the volume file
  - `[-voxel-subdiv]` โ€” voxel divisions while estimating voxel weights
    - `<subdiv-num>` โ€” number of subdivisions, default `3`
  - `[-thin-columns]` โ€” use non-overlapping polyhedra
  - `[-subvol-select]` โ€” select a single subvolume to map
    - `<subvol>` โ€” the subvolume number or name

  Map label volume data to a surface. If `-ribbon-constrained` is <red>not</red> specified, it uses the enclosing voxel method. The ribbon mapping method constructs a polyhedron from the vertex's neighbors on each surface, and estimates the amount of this polyhedron's volume that falls inside any nearby voxels, to use as the weights for a popularity comparison. If `-thin-columns` is specified, the polyhedron uses the edge midpoints and triangle centroids, so that neighboring vertices don't have overlapping polyhedra. This may require increasing `-voxel-subdiv` to get enough samples in each voxel to reliably land inside these smaller polyhedra. The volume ROI is useful to exclude partial volume effects of voxels the surfaces pass through, and will cause the mapping to ignore voxels that don't have a positive value in the mask. The subdivision number specifies how it approximates the amount of the volume the polyhedron intersects, by splitting each voxel into NxNxN pieces, and checking whether the center of each piece is inside the polyhedron. If you have very large voxels, consider increasing this if you get unexpected unlabeled vertices in your output ๐Ÿ‘€

---

- **`-volume-math`** โ€” <purple>EVALUATE EXPRESSION ON VOLUME FILES</purple> ๐Ÿงฎ

wb_command -volume-math <expression> <volume-out> [-fixnan <replace>] [-var <name> <volume>] [-subvolume <subvol>] [-repeat]


  - `<expression>` โ€” the expression to evaluate, in quotes
  - `<volume-out>` โ€” output โ€” the output volume
  - `[-fixnan]` โ€” replace NaN results with a value
    - `<replace>` โ€” value to replace NaN with
  - `[-var]` โ€” repeatable โ€” a volume file to use as a variable
    - `<name>` โ€” the name of the variable, as used in the expression
    - `<volume>` โ€” the volume file to use as this variable
  - `[-subvolume]` โ€” select a single subvolume
    - `<subvol>` โ€” the subvolume number or name
  - `[-repeat]` โ€” reuse a single subvolume for each subvolume of calculation

  This command evaluates `<expression>` at each voxel independently. There <hotpink>must</hotpink> be at least one `-var` option (to get the volume space from), even if the `<name>` specified in it isn't used in `<expression>`. All volumes must have the same volume space. Filenames are <red>not</red> valid in `<expression>` โ€” use a variable name and a `-var` option with matching `<name>` to specify an input file. If the `-subvolume` option is given to any `-var` option, only one subvolume is used from that file. If `-repeat` is specified, the file must either have only one subvolume, or have the `-subvolume` option specified. All files that don't use `-repeat` must have the same number of subvolumes requested to be used. The format of `<expression>` is as follows:

  Expressions consist of constants, variables, operators, parentheses, and functions, in infix notation, such as `'exp(-x + 3) * scale'`. Variables are strings of any length, using the characters `a-z`, `A-Z`, `0-9`, and `_`, but they may not take the name of a named constant. Currently there's only one named constant, `PI`. The operators are `+`, `-`, `*`, `/`, `^`, `>`, `<`, `>=`, `<=`, `==`, `!=`, `!`, `&&`, `||`. These behave as in C, except that `^` is exponentiation, i.e. `pow(x, y)`, and it takes higher precedence than other binary operators (also, `'-3^-4^-5'` means `'-(3^(-(4^-5)))'`). The `<=`, `>=`, `==`, and `!=` operators are given a small amount of wiggle room, equal to one millionth of the smaller of the absolute values of the values being compared. ๐ŸŒˆ

  Comparison and logical operators return `0` or `1`, and you can do masking with expressions like `'x * (mask > 0)'`. For all logical operators, an input is considered true iff it's greater than `0`. The expression `'0 < x < 5'` is not syntactically wrong, but it will <red>NOT</red> do what is desired, because it's evaluated left to right, i.e. `'((0 < x) < 5)'`, which will always return `1`, as both possible results of a comparison are less than `5`. A warning is generated if an expression of this type is detected. Use something like `'x > 0 && x < 5'` to get the desired behavior, bestie ๐Ÿ˜ญ

  Whitespace between elements is ignored, `' sin ( 2 * x ) '` is equivalent to `'sin(2*x)'`, but `'s in(2*x)'` is an <red>error</red>. Implied multiplication is <hotpink>not</hotpink> allowed โ€” the expression `'2x'` will be parsed as a variable. Parentheses are `()`, do not use `[]` or `{}`. Functions require parentheses, the expression `'sin x'` is an <red>error</red>.

  The following functions are supported:

  - `sin`: 1 argument, the sine of the argument (units are radians)
  - `cos`: 1 argument, the cosine of the argument (units are radians)
  - `tan`: 1 argument, the tangent of the argument (units are radians)
  - `asin`: 1 argument, the inverse of sine of the argument, in radians
  - `acos`: 1 argument, the inverse of cosine of the argument, in radians
  - `atan`: 1 argument, the inverse of tangent of the argument, in radians
  - `atan2`: 2 arguments, `atan2(y, x)` returns the inverse of tangent of `(y/x)`, in radians, determining quadrant by the sign of both arguments

- **`sinh`** โ€” 1 argument, the hyperbolic sine of the argument ๐ŸŒŠ
- **`cosh`** โ€” 1 argument, the hyperbolic cosine of the argument ๐ŸŒŠ
- **`tanh`** โ€” 1 argument, the hyperbolic tangent of the argument ๐ŸŒŠ
- **`asinh`** โ€” 1 argument, the inverse hyperbolic sine of the argument ๐Ÿ”„
- **`acosh`** โ€” 1 argument, the inverse hyperbolic cosine of the argument ๐Ÿ”„
- **`atanh`** โ€” 1 argument, the inverse hyperbolic tangent of the argument ๐Ÿ”„
- **`sinc`** โ€” 1 argument, `sinc(0) = 1`, `sin(x) / x` otherwise
- **`ln`** โ€” 1 argument, the natural logarithm of the argument ๐Ÿชต
- **`exp`** โ€” 1 argument, the constant e raised to the power of the argument โœจ
- **`log`** โ€” 1 argument, the base 10 logarithm of the argument ๐Ÿ”Ÿ
- **`log2`** โ€” 1 argument, the base 2 logarithm of the argument 2๏ธโƒฃ
- **`sqrt`** โ€” 1 argument, the square root of the argument ๐ŸŒฑ
- **`abs`** โ€” 1 argument, the absolute value of the argument
- **`floor`** โ€” 1 argument, the largest integer not greater than the argument โฌ‡๏ธ
- **`round`** โ€” 1 argument, the nearest integer, with ties rounded away from zero ๐Ÿ‘€
- **`ceil`** โ€” 1 argument, the smallest integer not less than the argument โฌ†๏ธ
- **`min`** โ€” 2 arguments, `min(x, y)` returns `y` if `(x > y)`, `x` otherwise
- **`max`** โ€” 2 arguments, `max(x, y)` returns `y` if `(x < y)`, `x` otherwise
- **`mod`** โ€” 2 arguments, `mod(x, y) = x - y * floor(x / y)`, or 0 if `y == 0`
- **`clamp`** โ€” 3 arguments, `clamp(x, low, high) = min(max(x, low), high)`

---

## ๐Ÿงฒ `-volume-merge` โ€” MERGE VOLUME FILES INTO A NEW FILE

okay so bestie, this one is the "glue a bunch of volumes together" button and it's lowkey iconic:

wb_command -volume-merge <volume-out> - output - the output volume file [-volume] - repeatable - specify an input volume file <volume-in> - a volume file to use subvolumes from [-subvolume] - repeatable - select a single subvolume to use <subvol> - the subvolume number or name [-up-to] - use an inclusive range of subvolumes <last-subvol> - the number or name of the last subvolume to include [-reverse] - use the range in reverse order


- **`<volume-out>`** โ€” output โ€” the output volume file ๐Ÿ’พ
- **`-volume`** โ€” repeatable โ€” specify an input volume file
  - **`<volume-in>`** โ€” a volume file to use subvolumes from
- **`-subvolume`** โ€” repeatable โ€” select a single subvolume to use
  - **`<subvol>`** โ€” the subvolume number or name
- **`-up-to`** โ€” use an inclusive range of subvolumes
  - **`<last-subvol>`** โ€” the number or name of the last subvolume to include
- **`-reverse`** โ€” use the range in reverse order ๐Ÿ”ƒ

<lavender>Takes one or more volume files and constructs a new volume file by concatenating subvolumes from them. The input volume files **must** have the same volume space.</lavender> like, no cap, they have to match, that's the vibe check.

Example time, periodt:

wb_command -volume-merge out.nii -volume first.nii -subvolume 1 -volume second.nii


This example would take the first subvolume from `first.nii`, followed by **all** subvolumes from `second.nii`, and write these to `out.nii`. chef's kiss ๐Ÿง‘โ€๐Ÿณ๐Ÿ’‹

---

## ๐ŸŽจ `-volume-palette` โ€” SET THE PALETTE OF A VOLUME FILE

glow-up time for your volume's colors ๐Ÿ’…

wb_command -volume-palette <volume> - the volume file to modify <mode> - the mapping mode [-subvolume] - select a single subvolume <subvolume> - the subvolume number or name [-pos-percent] - percentage min/max for positive data coloring <pos-min-%> - the percentile for the least positive data <pos-max-%> - the percentile for the most positive data [-neg-percent] - percentage min/max for negative data coloring <neg-min-%> - the percentile for the least negative data <neg-max-%> - the percentile for the most negative data [-pos-user] - user min/max values for positive data coloring <pos-min-user> - the value for the least positive data <pos-max-user> - the value for the most positive data [-neg-user] - user min/max values for negative data coloring <neg-min-user> - the value for the least negative data <neg-max-user> - the value for the most negative data [-interpolate] - interpolate colors <interpolate> - boolean, whether to interpolate [-disp-pos] - display positive data <display> - boolean, whether to display [-disp-neg] - display positive data <display> - boolean, whether to display [-disp-zero] - display data closer to zero than the min cutoff <display> - boolean, whether to display [-palette-name] - set the palette used <name> - the name of the palette [-thresholding] - set the thresholding <type> - thresholding setting <test> - show values inside or outside thresholds <min> - lower threshold <max> - upper threshold [-inversion] - specify palette inversion <type> - the type of inversion


- **`<volume>`** โ€” the volume file to modify
- **`<mode>`** โ€” the mapping mode
- **`-subvolume`** โ€” select a single subvolume
  - **`<subvolume>`** โ€” the subvolume number or name
- **`-pos-percent`** โ€” percentage min/max for positive data coloring
  - **`<pos-min-%>`** โ€” the percentile for the least positive data
  - **`<pos-max-%>`** โ€” the percentile for the most positive data
- **`-neg-percent`** โ€” percentage min/max for negative data coloring
  - **`<neg-min-%>`** โ€” the percentile for the least negative data
  - **`<neg-max-%>`** โ€” the percentile for the most negative data
- **`-pos-user`** โ€” user min/max values for positive data coloring
  - **`<pos-min-user>`** โ€” the value for the least positive data
  - **`<pos-max-user>`** โ€” the value for the most positive data
- **`-neg-user`** โ€” user min/max values for negative data coloring
  - **`<neg-min-user>`** โ€” the value for the least negative data
  - **`<neg-max-user>`** โ€” the value for the most negative data
- **`-interpolate`** โ€” interpolate colors
  - **`<interpolate>`** โ€” boolean, whether to interpolate
- **`-disp-pos`** โ€” display positive data
  - **`<display>`** โ€” boolean, whether to display
- **`-disp-neg`** โ€” display positive data
  - **`<display>`** โ€” boolean, whether to display
- **`-disp-zero`** โ€” display data closer to zero than the min cutoff
  - **`<display>`** โ€” boolean, whether to display
- **`-palette-name`** โ€” set the palette used
  - **`<name>`** โ€” the name of the palette
- **`-thresholding`** โ€” set the thresholding
  - **`<type>`** โ€” thresholding setting
  - **`<test>`** โ€” show values inside or outside thresholds
  - **`<min>`** โ€” lower threshold
  - **`<max>`** โ€” upper threshold
- **`-inversion`** โ€” specify palette inversion
  - **`<type>`** โ€” the type of inversion

> ๐Ÿšจ The original volume file is **overwritten** with the modified version. By default, **all** columns of the volume file are adjusted to the new settings, use the `-subvolume` option to change only one subvolume. Mapping settings not specified in options will be taken from the first subvolume.

The `<mode>` argument must be one of the following:

- `MODE_AUTO_SCALE`
- `MODE_AUTO_SCALE_ABSOLUTE_PERCENTAGE`
- `MODE_AUTO_SCALE_PERCENTAGE`
- `MODE_USER_SCALE`

The `<name>` argument to `-palette-name` must be one of the following โ€” and bestie, this menu is giving Cheesecake Factory, there are SO many:

ROY-BIG-BL videen_style Gray_Interp_Positive Gray_Interp PSYCH-FIXED RBGYR20 RBGYR20P RYGBR4_positive RGRBR_mirror90_pos Orange-Yellow POS_NEG_ZERO red-yellow blue-lightblue FSL power_surf black-red black-green black-blue black-red-positive black-green-positive black-blue-positive blue-black-green blue-black-red red-black-green fsl_red fsl_green fsl_blue fsl_yellow RedWhiteBlue cool-warm spectral RY-BC-BL magma JET256 PSYCH PSYCH-NO-NONE ROY-BIG clear_brain fidl raich4_clrmid raich6_clrmid HSB8_clrmid POS_NEG Special-RGB-Volume


The `<type>` argument to `-thresholding` must be one of the following:

- `THRESHOLD_TYPE_OFF`
- `THRESHOLD_TYPE_NORMAL`
- `THRESHOLD_TYPE_FILE`

The `<test>` argument to `-thresholding` must be one of the following:

- `THRESHOLD_TEST_SHOW_OUTSIDE`
- `THRESHOLD_TEST_SHOW_INSIDE`

The `<type>` argument to `-inversion` must be one of the following:

- `OFF`
- `POSITIVE_WITH_NEGATIVE`
- `POSITIVE_NEGATIVE_SEPARATE`

---

## ๐Ÿงด `-volume-parcel-resampling` โ€” SMOOTH AND RESAMPLE VOLUME PARCELS

smoothing AND resampling in one go, the multitasking queen ๐Ÿ‘‘

wb_command -volume-parcel-resampling <volume-in> - the input data volume <cur-parcels> - label volume of where the parcels currently are <new-parcels> - label volume of where the parcels should be <kernel> - gaussian kernel size in mm to smooth by during resampling, as sigma by default <volume-out> - output - output volume [-fix-zeros] - treat zero values as not being data [-fwhm] - smoothing kernel size is FWHM, not sigma [-subvolume] - select a single subvolume as input <subvol> - the subvolume number or name


- **`<volume-in>`** โ€” the input data volume
- **`<cur-parcels>`** โ€” label volume of where the parcels currently are
- **`<new-parcels>`** โ€” label volume of where the parcels should be
- **`<kernel>`** โ€” gaussian kernel size in mm to smooth by during resampling, as sigma by default
- **`<volume-out>`** โ€” output โ€” output volume
- **`-fix-zeros`** โ€” treat zero values as not being data
- **`-fwhm`** โ€” smoothing kernel size is FWHM, not sigma
- **`-subvolume`** โ€” select a single subvolume as input
  - **`<subvol>`** โ€” the subvolume number or name

<cyan>Smooths and resamples the region inside each label in `cur-parcels` to the region of the same label name in `new-parcels`.</cyan> Any voxels in the output label region but outside the input label region will be **extrapolated from nearby data**. The `-fix-zeros` option causes the smoothing to not use an input value if it is zero, but still write a smoothed value to the voxel, and after smoothing is complete, it will check for any remaining values of zero, and fill them in with extrapolated values. ๐Ÿซถ

> Note: all volumes must have the same dimensions and spacing. To use a different output space, see `-volume-parcel-resampling-generic`.

---

## ๐Ÿ›ธ `-volume-parcel-resampling-generic` โ€” SMOOTH AND RESAMPLE VOLUME PARCELS FROM DIFFERENT VOLUME SPACE

same energy as above but it does NOT care that your spaces match, it's flexible like that โœจ

wb_command -volume-parcel-resampling-generic <volume-in> - the input data volume <cur-parcels> - label volume of where the parcels currently are <new-parcels> - label volume of where the parcels should be <kernel> - gaussian kernel size in mm to smooth by during resampling, as sigma by default <volume-out> - output - output volume [-fwhm] - smoothing kernel size is FWHM, not sigma [-fix-zeros] - treat zero values as not being data [-subvolume] - select a single subvolume as input <subvol> - the subvolume number or name


- **`<volume-in>`** โ€” the input data volume
- **`<cur-parcels>`** โ€” label volume of where the parcels currently are
- **`<new-parcels>`** โ€” label volume of where the parcels should be
- **`<kernel>`** โ€” gaussian kernel size in mm to smooth by during resampling, as sigma by default
- **`<volume-out>`** โ€” output โ€” output volume
- **`-fwhm`** โ€” smoothing kernel size is FWHM, not sigma
- **`-fix-zeros`** โ€” treat zero values as not being data
- **`-subvolume`** โ€” select a single subvolume as input
  - **`<subvol>`** โ€” the subvolume number or name

Smooths and resamples the region inside each label in `cur-parcels` to the region of the same label name in `new-parcels`. Any voxels in the output label region but outside the input label region will be extrapolated from nearby data. The `-fix-zeros` option causes the smoothing to not use an input value if it is zero, but still write a smoothed value to the voxel, and after smoothing is complete, it will check for any remaining values of zero, and fill them in with extrapolated values. <mint>The output volume will use the volume space of `new-parcels`, which does not need to be in the same volume space as the input.</mint> ๐ŸŒˆ

---

## ๐Ÿซง `-volume-parcel-smoothing` โ€” SMOOTH PARCELS IN A VOLUME SEPARATELY

each parcel gets smoothed in its own lil bubble, no cross-contamination, we love boundaries ๐ŸŽ€

wb_command -volume-parcel-smoothing <data-volume> - the volume to smooth <label-volume> - a label volume containing the parcels to smooth <kernel> - the size of the gaussian smoothing kernel in mm, as sigma by default <volume-out> - output - the output volume [-fwhm] - smoothing kernel size is FWHM, not sigma [-fix-zeros] - treat zero values as not being data [-subvolume] - select a single subvolume to smooth <subvol> - the subvolume number or name


- **`<data-volume>`** โ€” the volume to smooth
- **`<label-volume>`** โ€” a label volume containing the parcels to smooth
- **`<kernel>`** โ€” the size of the gaussian smoothing kernel in mm, as sigma by default
- **`<volume-out>`** โ€” output โ€” the output volume
- **`-fwhm`** โ€” smoothing kernel size is FWHM, not sigma
- **`-fix-zeros`** โ€” treat zero values as not being data
- **`-subvolume`** โ€” select a single subvolume to smooth
  - **`<subvol>`** โ€” the subvolume number or name

<lavender>The volume is smoothed within each label in the label volume using data **only** from within the label.</lavender> Equivalent to running volume smoothing with ROIs matching each label separately, then adding the resulting volumes, but **faster**. iykyk, speedrun strats ๐Ÿƒโ€โ™€๏ธ๐Ÿ’จ

---

## ๐Ÿงฎ `-volume-reduce` โ€” PERFORM REDUCTION OPERATION ACROSS SUBVOLUMES

squish all your subvolumes down into one, like folding laundry but math ๐Ÿงบ

wb_command -volume-reduce <volume-in> - the volume file to reduce <operation> - the reduction operator to use <volume-out> - output - the output volume [-exclude-outliers] - exclude non-numeric values and outliers by standard deviation <sigma-below> - number of standard deviations below the mean to include <sigma-above> - number of standard deviations above the mean to include [-only-numeric] - exclude non-numeric values


- **`<volume-in>`** โ€” the volume file to reduce
- **`<operation>`** โ€” the reduction operator to use
- **`<volume-out>`** โ€” output โ€” the output volume
- **`-exclude-outliers`** โ€” exclude non-numeric values and outliers by standard deviation
  - **`<sigma-below>`** โ€” number of standard deviations below the mean to include
  - **`<sigma-above>`** โ€” number of standard deviations above the mean to include
- **`-only-numeric`** โ€” exclude non-numeric values

For each voxel, takes the data across subvolumes as a vector, and performs the specified reduction on it, putting the result into the single output volume at that voxel. <hotpink>The reduction operators are as follows:</hotpink> ๐Ÿ‘€

<lavender>okay so picking up right where we left off โ€” the rest of the operation menu, served fresh, no skips:</lavender>

- **`MAX`** โ€” <pink>the maximum value</pink> ๐Ÿ‘‘
- **`MIN`** โ€” the minimum value
- **`INDEXMAX`** โ€” the <yellow>1-based</yellow> index of the maximum value
- **`INDEXMIN`** โ€” the 1-based index of the minimum value
- **`SUM`** โ€” add all values
- **`PRODUCT`** โ€” multiply all values
- **`MEAN`** โ€” the mean of the data
- **`STDEV`** โ€” the standard deviation (N denominator)
- **`SAMPSTDEV`** โ€” the sample standard deviation (N-1 denominator)
- **`VARIANCE`** โ€” the variance of the data
- **`TSNR`** โ€” mean divided by sample standard deviation (N-1 denominator)
- **`COV`** โ€” sample standard deviation (N-1 denominator) divided by mean
- **`L2NORM`** โ€” square root of sum of squares
- **`MEDIAN`** โ€” the median of the data
- **`MODE`** โ€” the mode of the data
- **`COUNT_NONZERO`** โ€” the number of nonzero elements in the data

---

## ๐Ÿ๏ธ `-volume-remove-islands` โ€” REMOVE ISLANDS FROM AN ROI VOLUME

wb_command -volume-remove-islands

<volume-in> - the input ROI volume <volume-out> - output - the output ROI volume


- **`<volume-in>`** โ€” the input ROI volume, bestie ๐Ÿซถ
- **`<volume-out>`** โ€” <hotpink>output</hotpink> โ€” the output ROI volume

okay so what it does: it finds <purple>all face-connected parts of the ROI</purple>, and zeros out all but the largest one. bye bye lil islands ๐Ÿ’€

---

## ๐Ÿ”„ `-volume-reorient` โ€” CHANGE VOXEL ORDER OF A VOLUME FILE

wb_command -volume-reorient

<volume> - the volume to reorient <orient-string> - the desired orientation <volume-out> - out - the reoriented volume


- **`<volume>`** โ€” the volume to reorient
- **`<orient-string>`** โ€” the desired orientation
- **`<volume-out>`** โ€” <hotpink>out</hotpink> โ€” the reoriented volume

Changes the voxel order <pink>and</pink> the header spacing/origin information such that the value of any spatial point is unchanged. fr fr, nothing moves, it just gets *described* differently.

Orientation strings look like `'LPI'` โ€” which means first index is left to right, second is posterior to anterior, and third is inferior to superior. The valid characters are:

- **`L`** โ€” left to right
- **`R`** โ€” right to left
- **`P`** โ€” posterior to anterior
- **`A`** โ€” anterior to posterior
- **`I`** โ€” inferior to superior
- **`S`** โ€” superior to inferior

---

## ๐ŸŒ€ `-volume-resample` โ€” TRANSFORM AND RESAMPLE A VOLUME FILE

wb_command -volume-resample

<volume-in> - volume to resample <volume-space> - a volume file in the volume space you want for the output <method> - the resampling method <volume-out> - output - the output volume


- **`<volume-in>`** โ€” volume to resample
- **`<volume-space>`** โ€” a volume file in the volume space you want for the output โœจ
- **`<method>`** โ€” the resampling method
- **`<volume-out>`** โ€” <hotpink>output</hotpink> โ€” the output volume

### the transform flags, and yes they stack

- **`-affine`** โ€” repeatable โ€” add an affine transform
  - **`<affine>`** โ€” the affine file to use
- **`-flirt`** โ€” <red>MUST</red> be used if affine is a flirt affine
  - **`<source-volume>`** โ€” the source volume used when generating the affine
  - **`<target-volume>`** โ€” the target volume used when generating the affine
- **`-affine-series`** โ€” repeatable โ€” add an independent affine per-frame
  - **`<affine-series>`** โ€” text file containing `12` or `16` numbers per line, each being a row-major flattened affine
- **`-flirt`** โ€” <red>MUST</red> be used if the affines are flirt affines
  - **`<source-volume>`** โ€” the source volume used when generating the affine
  - **`<target-volume>`** โ€” the target volume used when generating the affine
- **`-warp`** โ€” repeatable โ€” add a nonlinear warpfield transform
  - **`<warpfield>`** โ€” the warpfield file
- **`-fnirt`** โ€” <red>MUST</red> be used if using a fnirt warpfield
  - **`<source-volume>`** โ€” the source volume used when generating the warpfield

Resample a volume file with an arbitrary list of transformations. You may specify `-affine`, `-warp`, and `-affine-series` multiple times each, and they will be used <purple>in the order specified</purple>. For instance, for rigid motion correction followed by nonlinear atlas registration, specify `-affine-series` first, then `-warp`.

The recommended methods are `CUBIC` (cubic spline) for most data, and `ENCLOSING_VOXEL` for label data. The parameter `<method>` must be one of:

- **`CUBIC`**
- **`ENCLOSING_VOXEL`**
- **`TRILINEAR`**

---

## ๐ŸŒŸ `-volume-rois-from-extrema` โ€” CREATE VOLUME ROI MAPS FROM EXTREMA MAPS

wb_command -volume-rois-from-extrema

<volume-in> - the input volume <limit> - distance limit from voxel center, in mm <volume-out> - output - the output volume


- **`<volume-in>`** โ€” the input volume
- **`<limit>`** โ€” distance limit from voxel center, in mm ๐Ÿ“
- **`<volume-out>`** โ€” <hotpink>output</hotpink> โ€” the output volume

### the optional bits ๐ŸŽ€

- **`-gaussian`** โ€” generate a gaussian kernel instead of a flat ROI
  - **`<sigma>`** โ€” the sigma for the gaussian kernel, in mm
- **`-roi`** โ€” select a region of interest to use
  - **`<roi-volume>`** โ€” the region to use
- **`-overlap-logic`** โ€” how to handle overlapping ROIs, default `ALLOW`
  - **`<method>`** โ€” the method of resolving overlaps
- **`-subvolume`** โ€” select a single subvolume to take the gradient of
  - **`<subvol>`** โ€” the subvolume number or name

For each nonzero value in each map, make a map with an ROI around that location. If the `-gaussian` option is specified, then <purple>normalized gaussian kernels</purple> are output instead of ROIs.

The `<method>` argument to `-overlap-logic` must be one of `ALLOW`, `CLOSEST`, or `EXCLUDE`. Here's the tea on each:

- **`ALLOW`** is the default, and means that ROIs are treated independently and may overlap.
- **`CLOSEST`** means that ROIs may not overlap, and that no ROI contains vertices that are closer to a different seed vertex.
- **`EXCLUDE`** means that ROIs may not overlap, and that any vertex within range of more than one ROI does not belong to any ROI.

---

## ๐Ÿงญ `-volume-set-space` โ€” CHANGE VOLUME SPACE INFORMATION

wb_command -volume-set-space

<volume-in> - the input volume <volume-out> - output - the output volume


- **`<volume-in>`** โ€” the input volume
- **`<volume-out>`** โ€” <hotpink>output</hotpink> โ€” the output volume

### pick your flavor of spacing info ๐Ÿ“

- **`-plumb`** โ€” set via axis order and spacing/offset
  - **`<axis-order>`** โ€” a string like `'XYZ'` that specifies which index is along which spatial dimension
  - **`<x-spacing>`** โ€” change in x-coordinate from incrementing the relevant index
  - **`<y-spacing>`** โ€” change in y-coordinate from incrementing the relevant index
  - **`<z-spacing>`** โ€” change in z-coordinate from incrementing the relevant index
  - **`<x-offset>`** โ€” the x-coordinate of the first voxel
  - **`<y-offset>`** โ€” the y-coordinate of the first voxel
  - **`<z-offset>`** โ€” the z-coordinate of the first voxel
- **`-sform`** โ€” set via a nifti sform
  - **`<xi-spacing>`** โ€” increase in x coordinate from incrementing the i index
  - **`<xj-spacing>`** โ€” increase in x coordinate from incrementing the j index
  - **`<xk-spacing>`** โ€” increase in x coordinate from incrementing the k index
  - **`<x-offset>`** โ€” x coordinate of first voxel
  - **`<yi-spacing>`** โ€” increase in y coordinate from incrementing the i index
  - **`<yj-spacing>`** โ€” increase in y coordinate from incrementing the j index
  - **`<yk-spacing>`** โ€” increase in y coordinate from incrementing the k index
  - **`<y-offset>`** โ€” y coordinate of first voxel
  - **`<zi-spacing>`** โ€” increase in z coordinate from incrementing the i index
  - **`<zj-spacing>`** โ€” increase in z coordinate from incrementing the j index
  - **`<zk-spacing>`** โ€” increase in z coordinate from incrementing the k index
  - **`<z-offset>`** โ€” z coordinate of first voxel
- **`-file`** โ€” copy spacing info from volume file with matching dimensions
  - **`<volume-ref>`** โ€” volume file to use for reference space
- **`-ignore-dims`** โ€” copy the spacing info even if the dimensions don't match

Writes a copy of the volume file, with the spacing information changed as specified. <yellow>No reordering of the voxel data occurs</yellow> โ€” see `-volume-reorient` to change the volume indexing order and reorder the voxels to match.

> โš ๏ธ <red>Exactly one of `-plumb`, `-sform`, or `-file` must be specified.</red> Not zero, not two. One. ๐Ÿ’…

---

## ๐Ÿงˆ `-volume-smoothing` โ€” SMOOTH A VOLUME FILE

wb_command -volume-smoothing

<volume-in> - the volume to smooth <kernel> - the size of the gaussian smoothing kernel in mm, as sigma by default <volume-out> - output - the output volume


- **`<volume-in>`** โ€” the volume to smooth
- **`<kernel>`** โ€” the size of the gaussian smoothing kernel in mm, as sigma by default
- **`<volume-out>`** โ€” <hotpink>output</hotpink> โ€” the output volume

### the lil extras ๐Ÿฆ‹

- **`-fwhm`** โ€” kernel size is FWHM, not sigma
- **`-roi`** โ€” smooth only from data within an ROI
  - **`<roivol>`** โ€” the volume to use as an ROI
- **`-fix-zeros`** โ€” treat zero values as not being data
- **`-subvolume`** โ€” select a single subvolume to smooth
  - **`<subvol>`** โ€” the subvolume number or name

Gaussian smoothing for volumes. By default, smooths all subvolumes with no ROI โ€” if ROI is given, only positive voxels in the ROI volume have their values used, and all other voxels are set to zero. <purple>Smoothing a non-orthogonal volume will be significantly slower</purple>, because the operation cannot be separated into 1-dimensional smoothings without distorting the kernel shape. it's giving math ๐Ÿ˜ญ

The `-fix-zeros` option causes the smoothing to not use an input value if it is zero, but still write a smoothed value to the voxel. This is useful for zeros that indicate lack of information, preventing them from pulling down the intensity of nearby voxels, while giving the zero an extrapolated value. lowkey genius โœจ

---

## ๐Ÿ“Š `-volume-stats` โ€” SPATIAL STATISTICS ON A VOLUME FILE

wb_command -volume-stats

<volume-in> - the input volume


- **`<volume-in>`** โ€” the input volume

### the knobs ๐ŸŽ›๏ธ

- **`-reduce`** โ€” use a reduction operation
  - **`<operation>`** โ€” the reduction operation
- **`-percentile`** โ€” give the value at a percentile
  - **`<percent>`** โ€” the percentile to find, must be between `0` and `100`
- **`-subvolume`** โ€” only display output for one subvolume
  - **`<subvolume>`** โ€” the subvolume number or name
- **`-roi`** โ€” only consider data inside an roi
  - **`<roi-volume>`** โ€” the roi, as a volume file
- **`-match-maps`** โ€” each subvolume of input uses the corresponding subvolume from the roi file
- **`-show-map-name`** โ€” print map index and name before each output

For each subvolume of the input, a line of text is printed, resulting from the specified reduction or percentile operation. Use `-subvolume` to only give output for a single subvolume. If the `-roi` option is used without `-match-maps`, then each line will contain as many numbers as there are maps in the ROI file, separated by <yellow>tab characters</yellow>. ๐Ÿ“‘

> โš ๏ธ <red>Exactly one of `-reduce` or `-percentile` must be specified.</red> pick one, bestie ๐Ÿซถ

The argument to the `-reduce` option must be one of the following:

- **`MAX`** โ€” the maximum value
- **`MIN`** โ€” the minimum value
- **`INDEXMAX`** โ€” the 1-based index of the maximum value
- **`INDEXMIN`** โ€” the 1-based index of the minimum value
- **`SUM`** โ€” add all values
- **`PRODUCT`** โ€” multiply all values
- **`MEAN`** โ€” the mean of the data
- **`STDEV`** โ€” the standard deviation (N denominator)
- **`SAMPSTDEV`** โ€” the sample standard deviation (N-1 denominator)
- **`VARIANCE`** โ€” the variance of the data
- **`TSNR`** โ€” mean divided by sample standard deviation (N-1 denominator)
- **`COV`** โ€” sample standard deviation (N-1 denominator) divided by mean
- **`L2NORM`** โ€” square root of sum of squares
- **`MEDIAN`** โ€” the median of the data
- **`MODE`** โ€” the mode of the data
- **`COUNT_NONZERO`** โ€” the number of nonzero elements in the data

---

## ๐Ÿ”ฅ `-volume-tfce` โ€” DO TFCE ON A VOLUME FILE

wb_command -volume-tfce


okay so this one's just warming up โ€” the details are literally right around the corner, hold on ๐ŸŒˆ

- **`<volume-in>`** โ€” the volume you're running TFCE on, bestie
- **`<volume-out>`** โ€” output โ€” where the finished volume goes ๐Ÿ’–
- **`[-presmooth]`** โ€” smooth the volume before running TFCE
  - **`<kernel>`** โ€” the size of the gaussian smoothing kernel in mm, as sigma by default
- **`[-fwhm]`** โ€” smoothing kernel size is FWHM, not sigma
- **`[-roi]`** โ€” pick a region of interest to run TFCE on
  - **`<roi-volume>`** โ€” the area to run TFCE on, as a volume
- **`[-parameters]`** โ€” set parameters for the TFCE integral
  - **`<E>`** โ€” exponent for cluster volume (default 0.5)
  - **`<H>`** โ€” exponent for threshold value (default 2.0)
- **`[-subvolume]`** โ€” select a single subvolume
  - **`<subvolume>`** โ€” the subvolume number or name

<yellow>This command does not do any statistical analysis.</yellow> Please use something like PALM if you are just trying to do statistics on your data. <pink>fr fr, it's just doing the mapping thing, not the math thing.</pink>

Threshold-free cluster enhancement (TFCE for the girlies who abbreviate everything) is a method to increase the relative value of regions that would form clusters in a standard thresholding test. This is accomplished by evaluating the integral of:

e(h, p)^E * h^H * dh


at each voxel `p`, where `h` ranges from 0 to the maximum value in the data, and `e(h, p)` is the extent of the cluster containing voxel `p` at threshold `h`. Negative values are similarly enhanced by negating the data, running the same process, and negating the result. <purple>(negate, enhance, un-negate โ€” the little transformation sandwich, iconic.)</purple>

This method is explained in: Smith SM, Nichols TE., "Threshold-free cluster enhancement: addressing problems of smoothing, threshold dependence and localisation in cluster inference." Neuroimage. 2009 Jan 1;44(1):83-98. PMID: 18501637

---

## <rainbow>-volume-to-surface-mapping</rainbow> MAP VOLUME TO SURFACE

wb_command -volume-to-surface-mapping


- **`<volume>`** โ€” the volume to map data from
- **`<surface>`** โ€” the surface to map the data onto
- **`<metric-out>`** โ€” output โ€” the output metric file

- **`[-trilinear]`** โ€” use trilinear volume interpolation
- **`[-enclosing]`** โ€” use value of the enclosing voxel
- **`[-cubic]`** โ€” use cubic splines
- **`[-ribbon-constrained]`** โ€” use ribbon constrained mapping algorithm
  - **`<inner-surf>`** โ€” the inner surface of the ribbon
  - **`<outer-surf>`** โ€” the outer surface of the ribbon
- **`[-volume-roi]`** โ€” use a volume roi
  - **`<roi-volume>`** โ€” the roi volume file
- **`[-weighted]`** โ€” treat the roi values as weightings rather than binary
- **`[-voxel-subdiv]`** โ€” voxel divisions while estimating voxel weights
  - **`<subdiv-num>`** โ€” number of subdivisions, default 3
- **`[-thin-columns]`** โ€” use non-overlapping polyhedra
- **`[-gaussian]`** โ€” reduce weight to voxels that aren't near `<surface>`
  - **`<scale>`** โ€” value to multiply the local thickness by, to get the gaussian sigma
- **`[-interpolate]`** โ€” instead of a weighted average of voxels, interpolate at subpoints inside the ribbon
  - **`<method>`** โ€” interpolation method, must be CUBIC, ENCLOSING_VOXEL, or TRILINEAR
- **`[-bad-vertices-out]`** โ€” output an ROI of which vertices didn't intersect any valid voxels
  - **`<roi-out>`** โ€” output โ€” the output metric file of vertices that have no data
- **`[-output-weights]`** โ€” write the voxel weights for a vertex to a volume file
  - **`<vertex>`** โ€” the vertex number to get the voxel weights for, 0-based
  - **`<weights-out>`** โ€” output โ€” volume to write the weights to
- **`[-output-weights-text]`** โ€” write the voxel weights for all vertices to a text file
  - **`<text-out>`** โ€” output โ€” the output text filename
- **`[-myelin-style]`** โ€” use the method from myelin mapping
  - **`<ribbon-roi>`** โ€” an roi volume of the cortical ribbon for this hemisphere
  - **`<thickness>`** โ€” a metric file of cortical thickness
  - **`<sigma>`** โ€” gaussian kernel in mm for weighting voxels within range
- **`[-legacy-bug]`** โ€” emulate old v1.2.3 and earlier code that didn't follow a cylinder cutoff
- **`[-subvol-select]`** โ€” select a single subvolume to map
  - **`<subvol>`** โ€” the subvolume number or name

<cyan>You must specify exactly one mapping method.</cyan> Enclosing voxel uses the value from the voxel the vertex lies inside, while trilinear does a 3D linear interpolation based on the voxels immediately on each side of the vertex's position.

The ribbon mapping method constructs a polyhedron from the vertex's neighbors on each surface, and estimates the amount of this polyhedron's volume that falls inside any nearby voxels, to use as the weights for sampling. If `-thin-columns` is specified, the polyhedron uses the edge midpoints and triangle centroids, so that neighboring vertices do not have overlapping polyhedra. This may require increasing `-voxel-subdiv` to get enough samples in each voxel to reliably land inside these smaller polyhedra. The volume ROI is useful to exclude partial volume effects of voxels the surfaces pass through, and will cause the mapping to ignore voxels that don't have a positive value in the mask. The subdivision number specifies how it approximates the amount of the volume the polyhedron intersects, by splitting each voxel into NxNxN pieces, and checking whether the center of each piece is inside the polyhedron. If you have very large voxels, consider increasing this if you get zeros in your output. <peach>(zeros in your output? not the vibe. bump that subdiv number.)</peach> The `-gaussian` option makes it act more like the myelin method, where the distance of a voxel from `<surface>` is used to downweight the voxel. The `-interpolate` suboption, instead of doing a weighted average of voxels, interpolates from the volume at the subdivided points inside the ribbon. If using both `-interpolate` and the `-weighted` suboption to `-volume-roi`, the roi volume weights are linearly interpolated, unless the `-interpolate` method is ENCLOSING_VOXEL, in which case ENCLOSING_VOXEL is also used for sampling the roi volume weights.

The myelin style method uses part of the caret5 myelin mapping command to do the mapping: for each surface vertex, take all voxels that are in a cylinder with radius and height equal to cortical thickness, centered on the vertex and aligned with the surface normal, and that are also within the ribbon ROI, and apply a gaussian kernel with the specified sigma to them to get the weights to use. The `-legacy-bug` flag reverts to the unintended behavior present from the initial implementation up to and including v1.2.3, which had only the tangential cutoff and a bounding box intended to be larger than where the cylinder cutoff should have been. <red>lowkey a bug, but the flag says "bug" so bestie, you know what you're signing up for.</red>

---

## <rainbow>-volume-vector-operation</rainbow> DO A VECTOR OPERATION ON VOLUME FILES

wb_command -volume-vector-operation


- **`<vectors-a>`** โ€” first vector input file
- **`<vectors-b>`** โ€” second vector input file
- **`<operation>`** โ€” what vector operation to do
- **`<volume-out>`** โ€” output โ€” the output file

- **`[-normalize-a]`** โ€” normalize vectors of first input
- **`[-normalize-b]`** โ€” normalize vectors of second input
- **`[-normalize-output]`** โ€” normalize output vectors (not valid for dot product)
- **`[-magnitude]`** โ€” output the magnitude of the result (not valid for dot product)

Does a vector operation on two volume files (that must have a multiple of 3 subvolumes). Either of the inputs may have multiple vectors (more than 3 subvolumes), but not both (at least one must have exactly 3 subvolumes). The `-magnitude` and `-normalize-output` options may not be specified together, or with the DOT operation. <purple>the rules are the rules, bestie.</purple> The `<operation>` parameter must be one of the following:

DOT CROSS ADD SUBTRACT


---

## <rainbow>-volume-warpfield-affine-regression</rainbow> REGRESS AFFINE FROM WARPFIELD

wb_command -volume-warpfield-affine-regression


- **`<warpfield>`** โ€” the input warpfield
- **`<affine-out>`** โ€” output โ€” the output affine file

- **`[-roi]`** โ€” only consider voxels within a mask (e.g., a brain mask)
  - **`<roi-vol>`** โ€” the mask volume
- **`[-fnirt]`** โ€” input is a fnirt warpfield
  - **`<source-volume>`** โ€” the source volume used when generating the fnirt warpfield
- **`[-flirt-out]`** โ€” write output as a flirt matrix rather than a world coordinate transform
  - **`<source-volume>`** โ€” the volume you want to apply the transform to
  - **`<target-volume>`** โ€” the target space you want the transformed volume to match

For all voxels in the warpfield, do a regression that predicts the post-warp coordinate from the source coordinate. When `-roi` is specified, only consider voxels with a value greater than 0 in `<roi-vol>`.

The default is to expect the warpfield to be in relative world coordinates (mm space), and to write the output as a world affine (mm space to mm space). If you are using FSL-created files and utilities, specify `-fnirt` and `-flirt` as needed, as their coordinate conventions are different. <yellow>iykyk โ€” FSL does its own thing and you gotta tell wb_command about it.</yellow>

---

## <rainbow>-volume-weighted-stats</rainbow> WEIGHTED SPATIAL STATISTICS ON A VOLUME FILE

wb_command -volume-weighted-stats


- **`<volume-in>`** โ€” the input volume

- **`[-weight-volume]`** โ€” use weights from a volume file
  - **`<weight-volume>`** โ€” volume file containing the weights
- **`[-match-maps]`** โ€” each subvolume of input uses the corresponding subvolume from the weights file
- **`[-subvolume]`** โ€” only display output for one subvolume
  - **`<subvolume>`** โ€” the subvolume number or name
- **`[-roi]`** โ€” only consider data inside an roi
  - **`<roi-volume>`** โ€” the roi, as a volume file
- **`[-match-maps]`** โ€” each subvolume of input uses the corresponding subvolume from the roi file
- **`[-mean]`** โ€” compute weighted mean
- **`[-stdev]`** โ€” compute weighted standard deviation
- **`[-sample]`** โ€” estimate population stdev from the sample
- **`[-percentile]`** โ€” compute weighted percentile
  - **`<percent>`** โ€” the percentile to find, must be between 0 and 100
- **`[-sum]`** โ€” compute weighted sum
- **`[-show-map-name]`** โ€” print map index and name before each output

<pink>For each subvolume</pink> of the input, you get a line of text printed out, and that line is whatever the operation you picked spits out. โœจ If you don't specify `-weight-volume`, then each voxel's volume is what gets used, periodt. Wanna only get output for a single subvolume? Pass `-subvolume`, done. And heads up bestie: if you use the `-roi` option <hotpink>without</hotpink> `-match-maps`, then each line will contain as many numbers as there are maps in the ROI file, separated by tab characters. tab-separated slay ๐Ÿ’…

> <red>Exactly one</red> of `-mean`, `-stdev`, `-percentile` or `-sum` must be specified. one. not two. not zero. that's the vibe check and you will fail it if you pick wrong ๐Ÿ˜ญ

And using `-sum` without `-weight-volume` is equivalent to integrating with respect to volume. that's it, that's the tea ๐Ÿ“

---

- **`-wbsparse-merge-dense`** โ€” MERGE WBSPARSE FILES ALONG DENSE DIMENSION ๐ŸŒˆ

wb_command -wbsparse-merge-dense


- **`<direction>`** โ€” which dimension to merge along, `ROW` or `COLUMN` ๐Ÿงญ
- **`<wbsparse-out>`** โ€” *output* โ€” the output wbsparse file ๐Ÿ’พ
- **`[-wbsparse]`** โ€” <purple>repeatable</purple> โ€” specify an input wbsparse file
  - **`<wbsparse-in>`** โ€” a wbsparse file to merge ๐Ÿซถ

<cyan>okay so</cyan> the input wbsparse files must have matching mappings along the direction <hotpink>not</hotpink> specified, and the mapping along the specified direction must be brain models. no cap, they gotta line up or it's not happening ๐Ÿ™ˆ

- **`-zip-scene-file`** โ€” ZIP A SCENE FILE AND ITS DATA FILES ๐ŸŽ€

wb_command -zip-scene-file


- **`<scene-file>`** โ€” the scene file to make the zip file from ๐ŸŒธ
- **`<extract-folder>`** โ€” the name of the folder created when the zip file is unzipped ๐Ÿ“
- **`<zip-file>`** โ€” *out* โ€” the zip file that will be created ๐Ÿ—œ๏ธ
- **`[-base-dir]`** โ€” specify a directory that all data files are somewhere within, this will become the root of the zipfile's directory structure
  - **`<directory>`** โ€” the directory
- **`[-skip-missing]`** โ€” any missing files will generate only warnings, and the zip file will be created anyway ๐Ÿ‘‘
- **`[-write-scene-file]`** โ€” rewrite the scene file before zipping, to store a new base path or fix extra `..`'s in paths that might break โœจ

> <red>If `zip-file` already exists, it will be overwritten.</red> rip to whatever was there before ๐Ÿ’€

If `-base-dir` is not specified, the base directory will be automatically set to the lowest level directory containing all files. The scene file must contain only relative paths, and no data files may be outside the base directory. that's the rule, bestie, no escaping the base dir ๐Ÿšซ

- **`-zip-spec-file`** โ€” ZIP A SPEC FILE AND ITS DATA FILES ๐Ÿฆ‹

wb_command -zip-spec-file


- **`<spec-file>`** โ€” the specification file to add to zip file ๐Ÿ“„
- **`<extract-folder>`** โ€” the name of the folder created when the zip file is unzipped ๐Ÿ“
- **`<zip-file>`** โ€” *out* โ€” the zip file that will be created ๐Ÿ—œ๏ธ
- **`[-base-dir]`** โ€” specify a directory that all data files are somewhere within, this will become the root of the zipfile's directory structure
  - **`<directory>`** โ€” the directory
- **`[-skip-missing]`** โ€” any missing files will generate only warnings, and the zip file will be created anyway ๐Ÿ‘‘

> <red>If `zip-file` already exists, it will be overwritten.</red> yes, again. it does not care about your feelings ๐Ÿ˜ญ

If `-base-dir` is not specified, the directory containing the spec file is used for the base directory. The spec file must contain only relative paths, and no data files may be outside the base directory. <yellow>Scene files inside spec files are not checked for what files they reference</yellow>, so ensure that all data files referenced by the scene files are also referenced by the spec file. fr fr, that one's on you ๐Ÿ™ˆ

---

<rainbow>and that's a wrap on the whole page, bestie ๐Ÿ’–</rainbow> This was `wb_command` <purple>version 2.0.1</purple>, dated <cyan>October 2024</cyan>. Go forth and be the main character of your own terminal ๐Ÿซถโœจ๐Ÿ’…
๐Ÿ“ฆ where this page comes from