connComp3D: Extract connected components from a 3D mask

Description Usage Arguments Value Examples

View source: R/conncomp.R

Description

Extract connected components from a 3D mask

Usage

1
connComp3D(mask, connect = c("6-connect", "18-connect", "26-connect"))

Arguments

mask

a 3D binary array

connect

the connectiivty constraint: "6-connect", "18-connect", or "26-connect"

Value

a two-element list of the connected components (cluster index and cluster size) The first element index is a 3D array containing the cluster index of the connected component for each voxel. The second element size is a 3D array consisting of the size of the connected component inhabited by each voxel.

Examples

1
2
3
4
dat <- array(as.logical(rnorm(10*10*10)>.5), c(10, 10, 10))
res1 <- connComp3D(dat, connect="6-connect")
res2 <- connComp3D(dat, connect="18-connect")
res3 <- connComp3D(dat, connect="26-connect")

bbuchsbaum/neuroim documentation built on March 29, 2021, 11:01 a.m.