Scroll to navigation

imagemath(1) The Computational Morphometry Toolkit imagemath(1)

NAME

imagemath - Image operations

DESCRIPTION

Perform operations on images using stack-based postfix notation.

Images can be read from files and pushed onto the stack. Images on the stack can be processed and combined via different operators. Results of all operations are put back onto the stack, where they can be further processed or written back to image files.

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).

Input/output operations

--in <string-vector>
Read input image(s) to top of stack
--out <string>
Write output image from top of stack (but leave it on the stack)
--set-padding-value <double>
Set the value that is interpreted as padding value in subsequently read images.
--unset-padding
Disable padding. All values in subsequently read images will be interpreted as actual data.

Internal settings

--float
Use single precision for computations and results [This is the default]
--double
Use double precision for computations and results

Stack operations

--pop
Pop (discard) top image from stack.
--dup
Duplicate image on top of the stack.
--all
Apply next single-image operation to all images on the stack.

Single-image operators

--fill <double>
Fill top image with constant value (i.e., assign value to all pixels)
--abs
Apply abs() function to top image
--log
Apply log() function to top image
--logit
Apply log(x/(1-x)) function to top image
--logistic
Apply 1/(1+exp(-x)) function to top image
--exp
Apply exp() function to top image
--sqr
Apply square operator to top image
--sqrt
Apply square root operator to top image
--trunc
Truncate all values in top image to integer
--one-over
For each pixel, replace its value x with 1.0/x
--scalar-mul <double>
Multiply top image with a scalar value
--scalar-add <double>
Add a scalar to each pixel of the top image
--scalar-xor <integer>
Bitwise exclusive-or between top level and given scalar value
--scalar-and <integer>
Bitwise and operation between top level and given scalar value
--thresh-below <double>
Set values below given threshold to threshold.
--thresh-above <double>
Set values above given threshold to threshold.

Image pair operators

--add
Add top and second image, place result on stack
--mul
Multiply top and second image, place result on stack
--div
Divide top image by second image, place result on stack
--atan2
Compute atan2() function from tup two image pixel pairs, place result on stack
--match-histograms
Scale intensities in one image to match intensities of another. The last image pushed onto the stack provides the reference intensity distribution, the preceding image will be modified. Both input images are removed from the stack and the modified image is pushed onto the stack.
--match-mean-sdev
Scale intensities of one image to match mean and standard deviation of another. The last image pushed onto the stack provides the reference intensity distribution, the preceding image will be modified. Both input images are removed from the stack and the modified image is pushed onto the stack.
--match-mean-sdev3
Scale intensities of an image by a factor and offset computed from two other images to match their mean and standard deviations. The last image pushed onto the stack provides the reference intensity distribution, the preceding image provides the intensity distribution to match to the reference image's, and the third image on the stack will be modified. All three input images are removed from the stack and the modified image is pushed onto the stack.
--mask-average
Mask averaging: the top image is taken as a multi-label mask. The pixels in the second image are averaged by mask labels, and then replaced with the average value for each mask label.

Complex Arithmetic

--complex-div
Complex division, (a+ib)/(c+id), assuming four values were put on the stack in order a, b, c, d. Place result on stack, real first, imaginary second (i.e., imaginary is top).

Operators that contract the entire stack into a single image

--sum
Sum all images on stack, place result on stack
--product
Compute product of all images on stack, place result on stack
--average
Average all images on stack, place result on stack
--variance
For each pixel, compute variance over all images on stack, place result on stack
--combine-pca
Combine images using PCA by projecting onto direction of largest correlation
--max-value
For each pixel, compute maximum VALUE over all images, place result on stack
--min-value
For each pixel, compute minimum VALUE over all images, place result on stack
--max-index
For each pixel, compute INDEX of image with maximum value, place result on stack

Operators that contract a stack of label images into a single label image

--vote
Merge all images on stack with voting, place result on stack
--staple <integer>
Combine binary maps on the stack using [arg] iterations of the STAPLE algorithm. The result of this operation is the spatial map of 'weights' W, which are the probabilities of image foreground at each pixel. In 'verbose' mode, estimated expert parameters p (sensitivity) and q (specificity) are also written to standard output.
--contract-labels
Contract multiple label maps into one by selecting the first (over all images on the stack) non-zero label at each pixel
--mstaple <integer>
Combine multi-label maps on the stack using [arg] iterations of the multi-class STAPLE algorithm.The result of this operation is the combined maximum-likeliood multi-label map.
--mstaple-disputed <integer>
Like previous operation, apply multi-class STAPLE algorithm, but restrict computation to 'disputed'voxels, i.e., those where the input label maps disagree. This often improves results by reducing, e.g., background effects.
--stack-entropy-labels
Compute stack entropy at each pixel from integer (label) input images

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.
Jan 25 2019 CMTK 3.3.1p1