Learn R Programming

ANTsR (version 1.0)

iMath: iMath

Description

Perform various (often mathematical) operations on the input image. Additional parameters should be specific for each operation. See the the full ImageMath in ANTs, on which this function is based.

Usage

iMath(img, operation, param = NA, ...)

Arguments

img

input object, usually antsImage

operation

a character string e.g. "GetLargestComponent" ... the special case of "GetOperations" or "GetOperationsFull" will return a list of operations and brief description. Some operations may not be valid (WIP), but most are.

param

... additional parameters

...

further parameter options

Examples

Run this code
# NOT RUN {
fi<-antsImageRead( getANTsRData("r16") , 2 )
mask<-getMask( fi )
op1<-iMath( fi , "GD" , 1 )  # gray matter dilation by 1 voxel
op2<-iMath( mask , "Neg" )  # negate
op3<-iMath( mask , "D" )  # distance transform
ops<-iMath( mask , "GetOperations" )  # list all ops

if ( usePkg("magrittr") ) { # string ops together
  lapgd <- fi %>% iMath("Laplacian",1)  %>% iMath("GD",3)
}
# }

Run the code above in your browser using DataLab