Skip to content

Options Structure

Paul Wright edited this page Aug 10, 2021 · 13 revisions

Overview

The RunPreproc function takes two arguments: paths, a cell array that specifies the input image filenames, and opt, a structure that specifies the options. The fields of the opt structure are detailed here. The subfields of do are all false by default.

Set-up options

Option Type Description Notes
opt.dir_out string Output directory Default: 'output'. Files in ‘path’ are copied to the output directory. Files ending ‘.gz’ are gunzipped (in which case outputs will be gzipped). Regular images are written int16. If label images are specified, these are checked so that values are <= 255 and written uint8.
opt.prefix string Filename prefix Default: 'pp_'. Added to filenames during initial copy.
opt.labels.part multi Values to use to collapse labels. First, rounds label image values. Next, if part is a string, binarises label values to zero and nonzero. If part is a vector, assigns sequential values to voxels with each value in the vector. If part is a cell array, assigns sequential labels to voxels with any of the values in each cell.

Erode

Option Type Description Notes
opt.do.erode Boolean Enable erode step Removes a few of the outer voxels

Reset origin

Option Type Description Notes
opt.do.res_orig Boolean Enable resetting origin Important for CT
opt.reset_orig.only_neg Boolean Only reset origin if image contains negative values. Negative values mean the image might be a CT.

Realignment to MNI space

Option Type Description Notes
opt.do.real_mni Boolean Enable realignment
opt.realign2mni.rigid Boolean Make realignment rigid Default: true.

Reslice to world space

Option Type Description Notes
opt.do.nm_reorient Boolean Enable reslicing The orientation matrix is applied to the image and reset.

Crop

Option Type Description Notes
opt.do.crop Boolean Enable cropping Remove unneccesary data to reduce image size
opt.crop.keep_neck Boolean Keep neck when cropping Default: true. False makes for even smaller image

Coregistration

Option Type Description Notes
opt.do.coreg Boolean Enable coregistration Uses Normalised Mutual Information (NMI)
opt.coreg.ref integer Reference image Default: 1. Which of the images acts as target for the others? Specify index in cell array paths{1}.

Denoising

Option Type Description Notes
opt.do.denoise Boolean Enable denoising

Super-resolution

Option Type Description Notes
opt.do.superres Boolean Enable super-resolution
opt.superres.ix integer vector (N img) Index of images to super-resolve Vector the same length as cell array of images. Number indicates channel (i.e. modality). Examples: [1 1 1] specifies three observations of one channel. [1 1 2 2 3 3] specifies two observations each of three channels. Default = [], which is interpreted as one observation from each channel.
opt.superres.verbose Boolean Enable verbose output from super-resolution Default: false.

Reslice images

Option Type Description Notes
opt.do.reslice Boolean Reslice images to have same image grids Only done if super-resolution is disabled.
opt.reslice.ref string Reference image Default: 1. Which of the images acts as target for the others? Specify index in cell array paths{1} if labels specified.
opt.reslice.deg integer Interpolation order Default: 1. 0 = nearest neighbour. 1 = trilinear. >=2 gives degree of B-spline.

Resize voxels

Option Type Description Notes
opt.do.vx Boolean Change voxel size If super-resolution is disabled, change voxel size when resetting origin, applying bounding box, or in a separate step (see detailed pipeline).
opt.vx.size number Specify voxel size in mm. Default: 1.
opt.vx.deg integer Interpolation order Default: 1. 0 = nearest neighbour. 1 = trilinear. >=2 gives degree of B-spline.

Apply SPM12 bounding box

Option Type Description Notes
opt.do.bb_spm Boolean Make image have same bounding-box as default SPM12 template Requires realignment to MNI.
opt.bb.dim [integer,integer,integer] Output dimensions after applying bounding-box By default the atlas dimensions will be used

Unified segmentation

Option Type Description Notes
opt.do.segment Boolean Enable unified segmentation
opt.segment.write_tc Boolean matrix (6x4) Select tissue classes to write Default native space GM, WM and CSF. Rows: tissue classes. Columns: image to write (native space, DARTEL import, standard space unmodulated, standard space modulated).
opt.segment.write_bf Boolean Write bias correction results Default: false. Can be a scalar, column vector length 2, or matrix N images x 2. Columns: write bias corrected image, write bias field.
opt.segment.write_df Boolean Write deformation fields Default: false. Can be scalar or column vector length 2. 1: write forward. 2: write inverse.
opt.segment.dir_out string Directory to save segmentation output
opt.segment.make_4d Boolean Write 4D nifti with segmentations.
opt.segment.domask Boolean Enable cost function masking Typically, a lesion mask is used to exclude abnormal voxels from segmentation.
opt.segment.maskvol integer Mask volume Specify index in cell array paths.

Bias field correction

Option Type Description Notes
opt.do.bfcorr Boolean Enable bias field correction Depends on segmentation

Skull stripping

Option Type Description Notes
opt.do.skullstrip Boolean Skull strip Depends on segmentation

Align output to template

Option Type Description Notes
opt.pth_template string Path to template Used to reslice and affinely register images to a template.

Write images warped to MNI space

Option Type Description Notes
opt.do.normalise Boolean Enable writing normalised images
opt.normalise.vox integer or column vector (3) Specify voxel size If integer, outputs cubic voxels this size. If row vector uses these dimensions. Default from SPM (usually [2 2 2]).
opt.normalise.deg integer Interpolation order Default: spm_get_defaults('normalise.write.interp'). 0 = nearest neighbour. 1 = trilinear. >=2 gives degree of B-spline.

Intensity normalisation

Option Type Description Notes
opt.do.int_norm Boolean Enable intensity normalisation
opt.int_norm.rng vector (2) Range into which to normalise intensities Default: [0 1]

Write 2D images

Option Type Description Notes
opt.do.write2d Boolean Write 2D versions If segmentation was run, writes 2D versions of segmented images too.
opt.dir_out2d string Directory to save 2D versions
opt.write2d.deg integer Interpolation order Default: 0. 0 = nearest neighbour. 1 = trilinear. >=2 gives degree of B-spline.
opt.write2d.sliceix integer Slice index This slice is written to the 2D file for each axis.

Output options

Option Type Description Notes
opt.do.go2native Boolean Write images in native space
opt.do.writemat Boolean Save orientation matrix to .mat file