getMask: Get Mask

Description Usage Arguments Details Value Author(s) Examples

View source: R/getMask.R

Description

Get a binary mask image from the given image after thresholding.

Usage

1
getMask(img, lowThresh, highThresh, cleanup = 2)

Arguments

img

Input image. Can be an antsImage of 2, 3 or 4 dimensions. If img is NULL, a file chooser dialog will appear.

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 >0, morphological operations will be applied to clean up the mask by eroding away small or weakly-connected areas, and closing holes.

Details

If cleanup is >0, the following steps are applied

  1. Erosion with radius 2 voxels

  2. Retain largest component

  3. Dilation with radius 1 voxel

  4. Morphological closing

These functions are available in iMath, see the operations “ME”, “GetLargestComponent”, “MD”, “FillHoles”.

Value

Object of type antsImage containing the mask image. The voxel intensities will be binarized, 1 for voxels in the mask and 0 outside.

Author(s)

Shrinidhi KL, Cook PA, Avants BB

Examples

1
2
3
4
5
img<-antsImageRead( getANTsRData("r16"))
mask<-getMask( img )
testthat::expect_error(getMask( img , lowThresh = "hey"))
pixeltype(img) = "unsigned int"
mask2<-getMask( img )

muschellij2/atropos documentation built on Oct. 11, 2018, 12:24 a.m.