Description Usage Arguments Value Author(s) Examples
View source: R/rfSegmentation.R
Predict image segmentation via random forests.
1 2 3 4 5 6 | rfSegmentationPredict(
rfSegmentationModel,
featureMatrix,
mask,
verbose = FALSE
)
|
rfSegmentationModel |
input rf model |
featureMatrix |
input feature matrix |
mask |
antsImage mask |
verbose |
bool |
segmentation is output
Tustison NJ, Avants BB
1 2 3 4 5 6 7 8 9 10 11 12 | 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 )
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.