sampledoc

ANTsR 0.0.0 documentation

Time series registration and transformation.

«  ANTs segmentation approaches.   ::   Contents   ::   Population study using simple_voxel_based_analysis.R  »

Time series registration and transformation.

Register a BOLD image to a BOLD template and apply the resulting mapping.

if (FALSE) {
    bfn <- getANTsRData("AB")
    tem <- antsImageRead(bfn, 3)
    ResampleImageBySpacing(list(3, tem, tem, 2, 2, 2))
    tfn <- getANTsRData("KK")
    img <- antsImageRead(tfn, 4)
    avg <- new("antsImage", dimension = 3, pixeltype = "float")
    antsMotionCorr(list(d = 3, a = img, o = avg))
    mytx <- antsRegistration(fixed = tem, moving = avg, typeofTransform = c("SyN"),
        outprefix = paste(tempdir(), "/Z", sep = ""))
    # use full access to antsApplyTx
    outimg <- antsApplyTransforms(fixed = tem, moving = avg, transformlist = mytx$fwdtransforms)
    par(mfrow = c(2, 1))
    plotANTsImage(tem, slices = "40x60x5", axis = 1)
    plotANTsImage(outimg, slices = "40x60x5", axis = 1)
    # imagetype 3 is the 4D image ...
    out4Dimg <- antsApplyTransforms(fixed = tem, moving = img, transformlist = mytx$fwdtransforms,
        imagetype = 3)
    avgtx <- new("antsImage", dimension = 3, pixeltype = "float")
    antsMotionCorr(list(d = 3, a = out4Dimg, o = avgtx))
    par(mfrow = c(2, 1))
    plotANTsImage(outimg, slices = "40x60x5", axis = 1)
    plotANTsImage(avgtx, slices = "40x60x5", axis = 1)
}
## [1] "SUCCESS"

«  ANTs segmentation approaches.   ::   Contents   ::   Population study using simple_voxel_based_analysis.R  »