Learn R Programming

ANTsR (version 0.4.0)

iMath: iMath

Description

Perform various (often mathematical) operations on the input image/s. Additional parameters should be specific for each operation. See the the full iMath 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 , "D" )  # distance transform
op3<-iMath( 0 , "GetOperations" )  # list all ops

if ( usePkg("magrittr") ) { # string ops together
  lapgd <- fi %>% iMath("Laplacian",1)  %>% iMath("GD",3)
}
# Canny is useful e.g.
# canny = ( iMath(myreg$warpedmovout,"Normalize")*255 ) %>% iMath("Canny",1,5,12)

# }

Run the code above in your browser using DataLab