# Apply a transform list to map an image from one domain to another

Source:`R/registration.R`

`ants_apply_transforms.Rd`

See `ants$apply_transforms`

for more details.

## Usage

```
ants_apply_transforms(
fixed,
moving,
transformlist,
interpolator = c("linear", "nearestNeighbor", "gaussian", "genericLabel", "bSpline",
"cosineWindowedSinc", "welchWindowedSinc", "hammingWindowedSinc",
"lanczosWindowedSinc"),
imagetype = 0L,
whichtoinvert = NULL,
compose = NULL,
defaultvalue = 0,
verbose = FALSE,
...
)
```

## Arguments

- fixed
fixed image defining domain into which the moving image is transformed

- moving
moving image to be mapped to fixed space

- transformlist
list of strings (path to transforms) generated by

`ants_registration`

where each transform is a file name- interpolator
how to interpolate the image; see 'Usage'

- imagetype
integer: 0 (scalar), 1 (vector), 2 (tensor), 3 (time-series), used when the fixed and moving images have different mode (dimensions)

- whichtoinvert
either

`NULL`

,`None`

('Python'), or a vector of logical with same length as`transformlist`

; print`ants$apply_transforms`

to see detailed descriptions- compose
optional character pointing to a valid file location

- defaultvalue
numerical value for mappings outside the image domain

- verbose
whether to verbose application of transform

- ...
must be named arguments passing to further methods

## Examples

```
if(interactive() && ants_available()) {
ants <- load_ants()
fixed <- as_ANTsImage( ants$get_ants_data('r16') )
moving <- as_ANTsImage( ants$get_ants_data('r64') )
fixed <- ants_resample_image(fixed, c(64, 64), TRUE, "linear")
moving <- ants_resample_image(moving, c(64,64), TRUE, "linear")
mytx <- ants_registration(fixed = fixed,
moving = moving,
type_of_transform = 'SyN')
mywarpedimage <- ants_apply_transforms(
fixed = fixed,
moving = moving,
transformlist = mytx$fwdtransforms
)
par(mfrow = c(1,3), mar = c(0,0,3,0))
pal <- gray.colors(256)
image(fixed[], asp = 1, axes = FALSE, col = pal,
ylim = c(1, 0), main = "Reference")
image(moving[], asp = 1, axes = FALSE, col = pal,
ylim = c(1, 0), main = "Moving")
image(mywarpedimage[], asp = 1, axes = FALSE, col = pal,
ylim = c(1, 0), main = "Moving reg+resamp into Reference")
}
```