maskImage: Mask input image by mask image.

View source: R/maskImage.R

maskImageR Documentation

Mask input image by mask image.

Description

Mask an input image by a mask image. If the mask image has multiple labels, it is possible to specify which label(s) to mask at.

Usage

maskImage(img.in, img.mask, level = 1, binarize = FALSE)

Arguments

img.in

Input image.

img.mask

Mask or label image.

level

Level(s) at which to mask image. If vector or list of values, output image is non-zero at all locations where label image matches any of the levels specified.

binarize

binarize the output image?

Value

An object of type antsImage.

Author(s)

Kandel BM and Avants B.

Examples


myimg <- antsImageRead(getANTsRData("r16"))
mask <- getMask(myimg)
myimg.mask <- maskImage(myimg, mask, 3)
myimg.mask <- maskImage(myimg, mask)
seg <- kmeansSegmentation(myimg, 3)
myimg.mask <- maskImage(myimg, seg$segmentation, c(1, 3))


stnava/ANTsR documentation built on April 13, 2025, 4:10 a.m.