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
)

Arguments

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

Value

feature image

Author

Brian B. Avants

Examples


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)
#> Warning: the standard deviation is zero