Predict image segmentation via random forests.

rfSegmentationPredict(
  rfSegmentationModel,
  featureMatrix,
  mask,
  verbose = FALSE
)

Arguments

rfSegmentationModel

input rf model

featureMatrix

input feature matrix

mask

antsImage mask

verbose

bool

Value

segmentation is output

Author

Tustison NJ, Avants BB

Examples


if (usePkg("randomForest")) {
  img <- antsImageRead(getANTsRData("r16"))
  mask <- getMask(img)
  mask2 <- getMask(img)
  mask[129:255, 1:255] <- 0
  mask2[2:128, 1:255] <- 0
  segs <- kmeansSegmentation(img, k = 3, kmask = mask)
  fmat <- t(antsrimpute(getNeighborhoodInMask(img, mask, c(2, 2))))
  rfsegs <- rfSegmentation(fmat, mask, segs$segmentation, ntrees = 100)
  fmat2 <- t(antsrimpute(getNeighborhoodInMask(img, mask2, c(2, 2))))
  rfseg2 <- rfSegmentationPredict(rfsegs$rfModel, fmat2, mask2)
}