powered by
Get a binary mask image from the given image after thresholding.
getMask( img = NULL, lowThresh = 1, highThresh = Inf, cleanup = FALSE )
Input image. Can be a filename of a 3D image or an antsImage of dimension 3. If img is NULL, a file chooser dialog will appear.
antsImage
img
An inclusive lower threshold for voxels to be included in the mask.
An inclusive upper threshold for voxels to be included in the mask.
If TRUE, morphological operations will be applied to clean up the mask by eroding away small or weakly-connected areas, and closing holes.
TRUE
Object of type antsImage containing the masked image. The voxel intensities will be binarized, 1 for voxels in the mask and 0 outside.
If cleanup is TRUE, the following steps are applied
cleanup
Erosion with radius 2 voxels
Retain largest component
Dilation with radius 1 voxel
Morphological closing
These functions are available in ImageMath, see the operations “ME”, “GetLargestComponent”, “MD”, “FillHoles”.
# NOT RUN { # input_img.nii is a 3D image mask_img <- get_mask( "input_img.nii" , 500 , 1e9 ) # }
Run the code above in your browser using DataLab