Home · Quickstart · Documentation · Citation · NiPy

# workflows.fmri.spm.preprocess

## `create_spm_preproc()`

Link to code

Create an spm preprocessing workflow with freesurfer registration and artifact detection.

The workflow realigns and smooths and registers the functional images with the subject’s freesurfer space.

### Example

    >>> preproc = create_spm_preproc()
    >>> preproc.base_dir = '.'
    >>> preproc.inputs.inputspec.fwhm = 6
    >>> preproc.inputs.inputspec.subject_id = 's1'
    >>> preproc.inputs.inputspec.subjects_dir = '.'
    >>> preproc.inputs.inputspec.functionals = ['f3.nii', 'f5.nii']
    >>> preproc.inputs.inputspec.norm_threshold = 1
    >>> preproc.inputs.inputspec.zintensity_threshold = 3

Inputs:

    inputspec.functionals : functional runs use 4d nifti
    inputspec.subject_id : freesurfer subject id
    inputspec.subjects_dir : freesurfer subjects dir
    inputspec.fwhm : smoothing fwhm
    inputspec.norm_threshold : norm threshold for outliers
    inputspec.zintensity_threshold : intensity threshold in z-score

Outputs:

    outputspec.realignment_parameters : realignment parameter files
    outputspec.smoothed_files : smoothed functional files
    outputspec.outlier_files : list of outliers
    outputspec.outlier_stats : statistics of outliers
    outputspec.outlier_plots : images of outliers
    outputspec.mask_file : binary mask file in reference image space
    outputspec.reg_file : registration file that maps reference image to
                            freesurfer space
    outputspec.reg_cost : cost of registration (useful for detecting misalignment)

### Graph

## `create_DARTEL_template()`

Link to code

Create a vbm workflow that generates DARTEL-based template

### Example

    >>> preproc = create_DARTEL_template()
    >>> preproc.inputs.inputspec.structural_files = [os.path.abspath('s1.nii'), os.path.abspath('s3.nii')]
    >>> preproc.inputs.inputspec.template_prefix = 'Template'
    >>> preproc.run()

Inputs:

    inputspec.structural_files : structural data to be used to create templates
    inputspec.template_prefix : prefix for dartel template

Outputs:

    outputspec.template_file : DARTEL template
    outputspec.flow_fields : warps from input struct files to the template

## `create_vbm_preproc()`

Link to code

Create a vbm workflow that generates DARTEL-based warps to MNI space

Based on: http://www.fil.ion.ucl.ac.uk/~john/misc/VBMclass10.pdf

### Example

    >>> preproc = create_vbm_preproc()
    >>> preproc.inputs.inputspec.fwhm = 8
    >>> preproc.inputs.inputspec.structural_files = [os.path.abspath('s1.nii'), os.path.abspath('s3.nii')]
    >>> preproc.inputs.inputspec.template_prefix = 'Template'
    >>> preproc.run()

Inputs:

    inputspec.structural_files : structural data to be used to create templates
    inputspec.fwhm: single of triplet for smoothing when normalizing to MNI space
    inputspec.template_prefix : prefix for dartel template

Outputs:

    outputspec.normalized_files : normalized gray matter files
    outputspec.template_file : DARTEL template
    outputspec.icv : intracranial volume (cc - assuming dimensions in mm)