Learn R Programming

rpyANTs (version 0.0.4)

ants_apply_transforms_to_points: Apply a transform list to map points from one domain to another

Description

See ants$apply_transforms_to_points for more details. Please note point mapping goes the opposite direction of image mapping (see ants_apply_transforms), for both reasons of convention and engineering.

Usage

ants_apply_transforms_to_points(
  dim,
  points,
  transformlist,
  whichtoinvert = NULL,
  verbose = FALSE,
  ...
)

Value

Transformed points in data frame (R object)

Arguments

dim

dimensions of the transformation

points

data frame containing columns 'x', 'y', 'z', 't' (depending on dim)

transformlist

list of strings (path to transforms) generated by ants_registration where each transform is a file name

whichtoinvert

either NULL, None ('Python'), or a vector of logical with same length as transformlist; print ants$apply_transforms_to_points to see detailed descriptions

verbose

whether to verbose application of transform

...

ignored

See Also

print(ants$apply_transforms_to_points)

Examples

Run this code

if(interactive() && ants_available()) {
  ants <- load_ants()
  fixed <- as_ANTsImage( ants$get_ants_data('r16') )
  moving <- as_ANTsImage( ants$get_ants_data('r27') )

  reg <- ants_registration(
    fixed = fixed, moving = moving,
    type_of_transform = "antsRegistrationSyNRepro[a]")

  pts <- data.frame(
    x = c(128, 127),
    y = c(101, 111)
  )

  ptsw = ants_apply_transforms_to_points(2, pts, reg$fwdtransforms)
  ptsw
}

Run the code above in your browser using DataLab