Skip to contents

Applies FiberMargin to a 2D pixel mask or 3D voxel mask using only coordinates and categorical assignments.

Usage

clean_categorical_mask(mask, samples = NULL, workers = NULL)

Arguments

mask

A categorical matrix or three-dimensional array. Missing cells are treated as void locations.

samples

Optional matrix or array with the same dimensions as mask. Different samples are cleaned independently.

workers

Optional CPU budget used across samples and independent spatial charts. NULL uses up to two physical cores when possible.

Value

A cleaned mask with the representation of mask. Pointwise attributes are candidate, margin_score, required, repair_margin, atlas_dispersion, isolation, and changed. margin_score is a local support contrast on the mask lattice; repair_margin is the gap to the local acceptance threshold.

Examples

mask <- matrix(c(rep("A", 50), rep("B", 50)), nrow = 10)
mask[5, 5] <- "B"
cleaned <- clean_categorical_mask(mask, workers = 1)