Learn R Programming

ANTsR (version 1.0)

rfSegmentation: A rfSegmentation function.

Description

Image segmentation via random forests.

Usage

rfSegmentation(labelimg, featureimages, ntrees = 100, verbose = FALSE)

Arguments

labelimg

input antsImage labelimage --- assume non-zero entries create a mask

featureimages

input list of antsImage feature images - length n means n predictors in rf

ntrees

number of rf trees

verbose

boolean

Value

list of n-probability images is output where n is number of classes

Examples

Run this code
# NOT RUN {
if ( usePkg("randomForest") ) {
img<-antsImageRead( getANTsRData("r16"))
mask<-getMask( img )
segs<-kmeansSegmentation( img, k=3, kmask = mask)
fimgs<-lappend( img, segs$probabilityimages )
rfsegs<-rfSegmentation( segs$segmentation, fimgs , verbose=TRUE )
plot( rfsegs$segmentation )
# now use in atropos w/priors
segs2<-atropos( a = img, m = '[0.2,1x1]',
  c = '[5,0]',  i = rfsegs$probabilityimages, x = mask)
 }
# }

Run the code above in your browser using DataLab