Applies SPM12 (Spatial) Normalization to images

spm12_normalize_write(
  deformation,
  other.files = NULL,
  bounding_box = matrix(c(-90, -126, -72, 90, 90, 108), nrow = 2, byrow = TRUE),
  voxel_size = c(2, 2, 2),
  interp = c("bspline4", "nearestneighbor", "trilinear", paste0("bspline", 2:3),
    paste0("bspline", 5:7)),
  retimg = FALSE,
  reorient = FALSE,
  add_spm_dir = TRUE,
  spmdir = spm_dir(verbose = verbose, install_dir = install_dir),
  clean = TRUE,
  verbose = TRUE,
  install_dir = NULL,
  ...
)

build_spm12_normalize_write(
  deformation,
  other.files = NULL,
  bounding_box = matrix(c(-90, -126, -72, 90, 90, 108), nrow = 2, byrow = TRUE),
  voxel_size = c(2, 2, 2),
  interp = c("bspline4", "nearestneighbor", "trilinear", paste0("bspline", 2:3),
    paste0("bspline", 5:7)),
  verbose = TRUE,
  ...
)

Arguments

deformation

Filename of deformation (nifti)

other.files

Files to be written using the estimated normalization

bounding_box

matrix (2x3) of the bounding box to use. Default is for MNI 2mm template size

voxel_size

The voxel sizes (x, y & z, in mm) of the written normalised images.

interp

Interpolator for sampling in fixed space

retimg

Logical indicating if image should be returned or result from run_matlab_script

reorient

if retimg=TRUE pass to readNIfTI

add_spm_dir

Add SPM12 directory from this package

spmdir

SPM dir to add, will use package default directory

clean

Remove scripts from temporary directory after running

verbose

Print diagnostic messages

install_dir

directory to download SPM12

...

Arguments passed to run_spm12_script

Value

List of SPM object, results, and output filenames

Examples

dims = rep(10, 3) temp_nii = array(rnorm(prod(dims)), dim = dims) temp_nii = oro.nifti::nifti(temp_nii) res = build_spm12_normalize_write(temp_nii, other.files = temp_nii, install_dir = tempdir())