# 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<-kmeansSegmentation( ilist[[i]], k=3, kmask = refmask)
seglist[[i]]<-seg$segmentation
}
r<-2
d<-2
pp<-jointIntensityFusion(ref,refmask,ilist, rSearch=0,
labelList=seglist, rad=rep(r,d) )
# }
Run the code above in your browser using DataLab