Perform math-operations on the given image
ImageMath( "" , "" , "" , "" [, ""] )
See section 'Arguments' for details. Number and type of arguments vary depending on 'operator' used.
Number of dimensions of the input image
result image
Must be one of the operators listed below. Mathematical Operations:
m : Multiply
+ : Add
- : Subtract
/ : Divide
^ : Power
exp : Take exponent exp(imagevalue*value)
addtozero : add image-b to image-a only over points where image-a has zero values
overadd : replace image-a pixel with image-b pixel if image-b pixel is non-zero
abs : absolute value
total : Sums up values in an image or in image1*image2 (img2 is the probability mask)
Decision : Computes result=1./(1.+exp(-1.0*( pix1-0.25)/pix2))
Neg : Produce image negative
Spatial Filtering:
G : Smooth with Gaussian of sigma = s
MD : Morphological Dilation with radius s
ME : Morphological Erosion with radius s
MO : Morphological Opening with radius s
MC : Morphological Closing with radius s
GD : Grayscale Dilation with radius s
GE : Grayscale Erosion with radius s
GO : Grayscale Opening with radius s
GC : Grayscale Closing with radius s
Time Series Operations:
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.
CompCorr : Outputs a comp-corr corrected 4D image as well as a 3D image measuring the correlation of a time series voxel/region with a reference voxel/region factored out. Requires a label image with 1=overall region of interest, 2=reference voxel, 3=region to factor out. If there is no 3rd label, then only the global signal is factored out.
TimeSeriesSubset : Outputs n 3D image sub-volumes extracted uniformly from the input time-series 4D image.
TimeSeriesToMatrix : Converts a 4D image + mask to matrix (stored as csv file) where rows are time and columns are space.
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).
Tensor Operations:
4DTensorTo3DTensor : Outputs a 3D_DT_Image with the same information.
ComponentTo3DTensor : Outputs a 3D_DT_Image with the same information as component images.
ExtractComponentFrom3DTensor : Outputs a component images.
ExtractVectorComponent : Produces the WhichVec component of the vector
TensorColor : Produces RGB values identifying principal directions
TensorFA : Tensor FA
TensorFADenominator : Tensor FA denominator
TensorFANumerator : Tensor FA numerator
TensorIOTest : Will write the DT image back out ... tests I/O processes for consistency.
TensorMeanDiffusion : Tensor mean diffusion
TensorToVector : Produces vector field identifying one of the principal directions, 2 = largest eigenvalue
TensorToVectorComponent : 0 => 2 produces component of the principal vector field (largest eigenvalue). 3 = 8 => gets values from the tensor
Unclassified Operators:
Byte : Convert to Byte image in [0,255]
CompareHeadersAndImages: Tries to find and fix header errors. Outputs a repaired image with new header. Never use this if you trust your header information.
ConvertImageSetToMatrix: Each row/column contains image content extracted from mask applied to images in *img.nii. ConvertImageSetToMatrix output can be an image type or csv file type.
RandomlySampleImageSetToCSV: N random samples are selected from each image in a list. RandomlySampleImageSetToCSV outputs a csv file type.
ConvertImageSetToEigenvectors: Each row/column contains image content extracted from mask applied to images in *img.nii. ConvertImageSetToEigenvectors output will be a csv file for each label value > 0 in the mask.
ConvertImageToFile : Writes voxel values to a file
ConvertLandmarkFile : Converts landmark file between formats. See ANTS.pdf for description of formats.
ImageMath 3 outfile.vtk ConvertLandmarkFile infile.txt
ConvertToGaussian : Convert to Gaussian
ConvertVectorToImage : The vector contains image content extracted from a mask. Here the vector is returned to its spatial origins as image content
CorrelationUpdate : In voxels, compute update that makes Image2 more like Image1.
CountVoxelDifference : The where function from IDL
CorruptImage : Currupt image
D : DistanceTransform
DiceAndMinDistSum : Outputs DiceAndMinDistSum and Dice Overlap to text log file + optional distance image
EnumerateLabelInterfaces: Enumerate label interfaces
ExtractSlice : Extracts slice number from last dimension of volume (2,3,4) dimensions
FastMarchingSegmentation: final output is the propagated label image. Optional stopping value: higher values allow more distant propagation
FillHoles : Parameter = ratio of edge at object to edge at background; Parameter = 1 is a definite hole bounded by object only, 0.99 is close; Default of parameter > 1 will fill all holes
FitSphere : Fit sphere
FlattenImage : Replaces values greater than percentageofMax*Max to the value percentageofMax*Max
GetLargestComponent : Get the largest object in an image
Grad : Gradient magnitude with sigma s (if normalize, then output in range [0, 1])
HistogramMatch : Histogram matching
InvId : computes the inverse-consistency of two deformations and write the inverse consistency error image
LabelStats : Compute volumes / masses of objects in a label image. Writes to text file
Laplacian : Laplacian computed with sigma s (if normalize, then output in range [0, 1])
Lipschitz : Computes the Lipschitz norm of a vector field
MakeImage : Make Image
Normalize : Normalize to [0,1]. Option instead divides by average value
PadImage : If Pad-Number is negative, de-Padding occurs
CenterImage2inImage1 : Center image2 to image1
PH : Print Header
PoissonDiffusion : Solves Poisson's equation in a designated region using non-zero sources
PropagateLabelsThroughMask: Final output is the propagated label image. Optional stopping value: higher values allow more distant propagation
PValueImage : P value image
RemoveLabelInterfaces: Remove label interfaces
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.
SetOrGetPixel : Set or get pixel; You can also pass a boolean at the end to force the physical space to be used
ImageMath 2 outimage.nii SetOrGetPixel Image Get 24 34; Gets the value at 24, 34
ImageMath 2 outimage.nii SetOrGetPixel Image 1.e9 24 34; This sets 1.e9 as the value at 23 34
Segment : Segment an Image with option of Priors, weight 1 => maximally local/prior-based
stack : Will put 2 images in the same volume
ThresholdAtMean : See the code
TileImages : Tile Images
TriPlanarView : Tri planar view
TruncateImageIntensity: Truncate image intensity
Where : The where function from IDL
0 -- Success 1 -- Failure
# NOT RUN {
ImageMath( 3 , "output_img.nii" , "D", "input_img.nii" , 1 )
ImageMath( 3 , "output_img.nii" , "MD", "input_img.nii" , 1 )
# }
Run the code above in your browser using DataLab