Learn R Programming

ANTsR (version 0.7.2.0)

jointLabelFusion: joint label and intensity fusion

Description

A multiple atlas voting scheme to customize labels for a new subject. This function will also perform intensity fusion. It almost directly calls the C++ in the ANTs executable so is much faster than other variants in ANTsR. One may want to normalize image intensities for each input image before passing to this function. If no labels are passed, we do intensity fusion. Note on computation time: the underlying C++ is multithreaded. You can control the number of threads by setting the environment variable ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS e.g. to use all or some of your CPUs. This will improve performance substantially. For instance, on a macbook pro from 2015, 8 cores improves speed by about 4x.

Usage

jointLabelFusion(targetI, targetIMask, atlasList, beta = 4, rad = 2,
  labelList = NA, rho = 0.01, usecor = FALSE, rSearch = 3,
  nonnegative = FALSE, verbose = FALSE)

Arguments

targetI

antsImage to be approximated

targetIMask

mask with value 1

atlasList

list containing antsImages with intensity images

beta

weight sharpness, default to 2

rad

neighborhood radius, default to 2

labelList

optional list containing antsImages with segmentation labels

rho

ridge penalty increases robustness to outliers but also makes image converge to average

usecor

employ correlation as local similarity

rSearch

radius of search, default is 3

nonnegative

constrain weights to be non-negative

verbose

boolean

Value

approximated image, segmentation and probabilities

Examples

Run this code
# NOT RUN {
set.seed(123)
ref<-antsImageRead( getANTsRData("r16"))
ref<-resampleImage(ref,c(50,50),1,0)
ref<-iMath(ref,"Normalize")
mi<-antsImageRead( getANTsRData("r27"))
mi2<-antsImageRead( getANTsRData("r30"))
mi3<-antsImageRead( getANTsRData("r62"))
mi4<-antsImageRead( getANTsRData("r64"))
mi5<-antsImageRead( getANTsRData("r85"))
refmask<-getMask(ref)
refmask<-iMath(refmask,"ME",2) # just to speed things up
ilist<-list(mi,mi2,mi3,mi4,mi5)
seglist<-list()
for ( i in 1:length(ilist) )
 {
 ilist[[i]]<-iMath(ilist[[i]],"Normalize")
 mytx<-antsRegistration(fixed=ref , moving=ilist[[i]] ,
   typeofTransform = c("Affine") )
 mywarpedimage<-antsApplyTransforms(fixed=ref,moving=ilist[[i]],
   transformlist=mytx$fwdtransforms)
 ilist[[i]]=mywarpedimage
 seg<-thresholdImage( ilist[[i]],"Otsu", 3)
 seglist[[i]]<-seg
 }
r<-2
pp<-jointLabelFusion(ref,refmask,ilist, rSearch=2,
  labelList=seglist, rad=rep(r, length(dim(ref)) ) )
pp<-jointLabelFusion(ref,refmask,ilist, rSearch=2,
  rad=rep(r, length(dim(ref)) ) )

# }
# NOT RUN {
ref = antsImageRead( getANTsRData("ch2") )
n = 50
ref = resampleImage(ref,c(n,n,n),1,0)
ref = iMath(ref,"Normalize")
refmask = getMask(ref)
ilist = list()
seglist = list()
for ( k in 1:5 ) {
mi = antsImageClone( ref ) + rnorm( n^3, 0, 0.1 )
mykseg = kmeansSegmentation( mi, 3, refmask )$segmentation
ilist[[ k ]] = mi
seglist[[ k ]] = mykseg
}
pp = jointLabelFusion( ref, refmask,ilist, rSearch=2,
 labelList=seglist, rad=rep(2, length(dim(ref)) ), verbose=TRUE )
plot( ref, pp$segmentation )
plot( pp$intensity  )
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab