.TH imagemath "1" "Jan 25 2019" "CMTK 3.3.1p1" "The Computational Morphometry Toolkit" .SH NAME imagemath \- Image operations .SH 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. .SH OPTIONS .SS Global Toolkit Options (these are shared by all CMTK tools) .TP 5 \fB\-\-help\fR Write list of basic command line options to standard output. .TP 5 \fB\-\-help-all\fR Write complete list of basic and advanced command line options to standard output. .TP 5 \fB\-\-wiki\fR Write list of command line options to standard output in MediaWiki markup. .TP 5 \fB\-\-man\fR Write man page source in 'nroff' markup to standard output. .TP 5 \fB\-\-version\fR Write toolkit version to standard output. .TP 5 \fB\-\-echo\fR Write the current command line to standard output. .TP 5 \fB\-\-verbose-level\fR \fI\fR Set verbosity level. .TP 5 \fB\-\-verbose\fR, \fB\-v\fR Increment verbosity level by 1 (deprecated; supported for backward compatibility). .TP 5 \fB\-\-threads\fR \fI\fR Set maximum number of parallel threads (for POSIX threads and OpenMP). .SS Input/output operations .TP 5 \fB\-\-in\fR \fI\fR Read input image(s) to top of stack .TP 5 \fB\-\-out\fR \fI\fR Write output image from top of stack (but leave it on the stack) .TP 5 \fB\-\-set-padding-value\fR \fI\fR Set the value that is interpreted as padding value in subsequently read images. .TP 5 \fB\-\-unset-padding\fR Disable padding. All values in subsequently read images will be interpreted as actual data. .SS Internal settings .TP 5 \fB\-\-float\fR Use single precision for computations and results \fB[This is the default]\fR .TP 5 \fB\-\-double\fR Use double precision for computations and results .SS Stack operations .TP 5 \fB\-\-pop\fR Pop (discard) top image from stack. .TP 5 \fB\-\-dup\fR Duplicate image on top of the stack. .TP 5 \fB\-\-all\fR Apply next single-image operation to all images on the stack. .SS Single-image operators .TP 5 \fB\-\-fill\fR \fI\fR Fill top image with constant value (i.e., assign value to all pixels) .TP 5 \fB\-\-abs\fR Apply abs() function to top image .TP 5 \fB\-\-log\fR Apply log() function to top image .TP 5 \fB\-\-logit\fR Apply log(x/(1-x)) function to top image .TP 5 \fB\-\-logistic\fR Apply 1/(1+exp(-x)) function to top image .TP 5 \fB\-\-exp\fR Apply exp() function to top image .TP 5 \fB\-\-sqr\fR Apply square operator to top image .TP 5 \fB\-\-sqrt\fR Apply square root operator to top image .TP 5 \fB\-\-trunc\fR Truncate all values in top image to integer .TP 5 \fB\-\-one-over\fR For each pixel, replace its value x with 1.0/x .TP 5 \fB\-\-scalar-mul\fR \fI\fR Multiply top image with a scalar value .TP 5 \fB\-\-scalar-add\fR \fI\fR Add a scalar to each pixel of the top image .TP 5 \fB\-\-scalar-xor\fR \fI\fR Bitwise exclusive-or between top level and given scalar value .TP 5 \fB\-\-scalar-and\fR \fI\fR Bitwise and operation between top level and given scalar value .TP 5 \fB\-\-thresh-below\fR \fI\fR Set values below given threshold to threshold. .TP 5 \fB\-\-thresh-above\fR \fI\fR Set values above given threshold to threshold. .SS Image pair operators .TP 5 \fB\-\-add\fR Add top and second image, place result on stack .TP 5 \fB\-\-mul\fR Multiply top and second image, place result on stack .TP 5 \fB\-\-div\fR Divide top image by second image, place result on stack .TP 5 \fB\-\-atan2\fR Compute atan2() function from tup two image pixel pairs, place result on stack .TP 5 \fB\-\-match-histograms\fR 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. .TP 5 \fB\-\-match-mean-sdev\fR 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. .TP 5 \fB\-\-match-mean-sdev3\fR 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. .TP 5 \fB\-\-mask-average\fR 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. .SS Complex Arithmetic .TP 5 \fB\-\-complex-div\fR 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). .SS Operators that contract the entire stack into a single image .TP 5 \fB\-\-sum\fR Sum all images on stack, place result on stack .TP 5 \fB\-\-product\fR Compute product of all images on stack, place result on stack .TP 5 \fB\-\-average\fR Average all images on stack, place result on stack .TP 5 \fB\-\-variance\fR For each pixel, compute variance over all images on stack, place result on stack .TP 5 \fB\-\-combine-pca\fR Combine images using PCA by projecting onto direction of largest correlation .TP 5 \fB\-\-max-value\fR For each pixel, compute maximum VALUE over all images, place result on stack .TP 5 \fB\-\-min-value\fR For each pixel, compute minimum VALUE over all images, place result on stack .TP 5 \fB\-\-max-index\fR For each pixel, compute INDEX of image with maximum value, place result on stack .SS Operators that contract a stack of label images into a single label image .TP 5 \fB\-\-vote\fR Merge all images on stack with voting, place result on stack .TP 5 \fB\-\-staple\fR \fI\fR 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. .TP 5 \fB\-\-contract-labels\fR Contract multiple label maps into one by selecting the first (over all images on the stack) non-zero label at each pixel .TP 5 \fB\-\-mstaple\fR \fI\fR 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. .TP 5 \fB\-\-mstaple-disputed\fR \fI\fR 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. .TP 5 \fB\-\-stack-entropy-labels\fR Compute stack entropy at each pixel from integer (label) input images .SH AUTHORS Torsten Rohlfing, with contributions from Michael P. Hasak, Greg Jefferis, Calvin R. Maurer, Daniel B. Russakoff, and Yaroslav Halchenko .SH LICENSE http://www.fsf.org/licensing/licenses/gpl.html .SH BUGS Report bugs at http://nitrc.org/projects/cmtk/ .SH 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.