getMask | R Documentation |
Get a binary mask image from the given image after thresholding.
getMask(img, lowThresh, highThresh, cleanup = 2)
img |
Input image. Can be an |
lowThresh |
An inclusive lower threshold for voxels to be included in the mask. |
highThresh |
An inclusive upper threshold for voxels to be included in the mask. |
cleanup |
If |
If cleanup
is >0
, the following steps are applied
Erosion with radius 2 voxels
Retain largest component
Dilation with radius 1 voxel
Morphological closing
These functions are available in iMath, see the operations “ME”, “GetLargestComponent”, “MD”, “FillHoles”.
Object of type antsImage
containing the mask image. The
voxel intensities will be binarized, 1 for voxels in the mask and 0 outside.
Shrinidhi KL, Cook PA, Avants BB
img <- ri(1)
mask <- getMask(img)
testthat::expect_error(getMask(img, lowThresh = "hey"))
pixeltype(img) <- "unsigned int"
mask2 <- getMask(img)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.