Home · Quickstart · User Guide and Examples · Interfaces Index · Developers · About · Nipy

# nipype.interfaces.nipy.preprocess module

## ComputeMask

Link to code

> Bases: NipyBaseInterface

> mean_volumea pathlike object or string representing an existing file

>   Mean EPI image, used to compute the threshold for the mask.

> Ma float

>   Upper fraction of the histogram to be discarded.

> cca boolean

>   Keep only the largest connected component.

> ma float

>   Lower fraction of the histogram to be discarded.

> reference_volumea pathlike object or string representing an existing file

>   Reference volume used to compute the mask. If none is give, the mean volume is used.

> brain_mask : a pathlike object or string representing an existing file

## SpaceTimeRealigner

Link to code

> Bases: NipyBaseInterface

> Simultaneous motion and slice timing correction algorithm

> If slice_times is not specified, this algorithm performs spatial motion correction

> This interface wraps nipy’s SpaceTimeRealign algorithm [Roche2011] or simply the SpatialRealign algorithm when timing info is not provided.

> Examples

>     >>> from nipype.interfaces.nipy import SpaceTimeRealigner
>     >>> #Run spatial realignment only
>     >>> realigner = SpaceTimeRealigner()
>     >>> realigner.inputs.in_file = ['functional.nii']
>     >>> res = realigner.run()

>     >>> realigner = SpaceTimeRealigner()
>     >>> realigner.inputs.in_file = ['functional.nii']
>     >>> realigner.inputs.tr = 2
>     >>> realigner.inputs.slice_times = list(range(0, 3, 67))
>     >>> realigner.inputs.slice_info = 2
>     >>> res = realigner.run()

> References

> [Roche2011]

> Roche A. A four-dimensional registration algorithm with application to joint correction of motion and slice timing in fMRI. IEEE Trans Med Imaging. 2011 Aug;30(8):1546-54. DOI.

> in_filea list of items which are a pathlike object or string representing an existing file

>   File to realign.

> slice_infoan integer or a list of items which are any value

>   Single integer or length 2 sequence If int, the axis in images that is the slice axis. In a 4D image, this will often be axis = 2. If a 2 sequence, then elements are `(slice_axis, slice_direction)`, where `slice_axis` is the slice axis in the image as above, and `slice_direction` is 1 if the slices were acquired slice 0 first, slice -1 last, or -1 if acquired slice -1 first, slice 0 last. If slice_info is an int, assume `slice_direction` == 1. Requires inputs: `slice_times`.

> slice_timesa list of items which are a float or ‘asc_alt_2’ or ‘asc_alt_2_1’ or ‘asc_alt_half’ or ‘asc_alt_siemens’ or ‘ascending’ or ‘desc_alt_2’ or ‘desc_alt_half’ or ‘descending’

>   Actual slice acquisition times.

> tra float

>   TR in seconds. Requires inputs: `slice_times`.

> out_filea list of items which are a pathlike object or string representing an existing file

>   Realigned files.

> par_filea list of items which are a pathlike object or string representing an existing file

>   Motion parameter files. Angles are not euler angles.

> SpaceTimeRealigner.keywords = ['slice timing', 'motion correction']

## Trim

Link to code

> Bases: NipyBaseInterface

> Simple interface to trim a few volumes from a 4d fmri nifti file

> Examples

>     >>> from nipype.interfaces.nipy.preprocess import Trim
>     >>> trim = Trim()
>     >>> trim.inputs.in_file = 'functional.nii'
>     >>> trim.inputs.begin_index = 3 # remove 3 first volumes
>     >>> res = trim.run()

> in_filea pathlike object or string representing an existing file

>   EPI image to trim.

> begin_indexan integer

>   First volume. (Nipype default value: `0`)

> end_indexan integer

>   Last volume indexed as in python (and 0 for last). (Nipype default value: `0`)

> out_filea pathlike object or string representing a file

>   Output filename.

> suffixa string

>   Suffix for out_file to use if no out_file provided. (Nipype default value: `_trim`)

> out_file : a pathlike object or string representing an existing file