nipype.interfaces.fsl.preprocess module

The fsl module provides classes for interfacing with the FSL command line tools. This was written to work with FSL version 4.1.4.

ApplyWarp

Link to code

Bases: FSLCommand

Wrapped executable: applywarp.

FSL’s applywarp wrapper to apply the results of a FNIRT registration

Examples

>>> from nipype.interfaces import fsl
>>> from nipype.testing import example_data
>>> aw = fsl.ApplyWarp()
>>> aw.inputs.in_file = example_data('structural.nii')
>>> aw.inputs.ref_file = example_data('mni.nii')
>>> aw.inputs.field_file = 'my_coefficients_filed.nii' 
>>> res = aw.run() 
Mandatory Inputs:
  • in_file (a pathlike object or string representing an existing file) – Image to be warped. Maps to a command-line argument: --in=%s (position: 0).

  • ref_file (a pathlike object or string representing an existing file) – Reference image. Maps to a command-line argument: --ref=%s (position: 1).

Optional Inputs:
  • abswarp (a boolean) – Treat warp field as absolute: x’ = w(x). Maps to a command-line argument: --abs. Mutually exclusive with inputs: relwarp.

  • args (a string) – Additional parameters to the command. Maps to a command-line argument: %s.

  • datatype (‘char’ or ‘short’ or ‘int’ or ‘float’ or ‘double’) – Force output data type [char short int float double]. Maps to a command-line argument: --datatype=%s.

  • environ (a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’) – Environment variables. (Nipype default value: {})

  • field_file (a pathlike object or string representing an existing file) – File containing warp field. Maps to a command-line argument: --warp=%s.

  • interp (‘nn’ or ‘trilinear’ or ‘sinc’ or ‘spline’) – Interpolation method. Maps to a command-line argument: --interp=%s (position: -2).

  • mask_file (a pathlike object or string representing an existing file) – Filename for mask image (in reference space). Maps to a command-line argument: --mask=%s.

  • out_file (a pathlike object or string representing a file) – Output filename. Maps to a command-line argument: --out=%s (position: 2).

  • output_type (‘NIFTI’ or ‘NIFTI_PAIR’ or ‘NIFTI_GZ’ or ‘NIFTI_PAIR_GZ’) – FSL output type.

  • postmat (a pathlike object or string representing an existing file) – Filename for post-transform (affine matrix). Maps to a command-line argument: --postmat=%s.

  • premat (a pathlike object or string representing an existing file) – Filename for pre-transform (affine matrix). Maps to a command-line argument: --premat=%s.

  • relwarp (a boolean) – Treat warp field as relative: x’ = x + w(x). Maps to a command-line argument: --rel (position: -1). Mutually exclusive with inputs: abswarp.

  • superlevel (‘a’ or an integer) – Level of intermediary supersampling, a for ‘automatic’ or integer level. Default = 2. Maps to a command-line argument: --superlevel=%s.

  • supersample (a boolean) – Intermediary supersampling of output, default is off. Maps to a command-line argument: --super.

Outputs:

out_file (a pathlike object or string representing an existing file) – Warped output file.

ApplyXFM

Link to code

Bases: FLIRT

Wrapped executable: flirt.

Currently just a light wrapper around FLIRT, with no modifications

ApplyXFM is used to apply an existing transform to an image

Examples

>>> import nipype.interfaces.fsl as fsl
>>> from nipype.testing import example_data
>>> applyxfm = fsl.preprocess.ApplyXFM()
>>> applyxfm.inputs.in_file = example_data('structural.nii')
>>> applyxfm.inputs.in_matrix_file = example_data('trans.mat')
>>> applyxfm.inputs.out_file = 'newfile.nii'
>>> applyxfm.inputs.reference = example_data('mni.nii')
>>> applyxfm.inputs.apply_xfm = True
>>> result = applyxfm.run() 
Mandatory Inputs:
  • in_file (a pathlike object or string representing an existing file) – Input file. Maps to a command-line argument: -in %s (position: 0).

  • reference (a pathlike object or string representing an existing file) – Reference file. Maps to a command-line argument: -ref %s (position: 1).

Optional Inputs:
  • angle_rep (‘quaternion’ or ‘euler’) – Representation of rotation angles. Maps to a command-line argument: -anglerep %s.

  • apply_isoxfm (a float) – As applyxfm but forces isotropic resampling. Maps to a command-line argument: -applyisoxfm %f. Mutually exclusive with inputs: apply_xfm.

  • apply_xfm (a boolean) – Apply transformation supplied by in_matrix_file or uses_qform to use the affine matrix stored in the reference header. Maps to a command-line argument: -applyxfm. (Nipype default value: True)

  • args (a string) – Additional parameters to the command. Maps to a command-line argument: %s.

  • bbrslope (a float) – Value of bbr slope. Maps to a command-line argument: -bbrslope %f.

  • bbrtype (‘signed’ or ‘global_abs’ or ‘local_abs’) – Type of bbr cost function: signed [default], global_abs, local_abs. Maps to a command-line argument: -bbrtype %s.

  • bgvalue (a float) – Use specified background value for points outside FOV. Maps to a command-line argument: -setbackground %f.

  • bins (an integer) – Number of histogram bins. Maps to a command-line argument: -bins %d.

  • coarse_search (an integer) – Coarse search delta angle. Maps to a command-line argument: -coarsesearch %d.

  • cost (‘mutualinfo’ or ‘corratio’ or ‘normcorr’ or ‘normmi’ or ‘leastsq’ or ‘labeldiff’ or ‘bbr’) – Cost function. Maps to a command-line argument: -cost %s.

  • cost_func (‘mutualinfo’ or ‘corratio’ or ‘normcorr’ or ‘normmi’ or ‘leastsq’ or ‘labeldiff’ or ‘bbr’) – Cost function. Maps to a command-line argument: -searchcost %s.

  • datatype (‘char’ or ‘short’ or ‘int’ or ‘float’ or ‘double’) – Force output data type. Maps to a command-line argument: -datatype %s.

  • display_init (a boolean) – Display initial matrix. Maps to a command-line argument: -displayinit.

  • dof (an integer) – Number of transform degrees of freedom. Maps to a command-line argument: -dof %d.

  • echospacing (a float) – Value of EPI echo spacing - units of seconds. Maps to a command-line argument: -echospacing %f.

  • environ (a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’) – Environment variables. (Nipype default value: {})

  • fieldmap (a pathlike object or string representing a file) – Fieldmap image in rads/s - must be already registered to the reference image. Maps to a command-line argument: -fieldmap %s.

  • fieldmapmask (a pathlike object or string representing a file) – Mask for fieldmap image. Maps to a command-line argument: -fieldmapmask %s.

  • fine_search (an integer) – Fine search delta angle. Maps to a command-line argument: -finesearch %d.

  • force_scaling (a boolean) – Force rescaling even for low-res images. Maps to a command-line argument: -forcescaling.

  • in_matrix_file (a pathlike object or string representing a file) – Input 4x4 affine matrix. Maps to a command-line argument: -init %s.

  • in_weight (a pathlike object or string representing an existing file) – File for input weighting volume. Maps to a command-line argument: -inweight %s.

  • interp (‘trilinear’ or ‘nearestneighbour’ or ‘sinc’ or ‘spline’) – Final interpolation method used in reslicing. Maps to a command-line argument: -interp %s.

  • min_sampling (a float) – Set minimum voxel dimension for sampling. Maps to a command-line argument: -minsampling %f.

  • no_clamp (a boolean) – Do not use intensity clamping. Maps to a command-line argument: -noclamp.

  • no_resample (a boolean) – Do not change input sampling. Maps to a command-line argument: -noresample.

  • no_resample_blur (a boolean) – Do not use blurring on downsampling. Maps to a command-line argument: -noresampblur.

  • no_search (a boolean) – Set all angular searches to ranges 0 to 0. Maps to a command-line argument: -nosearch.

  • out_file (a pathlike object or string representing a file) – Registered output file. Maps to a command-line argument: -out %s (position: 2).

  • out_log (a pathlike object or string representing a file) – Output log. Requires inputs: save_log.

  • out_matrix_file (a pathlike object or string representing a file) – Output affine matrix in 4x4 asciii format. Maps to a command-line argument: -omat %s (position: 3).

  • output_type (‘NIFTI’ or ‘NIFTI_PAIR’ or ‘NIFTI_GZ’ or ‘NIFTI_PAIR_GZ’) – FSL output type.

  • padding_size (an integer) – For applyxfm: interpolates outside image by size. Maps to a command-line argument: -paddingsize %d.

  • pedir (an integer) – Phase encode direction of EPI - 1/2/3=x/y/z & -1/-2/-3=-x/-y/-z. Maps to a command-line argument: -pedir %d.

  • ref_weight (a pathlike object or string representing an existing file) – File for reference weighting volume. Maps to a command-line argument: -refweight %s.

  • rigid2D (a boolean) – Use 2D rigid body mode - ignores dof. Maps to a command-line argument: -2D.

  • save_log (a boolean) – Save to log file.

  • schedule (a pathlike object or string representing an existing file) – Replaces default schedule. Maps to a command-line argument: -schedule %s.

  • searchr_x (a list of from 2 to 2 items which are an integer) – Search angles along x-axis, in degrees. Maps to a command-line argument: -searchrx %s.

  • searchr_y (a list of from 2 to 2 items which are an integer) – Search angles along y-axis, in degrees. Maps to a command-line argument: -searchry %s.

  • searchr_z (a list of from 2 to 2 items which are an integer) – Search angles along z-axis, in degrees. Maps to a command-line argument: -searchrz %s.

  • sinc_width (an integer) – Full-width in voxels. Maps to a command-line argument: -sincwidth %d.

  • sinc_window (‘rectangular’ or ‘hanning’ or ‘blackman’) – Sinc window. Maps to a command-line argument: -sincwindow %s.

  • uses_qform (a boolean) – Initialize using sform or qform. Maps to a command-line argument: -usesqform.

  • verbose (an integer) – Verbose mode, 0 is least. Maps to a command-line argument: -verbose %d.

  • wm_seg (a pathlike object or string representing a file) – White matter segmentation volume needed by BBR cost function. Maps to a command-line argument: -wmseg %s.

  • wmcoords (a pathlike object or string representing a file) – White matter boundary coordinates for BBR cost function. Maps to a command-line argument: -wmcoords %s.

  • wmnorms (a pathlike object or string representing a file) – White matter boundary normals for BBR cost function. Maps to a command-line argument: -wmnorms %s.

Outputs:
  • out_file (a pathlike object or string representing an existing file) – Path/name of registered file (if generated).

  • out_log (a pathlike object or string representing a file) – Path/name of output log (if generated).

  • out_matrix_file (a pathlike object or string representing an existing file) – Path/name of calculated affine transform (if generated).

BET

Link to code

Bases: FSLCommand

Wrapped executable: bet.

FSL BET wrapper for skull stripping

For complete details, see the BET Documentation.

Examples

>>> from nipype.interfaces import fsl
>>> btr = fsl.BET()
>>> btr.inputs.in_file = 'structural.nii'
>>> btr.inputs.frac = 0.7
>>> btr.inputs.out_file = 'brain_anat.nii'
>>> btr.cmdline
'bet structural.nii brain_anat.nii -f 0.70'
>>> res = btr.run() 
Mandatory Inputs:

in_file (a pathlike object or string representing an existing file) – Input file to skull strip. Maps to a command-line argument: %s (position: 0).

Optional Inputs:
  • args (a string) – Additional parameters to the command. Maps to a command-line argument: %s.

  • center (a list of at most 3 items which are an integer) – Center of gravity in voxels. Maps to a command-line argument: -c %s.

  • environ (a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’) – Environment variables. (Nipype default value: {})

  • frac (a float) – Fractional intensity threshold. Maps to a command-line argument: -f %.2f.

  • functional (a boolean) – Apply to 4D fMRI data. Maps to a command-line argument: -F. Mutually exclusive with inputs: functional, reduce_bias, robust, padding, remove_eyes, surfaces, t2_guided.

  • mask (a boolean) – Create binary mask image. Maps to a command-line argument: -m.

  • mesh (a boolean) – Generate a vtk mesh brain surface. Maps to a command-line argument: -e.

  • no_output (a boolean) – Don’t generate segmented output. Maps to a command-line argument: -n.

  • out_file (a pathlike object or string representing a file) – Name of output skull stripped image. Maps to a command-line argument: %s (position: 1).

  • outline (a boolean) – Create surface outline image. Maps to a command-line argument: -o.

  • output_type (‘NIFTI’ or ‘NIFTI_PAIR’ or ‘NIFTI_GZ’ or ‘NIFTI_PAIR_GZ’) – FSL output type.

  • padding (a boolean) – Improve BET if FOV is very small in Z (by temporarily padding end slices). Maps to a command-line argument: -Z. Mutually exclusive with inputs: functional, reduce_bias, robust, padding, remove_eyes, surfaces, t2_guided.

  • radius (an integer) – Head radius. Maps to a command-line argument: -r %d.

  • reduce_bias (a boolean) – Bias field and neck cleanup. Maps to a command-line argument: -B. Mutually exclusive with inputs: functional, reduce_bias, robust, padding, remove_eyes, surfaces, t2_guided.

  • remove_eyes (a boolean) – Eye & optic nerve cleanup (can be useful in SIENA). Maps to a command-line argument: -S. Mutually exclusive with inputs: functional, reduce_bias, robust, padding, remove_eyes, surfaces, t2_guided.

  • robust (a boolean) – Robust brain centre estimation (iterates BET several times). Maps to a command-line argument: -R. Mutually exclusive with inputs: functional, reduce_bias, robust, padding, remove_eyes, surfaces, t2_guided.

  • skull (a boolean) – Create skull image. Maps to a command-line argument: -s.

  • surfaces (a boolean) – Run bet2 and then betsurf to get additional skull and scalp surfaces (includes registrations). Maps to a command-line argument: -A. Mutually exclusive with inputs: functional, reduce_bias, robust, padding, remove_eyes, surfaces, t2_guided.

  • t2_guided (a pathlike object or string representing a file) – As with creating surfaces, when also feeding in non-brain-extracted T2 (includes registrations). Maps to a command-line argument: -A2 %s. Mutually exclusive with inputs: functional, reduce_bias, robust, padding, remove_eyes, surfaces, t2_guided.

  • threshold (a boolean) – Apply thresholding to segmented brain image and mask. Maps to a command-line argument: -t.

  • vertical_gradient (a float) – Vertical gradient in fractional intensity threshold (-1, 1). Maps to a command-line argument: -g %.2f.

Outputs:
  • inskull_mask_file (a pathlike object or string representing a file) – Path/name of inskull mask (if generated).

  • inskull_mesh_file (a pathlike object or string representing a file) – Path/name of inskull mesh outline (if generated).

  • mask_file (a pathlike object or string representing a file) – Path/name of binary brain mask (if generated).

  • meshfile (a pathlike object or string representing a file) – Path/name of vtk mesh file (if generated).

  • out_file (a pathlike object or string representing a file) – Path/name of skullstripped file (if generated).

  • outline_file (a pathlike object or string representing a file) – Path/name of outline file (if generated).

  • outskin_mask_file (a pathlike object or string representing a file) – Path/name of outskin mask (if generated).

  • outskin_mesh_file (a pathlike object or string representing a file) – Path/name of outskin mesh outline (if generated).

  • outskull_mask_file (a pathlike object or string representing a file) – Path/name of outskull mask (if generated).

  • outskull_mesh_file (a pathlike object or string representing a file) – Path/name of outskull mesh outline (if generated).

  • skull_file (a pathlike object or string representing a file) – Path/name of skull file (if generated).

  • skull_mask_file (a pathlike object or string representing a file) – Path/name of skull mask (if generated).

FAST

Link to code

Bases: FSLCommand

Wrapped executable: fast.

FSL FAST wrapper for segmentation and bias correction

For complete details, see the FAST Documentation.

Examples

>>> from nipype.interfaces import fsl
>>> fast = fsl.FAST()
>>> fast.inputs.in_files = 'structural.nii'
>>> fast.inputs.out_basename = 'fast_'
>>> fast.cmdline
'fast -o fast_ -S 1 structural.nii'
>>> out = fast.run()  
Mandatory Inputs:

in_files (a list of items which are a pathlike object or string representing an existing file) – Image, or multi-channel set of images, to be segmented. Maps to a command-line argument: %s (position: -1).

Optional Inputs:
  • args (a string) – Additional parameters to the command. Maps to a command-line argument: %s.

  • bias_iters (1 <= an integer <= 10) – Number of main-loop iterations during bias-field removal. Maps to a command-line argument: -I %d.

  • bias_lowpass (4 <= an integer <= 40) – Bias field smoothing extent (FWHM) in mm. Maps to a command-line argument: -l %d.

  • environ (a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’) – Environment variables. (Nipype default value: {})

  • hyper (0.0 <= a floating point number <= 1.0) – Segmentation spatial smoothness. Maps to a command-line argument: -H %.2f.

  • img_type (1 or 2 or 3) – Int specifying type of image: (1 = T1, 2 = T2, 3 = PD). Maps to a command-line argument: -t %d.

  • init_seg_smooth (0.0001 <= a floating point number <= 0.1) – Initial segmentation spatial smoothness (during bias field estimation). Maps to a command-line argument: -f %.3f.

  • init_transform (a pathlike object or string representing an existing file) – <standard2input.mat> initialise using priors. Maps to a command-line argument: -a %s.

  • iters_afterbias (1 <= an integer <= 20) – Number of main-loop iterations after bias-field removal. Maps to a command-line argument: -O %d.

  • manual_seg (a pathlike object or string representing an existing file) – Filename containing intensities. Maps to a command-line argument: -s %s.

  • mixel_smooth (0.0 <= a floating point number <= 1.0) – Spatial smoothness for mixeltype. Maps to a command-line argument: -R %.2f.

  • no_bias (a boolean) – Do not remove bias field. Maps to a command-line argument: -N.

  • no_pve (a boolean) – Turn off PVE (partial volume estimation). Maps to a command-line argument: --nopve.

  • number_classes (1 <= an integer <= 10) – Number of tissue-type classes. Maps to a command-line argument: -n %d.

  • other_priors (a list of from 3 to 3 items which are a pathlike object or string representing a file) – Alternative prior images. Maps to a command-line argument: -A %s.

  • out_basename (a pathlike object or string representing a file) – Base name of output files. Maps to a command-line argument: -o %s.

  • output_biascorrected (a boolean) – Output restored image (bias-corrected image). Maps to a command-line argument: -B.

  • output_biasfield (a boolean) – Output estimated bias field. Maps to a command-line argument: -b.

  • output_type (‘NIFTI’ or ‘NIFTI_PAIR’ or ‘NIFTI_GZ’ or ‘NIFTI_PAIR_GZ’) – FSL output type.

  • probability_maps (a boolean) – Outputs individual probability maps. Maps to a command-line argument: -p.

  • segment_iters (1 <= an integer <= 50) – Number of segmentation-initialisation iterations. Maps to a command-line argument: -W %d.

  • segments (a boolean) – Outputs a separate binary image for each tissue type. Maps to a command-line argument: -g.

  • use_priors (a boolean) – Use priors throughout. Maps to a command-line argument: -P.

  • verbose (a boolean) – Switch on diagnostic messages. Maps to a command-line argument: -v.

Outputs:
  • bias_field (a list of items which are a pathlike object or string representing a file)

  • mixeltype (a pathlike object or string representing a file) – Path/name of mixeltype volume file _mixeltype.

  • partial_volume_files (a list of items which are a pathlike object or string representing a file)

  • partial_volume_map (a pathlike object or string representing a file) – Path/name of partial volume file _pveseg.

  • probability_maps (a list of items which are a pathlike object or string representing a file)

  • restored_image (a list of items which are a pathlike object or string representing a file)

  • tissue_class_files (a list of items which are a pathlike object or string representing a file)

  • tissue_class_map (a pathlike object or string representing an existing file) – Path/name of binary segmented volume file one val for each class _seg.

FIRST

Link to code

Bases: FSLCommand

Wrapped executable: run_first_all.

FSL run_first_all wrapper for segmentation of subcortical volumes

http://www.fmrib.ox.ac.uk/fsl/first/index.html

Examples

>>> from nipype.interfaces import fsl
>>> first = fsl.FIRST()
>>> first.inputs.in_file = 'structural.nii'
>>> first.inputs.out_file = 'segmented.nii'
>>> res = first.run() 
Mandatory Inputs:
  • in_file (a pathlike object or string representing an existing file) – Input data file. Maps to a command-line argument: -i %s (position: -2).

  • out_file (a pathlike object or string representing a file) – Output data file. Maps to a command-line argument: -o %s (position: -1). (Nipype default value: segmented)

Optional Inputs:
  • affine_file (a pathlike object or string representing an existing file) – Affine matrix to use (e.g. img2std.mat) (does not re-run registration). Maps to a command-line argument: -a %s (position: 6).

  • args (a string) – Additional parameters to the command. Maps to a command-line argument: %s.

  • brain_extracted (a boolean) – Input structural image is already brain-extracted. Maps to a command-line argument: -b (position: 2).

  • environ (a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’) – Environment variables. (Nipype default value: {})

  • list_of_specific_structures (a list of at least 1 items which are a string) – Runs only on the specified structures (e.g. L_Hipp, R_HippL_Accu, R_Accu, L_Amyg, R_AmygL_Caud, R_Caud, L_Pall, R_PallL_Puta, R_Puta, L_Thal, R_Thal, BrStem. Maps to a command-line argument: -s %s (position: 5).

  • method (‘auto’ or ‘fast’ or ‘none’) – Method must be one of auto, fast, none, or it can be entered using the ‘method_as_numerical_threshold’ input. Maps to a command-line argument: -m %s (position: 4). Mutually exclusive with inputs: method_as_numerical_threshold. (Nipype default value: auto)

  • method_as_numerical_threshold (a float) – Specify a numerical threshold value or use the ‘method’ input to choose auto, fast, or none. Maps to a command-line argument: -m %.4f (position: 4).

  • no_cleanup (a boolean) – Input structural image is already brain-extracted. Maps to a command-line argument: -d (position: 3).

  • output_type (‘NIFTI’ or ‘NIFTI_PAIR’ or ‘NIFTI_GZ’ or ‘NIFTI_PAIR_GZ’) – FSL output type.

  • verbose (a boolean) – Use verbose logging. Maps to a command-line argument: -v (position: 1).

Outputs:
  • bvars (a list of items which are a pathlike object or string representing an existing file) – Bvars for each subcortical region.

  • original_segmentations (a pathlike object or string representing an existing file) – 3D image file containing the segmented regions as integer values. Uses CMA labelling.

  • segmentation_file (a pathlike object or string representing an existing file) – 4D image file containing a single volume per segmented region.

  • vtk_surfaces (a list of items which are a pathlike object or string representing an existing file) – VTK format meshes for each subcortical region.

FLIRT

Link to code

Bases: FSLCommand

Wrapped executable: flirt.

FSL FLIRT wrapper for coregistration

For complete details, see the FLIRT Documentation.

To print out the command line help, use:

fsl.FLIRT().inputs_help()

Examples

>>> from nipype.interfaces import fsl
>>> from nipype.testing import example_data
>>> flt = fsl.FLIRT(bins=640, cost_func='mutualinfo')
>>> flt.inputs.in_file = 'structural.nii'
>>> flt.inputs.reference = 'mni.nii'
>>> flt.inputs.output_type = "NIFTI_GZ"
>>> flt.cmdline 
'flirt -in structural.nii -ref mni.nii -out structural_flirt.nii.gz -omat structural_flirt.mat -bins 640 -searchcost mutualinfo'
>>> res = flt.run() 
Mandatory Inputs:
  • in_file (a pathlike object or string representing an existing file) – Input file. Maps to a command-line argument: -in %s (position: 0).

  • reference (a pathlike object or string representing an existing file) – Reference file. Maps to a command-line argument: -ref %s (position: 1).

Optional Inputs:
  • angle_rep (‘quaternion’ or ‘euler’) – Representation of rotation angles. Maps to a command-line argument: -anglerep %s.

  • apply_isoxfm (a float) – As applyxfm but forces isotropic resampling. Maps to a command-line argument: -applyisoxfm %f. Mutually exclusive with inputs: apply_xfm.

  • apply_xfm (a boolean) – Apply transformation supplied by in_matrix_file or uses_qform to use the affine matrix stored in the reference header. Maps to a command-line argument: -applyxfm.

  • args (a string) – Additional parameters to the command. Maps to a command-line argument: %s.

  • bbrslope (a float) – Value of bbr slope. Maps to a command-line argument: -bbrslope %f.

  • bbrtype (‘signed’ or ‘global_abs’ or ‘local_abs’) – Type of bbr cost function: signed [default], global_abs, local_abs. Maps to a command-line argument: -bbrtype %s.

  • bgvalue (a float) – Use specified background value for points outside FOV. Maps to a command-line argument: -setbackground %f.

  • bins (an integer) – Number of histogram bins. Maps to a command-line argument: -bins %d.

  • coarse_search (an integer) – Coarse search delta angle. Maps to a command-line argument: -coarsesearch %d.

  • cost (‘mutualinfo’ or ‘corratio’ or ‘normcorr’ or ‘normmi’ or ‘leastsq’ or ‘labeldiff’ or ‘bbr’) – Cost function. Maps to a command-line argument: -cost %s.

  • cost_func (‘mutualinfo’ or ‘corratio’ or ‘normcorr’ or ‘normmi’ or ‘leastsq’ or ‘labeldiff’ or ‘bbr’) – Cost function. Maps to a command-line argument: -searchcost %s.

  • datatype (‘char’ or ‘short’ or ‘int’ or ‘float’ or ‘double’) – Force output data type. Maps to a command-line argument: -datatype %s.

  • display_init (a boolean) – Display initial matrix. Maps to a command-line argument: -displayinit.

  • dof (an integer) – Number of transform degrees of freedom. Maps to a command-line argument: -dof %d.

  • echospacing (a float) – Value of EPI echo spacing - units of seconds. Maps to a command-line argument: -echospacing %f.

  • environ (a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’) – Environment variables. (Nipype default value: {})

  • fieldmap (a pathlike object or string representing a file) – Fieldmap image in rads/s - must be already registered to the reference image. Maps to a command-line argument: -fieldmap %s.

  • fieldmapmask (a pathlike object or string representing a file) – Mask for fieldmap image. Maps to a command-line argument: -fieldmapmask %s.

  • fine_search (an integer) – Fine search delta angle. Maps to a command-line argument: -finesearch %d.

  • force_scaling (a boolean) – Force rescaling even for low-res images. Maps to a command-line argument: -forcescaling.

  • in_matrix_file (a pathlike object or string representing a file) – Input 4x4 affine matrix. Maps to a command-line argument: -init %s.

  • in_weight (a pathlike object or string representing an existing file) – File for input weighting volume. Maps to a command-line argument: -inweight %s.

  • interp (‘trilinear’ or ‘nearestneighbour’ or ‘sinc’ or ‘spline’) – Final interpolation method used in reslicing. Maps to a command-line argument: -interp %s.

  • min_sampling (a float) – Set minimum voxel dimension for sampling. Maps to a command-line argument: -minsampling %f.

  • no_clamp (a boolean) – Do not use intensity clamping. Maps to a command-line argument: -noclamp.

  • no_resample (a boolean) – Do not change input sampling. Maps to a command-line argument: -noresample.

  • no_resample_blur (a boolean) – Do not use blurring on downsampling. Maps to a command-line argument: -noresampblur.

  • no_search (a boolean) – Set all angular searches to ranges 0 to 0. Maps to a command-line argument: -nosearch.

  • out_file (a pathlike object or string representing a file) – Registered output file. Maps to a command-line argument: -out %s (position: 2).

  • out_log (a pathlike object or string representing a file) – Output log. Requires inputs: save_log.

  • out_matrix_file (a pathlike object or string representing a file) – Output affine matrix in 4x4 asciii format. Maps to a command-line argument: -omat %s (position: 3).

  • output_type (‘NIFTI’ or ‘NIFTI_PAIR’ or ‘NIFTI_GZ’ or ‘NIFTI_PAIR_GZ’) – FSL output type.

  • padding_size (an integer) – For applyxfm: interpolates outside image by size. Maps to a command-line argument: -paddingsize %d.

  • pedir (an integer) – Phase encode direction of EPI - 1/2/3=x/y/z & -1/-2/-3=-x/-y/-z. Maps to a command-line argument: -pedir %d.

  • ref_weight (a pathlike object or string representing an existing file) – File for reference weighting volume. Maps to a command-line argument: -refweight %s.

  • rigid2D (a boolean) – Use 2D rigid body mode - ignores dof. Maps to a command-line argument: -2D.

  • save_log (a boolean) – Save to log file.

  • schedule (a pathlike object or string representing an existing file) – Replaces default schedule. Maps to a command-line argument: -schedule %s.

  • searchr_x (a list of from 2 to 2 items which are an integer) – Search angles along x-axis, in degrees. Maps to a command-line argument: -searchrx %s.

  • searchr_y (a list of from 2 to 2 items which are an integer) – Search angles along y-axis, in degrees. Maps to a command-line argument: -searchry %s.

  • searchr_z (a list of from 2 to 2 items which are an integer) – Search angles along z-axis, in degrees. Maps to a command-line argument: -searchrz %s.

  • sinc_width (an integer) – Full-width in voxels. Maps to a command-line argument: -sincwidth %d.

  • sinc_window (‘rectangular’ or ‘hanning’ or ‘blackman’) – Sinc window. Maps to a command-line argument: -sincwindow %s.

  • uses_qform (a boolean) – Initialize using sform or qform. Maps to a command-line argument: -usesqform.

  • verbose (an integer) – Verbose mode, 0 is least. Maps to a command-line argument: -verbose %d.

  • wm_seg (a pathlike object or string representing a file) – White matter segmentation volume needed by BBR cost function. Maps to a command-line argument: -wmseg %s.

  • wmcoords (a pathlike object or string representing a file) – White matter boundary coordinates for BBR cost function. Maps to a command-line argument: -wmcoords %s.

  • wmnorms (a pathlike object or string representing a file) – White matter boundary normals for BBR cost function. Maps to a command-line argument: -wmnorms %s.

Outputs:
  • out_file (a pathlike object or string representing an existing file) – Path/name of registered file (if generated).

  • out_log (a pathlike object or string representing a file) – Path/name of output log (if generated).

  • out_matrix_file (a pathlike object or string representing an existing file) – Path/name of calculated affine transform (if generated).

FLIRT.aggregate_outputs(runtime=None, needed_outputs=None)

Collate expected outputs and apply output traits validation.

FNIRT

Link to code

Bases: FSLCommand

Wrapped executable: fnirt.

FSL FNIRT wrapper for non-linear registration

For complete details, see the FNIRT Documentation.

Examples

>>> from nipype.interfaces import fsl
>>> from nipype.testing import example_data
>>> fnt = fsl.FNIRT(affine_file=example_data('trans.mat'))
>>> res = fnt.run(ref_file=example_data('mni.nii', in_file=example_data('structural.nii')) 

T1 -> Mni153

>>> from nipype.interfaces import fsl
>>> fnirt_mprage = fsl.FNIRT()
>>> fnirt_mprage.inputs.in_fwhm = [8, 4, 2, 2]
>>> fnirt_mprage.inputs.subsampling_scheme = [4, 2, 1, 1]

Specify the resolution of the warps

>>> fnirt_mprage.inputs.warp_resolution = (6, 6, 6)
>>> res = fnirt_mprage.run(in_file='structural.nii', ref_file='mni.nii', warped_file='warped.nii', fieldcoeff_file='fieldcoeff.nii')

We can check the command line and confirm that it’s what we expect.

>>> fnirt_mprage.cmdline  
'fnirt --cout=fieldcoeff.nii --in=structural.nii --infwhm=8,4,2,2 --ref=mni.nii --subsamp=4,2,1,1 --warpres=6,6,6 --iout=warped.nii'
Mandatory Inputs:
  • in_file (a pathlike object or string representing an existing file) – Name of input image. Maps to a command-line argument: --in=%s.

  • ref_file (a pathlike object or string representing an existing file) – Name of reference image. Maps to a command-line argument: --ref=%s.

Optional Inputs:
  • affine_file (a pathlike object or string representing an existing file) – Name of file containing affine transform. Maps to a command-line argument: --aff=%s.

  • apply_inmask (a list of items which are 0 or 1) – List of iterations to use input mask on (1 to use, 0 to skip). Maps to a command-line argument: --applyinmask=%s. Mutually exclusive with inputs: skip_inmask.

  • apply_intensity_mapping (a list of items which are 0 or 1) – List of subsampling levels to apply intensity mapping for (0 to skip, 1 to apply). Maps to a command-line argument: --estint=%s. Mutually exclusive with inputs: skip_intensity_mapping.

  • apply_refmask (a list of items which are 0 or 1) – List of iterations to use reference mask on (1 to use, 0 to skip). Maps to a command-line argument: --applyrefmask=%s. Mutually exclusive with inputs: skip_refmask.

  • args (a string) – Additional parameters to the command. Maps to a command-line argument: %s.

  • bias_regularization_lambda (a float) – Weight of regularisation for bias-field, default 10000. Maps to a command-line argument: --biaslambda=%f.

  • biasfield_resolution (a tuple of the form: (an integer, an integer, an integer)) – Resolution (in mm) of bias-field modelling local intensities, default 50, 50, 50. Maps to a command-line argument: --biasres=%d,%d,%d.

  • config_file (‘T1_2_MNI152_2mm’ or ‘FA_2_FMRIB58_1mm’ or a pathlike object or string representing an existing file) – Name of config file specifying command line arguments. Maps to a command-line argument: --config=%s.

  • derive_from_ref (a boolean) – If true, ref image is used to calculate derivatives. Default false. Maps to a command-line argument: --refderiv.

  • environ (a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’) – Environment variables. (Nipype default value: {})

  • field_file (a boolean or a pathlike object or string representing a file) – Name of output file with field or true. Maps to a command-line argument: --fout=%s.

  • fieldcoeff_file (a boolean or a pathlike object or string representing a file) – Name of output file with field coefficients or true. Maps to a command-line argument: --cout=%s.

  • hessian_precision (‘double’ or ‘float’) – Precision for representing Hessian, double or float. Default double. Maps to a command-line argument: --numprec=%s.

  • in_fwhm (a list of items which are an integer) – FWHM (in mm) of gaussian smoothing kernel for input volume, default [6, 4, 2, 2]. Maps to a command-line argument: --infwhm=%s.

  • in_intensitymap_file (a list of from 1 to 2 items which are a pathlike object or string representing an existing file) – Name of file/files containing initial intensity mapping usually generated by previous fnirt run. Maps to a command-line argument: --intin=%s.

  • inmask_file (a pathlike object or string representing an existing file) – Name of file with mask in input image space. Maps to a command-line argument: --inmask=%s.

  • inmask_val (a float) – Value to mask out in –in image. Default =0.0. Maps to a command-line argument: --impinval=%f.

  • intensity_mapping_model (‘none’ or ‘global_linear’ or ‘global_non_linear’ or ‘local_linear’ or ‘global_non_linear_with_bias’ or ‘local_non_linear’) – Model for intensity-mapping. Maps to a command-line argument: --intmod=%s.

  • intensity_mapping_order (an integer) – Order of poynomial for mapping intensities, default 5. Maps to a command-line argument: --intorder=%d.

  • inwarp_file (a pathlike object or string representing an existing file) – Name of file containing initial non-linear warps. Maps to a command-line argument: --inwarp=%s.

  • jacobian_file (a boolean or a pathlike object or string representing a file) – Name of file for writing out the Jacobian of the field (for diagnostic or VBM purposes). Maps to a command-line argument: --jout=%s.

  • jacobian_range (a tuple of the form: (a float, a float)) – Allowed range of Jacobian determinants, default 0.01, 100.0. Maps to a command-line argument: --jacrange=%f,%f.

  • log_file (a pathlike object or string representing a file) – Name of log-file. Maps to a command-line argument: --logout=%s.

  • max_nonlin_iter (a list of items which are an integer) – Max # of non-linear iterations list, default [5, 5, 5, 5]. Maps to a command-line argument: --miter=%s.

  • modulatedref_file (a boolean or a pathlike object or string representing a file) – Name of file for writing out intensity modulated –ref (for diagnostic purposes). Maps to a command-line argument: --refout=%s.

  • out_intensitymap_file (a boolean or a pathlike object or string representing a file) – Name of files for writing information pertaining to intensity mapping. Maps to a command-line argument: --intout=%s.

  • output_type (‘NIFTI’ or ‘NIFTI_PAIR’ or ‘NIFTI_GZ’ or ‘NIFTI_PAIR_GZ’) – FSL output type.

  • ref_fwhm (a list of items which are an integer) – FWHM (in mm) of gaussian smoothing kernel for ref volume, default [4, 2, 0, 0]. Maps to a command-line argument: --reffwhm=%s.

  • refmask_file (a pathlike object or string representing an existing file) – Name of file with mask in reference space. Maps to a command-line argument: --refmask=%s.

  • refmask_val (a float) – Value to mask out in –ref image. Default =0.0. Maps to a command-line argument: --imprefval=%f.

  • regularization_lambda (a list of items which are a float) – Weight of regularisation, default depending on –ssqlambda and –regmod switches. See user documentation. Maps to a command-line argument: --lambda=%s.

  • regularization_model (‘membrane_energy’ or ‘bending_energy’) – Model for regularisation of warp-field [membrane_energy bending_energy], default bending_energy. Maps to a command-line argument: --regmod=%s.

  • skip_implicit_in_masking (a boolean) – Skip implicit masking based on value in –in image. Default = 0. Maps to a command-line argument: --impinm=0.

  • skip_implicit_ref_masking (a boolean) – Skip implicit masking based on value in –ref image. Default = 0. Maps to a command-line argument: --imprefm=0.

  • skip_inmask (a boolean) – Skip specified inmask if set, default false. Maps to a command-line argument: --applyinmask=0. Mutually exclusive with inputs: apply_inmask.

  • skip_intensity_mapping (a boolean) – Skip estimate intensity-mapping default false. Maps to a command-line argument: --estint=0. Mutually exclusive with inputs: apply_intensity_mapping.

  • skip_lambda_ssq (a boolean) – If true, lambda is not weighted by current ssq, default false. Maps to a command-line argument: --ssqlambda=0.

  • skip_refmask (a boolean) – Skip specified refmask if set, default false. Maps to a command-line argument: --applyrefmask=0. Mutually exclusive with inputs: apply_refmask.

  • spline_order (an integer) – Order of spline, 2->Qadratic spline, 3->Cubic spline. Default=3. Maps to a command-line argument: --splineorder=%d.

  • subsampling_scheme (a list of items which are an integer) – Sub-sampling scheme, list, default [4, 2, 1, 1]. Maps to a command-line argument: --subsamp=%s.

  • warp_resolution (a tuple of the form: (an integer, an integer, an integer)) – (approximate) resolution (in mm) of warp basis in x-, y- and z-direction, default 10, 10, 10. Maps to a command-line argument: --warpres=%d,%d,%d.

  • warped_file (a pathlike object or string representing a file) – Name of output image. Maps to a command-line argument: --iout=%s.

Outputs:
  • field_file (a pathlike object or string representing a file) – File with warp field.

  • fieldcoeff_file (a pathlike object or string representing an existing file) – File with field coefficients.

  • jacobian_file (a pathlike object or string representing a file) – File containing Jacobian of the field.

  • log_file (a pathlike object or string representing a file) – Name of log-file.

  • modulatedref_file (a pathlike object or string representing a file) – File containing intensity modulated –ref.

  • out_intensitymap_file (a list of from 2 to 2 items which are a pathlike object or string representing a file) – Files containing info pertaining to intensity mapping.

  • warped_file (a pathlike object or string representing an existing file) – Warped image.

FNIRT.filemap = {'field_file': 'field', 'fieldcoeff_file': 'fieldwarp', 'jacobian_file': 'field_jacobian', 'log_file': 'log.txt', 'modulatedref_file': 'modulated', 'out_intensitymap_file': 'intmap', 'warped_file': 'warped'}
classmethod FNIRT.intensitymap_file_basename(f)

Removes valid intensitymap extensions from f, returning a basename that can refer to both intensitymap files.

FNIRT.write_config(configfile)

Writes out currently set options to specified config file

XX TODO : need to figure out how the config file is written

Parameters:

configfile (/path/to/configfile)

FUGUE

Link to code

Bases: FSLCommand

Wrapped executable: fugue.

FSL FUGUE set of tools for EPI distortion correction

FUGUE is, most generally, a set of tools for EPI distortion correction.

Distortions may be corrected for
  1. improving registration with non-distorted images (e.g. structurals), or

  2. dealing with motion-dependent changes.

FUGUE is designed to deal only with the first case - improving registration.

Examples

Unwarping an input image (shift map is known):

>>> from nipype.interfaces.fsl.preprocess import FUGUE
>>> fugue = FUGUE()
>>> fugue.inputs.in_file = 'epi.nii'
>>> fugue.inputs.mask_file = 'epi_mask.nii'
>>> fugue.inputs.shift_in_file = 'vsm.nii'  # Previously computed with fugue as well
>>> fugue.inputs.unwarp_direction = 'y'
>>> fugue.inputs.output_type = "NIFTI_GZ"
>>> fugue.cmdline 
'fugue --in=epi.nii --mask=epi_mask.nii --loadshift=vsm.nii --unwarpdir=y --unwarp=epi_unwarped.nii.gz'
>>> fugue.run() 

Warping an input image (shift map is known):

>>> from nipype.interfaces.fsl.preprocess import FUGUE
>>> fugue = FUGUE()
>>> fugue.inputs.in_file = 'epi.nii'
>>> fugue.inputs.forward_warping = True
>>> fugue.inputs.mask_file = 'epi_mask.nii'
>>> fugue.inputs.shift_in_file = 'vsm.nii'  # Previously computed with fugue as well
>>> fugue.inputs.unwarp_direction = 'y'
>>> fugue.inputs.output_type = "NIFTI_GZ"
>>> fugue.cmdline 
'fugue --in=epi.nii --mask=epi_mask.nii --loadshift=vsm.nii --unwarpdir=y --warp=epi_warped.nii.gz'
>>> fugue.run() 

Computing the vsm (unwrapped phase map is known):

>>> from nipype.interfaces.fsl.preprocess import FUGUE
>>> fugue = FUGUE()
>>> fugue.inputs.phasemap_in_file = 'epi_phasediff.nii'
>>> fugue.inputs.mask_file = 'epi_mask.nii'
>>> fugue.inputs.dwell_to_asym_ratio = (0.77e-3 * 3) / 2.46e-3
>>> fugue.inputs.unwarp_direction = 'y'
>>> fugue.inputs.save_shift = True
>>> fugue.inputs.output_type = "NIFTI_GZ"
>>> fugue.cmdline 
'fugue --dwelltoasym=0.9390243902 --mask=epi_mask.nii --phasemap=epi_phasediff.nii --saveshift=epi_phasediff_vsm.nii.gz --unwarpdir=y'
>>> fugue.run() 
Optional Inputs:
  • args (a string) – Additional parameters to the command. Maps to a command-line argument: %s.

  • asym_se_time (a float) – Set the fieldmap asymmetric spin echo time (sec). Maps to a command-line argument: --asym=%.10f.

  • despike_2dfilter (a boolean) – Apply a 2D de-spiking filter. Maps to a command-line argument: --despike.

  • despike_threshold (a float) – Specify the threshold for de-spiking (default=3.0). Maps to a command-line argument: --despikethreshold=%s.

  • dwell_time (a float) – Set the EPI dwell time per phase-encode line - same as echo spacing - (sec). Maps to a command-line argument: --dwell=%.10f.

  • dwell_to_asym_ratio (a float) – Set the dwell to asym time ratio. Maps to a command-line argument: --dwelltoasym=%.10f.

  • environ (a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’) – Environment variables. (Nipype default value: {})

  • fmap_in_file (a pathlike object or string representing an existing file) – Filename for loading fieldmap (rad/s). Maps to a command-line argument: --loadfmap=%s.

  • fmap_out_file (a pathlike object or string representing a file) – Filename for saving fieldmap (rad/s). Maps to a command-line argument: --savefmap=%s.

  • forward_warping (a boolean) – Apply forward warping instead of unwarping. (Nipype default value: False)

  • fourier_order (an integer) – Apply Fourier (sinusoidal) fitting of order N. Maps to a command-line argument: --fourier=%d.

  • icorr (a boolean) – Apply intensity correction to unwarping (pixel shift method only). Maps to a command-line argument: --icorr. Requires inputs: shift_in_file.

  • icorr_only (a boolean) – Apply intensity correction only. Maps to a command-line argument: --icorronly. Requires inputs: unwarped_file.

  • in_file (a pathlike object or string representing an existing file) – Filename of input volume. Maps to a command-line argument: --in=%s.

  • mask_file (a pathlike object or string representing an existing file) – Filename for loading valid mask. Maps to a command-line argument: --mask=%s.

  • median_2dfilter (a boolean) – Apply 2D median filtering. Maps to a command-line argument: --median.

  • no_extend (a boolean) – Do not apply rigid-body extrapolation to the fieldmap. Maps to a command-line argument: --noextend.

  • no_gap_fill (a boolean) – Do not apply gap-filling measure to the fieldmap. Maps to a command-line argument: --nofill.

  • nokspace (a boolean) – Do not use k-space forward warping. Maps to a command-line argument: --nokspace.

  • output_type (‘NIFTI’ or ‘NIFTI_PAIR’ or ‘NIFTI_GZ’ or ‘NIFTI_PAIR_GZ’) – FSL output type.

  • pava (a boolean) – Apply monotonic enforcement via PAVA. Maps to a command-line argument: --pava.

  • phase_conjugate (a boolean) – Apply phase conjugate method of unwarping. Maps to a command-line argument: --phaseconj.

  • phasemap_in_file (a pathlike object or string representing an existing file) – Filename for input phase image. Maps to a command-line argument: --phasemap=%s.

  • poly_order (an integer) – Apply polynomial fitting of order N. Maps to a command-line argument: --poly=%d.

  • save_fmap (a boolean) – Write field map volume. Mutually exclusive with inputs: save_unmasked_fmap.

  • save_shift (a boolean) – Write pixel shift volume. Mutually exclusive with inputs: save_unmasked_shift.

  • save_unmasked_fmap (a boolean) – Saves the unmasked fieldmap when using –savefmap. Maps to a command-line argument: --unmaskfmap. Mutually exclusive with inputs: save_fmap.

  • save_unmasked_shift (a boolean) – Saves the unmasked shiftmap when using –saveshift. Maps to a command-line argument: --unmaskshift. Mutually exclusive with inputs: save_shift.

  • shift_in_file (a pathlike object or string representing an existing file) – Filename for reading pixel shift volume. Maps to a command-line argument: --loadshift=%s.

  • shift_out_file (a pathlike object or string representing a file) – Filename for saving pixel shift volume. Maps to a command-line argument: --saveshift=%s.

  • smooth2d (a float) – Apply 2D Gaussian smoothing of sigma N (in mm). Maps to a command-line argument: --smooth2=%.2f.

  • smooth3d (a float) – Apply 3D Gaussian smoothing of sigma N (in mm). Maps to a command-line argument: --smooth3=%.2f.

  • unwarp_direction (‘x’ or ‘y’ or ‘z’ or ‘x-’ or ‘y-’ or ‘z-’) – Specifies direction of warping (default y). Maps to a command-line argument: --unwarpdir=%s.

  • unwarped_file (a pathlike object or string representing a file) – Apply unwarping and save as filename. Maps to a command-line argument: --unwarp=%s. Mutually exclusive with inputs: warped_file. Requires inputs: in_file.

  • warped_file (a pathlike object or string representing a file) – Apply forward warping and save as filename. Maps to a command-line argument: --warp=%s. Mutually exclusive with inputs: unwarped_file. Requires inputs: in_file.

Outputs:
  • fmap_out_file (a pathlike object or string representing a file) – Fieldmap file.

  • shift_out_file (a pathlike object or string representing a file) – Voxel shift map file.

  • unwarped_file (a pathlike object or string representing a file) – Unwarped file.

  • warped_file (a pathlike object or string representing a file) – Forward warped file.

MCFLIRT

Link to code

Bases: FSLCommand

Wrapped executable: mcflirt.

FSL MCFLIRT wrapper for within-modality motion correction

For complete details, see the MCFLIRT Documentation.

Examples

>>> from nipype.interfaces import fsl
>>> mcflt = fsl.MCFLIRT()
>>> mcflt.inputs.in_file = 'functional.nii'
>>> mcflt.inputs.cost = 'mutualinfo'
>>> mcflt.inputs.out_file = 'moco.nii'
>>> mcflt.cmdline
'mcflirt -in functional.nii -cost mutualinfo -out moco.nii'
>>> res = mcflt.run()  
Mandatory Inputs:

in_file (a pathlike object or string representing an existing file) – Timeseries to motion-correct. Maps to a command-line argument: -in %s (position: 0).

Optional Inputs:
  • args (a string) – Additional parameters to the command. Maps to a command-line argument: %s.

  • bins (an integer) – Number of histogram bins. Maps to a command-line argument: -bins %d.

  • cost (‘mutualinfo’ or ‘woods’ or ‘corratio’ or ‘normcorr’ or ‘normmi’ or ‘leastsquares’) – Cost function to optimize. Maps to a command-line argument: -cost %s.

  • dof (an integer) – Degrees of freedom for the transformation. Maps to a command-line argument: -dof %d.

  • environ (a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’) – Environment variables. (Nipype default value: {})

  • init (a pathlike object or string representing an existing file) – Initial transformation matrix. Maps to a command-line argument: -init %s.

  • interpolation (‘spline’ or ‘nn’ or ‘sinc’) – Interpolation method for transformation. Maps to a command-line argument: -%s_final.

  • mean_vol (a boolean) – Register to mean volume. Maps to a command-line argument: -meanvol.

  • out_file (a pathlike object or string representing a file) – File to write. Maps to a command-line argument: -out %s.

  • output_type (‘NIFTI’ or ‘NIFTI_PAIR’ or ‘NIFTI_GZ’ or ‘NIFTI_PAIR_GZ’) – FSL output type.

  • ref_file (a pathlike object or string representing an existing file) – Target image for motion correction. Maps to a command-line argument: -reffile %s.

  • ref_vol (an integer) – Volume to align frames to. Maps to a command-line argument: -refvol %d.

  • rotation (an integer) – Scaling factor for rotation tolerances. Maps to a command-line argument: -rotation %d.

  • save_mats (a boolean) – Save transformation matrices. Maps to a command-line argument: -mats.

  • save_plots (a boolean) – Save transformation parameters. Maps to a command-line argument: -plots.

  • save_rms (a boolean) – Save rms displacement parameters. Maps to a command-line argument: -rmsabs -rmsrel.

  • scaling (a float) – Scaling factor to use. Maps to a command-line argument: -scaling %.2f.

  • smooth (a float) – Smoothing factor for the cost function. Maps to a command-line argument: -smooth %.2f.

  • stages (an integer) – Stages (if 4, perform final search with sinc interpolation. Maps to a command-line argument: -stages %d.

  • stats_imgs (a boolean) – Produce variance and std. dev. images. Maps to a command-line argument: -stats.

  • use_contour (a boolean) – Run search on contour images. Maps to a command-line argument: -edge.

  • use_gradient (a boolean) – Run search on gradient images. Maps to a command-line argument: -gdt.

Outputs:
  • mat_file (a list of items which are a pathlike object or string representing an existing file) – Transformation matrices.

  • mean_img (a pathlike object or string representing an existing file) – Mean timeseries image (if mean_vol=True).

  • out_file (a pathlike object or string representing an existing file) – Motion-corrected timeseries.

  • par_file (a pathlike object or string representing an existing file) – Text-file with motion parameters.

  • rms_files (a list of items which are a pathlike object or string representing an existing file) – Absolute and relative displacement parameters.

  • std_img (a pathlike object or string representing an existing file) – Standard deviation image.

  • variance_img (a pathlike object or string representing an existing file) – Variance image.

PRELUDE

Link to code

Bases: FSLCommand

Wrapped executable: prelude.

FSL prelude wrapper for phase unwrapping

Examples

Please insert examples for use of this command

Mandatory Inputs:
  • complex_phase_file (a pathlike object or string representing an existing file) – Complex phase input volume. Maps to a command-line argument: --complex=%s. Mutually exclusive with inputs: magnitude_file, phase_file.

  • magnitude_file (a pathlike object or string representing an existing file) – File containing magnitude image. Maps to a command-line argument: --abs=%s. Mutually exclusive with inputs: complex_phase_file.

  • phase_file (a pathlike object or string representing an existing file) – Raw phase file. Maps to a command-line argument: --phase=%s. Mutually exclusive with inputs: complex_phase_file.

Optional Inputs:
  • args (a string) – Additional parameters to the command. Maps to a command-line argument: %s.

  • end (an integer) – Final image number to process (default Inf). Maps to a command-line argument: --end=%d.

  • environ (a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’) – Environment variables. (Nipype default value: {})

  • label_file (a pathlike object or string representing a file) – Saving the area labels output. Maps to a command-line argument: --labels=%s.

  • labelprocess2d (a boolean) – Does label processing in 2D (slice at a time). Maps to a command-line argument: --labelslices.

  • mask_file (a pathlike object or string representing an existing file) – Filename of mask input volume. Maps to a command-line argument: --mask=%s.

  • num_partitions (an integer) – Number of phase partitions to use. Maps to a command-line argument: --numphasesplit=%d.

  • output_type (‘NIFTI’ or ‘NIFTI_PAIR’ or ‘NIFTI_GZ’ or ‘NIFTI_PAIR_GZ’) – FSL output type.

  • process2d (a boolean) – Does all processing in 2D (slice at a time). Maps to a command-line argument: --slices. Mutually exclusive with inputs: labelprocess2d.

  • process3d (a boolean) – Forces all processing to be full 3D. Maps to a command-line argument: --force3D. Mutually exclusive with inputs: labelprocess2d, process2d.

  • rawphase_file (a pathlike object or string representing a file) – Saving the raw phase output. Maps to a command-line argument: --rawphase=%s.

  • removeramps (a boolean) – Remove phase ramps during unwrapping. Maps to a command-line argument: --removeramps.

  • savemask_file (a pathlike object or string representing a file) – Saving the mask volume. Maps to a command-line argument: --savemask=%s.

  • start (an integer) – First image number to process (default 0). Maps to a command-line argument: --start=%d.

  • threshold (a float) – Intensity threshold for masking. Maps to a command-line argument: --thresh=%.10f.

  • unwrapped_phase_file (a pathlike object or string representing a file) – File containing unwrapepd phase. Maps to a command-line argument: --unwrap=%s.

Outputs:

unwrapped_phase_file (a pathlike object or string representing an existing file) – Unwrapped phase file.

SUSAN

Link to code

Bases: FSLCommand

Wrapped executable: susan.

FSL SUSAN wrapper to perform smoothing

For complete details, see the SUSAN Documentation.

Examples

>>> from nipype.interfaces import fsl
>>> from nipype.testing import example_data
>>> anatfile  
anatomical.nii  
>>> sus = fsl.SUSAN()
>>> sus.inputs.in_file = example_data('structural.nii')
>>> sus.inputs.brightness_threshold = 2000.0
>>> sus.inputs.fwhm = 8.0
>>> result = sus.run()  
Mandatory Inputs:
  • brightness_threshold (a float) – Brightness threshold and should be greater than noise level and less than contrast of edges to be preserved. Maps to a command-line argument: %.10f (position: 2).

  • fwhm (a float) – Fwhm of smoothing, in mm, gets converted using sqrt(8*log(2)). Maps to a command-line argument: %.10f (position: 3).

  • in_file (a pathlike object or string representing an existing file) – Filename of input timeseries. Maps to a command-line argument: %s (position: 1).

Optional Inputs:
  • args (a string) – Additional parameters to the command. Maps to a command-line argument: %s.

  • dimension (3 or 2) – Within-plane (2) or fully 3D (3). Maps to a command-line argument: %d (position: 4). (Nipype default value: 3)

  • environ (a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’) – Environment variables. (Nipype default value: {})

  • out_file (a pathlike object or string representing a file) – Output file name. Maps to a command-line argument: %s (position: -1).

  • output_type (‘NIFTI’ or ‘NIFTI_PAIR’ or ‘NIFTI_GZ’ or ‘NIFTI_PAIR_GZ’) – FSL output type.

  • usans (a list of at most 2 items which are a tuple of the form: (a pathlike object or string representing an existing file, a float)) – Determines whether the smoothing area (USAN) is to be found from secondary images (0, 1 or 2). A negative value for any brightness threshold will auto-set the threshold at 10% of the robust range. (Nipype default value: [])

  • use_median (1 or 0) – Whether to use a local median filter in the cases where single-point noise is detected. Maps to a command-line argument: %d (position: 5). (Nipype default value: 1)

Outputs:

smoothed_file (a pathlike object or string representing an existing file) – Smoothed output file.

SliceTimer

Link to code

Bases: FSLCommand

Wrapped executable: slicetimer.

FSL slicetimer wrapper to perform slice timing correction

Examples

>>> from nipype.interfaces import fsl
>>> from nipype.testing import example_data
>>> st = fsl.SliceTimer()
>>> st.inputs.in_file = example_data('functional.nii')
>>> st.inputs.interleaved = True
>>> result = st.run() 
Mandatory Inputs:

in_file (a pathlike object or string representing an existing file) – Filename of input timeseries. Maps to a command-line argument: --in=%s (position: 0).

Optional Inputs:
  • args (a string) – Additional parameters to the command. Maps to a command-line argument: %s.

  • custom_order (a pathlike object or string representing an existing file) – Filename of single-column custom interleave order file (first slice is referred to as 1 not 0). Maps to a command-line argument: --ocustom=%s.

  • custom_timings (a pathlike object or string representing an existing file) – Slice timings, in fractions of TR, range 0:1 (default is 0.5 = no shift). Maps to a command-line argument: --tcustom=%s.

  • environ (a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’) – Environment variables. (Nipype default value: {})

  • global_shift (a float) – Shift in fraction of TR, range 0:1 (default is 0.5 = no shift). Maps to a command-line argument: --tglobal.

  • index_dir (a boolean) – Slice indexing from top to bottom. Maps to a command-line argument: --down.

  • interleaved (a boolean) – Use interleaved acquisition. Maps to a command-line argument: --odd.

  • out_file (a pathlike object or string representing a file) – Filename of output timeseries. Maps to a command-line argument: --out=%s.

  • output_type (‘NIFTI’ or ‘NIFTI_PAIR’ or ‘NIFTI_GZ’ or ‘NIFTI_PAIR_GZ’) – FSL output type.

  • slice_direction (1 or 2 or 3) – Direction of slice acquisition (x=1, y=2, z=3) - default is z. Maps to a command-line argument: --direction=%d.

  • time_repetition (a float) – Specify TR of data - default is 3s. Maps to a command-line argument: --repeat=%f.

Outputs:

slice_time_corrected_file (a pathlike object or string representing an existing file) – Slice time corrected file.