# 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