antsreg: Wrapper object for one or more ANTs transforms

View source: R/xform.R

antsregR Documentation

Wrapper object for one or more ANTs transforms

Description

Wrapping paths to one or more ANTs registration files on disk in an antsreg object means that they can be used by nat::xform and inside nat::reglist objects.

as.antsreg constructs an antsreg object from an ANTs ouput directory. This is more convenient for end users.

Usage

antsreg(..., swap = NULL)

as.antsreg(x, inverse = FALSE)

Arguments

...

One or more ANTs registrations.

swap

Whether or not to invert the registration. Note that while affine registrations are invertible, deformation fields (usually specifying non-rigid registrations) are not.

x

Path to a directory containing ANTs registration files

inverse

Whether or not to select the inverse direction when constructing an antsreg object from a directory.

Details

At present, we assume that all ANTs transforms are specified by files on disk.

For the purposes of the swap argument, we assume we are trying to specify a registration in the direction required for images to be transformed. This is the opposite of the direction required for transformation of points.

Registrations are given in the order that they are to be applied reading from left to right. See nat::xform and nat::reglist for further details.

ANTs typically writes registrations into folders containing a single affine matrix and a pair of deformation fields (one defining the forward transform, the other the inverse transform).

Value

A character vector with additional class antsreg.

See Also

Other antsreg: xformpoints.antsreg

Examples

## Not run: 
# define forward and inverse registrations
inv=antsreg("JRC2018F_FAFB/JRC2018F_FAFB1InverseWarp_down.nii.gz",
    "JRC2018F_FAFB/JRC2018F_FAFB0GenericAffine.mat", swap=c(FALSE,TRUE))
fwd=antsreg("JRC2018F_FAFB/JRC2018F_FAFB0GenericAffine.mat",
    "JRC2018F_FAFB/JRC2018F_FAFB1Warp_down.nii.gz", swap=c(TRUE,TRUE))

# position of DA1 glomerulus in FAFB
da1glomr.fafb <- cbind(429316, 217924, 42960)
da1glomr.fafbum=da1glomr.fafb/1e3
# map position from FAFB to JRC2018
res <- xform(da1glomr.fafbum, inv)
# and back again
res2 <- xform(res, fwd)

# print out locations
da1glomr.fafbum
res
res2

## End(Not run)

jefferis/nat.ants documentation built on Dec. 12, 2023, 5:14 a.m.