randomMask: Get a random mask

View source: R/randomMask.R

randomMaskR Documentation

Get a random mask

Description

Get a mask with a specific number of voxels randomly distributed on the input image/mask

Usage

randomMask(img, nsamples, perLabel = FALSE, seed)

Arguments

img

an antsImage, either continuous or mask-like. This will define the space where to sample voxels from. If this image is continous (i.e., a T1), voxels will be sampled from all nonzero voxels.

nsamples

the number of random voxels to select from

perLabel

logical, if true the input image must be multi-label and the the output will have nsamples from each label (i.e., 200 samples from each label)

seed

random seed

Value

binary antsImage with random voxels set to 1

Author(s)

Pustina D

Examples


img <- antsImageRead(getANTsRData("r16"))
randmask <- randomMask(img, 200)


stnava/ANTsR documentation built on April 16, 2024, 12:17 a.m.