.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.4. .TH IMAGEMATH "1" "September 2017" "ImageMath 2.1.0" "User Commands" .SH NAME ImageMath \- part of ANTS registration suite .SH SYNOPSIS .B ImageMath \fI\,ImageDimension \/\fR[\fI\,operations and inputs\/\fR] \fI\, \/\fR .SH DESCRIPTION Usage Information .IP ImageDimension: 2 or 3 (for 2 or 3 dimensional operations). ImageDimension: 4 (for operations on 4D file, e.g. time\-series data). Operator: See list of valid operators below. The last two arguments can be an image or float value NB: Some options output text files .SS "Mathematical Operations:" .TP m : Multiply \fB\-\-\-\fR use vm for vector multiply .TP + : Add \fB\-\-\-\fR use v+ for vector add .TP \- : Subtract \fB\-\-\-\fR use v\- for vector subtract .TP / : Divide .TP ^ : Power .TP max : voxelwise max .TP exp : Take exponent exp(imagevalue*value) .TP addtozero : add image\-b to image\-a only over points where image\-a has zero values .TP overadd : replace image\-a pixel with image\-b pixel if image\-b pixel is non\-zero .TP abs : absolute value .TP total : Sums up values in an image or in image1*image2 (img2 is the probability mask) .TP mean : Average of values in an image or in image1*image2 (img2 is the probability mask) .TP vtotal : Sums up volumetrically weighted values in an image or in image1*image2 (img2 is the probability mask) .TP Decision : Computes result=1./(1.+exp(\fB\-1\fR.0*( pix1\-0.25)/pix2)) .TP Neg : Produce image negative .SS "Spatial Filtering:" .TP Project Image1.ext axis\-a which\-projection : Project an image along axis a, which\-projection=0(sum, 1=max, 2=min) .TP G Image1.ext s : Smooth with Gaussian of sigma = s .TP MD Image1.ext s : Morphological Dilation with radius s .TP ME Image1.ext s : Morphological Erosion with radius s .TP MO Image1.ext s : Morphological Opening with radius s .TP MC Image1.ext s : Morphological Closing with radius s .TP GD Image1.ext s : Grayscale Dilation with radius s .TP GE Image1.ext s : Grayscale Erosion with radius s .TP GO Image1.ext s : Grayscale Opening with radius s .TP GC Image1.ext s : Grayscale Closing with radius s .TP BlobDetector Image1.ext NumberOfBlobsToExtract Optional\-Input\-Image2 Blob\-2\-out.nii.gz N\-Blobs\-To\-Match : blob detection by searching for local extrema of the Laplacian of the Gassian (LoG) .IP Example matching 6 best blobs from 2 images: ImageMath 2 blob.nii.gz BlobDetector image1.nii.gz 1000 image2.nii.gz blob2.nii.gz 6 .IP MatchBlobs Image1.ext Image1LM.ext Image2.ext .PP Transform Image: Translate InImage.ext x [ y z ] .SS "Time Series Operations:" .TP CompCorrAuto : Outputs a csv file containing global signal vector and N comp\-corr eigenvectors determined from PCA of the high\-variance voxels. Also outputs a comp\-corr + global signal corrected 4D image as well as a 3D image measuring the time series variance. Requires a label image with label 1 identifying voxels in the brain. .TP ImageMath 4 ${out}compcorr.nii.gz ThreeTissueConfounds ${out}.nii.gz ${out}seg.nii.gz 1 3 : Outputs average global, CSF and WM signals. Requires a label image with 3 labels , csf, gm , wm . .TP Usage : ThreeTissueConfounds 4D_TimeSeries.nii.gz LabeLimage.nii.gz csf\-label wm\-label .IP TimeSeriesSubset : Outputs n 3D image sub\-volumes extracted uniformly from the input time\-series 4D image. .TP Usage : TimeSeriesSubset 4D_TimeSeries.nii.gz n .IP TimeSeriesDisassemble : Outputs n 3D image volumes for each time\-point in time\-series 4D image. .TP Usage : TimeSeriesDisassemble 4D_TimeSeries.nii.gz .IP TimeSeriesAssemble : Outputs a 4D time\-series image from a list of 3D volumes. .TP Usage : TimeSeriesAssemble time_spacing time_origin *images.nii.gz .IP TimeSeriesToMatrix : Converts a 4D image + mask to matrix (stored as csv file) where rows are time and columns are space . .TP Usage : TimeSeriesToMatrix 4D_TimeSeries.nii.gz mask .IP TimeSeriesSimpleSubtraction : Outputs a 3D mean pair\-wise difference list of 3D volumes. .TP Usage : TimeSeriesSimpleSubtraction image.nii.gz .IP TimeSeriesSurroundSubtraction : Outputs a 3D mean pair\-wise difference list of 3D volumes. .TP Usage : TimeSeriesSurroundSubtraction image.nii.gz .IP TimeSeriesSincSubtraction : Outputs a 3D mean pair\-wise difference list of 3D volumes. .TP Usage : TimeSeriesSincSubtraction image.nii.gz .IP SplitAlternatingTimeSeries : Outputs 2 3D time series .TP Usage : SplitAlternatingTimeSeries image.nii.gz .TP ComputeTimeSeriesLeverage : Outputs a csv file that identifies the raw leverage and normalized leverage for each time point in the 4D image. leverage, here, is the difference of the time\-point image from the average of the n images. the normalized leverage is = average( sum_k abs(Leverage(t)\-Leverage(k)) )/Leverage(t). .TP Usage : ComputeTimeSeriesLeverage 4D_TimeSeries.nii.gz k_neighbors .IP SliceTimingCorrection : Outputs a slice\-timing corrected 4D time series .TP Usage : SliceTimingCorrection image.nii.gz sliceTiming [sinc / bspline] [sincRadius=4 / bsplineOrder=3] .IP PASL : computes the PASL model of CBF .PP f = rac{ lambda DeltaM } .TP { 2 alpha M_0 TI_1 exp( \- TI_2 / T_{1a} ) } .TP Usage : PASL 3D/4D_TimeSeries.nii.gz BoolFirstImageIsControl M0Image parameter_list.txt .IP pCASL : computes the pCASL model of CBF f = rac{ lambda DeltaM R_{1a} } .TP { 2 alpha M_0 [ exp( \- w R_{1a} ) \- exp( \fB\-w\fR ( au + w ) R_{1a}) ] } .TP Usage : pCASL 3D/4D_TimeSeries.nii.gz parameter_list.txt .IP PASLQuantifyCBF : Outputs a 3D CBF image in ml/100g/min from a magnetization ratio image .TP Usage : PASLQuantifyCBF mag_ratio.nii.gz [TI1=700] [TI2=1900] [T1blood=1664] [Lambda=0.9] [Alpha=0.95] [SliceDelay\-45] .SS "Tensor Operations:" .TP 4DTensorTo3DTensor : Outputs a 3D_DT_Image with the same information. .TP Usage : 4DTensorTo3DTensor 4D_DTImage.ext .TP ComponentTo3DTensor : Outputs a 3D_DT_Image with the same information as component images. .TP Usage : ComponentTo3DTensor component_image_prefix[xx,xy,xz,yy,yz,zz] extension .TP ExtractComponentFrom3DTensor : Outputs a component images. .TP Usage : ExtractComponentFrom3DTensor dtImage.ext which={xx,xy,xz,yy,yz,zz} .IP ExtractVectorComponent: Produces the WhichVec component of the vector .TP Usage : ExtractVectorComponent VecImage WhichVec .TP TensorColor : Produces RGB values identifying principal directions .TP Usage : TensorColor DTImage.ext .TP TensorFA : .TP Usage : TensorFA DTImage.ext .TP TensorFADenominator : .TP Usage : TensorFADenominator DTImage.ext .TP TensorFANumerator : .TP Usage : TensorFANumerator DTImage.ext .TP TensorIOTest : Will write the DT image back out ... tests I/O processes for consistency. .TP Usage : TensorIOTest DTImage.ext .TP TensorMeanDiffusion : Mean of the eigenvalues .TP Usage : TensorMeanDiffusion DTImage.ext .TP TensorRadialDiffusion : Mean of the two smallest eigenvalues .TP Usage : TensorRadialDiffusion DTImage.ext .TP TensorAxialDiffusion : Largest eigenvalue, equivalent to TensorEigenvalue DTImage.ext 2 .TP Usage : TensorAxialDiffusion DTImage.ext .TP TensorEigenvalue : Gets a single eigenvalue 0\-2, where 0 = smallest, 2 = largest .TP Usage : TensorEigenvalue DTImage.ext WhichInd .TP TensorToVector : Produces vector field identifying one of the principal directions, 2 = largest eigenvalue .TP Usage : TensorToVector DTImage.ext WhichVec .IP TensorToVectorComponent: 0 => 2 produces component of the principal vector field (largest eigenvalue). 3 = 8 => gets values from the tensor .TP Usage : TensorToVectorComponent DTImage.ext WhichVec .TP TensorMask : Mask a tensor image, sets background tensors to zero or to isotropic tensors with specified mean diffusivity .TP Usage : TensorMask DTImage.ext mask.ext [ backgroundMD = 0 ] .TP FuseNImagesIntoNDVectorField : Create ND field from N input scalar images .TP Usage : FuseNImagesIntoNDVectorField imagex imagey imagez .SS "Label Fusion:" .IP MajorityVoting : Select label with most votes from candidates .IP Usage: MajorityVoting LabelImage1.nii.gz .. LabelImageN.nii.gz .IP CorrelationVoting : Select label with local correlation weights .IP Usage: CorrelationVoting Template.ext IntenistyImages* LabelImages* {Optional\-Radius=5} .IP STAPLE : Select label using STAPLE method .IP Usage: STAPLE confidence\-weighting LabelImages* Note: Gives probabilistic output (float) .IP MostLikely : Select label from from maximum probabilistic segmentations .IP Usage: MostLikely probabilityThreshold ProbabilityImages* .IP AverageLabels : Select label using STAPLE method .IP Usage: STAPLE LabelImages* Note: Gives probabilistic output (float) .SS "Image Metrics & Info:" .IP PearsonCorrelation: r\-value from intesities of two images .IP Usage: PearsonCorrelation image1.ext image2.ext {Optional\-mask.ext} .IP NeighborhoodCorrelation: local correlations .IP Usage: NeighborhoodCorrelation image1.ext image2.ext {Optional\-radius=5} {Optional\-image\-mask} .IP NormalizedCorrelation: r\-value from intesities of two images .IP Usage: NormalizedCorrelation image1.ext image2.ext {Optional\-image\-mask} .IP Demons: .IP Usage: Demons image1.ext image2.ext .IP Mattes: mutual information .IP Usage: Mattes image1.ext image2.ext {Optional\-number\-bins=32} {Optional\-image\-mask} .SS "Unclassified Operators:" .IP ReflectionMatrix : Create a reflection matrix about an axis .IP out.mat ReflectionMatrix image_in axis .IP MakeAffineTransform : Create an itk affine transform matrix ClosestSimplifiedHeaderMatrix : does what it says ... image\-in, image\-out Byte : Convert to Byte image in [0,255] .IP CompareHeadersAndImages: Tries to find and fix header errors. Outputs a repaired image with new header. .IP Never use this if you trust your header information. .TP Usage : CompareHeadersAndImages Image1 Image2 .IP ConvertImageSetToMatrix: Each row/column contains image content extracted from mask applied to images in *img.nii .TP Usage : ConvertImageSetToMatrix rowcoloption Mask.nii *images.nii .IP ConvertImageSetToMatrix output can be an image type or csv file type. .IP RandomlySampleImageSetToCSV: N random samples are selected from each image in a list .TP Usage : RandomlySampleImageSetToCSV N_samples *images.nii .IP RandomlySampleImageSetToCSV outputs a csv file type. .IP FrobeniusNormOfMatrixDifference: take the difference between two itk\-transform matrices and then compute the frobenius norm .TP Usage : FrobeniusNormOfMatrixDifference mat1 mat2 .IP ConvertImageSetToEigenvectors: Each row/column contains image content extracted from mask applied to images in *img.nii .TP Usage : ConvertImageSetToEigenvectors N_Evecs Mask.nii *images.nii .IP ConvertImageSetToEigenvectors output will be a csv file for each label value > 0 in the mask. .TP ConvertImageToFile : Writes voxel values to a file .TP Usage : ConvertImageToFile imagevalues.nii {Optional\-ImageMask.nii} .TP ConvertLandmarkFile : Converts landmark file between formats. See ANTS.pdf for description of formats. .TP Usage : ConvertLandmarkFile InFile.txt .TP Example 1 : ImageMath 3 outfile.vtk ConvertLandmarkFile infile.txt .TP ConvertToGaussian : .TP Usage : ConvertToGaussian TValueImage sigma\-float .TP ConvertVectorToImage : The vector contains image content extracted from a mask. Here the vector is returned to its spatial origins as image content .TP Usage : ConvertVectorToImage Mask.nii vector.nii .TP CorrelationUpdate : In voxels, compute update that makes Image2 more like Image1. .TP Usage : CorrelationUpdate Image1.ext Image2.ext RegionRadius .TP CountVoxelDifference : The where function from IDL .TP Usage : CountVoxelDifference Image1 Image2 Mask .TP CorruptImage : .TP Usage : CorruptImage Image NoiseLevel Smoothing .TP D : Danielson Distance Transform .IP MaurerDistance : Maurer distance transform (much faster than Danielson) .TP Usage : MaurerDistance inputImage {foreground=1} .TP DiceAndMinDistSum : Outputs DiceAndMinDistSum and Dice Overlap to text log file + optional distance image .TP Usage : DiceAndMinDistSum LabelImage1.ext LabelImage2.ext OptionalDistImage .IP EnumerateLabelInterfaces: .TP Usage : EnumerateLabelInterfaces ImageIn ColoredImageOutname NeighborFractionToIgnore .TP ClusterThresholdVariate : for sparse estimation .TP Usage : ClusterThresholdVariate image mask MinClusterSize .TP ExtractSlice : Extracts slice number from last dimension of volume (2,3,4) dimensions .TP Usage : ExtractSlice volume.nii.gz slicetoextract .IP FastMarchingSegmentation: final output is the propagated label image. Optional stopping value: higher values allow more distant propagation .TP Usage : FastMarchingSegmentation speed/binaryimagemask.ext initiallabelimage.ext Optional\-Stopping\-Value .TP FillHoles : Parameter = ratio of edge at object to edge at background; \fB\-\-\fR .IP Parameter = 1 is a definite hole bounded by object only, 0.99 is close Default of parameter > 1 will fill all holes .TP Usage : FillHoles Image.ext parameter .TP InPaint : very simple inpainting \fB\-\-\-\fR assumes zero values should be inpainted .TP Usage : InPaint #iterations .TP PeronaMalik : anisotropic diffusion w/varying conductance param (0.25 in example below) .TP Usage : PeronaMalik image #iterations conductance .TP Finite : replace non\-finite values with finite\-value (default = 0) .TP Usage : Finite Image.exdt {replace\-value=0} .TP FitSphere : .TP Usage : FitSphere GM\-ImageIn {WM\-Image} {MaxRad\-Default=5} .TP FlattenImage : Replaces values greater than %ofMax*Max to the value %ofMax*Max .TP Usage : FlattenImage Image %ofMax .TP GetLargestComponent : Get the largest object in an image .TP Usage : GetLargestComponent InputImage {MinObjectSize} .TP Grad : Gradient magnitude with sigma s (if normalize, then output in range [0, 1]) .TP Usage : Grad Image.ext s normalize? .TP HistogramMatch : .TP Usage : HistogramMatch SourceImage ReferenceImage {NumberBins\-Default=255} {NumberPoints\-Default=64} .TP RescaleImage : .TP Usage : RescaleImage InputImage min max .TP WindowImage : .TP Usage : WindowImage InputImage windowMinimum windowMaximum outputMinimum outputMaximum .TP NeighborhoodStats : .TP Usage : NeighborhoodStats inputImage whichStat radius whichStat: 1 = min, 2 = max, 3 = variance, 4 = sigma, 5 = skewness, 6 = kurtosis, 7 = entropy .TP InvId : computes the inverse\-consistency of two deformations and write the inverse consistency error image .TP Usage : InvId VectorFieldName VectorFieldName .TP ReplicateDisplacement : replicate a ND displacement to a ND+1 image .TP Usage : ReplicateDisplacement VectorFieldName TimeDims TimeSpacing TimeOrigin .TP ReplicateImage : replicate a ND image to a ND+1 image .TP Usage : ReplicateImage ImageName TimeDims TimeSpacing TimeOrigin .TP ShiftImageSlicesInTime : shift image slices by one .TP Usage : ShiftImageSlicesInTime ImageName shift\-amount\-default\-1 shift\-dim\-default\-last\-dim .TP LabelStats : Compute volumes / masses of objects in a label image. Writes to text file .TP Usage : LabelStats labelimage.ext valueimage.nii .TP Laplacian : Laplacian computed with sigma s (if normalize, then output in range [0, 1]) .TP Usage : Laplacian Image.ext s normalize? .TP Canny : Canny edge detector .TP Usage : Canny Image.ext signa lowerThresh upperThresh .TP CropBinaryImage : returns cropped image .TP Lipschitz : Computes the Lipschitz norm of a vector field .TP Usage : Lipschitz VectorFieldName .TP MakeImage : .TP Usage : MakeImage SizeX SizeY {SizeZ}; .TP MTR : Computes the magnetization transfer ratio ( (M0\-M1)/M0 ) and truncates values to [0,1] .TP Usage : MTR M0Image M1Image [MaskImage]; .TP Normalize : Normalize to [0,1]. Option instead divides by average value .TP Usage : Normalize Image.ext opt .TP PadImage : If Pad\-Number is negative, de\-Padding occurs .TP Usage : PadImage ImageIn Pad\-Number .TP SigmoidImage : .TP Usage : SigmoidImage ImageIn [alpha=1.0] [beta=0.0] .TP Sharpen : .TP Usage : Sharpen ImageIn .TP CenterImage2inImage1 : .TP Usage : ReferenceImageSpace ImageToCenter .TP PH : Print Header .TP PoissonDiffusion : Solves Poisson's equation in a designated region using non\-zero sources .TP Usage : PoissonDiffusion inputImage labelImage [sigma=1.0] [regionLabel=1] [numberOfIterations=500] [convergenceThreshold=1e\-10] .IP PropagateLabelsThroughMask: Final output is the propagated label image. Optional stopping value: higher values allow more distant propagation .TP Usage : PropagateLabelsThroughMask speed/binaryimagemask.nii.gz initiallabelimage.nii.gz Optional\-Stopping\-Value 0/1/2 .TP 0/1/2 => 0, no topology constraint, 1 \- strict topology constraint, 2 \- no handles .TP PValueImage : .TP Usage : PValueImage TValueImage dof .IP RemoveLabelInterfaces: .TP Usage : RemoveLabelInterfaces ImageIn .IP ReplaceVoxelValue: replace voxels in the range [a,b] in the input image with c .TP Usage : ReplaceVoxelValue inputImage a b c .TP ROIStatistics : computes anatomical locations, cluster size and mass of a stat image which should be in the same physical space (but not nec same resolution) as the label image. .TP Usage : ROIStatistics LabelNames.txt labelimage.ext valueimage.nii .TP SetOrGetPixel : .TP Usage : SetOrGetPixel ImageIn Get/Set\-Value IndexX IndexY {IndexZ} .TP Example 1 : ImageMath 2 outimage.nii SetOrGetPixel Image Get 24 34; Gets the value at 24, 34 .TP Example 2 : ImageMath 2 outimage.nii SetOrGetPixel Image 1.e9 24 34; This sets 1.e9 as the value at 23 34 .IP You can also pass a boolean at the end to force the physical space to be used .TP Segment : Segment an Image with option of Priors, weight 1 => maximally local/prior\-based ) .TP Usage : Segment Image1.ext N\-Classes LocalityVsGlobalityWeight\-In\-ZeroToOneRange OptionalPriorImages .TP stack : Will put 2 images in the same volume .TP Usage : Stack Image1.ext Image2.ext .TP ThresholdAtMean : See the code .TP Usage : ThresholdAtMean Image %ofMean .TP TileImages : .TP Usage : TileImages NumColumns ImageList* .TP TriPlanarView : .TP Usage : TriPlanarView ImageIn.nii.gz PercentageToClampLowIntensity PercentageToClampHiIntensity x\-slice y\-slice z\-slice .IP TruncateImageIntensity: .TP Usage : TruncateImageIntensity InputImage.ext {lowerQuantile=0.05} {upperQuantile=0.95} {numberOfBins=65} {binary\-maskImage} .TP Where : The where function from IDL .TP Usage : Where Image ValueToLookFor maskImage\-option tolerance