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)

Write list of basic command line options to standard output.
Write complete list of basic and advanced command line options to standard output.
Write list of command line options to standard output in MediaWiki markup.
Write man page source in 'nroff' markup to standard output.
Write toolkit version to standard output.
Write the current command line to standard output.
Set verbosity level.
Increment verbosity level by 1 (deprecated; supported for backward compatibility).
Set maximum number of parallel threads (for POSIX threads and OpenMP).

Input/output operations

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

Internal settings

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

Stack operations

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

Single-image operators

Fill top image with constant value (i.e., assign value to all pixels)
Apply abs() function to top image
Apply log() function to top image
Apply log(x/(1-x)) function to top image
Apply 1/(1+exp(-x)) function to top image
Apply exp() function to top image
Apply square operator to top image
Apply square root operator to top image
Truncate all values in top image to integer
For each pixel, replace its value x with 1.0/x
Multiply top image with a scalar value
Add a scalar to each pixel of the top image
Bitwise exclusive-or between top level and given scalar value
Bitwise and operation between top level and given scalar value
Set values below given threshold to threshold.
Set values above given threshold to threshold.

Image pair operators

Add top and second image, place result on stack
Multiply top and second image, place result on stack
Divide top image by second image, place result on stack
Compute atan2() function from tup two image pixel pairs, place result on stack
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.
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.
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 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 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 all images on stack, place result on stack
Compute product of all images on stack, place result on stack
Average all images on stack, place result on stack
For each pixel, compute variance over all images on stack, place result on stack
Combine images using PCA by projecting onto direction of largest correlation
For each pixel, compute maximum VALUE over all images, place result on stack
For each pixel, compute minimum VALUE over all images, place result on stack
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

Merge all images on stack with voting, place result on stack
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 multiple label maps into one by selecting the first (over all images on the stack) non-zero label at each pixel
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.
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.
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.

Jul 7 2024 CMTK 3.3.1p2