View source: R/segmentShapeFromImage.R
segmentShapeFromImage | R Documentation |
takes an image and a shape and relates the 2nd with the first to yield a feature image - the function is user modifiable but defaults to cor
segmentShapeFromImage(
img,
shape,
mask = NULL,
rad = NA,
scfun,
maskZeroes = TRUE
)
img |
antsImage |
shape |
to define features |
mask |
with values 1 or 0 |
rad |
max radius ( optional, not recommended ) |
scfun |
function to apply to create feature image (defaults to cor) |
maskZeroes |
if TRUE (default), zeroes will not influence the result |
feature image
Brian B. Avants
set.seed(123)
fi <- makeImage(c(20, 20), rnorm(400, mean = 1, sd = 0.1))
mask <- getMask(fi, 0.8, Inf, 0)
segs <- kmeansSegmentation(fi, 3, mask)$segmentation
segs[segs != 1] <- 0
shp <- labelClusters(segs, 1)
shp[shp != 1] <- 0
fimg <- segmentShapeFromImage(fi, shp, mask)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.