Performs SPM12 Segmentation on an Image

spm12_segment(
  filename,
  set_origin = TRUE,
  biasreg = 0.001,
  biasfwhm = 60,
  native = TRUE,
  dartel = FALSE,
  modulated = FALSE,
  unmodulated = FALSE,
  bias_field = FALSE,
  bias_corrected = FALSE,
  n_gaus = c(1, 1, 2, 3, 4, 2),
  smoothness = 0,
  sampling_distance = 3,
  regularization = c(0, 0.001, 0.5, 0.05, 0.2),
  affine = c("mni", "eastern", "subj", "none"),
  mrf = 1,
  def_inverse = TRUE,
  def_forward = TRUE,
  warp_cleanup = c("light", "none", "thorough"),
  retimg = TRUE,
  add_spm_dir = TRUE,
  spmdir = spm_dir(verbose = verbose, install_dir = install_dir),
  clean = TRUE,
  verbose = TRUE,
  reorient = FALSE,
  install_dir = NULL,
  ...
)

Arguments

filename

File to be segmented

set_origin

Run acpc_reorient on image first. Warning, this will set the orientation differently

biasreg

Amount of bias regularization

biasfwhm

FWHM of Gaussian smoothness of bias.

native

Keep tissue class image (c*) in alignment with the original.

dartel

Keep tissue class image (rc*) that can be used with the Dartel toolbox .

modulated

Keep modulated images. Modulation is to compensate for the effect of spatial normalisation.

unmodulated

Keep unmodulated data

bias_field

save a bias corrected version of your images

bias_corrected

save an estimated bias field from your images

n_gaus

The number of Gaussians used to represent the intensity distribution for each tissue class. Can be 1:8 or infinity

smoothness

FWHM of smoothing done

sampling_distance

smoothness of the warping field. This is used to derive a fudge factor to account for correlations between neighbouring voxels. Approximate distance between sampled points when estimating the model parameters.

regularization

parameters for warping regularization

affine

Space to register the image to, using an affine registration

mrf

strength of the Markov random field. Setting the value to zero will disable the cleanup.

def_inverse

keep the inverse deformation field

def_forward

keep the forward deformation field

warp_cleanup

Level of cleanup with the warping. If you find pieces of brain being chopped out in your data, then you may wish to disable or tone down the cleanup procedure.

retimg

Logical indicating if image should be returned or result from run_matlab_script

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

reorient

if retimg=TRUE pass to readNIfTI

install_dir

directory to download SPM12

...

Arguments passed to run_spm12_script

Value

List of output files (or niftis depending on retimg), output matrix, and output deformations.