ants.ops.get_mask
- get_mask(image, low_thresh=None, high_thresh=None, cleanup=2)[source]
Get a binary mask image from the given image after thresholding
ANTsR function: getMask
- Parameters:
image (
ants.core.ANTsImage) – image from which mask will be computed. Can be an antsImage of 2, 3 or 4 dimensions.low_thresh (
scalar (optional)) – An inclusive lower threshold for voxels to be included in the mask. If not given, defaults to image mean.high_thresh (
scalar (optional)) – An inclusive upper threshold for voxels to be included in the mask. If not given, defaults to image maxcleanup (
int) –If > 0, morphological operations will be applied to clean up the mask by eroding away small or weakly-connected areas, and closing holes. If cleanup is >0, the following steps are applied
Erosion with radius 2 voxels
Retain largest component
Dilation with radius 1 voxel
Morphological closing
- Return type:
ants.core.ANTsImage
Example
>>> import ants >>> image = ants.image_read( ants.get_ants_data('r16') ) >>> mask = ants.get_mask(image)