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.

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

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) tf<-getANTsRData("r27") tem<-antsImageRead(tf) mask = tem > 20 fh <- iMath( mask , "FillHoles" ) # list all ops stopifnot(range(fh) == c(0, 1)) filled = fh > 0