SYNOPSIS

convertx [options] infile outfile

DESCRIPTION

This tool converts between image file formats and pixel data types. It can also apply simple, general-purpose image operations in the process. An arbitrary number of operations can be specified on the command line, which will be applied exactly in the order given.

OPTIONS

Global Toolkit Options (these are shared by all CMTK tools)

--help

Write list of basic command line options to standard output.

--help-all

Write complete list of basic and advanced command line options to standard output.

--wiki

Write list of command line options to standard output in MediaWiki markup.

--man

Write man page source in 'nroff' markup to standard output.

--version

Write toolkit version to standard output.

--echo

Write the current command line to standard output.

--verbose-level <integer>

Set verbosity level.

--verbose, -v

Increment verbosity level by 1 (deprecated; supported for backward compatibility).

--threads <integer>

Set maximum number of parallel threads (for POSIX threads and OpenMP).

Image/Transformation Database

--db <string>

Path to image/transformation database that should be updated with the newly created image. [Default: NONE]

Input Image Controls

--set-padding <double>

Set padding value: all pixels in the input image that have this value will be ignored in all subsequent operations.

--unset-padding

Unset padding value: for all subsequent operations, all pixels will be treated according to their value.

--labels

Specify that the image values are to be treated as discrete labels. This will result in the appropriate intent code to be set in output files in NIfTI format.

--grey

Specify that the image values are to be treated as continuous grey levels. This will reset the intent code in files read from NIfTI format.

Data Type Conversion

--char

8 bits, signed integer

--byte

8 bits, unsigned integer

--short

16 bits, signed integer

--ushort

16 bits, unsigned integer

--int

32 bits signed integer

--uint

32 bits unsigned integer

--float

32 bits floating point

--double

64 bits floating point

Value Mappings

--map-values <string>

Apply mapping function to pixel values. Mapping is defined as 'VAL0[,VAL1,...][:NEWVAL]' to map values VAL0, VAL1, etc. to new value NEWVAL. If NEWVAL is not given, values are set to padding.

--map-values-only <string>

Apply mapping function to pixel values and replace unmapped pixels with padding. Multiple such mapping rules can be concatenated as RULE0+RULE1[+...]; all concatenated rules will be applied simultaneously.Mapping is defined as 'VAL0[,VAL1,...][:NEWVAL]' to map values VAL0, VAL1, etc. to new value NEWVAL. If NEWVAL is not given, values are set to padding. Multiple such mapping rules can be concatenated as RULE0+RULE1[+...]; all concatenated rules will be applied simultaneously.

--replace-padding <double>

Replace padded pixel data with given value.

--replace-inf-nan <double>

Replace all infinite and not-a-number pixels with given value.

Image Flipping

--flip-x

Flip (mirror) along x-direction

--flip-y

Flip (mirror) along y-direction

--flip-z

Flip (mirror) along z-direction

Image Masking and Thresholding

--mask <string>

Binary mask file name: eliminate all image pixels where mask is 0. Masked-out pixels will NOT be set to zero, but will instead be replaced with the currently-set padding value. Use '--set-padding 0' prior to '--mask' to force setting to zero.

--mask-inverse <string>

Inverse binary mask file name eliminate all image pixels where mask is NOT 0. See also notes regarding padding under '--mask' above.

--thresh-below <double>

Set all values below threshold to threshold value.

--thresh-above <double>

Set all values above threshold to threshold value.

--thresh-below-to-padding <double>

Set all values below threshold to padding value.

--thresh-above-to-padding <double>

Set all values above threshold to padding value.

--binarize-thresh <double>

Set all values below threshold to 0, all values equal or above to 1.

--otsu-thresh

Binarize image to 0/1 using threshold computed with Otsu's method. Argument is number of histogram bins for threshold computation.

--otsu-thresh-nbins <integer>

Binarization using Otsu's method with user-defined number of histogram bins for threshold computation.

--prune-histogram <integer>

Threshold image by 'intensity histogram pruning', i.e., for given argument n [histogram bins] determine thresholds such that the 1/n-th fraction of highest and lowest voxels are thresholded.

--prune-histogram-high <integer>

Like '--prune-histograms', but only remove high intensities.

--prune-histogram-low <integer>

Like '--prune-histograms', but only remove low intensities.

Intensity Transformations

--scale-to-range <string>

Scale image intensities to range 'from:to', e.g., '0:255' before conversion to byte data.

--histogram-equalization

Apply histogram equalization.

--histogram-equalization-nbins <integer>

Apply histogram equalization with <int> number of bins.

--match-histograms <string>

Transform intensities to match the distribution in the image provided as the argument for this command.

--match-mean-sdev <string>

Scale intensities to match the mean and standard distribution of intensities in the image provided as the argument for this command.

Morphological Operations

--revert

Revert a binary mask, i.e., exchange foreground and background.

--erode <integer>

Morphological erosion operator (by pixels)

--dilate <integer>

Morphological dilation operator (by pixels)

--erode-distance <double>

Morphological erosion operator (by distance). Often preferable for anisotropic data.

--erode-distance-multilabel <double>

Morphological erosion operator (by distance) for multi-label maps. The result will be either byte, unsigned short, or unsigned int data, depending on the index of the largest used label in the input.

--dilate-distance <double>

Morphological dilation operator (by distance). Oftern preferable for anisotropic data.

--connected-components

Create connected components map with regions numbered by decreasing component size

--boundary-map

Create boundary map

--multi-boundary-map

Create multi-valued boundary map

--distance-map

Compute unsigned Euclidean distance map. Input image is interpreted as binary mask.

--signed-distance-map

Compute signed (inside=negative, outside=positive) Euclidean distance map

Filter Operations

--median-filter <string>

Median filter. This operation takes the filter radius in pixels as the parameter. A single integer defines the kernel radius in all three dimensions. Three comma-separated integers define separate radii for the three dimensions.

--mean-filter <string>

Regional mean filter. This operation takes the filter radius in pixels as the parameter. A single integer defines the kernel radius in all three dimensions. Three comma-separated integers define separate radii for the three dimensions.

--fast-mean-filter <string>

Regional mean filter (fast, linear time implementation). This operation takes the filter radius in pixels as the parameter. A single integer defines the kernel radius in all three dimensions. Three comma-separated integers define separate radii for the three dimensions.

--variance-filter <string>

Regional variance filter. This operation takes the filter radius in pixels as the parameter. A single integer defines the kernel radius in all three dimensions. Three comma-separated integers define separate radii for the three dimensions.

--fast-variance-filter <string>

Fast (linear-time) regional variance filter. This operation takes the filter radius in pixels as the parameter. A single integer defines the kernel radius in all three dimensions. Three comma-separated integers define separate radii for the three dimensions.

--third-moment-filter <string>

Regional third moment filter. This operation takes the filter radius in pixels as the parameter. A single integer defines the kernel radius in all three dimensions. Three comma-separated integers define separate radii for the three dimensions.

--standard-deviation-filter <string>

Regional standard deviation filter. This operation takes the filter radius in pixels as the parameter. A single integer defines the kernel radius in all three dimensions. Three comma-separated integers define separate radii for the three dimensions.

--smoothness-filter <string>

Regional 'smoothness' filter. This operation takes the filter radius in pixels as the parameter. A single integer defines the kernel radius in all three dimensions. Three comma-separated integers define separate radii for the three dimensions.

--gaussian-filter-sigma <double>

Filter image with Gaussian kernel. This operation takes a single real-valued parameter, which specifies the kernel coefficient sigma in world units [e.g., mm] as the parameter.

--gaussian-filter-fwhm <double>

Filter image with Gaussian kernel. This operation takes a single real-valued parameter, which specifies the kernel full width at half maximum in world units [e.g., mm].

--laplace-filter

Filter image with edge-enhancing Laplacian kernel.

Grid Operations

--downsample-select <string>

Downsample image by pixel selection using per-axis factors 'Fx,Fy,Fz' or using single factor 'Fxyz'

--downsample-average <string>

Downsample image by averaging using per-axis factors 'Fx,Fy,Fz' or using single factor 'Fxyz'

--resample <double>

Resample image to near-isotropic pixels while preserving the image field-of-view. Takes one argument, the target resolution in world units [e.g., mm]

--resample-exact <double>

Resample image to exactly isotropic pixels of the given resolution while matching the image field-of-view as closely as possible. Takes one argument, the target resolution in world units [e.g., mm]

--crop-by-index <string>

Crop image to a region specified by a set of six grid index coordinates given as comma-separated integers x0,y0,z0,x1,y1,z1

--crop-by-threshold <double>

Crop image to region determined via a given threshold. The resulting image will contain all pixels larger than the given parameter.

--crop-by-threshold-write-region <double>

Crop image to region determined via a given threshold and write cropping region to standard output.

--crop-by-threshold-write-xform <double>

Crop image to region determined via a given threshold and write cropping transformation to standard output.

AUTHORS

Torsten Rohlfing, with contributions from Michael P. Hasak, Greg Jefferis, Calvin R. Maurer, Daniel B. Russakoff, and Yaroslav Halchenko

LICENSE

http://www.fsf.org/licensing/licenses/gpl.html

BUGS

Report bugs at http://nitrc.org/projects/cmtk/

ACKNOWLEDGMENTS

CMTK is developed with support from the NIAAA under Grant AA021697, National Consortium on Alcohol and Neurodevelopment in Adolescence (N-CANDA): Data Integration Component. From April 2009 through September 2011, CMTK development and maintenance was supported by the NIBIB under Grant EB008381.