Skip to content

nonrigid motion correction example

stnava edited this page Jan 17, 2017 · 1 revision
library(ANTsR)
fn = "s080_20151205_124111pcaslcvnavs016a1001.nii"
kidney = antsImageRead( fn )
kidSplit = splitNDImageToList( kidney )
kidAvg = antsAverageImages( kidSplit, 0 )
regList = list()
n = dim( kidney )[ 3 ]
for ( i in 1:n ) {
  print( i )
  regList[[ i ]] = antsRegistration( kidAvg, kidSplit[[ i ]],
    typeofTransform = "SyNOnly", synMetric = "CC",
    regIterations = c(60, 10 ), synSampling=4 )$warpedmovout
}
kidMo = mergeListToNDImage( kidney, regList )
antsImageWrite( kidMo, "/tmp/temp.nii.gz" )