resample_to_target-methods: Resample an Image to a Target Image

Description Usage Arguments Value Examples

Description

Resamples an antsImage or nifti object to a target

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
resample_to_target(
  img,
  target,
  interpolator = c("linear", "nearestNeighbor", "multiLabel", "gaussian", "bSpline",
    "cosineWindowedSinc", "welchWindowedSinc", "hammingWindowedSinc",
    "lanczosWindowedSinc", "genericLabel"),
  copy_origin = FALSE,
  ...
)

## S4 method for signature 'character'
resample_to_target(
  img,
  target,
  interpolator = c("linear", "nearestNeighbor", "multiLabel", "gaussian", "bSpline",
    "cosineWindowedSinc", "welchWindowedSinc", "hammingWindowedSinc",
    "lanczosWindowedSinc", "genericLabel"),
  copy_origin = FALSE,
  ...
)

## S4 method for signature 'nifti'
resample_to_target(
  img,
  target,
  interpolator = c("linear", "nearestNeighbor", "multiLabel", "gaussian", "bSpline",
    "cosineWindowedSinc", "welchWindowedSinc", "hammingWindowedSinc",
    "lanczosWindowedSinc", "genericLabel"),
  copy_origin = FALSE,
  ...
)

## S4 method for signature 'antsImage'
resample_to_target(
  img,
  target,
  interpolator = c("linear", "nearestNeighbor", "multiLabel", "gaussian", "bSpline",
    "cosineWindowedSinc", "welchWindowedSinc", "hammingWindowedSinc",
    "lanczosWindowedSinc", "genericLabel"),
  copy_origin = FALSE,
  ...
)

.resample_to_target(
  img,
  target,
  interpolator = c("linear", "nearestNeighbor", "multiLabel", "gaussian", "bSpline",
    "cosineWindowedSinc", "welchWindowedSinc", "hammingWindowedSinc",
    "lanczosWindowedSinc", "genericLabel"),
  copy_origin = FALSE,
  ...
)

Arguments

img

character path of image or an object of class nifti, or antsImage

target

image of reference, the output will be in this space. Will be coerced using check_ants

interpolator

what type of interpolation should be done

copy_origin

Copy image origin from target, using antsCopyOrigin

...

additional arguments to pass to resampleImageToTarget

Value

An antsImage or nifti depending on input

Examples

1
2
3
4
5
6
7
8
9
library(oro.nifti)
library(extrantsr)
n = 30
x = nifti(array(rnorm(n^3*10), dim = c(n, n, n)))
new_pixdim = c(0.5, 0.5, 0.5)
res = resample_image(x, parameters = new_pixdim)
x2 = resample_to_target(x, res)
pixdim(x2)[2:4]
stopifnot(all(pixdim(x2)[2:4] == new_pixdim))

neuroconductor/extrantsr documentation built on Sept. 28, 2020, 11:31 a.m.