nipype.interfaces.fsl.epi module

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

ApplyTOPUP

Link to code

Bases: FSLCommand

Wrapped executable: applytopup.

Interface for FSL topup, a tool for estimating and correcting susceptibility induced distortions. General reference and use example.

Examples

>>> from nipype.interfaces.fsl import ApplyTOPUP
>>> applytopup = ApplyTOPUP()
>>> applytopup.inputs.in_files = ["epi.nii", "epi_rev.nii"]
>>> applytopup.inputs.encoding_file = "topup_encoding.txt"
>>> applytopup.inputs.in_topup_fieldcoef = "topup_fieldcoef.nii.gz"
>>> applytopup.inputs.in_topup_movpar = "topup_movpar.txt"
>>> applytopup.inputs.output_type = "NIFTI_GZ"
>>> applytopup.cmdline 
'applytopup --datain=topup_encoding.txt --imain=epi.nii,epi_rev.nii --inindex=1,2 --topup=topup --out=epi_corrected.nii.gz'
>>> res = applytopup.run() 
Mandatory Inputs:
  • encoding_file (a pathlike object or string representing an existing file) – Name of text file with PE directions/times. Maps to a command-line argument: --datain=%s.

  • in_files (a list of items which are a pathlike object or string representing an existing file) – Name of file with images. Maps to a command-line argument: --imain=%s.

Optional Inputs:
  • 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. Maps to a command-line argument: -d=%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: {})

  • in_index (a list of items which are an integer) – Comma separated list of indices corresponding to –datain. Maps to a command-line argument: --inindex=%s.

  • in_topup_fieldcoef (a pathlike object or string representing an existing file) – Topup file containing the field coefficients. Maps to a command-line argument: --topup=%s. Requires inputs: in_topup_movpar.

  • in_topup_movpar (a pathlike object or string representing an existing file) – Topup movpar.txt file. Requires inputs: in_topup_fieldcoef.

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

  • method (‘jac’ or ‘lsr’) – Use jacobian modulation (jac) or least-squares resampling (lsr). Maps to a command-line argument: --method=%s.

  • out_corrected (a pathlike object or string representing a file) – Output (warped) image. Maps to a command-line argument: --out=%s.

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

Outputs:

out_corrected (a pathlike object or string representing an existing file) – Name of 4D image file with unwarped images.

EPIDeWarp

Link to code

Bases: FSLCommand

Wrapped executable: epidewarp.fsl.

Wraps the unwarping script epidewarp.fsl.

Warning

deprecated in FSL, please use niflow.nipype1.workflows.dmri.preprocess.epi.sdc_fmb() instead.

Examples

>>> from nipype.interfaces.fsl import EPIDeWarp
>>> dewarp = EPIDeWarp()
>>> dewarp.inputs.epi_file = "functional.nii"
>>> dewarp.inputs.mag_file = "magnitude.nii"
>>> dewarp.inputs.dph_file = "phase.nii"
>>> dewarp.inputs.output_type = "NIFTI_GZ"
>>> dewarp.cmdline 
'epidewarp.fsl --mag magnitude.nii --dph phase.nii --epi functional.nii --esp 0.58 --exfdw .../exfdw.nii.gz --nocleanup --sigma 2 --tediff 2.46 --tmpdir .../temp --vsm .../vsm.nii.gz'
>>> res = dewarp.run() 
Mandatory Inputs:
  • dph_file (a pathlike object or string representing an existing file) – Phase file assumed to be scaled from 0 to 4095. Maps to a command-line argument: --dph %s.

  • mag_file (a pathlike object or string representing an existing file) – Magnitude file. Maps to a command-line argument: --mag %s (position: 0).

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

  • cleanup (a boolean) – Cleanup. Maps to a command-line argument: --cleanup.

  • 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: {})

  • epi_file (a pathlike object or string representing an existing file) – EPI volume to unwarp. Maps to a command-line argument: --epi %s.

  • epidw (a string) – Dewarped epi volume. Maps to a command-line argument: --epidw %s.

  • esp (a float) – EPI echo spacing. Maps to a command-line argument: --esp %s. (Nipype default value: 0.58)

  • exf_file (a pathlike object or string representing an existing file) – Example func volume (or use epi). Maps to a command-line argument: --exf %s.

  • exfdw (a string) – Dewarped example func volume. Maps to a command-line argument: --exfdw %s.

  • nocleanup (a boolean) – No cleanup. Maps to a command-line argument: --nocleanup. (Nipype default value: True)

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

  • sigma (an integer) – 2D spatial gaussing smoothing stdev (default = 2mm). Maps to a command-line argument: --sigma %s. (Nipype default value: 2)

  • tediff (a float) – Difference in B0 field map TEs. Maps to a command-line argument: --tediff %s. (Nipype default value: 2.46)

  • tmpdir (a string) – Tmpdir. Maps to a command-line argument: --tmpdir %s.

  • vsm (a string) – Voxel shift map. Maps to a command-line argument: --vsm %s.

Outputs:
  • exf_mask (a pathlike object or string representing a file) – Mask from example functional volume.

  • exfdw (a pathlike object or string representing a file) – Dewarped functional volume example.

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

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

Eddy

Link to code

Bases: FSLCommand

Wrapped executable: eddy_openmp.

Interface for FSL eddy, a tool for estimating and correcting eddy currents induced distortions. User guide and more info regarding acqp file.

Examples

>>> from nipype.interfaces.fsl import Eddy

Running eddy on a CPU using OpenMP: >>> eddy = Eddy() >>> eddy.inputs.in_file = ‘epi.nii’ >>> eddy.inputs.in_mask = ‘epi_mask.nii’ >>> eddy.inputs.in_index = ‘epi_index.txt’ >>> eddy.inputs.in_acqp = ‘epi_acqp.txt’ >>> eddy.inputs.in_bvec = ‘bvecs.scheme’ >>> eddy.inputs.in_bval = ‘bvals.scheme’ >>> eddy.cmdline # doctest: +ELLIPSIS ‘eddy_openmp –flm=quadratic –ff=10.0 –acqp=epi_acqp.txt –bvals=bvals.scheme –bvecs=bvecs.scheme –imain=epi.nii –index=epi_index.txt –mask=epi_mask.nii –interp=spline –resamp=jac –niter=5 –nvoxhp=1000 –out=…/eddy_corrected –slm=none’

Running eddy on an Nvidia GPU using cuda: >>> eddy.inputs.use_cuda = True >>> eddy.cmdline # doctest: +ELLIPSIS ‘eddy_cuda –flm=quadratic –ff=10.0 –acqp=epi_acqp.txt –bvals=bvals.scheme –bvecs=bvecs.scheme –imain=epi.nii –index=epi_index.txt –mask=epi_mask.nii –interp=spline –resamp=jac –niter=5 –nvoxhp=1000 –out=…/eddy_corrected –slm=none’

Running eddy with slice-to-volume motion correction: >>> eddy.inputs.mporder = 6 >>> eddy.inputs.slice2vol_niter = 5 >>> eddy.inputs.slice2vol_lambda = 1 >>> eddy.inputs.slice2vol_interp = ‘trilinear’ >>> eddy.inputs.slice_order = ‘epi_slspec.txt’ >>> eddy.cmdline # doctest: +ELLIPSIS ‘eddy_cuda –flm=quadratic –ff=10.0 –acqp=epi_acqp.txt –bvals=bvals.scheme –bvecs=bvecs.scheme –imain=epi.nii –index=epi_index.txt –mask=epi_mask.nii –interp=spline –resamp=jac –mporder=6 –niter=5 –nvoxhp=1000 –out=…/eddy_corrected –s2v_interp=trilinear –s2v_lambda=1 –s2v_niter=5 –slspec=epi_slspec.txt –slm=none’ >>> res = eddy.run() # doctest: +SKIP

Mandatory Inputs:
  • in_acqp (a pathlike object or string representing an existing file) – File containing acquisition parameters. Maps to a command-line argument: --acqp=%s.

  • in_bval (a pathlike object or string representing an existing file) – File containing the b-values for all volumes in –imain. Maps to a command-line argument: --bvals=%s.

  • in_bvec (a pathlike object or string representing an existing file) – File containing the b-vectors for all volumes in –imain. Maps to a command-line argument: --bvecs=%s.

  • in_file (a pathlike object or string representing an existing file) – File containing all the images to estimate distortions for. Maps to a command-line argument: --imain=%s.

  • in_index (a pathlike object or string representing an existing file) – File containing indices for all volumes in –imain into –acqp and –topup. Maps to a command-line argument: --index=%s.

  • in_mask (a pathlike object or string representing an existing file) – Mask to indicate brain. Maps to a command-line argument: --mask=%s.

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

  • cnr_maps (a boolean) – Output CNR-Maps. Maps to a command-line argument: --cnr_maps.

  • dont_peas (a boolean) – Do NOT perform a post-eddy alignment of shells. Maps to a command-line argument: --dont_peas.

  • dont_sep_offs_move (a boolean) – Do NOT attempt to separate field offset from subject movement. Maps to a command-line argument: --dont_sep_offs_move.

  • 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: {})

  • estimate_move_by_susceptibility (a boolean) – Estimate how susceptibility field changes with subject movement. Maps to a command-line argument: --estimate_move_by_susceptibility.

  • fep (a boolean) – Fill empty planes in x- or y-directions. Maps to a command-line argument: --fep.

  • field (a pathlike object or string representing an existing file) – Non-topup derived fieldmap scaled in Hz. Maps to a command-line argument: --field=%s.

  • field_mat (a pathlike object or string representing an existing file) – Matrix specifying the relative positions of the fieldmap, –field, and the first volume of the input file, –imain. Maps to a command-line argument: --field_mat=%s.

  • flm (‘quadratic’ or ‘linear’ or ‘cubic’) – First level EC model. Maps to a command-line argument: --flm=%s. (Nipype default value: quadratic)

  • fudge_factor (a float) – Fudge factor for hyperparameter error variance. Maps to a command-line argument: --ff=%s. (Nipype default value: 10.0)

  • fwhm (a float) – FWHM for conditioning filter when estimating the parameters. Maps to a command-line argument: --fwhm=%s.

  • in_topup_fieldcoef (a pathlike object or string representing an existing file) – Topup results file containing the field coefficients. Maps to a command-line argument: --topup=%s. Requires inputs: in_topup_movpar.

  • in_topup_movpar (a pathlike object or string representing an existing file) – Topup results file containing the movement parameters (movpar.txt). Requires inputs: in_topup_fieldcoef.

  • initrand (a boolean) – Resets rand for when selecting voxels. Maps to a command-line argument: --initrand.

  • interp (‘spline’ or ‘trilinear’) – Interpolation model for estimation step. Maps to a command-line argument: --interp=%s. (Nipype default value: spline)

  • is_shelled (a boolean) – Override internal check to ensure that date are acquired on a set of b-value shells. Maps to a command-line argument: --data_is_shelled.

  • json (a string or os.PathLike object referring to an existing file) – Name of .json text file with information about slice timing. Maps to a command-line argument: --json=%s. Mutually exclusive with inputs: slice_order. Requires inputs: mporder.

  • mbs_ksp (an integer) – Knot-spacing for MBS field estimation. Maps to a command-line argument: --mbs_ksp=%smm. Requires inputs: estimate_move_by_susceptibility.

  • mbs_lambda (an integer) – Weighting of regularisation for MBS estimation. Maps to a command-line argument: --mbs_lambda=%s. Requires inputs: estimate_move_by_susceptibility.

  • mbs_niter (an integer) – Number of iterations for MBS estimation. Maps to a command-line argument: --mbs_niter=%s. Requires inputs: estimate_move_by_susceptibility.

  • method (‘jac’ or ‘lsr’) – Final resampling method (jacobian/least squares). Maps to a command-line argument: --resamp=%s. (Nipype default value: jac)

  • mporder (an integer) – Order of slice-to-vol movement model. Maps to a command-line argument: --mporder=%s. Requires inputs: use_cuda.

  • multiband_factor (an integer) – Multi-band factor. Maps to a command-line argument: --mb=%s.

  • multiband_offset (0 or 1 or -1) – Multi-band offset (-1 if bottom slice removed, 1 if top slice removed. Maps to a command-line argument: --mb_offs=%d. Requires inputs: multiband_factor.

  • niter (an integer) – Number of iterations. Maps to a command-line argument: --niter=%s. (Nipype default value: 5)

  • num_threads (an integer) – Number of openmp threads to use. (Nipype default value: 1)

  • nvoxhp (an integer) – # of voxels used to estimate the hyperparameters. Maps to a command-line argument: --nvoxhp=%s. (Nipype default value: 1000)

  • out_base (a string) – Basename for output image. Maps to a command-line argument: --out=%s. (Nipype default value: eddy_corrected)

  • outlier_nstd (an integer) – Number of std off to qualify as outlier. Maps to a command-line argument: --ol_nstd. Requires inputs: repol.

  • outlier_nvox (an integer) – Min # of voxels in a slice for inclusion in outlier detection. Maps to a command-line argument: --ol_nvox. Requires inputs: repol.

  • outlier_pos (a boolean) – Consider both positive and negative outliers if set. Maps to a command-line argument: --ol_pos. Requires inputs: repol.

  • outlier_sqr (a boolean) – Consider outliers among sums-of-squared differences if set. Maps to a command-line argument: --ol_sqr. Requires inputs: repol.

  • outlier_type (‘sw’ or ‘gw’ or ‘both’) – Type of outliers, slicewise (sw), groupwise (gw) or both (both). Maps to a command-line argument: --ol_type. Requires inputs: repol.

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

  • repol (a boolean) – Detect and replace outlier slices. Maps to a command-line argument: --repol.

  • residuals (a boolean) – Output Residuals. Maps to a command-line argument: --residuals.

  • session (a pathlike object or string representing an existing file) – File containing session indices for all volumes in –imain. Maps to a command-line argument: --session=%s.

  • slice2vol_interp (‘trilinear’ or ‘spline’) – Slice-to-vol interpolation model for estimation step. Maps to a command-line argument: --s2v_interp=%s. Requires inputs: mporder.

  • slice2vol_lambda (an integer) – Regularisation weight for slice-to-vol movement (reasonable range 1-10). Maps to a command-line argument: --s2v_lambda=%d. Requires inputs: mporder.

  • slice2vol_niter (an integer) – Number of iterations for slice-to-vol. Maps to a command-line argument: --s2v_niter=%d. Requires inputs: mporder.

  • slice_order (a string or os.PathLike object referring to an existing file) – Name of text file completely specifying slice/group acquisition. Maps to a command-line argument: --slspec=%s. Mutually exclusive with inputs: json. Requires inputs: mporder.

  • slm (‘none’ or ‘linear’ or ‘quadratic’) – Second level EC model. Maps to a command-line argument: --slm=%s. (Nipype default value: none)

  • use_cuda (a boolean) – Run eddy using cuda gpu.

Outputs:
  • out_cnr_maps (a pathlike object or string representing an existing file) – Path/name of file with the cnr_maps.

  • out_corrected (a pathlike object or string representing an existing file) – 4D image file containing all the corrected volumes.

  • out_movement_over_time (a pathlike object or string representing an existing file) – Text file containing translations (mm) and rotations (radians) for each excitation.

  • out_movement_rms (a pathlike object or string representing an existing file) – Summary of the ‘total movement’ in each volume.

  • out_outlier_free (a pathlike object or string representing an existing file) – 4D image file not corrected for susceptibility or eddy-current distortions or subject movement but with outlier slices replaced.

  • out_outlier_map (a pathlike object or string representing an existing file) – Matrix where rows represent volumes and columns represent slices. “0” indicates that scan-slice is not an outlier and “1” indicates that it is.

  • out_outlier_n_sqr_stdev_map (a pathlike object or string representing an existing file) – Matrix where rows represent volumes and columns represent slices. Values indicate number of standard deivations off the square root of the mean squared difference between observation and prediction is.

  • out_outlier_n_stdev_map (a pathlike object or string representing an existing file) – Matrix where rows represent volumes and columns represent slices. Values indicate number of standard deviations off the mean difference between observation and prediction is.

  • out_outlier_report (a pathlike object or string representing an existing file) – Text file with a plain language report on what outlier slices eddy has found.

  • out_parameter (a pathlike object or string representing an existing file) – Text file with parameters defining the field and movement for each scan.

  • out_residuals (a pathlike object or string representing an existing file) – Path/name of file with the residuals.

  • out_restricted_movement_rms (a pathlike object or string representing an existing file) – Summary of the ‘total movement’ in each volume disregarding translation in the PE direction.

  • out_rotated_bvecs (a pathlike object or string representing an existing file) – File containing rotated b-values for all volumes.

  • out_shell_alignment_parameters (a pathlike object or string representing an existing file) – Text file containing rigid body movement parameters between the different shells as estimated by a post-hoc mutual information based registration.

  • out_shell_pe_translation_parameters (a pathlike object or string representing an existing file) – Text file containing translation along the PE-direction between the different shells as estimated by a post-hoc mutual information based registration.

EddyCorrect

Link to code

Bases: FSLCommand

Wrapped executable: eddy_correct.

Warning

Deprecated in FSL. Please use nipype.interfaces.fsl.epi.Eddy instead

Example

>>> from nipype.interfaces.fsl import EddyCorrect
>>> eddyc = EddyCorrect(in_file='diffusion.nii',
...                     out_file="diffusion_edc.nii", ref_num=0)
>>> eddyc.cmdline
'eddy_correct diffusion.nii diffusion_edc.nii 0'
Mandatory Inputs:
  • in_file (a pathlike object or string representing an existing file) – 4D input file. Maps to a command-line argument: %s (position: 0).

  • ref_num (an integer) – Reference number. Maps to a command-line argument: %d (position: 2). (Nipype default value: 0)

Optional Inputs:
  • args (a string) – Additional parameters to the command. Maps to a command-line argument: %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: {})

  • out_file (a pathlike object or string representing a file) – 4D output file. 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.

Outputs:

eddy_corrected (a pathlike object or string representing an existing file) – Path/name of 4D eddy corrected output file.

EddyQuad

Link to code

Bases: FSLCommand

Wrapped executable: eddy_quad.

Interface for FSL eddy_quad, a tool for generating single subject reports and storing the quality assessment indices for each subject. User guide

Examples

>>> from nipype.interfaces.fsl import EddyQuad
>>> quad = EddyQuad()
>>> quad.inputs.base_name  = 'eddy_corrected'
>>> quad.inputs.idx_file   = 'epi_index.txt'
>>> quad.inputs.param_file = 'epi_acqp.txt'
>>> quad.inputs.mask_file  = 'epi_mask.nii'
>>> quad.inputs.bval_file  = 'bvals.scheme'
>>> quad.inputs.bvec_file  = 'bvecs.scheme'
>>> quad.inputs.output_dir = 'eddy_corrected.qc'
>>> quad.inputs.field      = 'fieldmap_phase_fslprepared.nii'
>>> quad.inputs.verbose    = True
>>> quad.cmdline
'eddy_quad eddy_corrected --bvals bvals.scheme --bvecs bvecs.scheme --field fieldmap_phase_fslprepared.nii --eddyIdx epi_index.txt --mask epi_mask.nii --output-dir eddy_corrected.qc --eddyParams epi_acqp.txt --verbose'
>>> res = quad.run() 
Mandatory Inputs:
  • bval_file (a pathlike object or string representing an existing file) – B-values file. Maps to a command-line argument: --bvals %s.

  • idx_file (a pathlike object or string representing an existing file) – File containing indices for all volumes into acquisition parameters. Maps to a command-line argument: --eddyIdx %s.

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

  • param_file (a pathlike object or string representing an existing file) – File containing acquisition parameters. Maps to a command-line argument: --eddyParams %s.

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

  • base_name (a string) – Basename (including path) for EDDY output files, i.e., corrected images and QC files. Maps to a command-line argument: %s (position: 0). (Nipype default value: eddy_corrected)

  • bvec_file (a pathlike object or string representing an existing file) – B-vectors file - only used when <base_name>.eddy_residuals file is present. Maps to a command-line argument: --bvecs %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 (a pathlike object or string representing an existing file) – TOPUP estimated field (in Hz). Maps to a command-line argument: --field %s.

  • output_dir (a string) – Output directory - default = ‘<base_name>.qc’. Maps to a command-line argument: --output-dir %s.

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

  • slice_spec (a pathlike object or string representing an existing file) – Text file specifying slice/group acquisition. Maps to a command-line argument: --slspec %s.

  • verbose (a boolean) – Display debug messages. Maps to a command-line argument: --verbose.

Outputs:
  • avg_b0_pe_png (a list of items which are a pathlike object or string representing an existing file) – Image showing mid-sagittal, -coronal and -axial slices of each averaged pe-direction b0 volume. Generated when using the -f option.

  • avg_b_png (a list of items which are a pathlike object or string representing an existing file) – Image showing mid-sagittal, -coronal and -axial slices of each averaged b-shell volume.

  • clean_volumes (a pathlike object or string representing an existing file) – Text file containing a list of clean volumes, based on the eddy squared residuals. To generate a version of the pre-processed dataset without outlier volumes, use: fslselectvols -i <eddy_corrected_data> -o eddy_corrected_data_clean –vols=vols_no_outliers.txt.

  • cnr_png (a list of items which are a pathlike object or string representing an existing file) – Image showing mid-sagittal, -coronal and -axial slices of each b-shell CNR volume. Generated when CNR maps are available.

  • qc_json (a pathlike object or string representing an existing file) – Single subject database containing quality metrics and data info.

  • qc_pdf (a pathlike object or string representing an existing file) – Single subject QC report.

  • residuals (a pathlike object or string representing an existing file) – Text file containing the volume-wise mask-averaged squared residuals. Generated when residual maps are available.

  • vdm_png (a pathlike object or string representing an existing file) – Image showing mid-sagittal, -coronal and -axial slices of the voxel displacement map. Generated when using the -f option.

EpiReg

Link to code

Bases: FSLCommand

Wrapped executable: epi_reg.

Runs FSL epi_reg script for simultaneous coregistration and fieldmap unwarping.

Examples

>>> from nipype.interfaces.fsl import EpiReg
>>> epireg = EpiReg()
>>> epireg.inputs.epi='epi.nii'
>>> epireg.inputs.t1_head='T1.nii'
>>> epireg.inputs.t1_brain='T1_brain.nii'
>>> epireg.inputs.out_base='epi2struct'
>>> epireg.inputs.fmap='fieldmap_phase_fslprepared.nii'
>>> epireg.inputs.fmapmag='fieldmap_mag.nii'
>>> epireg.inputs.fmapmagbrain='fieldmap_mag_brain.nii'
>>> epireg.inputs.echospacing=0.00067
>>> epireg.inputs.pedir='y'
>>> epireg.cmdline 
'epi_reg --echospacing=0.000670 --fmap=fieldmap_phase_fslprepared.nii --fmapmag=fieldmap_mag.nii --fmapmagbrain=fieldmap_mag_brain.nii --noclean --pedir=y --epi=epi.nii --t1=T1.nii --t1brain=T1_brain.nii --out=epi2struct'
>>> epireg.run() 
Mandatory Inputs:
  • epi (a pathlike object or string representing an existing file) – EPI image. Maps to a command-line argument: --epi=%s (position: -4).

  • t1_brain (a pathlike object or string representing an existing file) – Brain extracted T1 image. Maps to a command-line argument: --t1brain=%s (position: -2).

  • t1_head (a pathlike object or string representing an existing file) – Wholehead T1 image. Maps to a command-line argument: --t1=%s (position: -3).

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

  • echospacing (a float) – Effective EPI echo spacing (sometimes called dwell time) - in 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: {})

  • fmap (a pathlike object or string representing an existing file) – Fieldmap image (in rad/s). Maps to a command-line argument: --fmap=%s.

  • fmapmag (a pathlike object or string representing an existing file) – Fieldmap magnitude image - wholehead. Maps to a command-line argument: --fmapmag=%s.

  • fmapmagbrain (a pathlike object or string representing an existing file) – Fieldmap magnitude image - brain extracted. Maps to a command-line argument: --fmapmagbrain=%s.

  • no_clean (a boolean) – Do not clean up intermediate files. Maps to a command-line argument: --noclean. (Nipype default value: True)

  • no_fmapreg (a boolean) – Do not perform registration of fmap to T1 (use if fmap already registered). Maps to a command-line argument: --nofmapreg.

  • out_base (a string) – Output base name. Maps to a command-line argument: --out=%s (position: -1). (Nipype default value: epi2struct)

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

  • pedir (‘x’ or ‘y’ or ‘z’ or ‘-x’ or ‘-y’ or ‘-z’) – Phase encoding direction, dir = x/y/z/-x/-y/-z. Maps to a command-line argument: --pedir=%s.

  • weight_image (a pathlike object or string representing an existing file) – Weighting image (in T1 space). Maps to a command-line argument: --weight=%s.

  • wmseg (a pathlike object or string representing an existing file) – White matter segmentation of T1 image, has to be named like the t1brain and end on _wmseg. Maps to a command-line argument: --wmseg=%s.

Outputs:
  • epi2str_inv (a pathlike object or string representing an existing file) – Rigid structural-to-epi transform.

  • epi2str_mat (a pathlike object or string representing an existing file) – Rigid epi-to-structural transform.

  • fmap2epi_mat (a pathlike object or string representing an existing file) – Rigid fieldmap-to-epi transform.

  • fmap2str_mat (a pathlike object or string representing an existing file) – Rigid fieldmap-to-structural transform.

  • fmap_epi (a pathlike object or string representing an existing file) – Fieldmap in epi space.

  • fmap_str (a pathlike object or string representing an existing file) – Fieldmap in structural space.

  • fmapmag_str (a pathlike object or string representing an existing file) – Fieldmap magnitude image in structural space.

  • fullwarp (a pathlike object or string representing an existing file) – Warpfield to unwarp epi and transform into structural space.

  • out_1vol (a pathlike object or string representing an existing file) – Unwarped and coregistered single volume.

  • out_file (a pathlike object or string representing an existing file) – Unwarped and coregistered epi input.

  • seg (a pathlike object or string representing an existing file) – White matter, gray matter, csf segmentation.

  • shiftmap (a pathlike object or string representing an existing file) – Shiftmap in epi space.

  • wmedge (a pathlike object or string representing an existing file) – White matter edges for visualization.

  • wmseg (a pathlike object or string representing an existing file) – White matter segmentation used in flirt bbr.

PrepareFieldmap

Link to code

Bases: FSLCommand

Wrapped executable: fsl_prepare_fieldmap.

Interface for the fsl_prepare_fieldmap script (FSL 5.0)

Prepares a fieldmap suitable for FEAT from SIEMENS data - saves output in rad/s format (e.g. `fsl_prepare_fieldmap SIEMENS images_3_gre_field_mapping images_4_gre_field_mapping fmap_rads 2.65`).

Examples

>>> from nipype.interfaces.fsl import PrepareFieldmap
>>> prepare = PrepareFieldmap()
>>> prepare.inputs.in_phase = "phase.nii"
>>> prepare.inputs.in_magnitude = "magnitude.nii"
>>> prepare.inputs.output_type = "NIFTI_GZ"
>>> prepare.cmdline 
'fsl_prepare_fieldmap SIEMENS phase.nii magnitude.nii .../phase_fslprepared.nii.gz 2.460000'
>>> res = prepare.run() 
Mandatory Inputs:
  • delta_TE (a float) – Echo time difference of the fieldmap sequence in ms. (usually 2.46ms in Siemens). Maps to a command-line argument: %f (position: -2). (Nipype default value: 2.46)

  • in_magnitude (a pathlike object or string representing an existing file) – Magnitude difference map, brain extracted. Maps to a command-line argument: %s (position: 3).

  • in_phase (a pathlike object or string representing an existing file) – Phase difference map, in SIEMENS format range from 0-4096 or 0-8192). Maps to a command-line argument: %s (position: 2).

Optional Inputs:
  • args (a string) – Additional parameters to the command. Maps to a command-line argument: %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: {})

  • nocheck (a boolean) – Do not perform sanity checks for image size/range/dimensions. Maps to a command-line argument: --nocheck (position: -1). (Nipype default value: False)

  • out_fieldmap (a pathlike object or string representing a file) – Output name for prepared fieldmap. Maps to a command-line argument: %s (position: 4).

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

  • scanner (a string) – Must be SIEMENS. Maps to a command-line argument: %s (position: 1). (Nipype default value: SIEMENS)

Outputs:

out_fieldmap (a pathlike object or string representing an existing file) – Output name for prepared fieldmap.

SigLoss

Link to code

Bases: FSLCommand

Wrapped executable: sigloss.

Estimates signal loss from a field map (in rad/s)

Examples

>>> from nipype.interfaces.fsl import SigLoss
>>> sigloss = SigLoss()
>>> sigloss.inputs.in_file = "phase.nii"
>>> sigloss.inputs.echo_time = 0.03
>>> sigloss.inputs.output_type = "NIFTI_GZ"
>>> sigloss.cmdline 
'sigloss --te=0.030000 -i phase.nii -s .../phase_sigloss.nii.gz'
>>> res = sigloss.run() 
Mandatory Inputs:

in_file (a pathlike object or string representing an existing file) – B0 fieldmap file. Maps to a command-line argument: -i %s.

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

  • echo_time (a float) – Echo time in seconds. Maps to a command-line argument: --te=%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: {})

  • mask_file (a pathlike object or string representing an existing file) – Brain mask file. Maps to a command-line argument: -m %s.

  • out_file (a pathlike object or string representing a file) – Output signal loss estimate file. Maps to a command-line argument: -s %s.

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

  • slice_direction (‘x’ or ‘y’ or ‘z’) – Slicing direction. Maps to a command-line argument: -d %s.

Outputs:

out_file (a pathlike object or string representing an existing file) – Signal loss estimate file.

TOPUP

Link to code

Bases: FSLCommand

Wrapped executable: topup.

Interface for FSL topup, a tool for estimating and correcting susceptibility induced distortions. See FSL documentation for reference, usage examples, and exemplary config files.

Examples

>>> from nipype.interfaces.fsl import TOPUP
>>> topup = TOPUP()
>>> topup.inputs.in_file = "b0_b0rev.nii"
>>> topup.inputs.encoding_file = "topup_encoding.txt"
>>> topup.inputs.output_type = "NIFTI_GZ"
>>> topup.cmdline 
'topup --config=b02b0.cnf --datain=topup_encoding.txt --imain=b0_b0rev.nii --out=b0_b0rev_base --iout=b0_b0rev_corrected.nii.gz --fout=b0_b0rev_field.nii.gz --jacout=jac --logout=b0_b0rev_topup.log --rbmout=xfm --dfout=warpfield'
>>> res = topup.run() 
Mandatory Inputs:
  • encoding_direction (a list of items which are ‘y’ or ‘x’ or ‘z’ or ‘x-’ or ‘y-’ or ‘z-’) – Encoding direction for automatic generation of encoding_file. Maps to a command-line argument: --datain=%s. Mutually exclusive with inputs: encoding_file. Requires inputs: readout_times.

  • encoding_file (a pathlike object or string representing an existing file) – Name of text file with PE directions/times. Maps to a command-line argument: --datain=%s. Mutually exclusive with inputs: encoding_direction.

  • in_file (a pathlike object or string representing an existing file) – Name of 4D file with images. Maps to a command-line argument: --imain=%s.

  • readout_times (a list of items which are a float) – Readout times (dwell times by # phase-encode steps minus 1). Mutually exclusive with inputs: encoding_file. Requires inputs: encoding_direction.

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

  • config (a string) – Name of config file specifying command line arguments. Maps to a command-line argument: --config=%s. (Nipype default value: b02b0.cnf)

  • 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: {})

  • estmov (1 or 0) – Estimate movements if set. Maps to a command-line argument: --estmov=%d.

  • fwhm (a float) – FWHM (in mm) of gaussian smoothing kernel. Maps to a command-line argument: --fwhm=%f.

  • interp (‘spline’ or ‘linear’) – Image interpolation model, linear or spline. Maps to a command-line argument: --interp=%s.

  • max_iter (an integer) – Max # of non-linear iterations. Maps to a command-line argument: --miter=%d.

  • minmet (0 or 1) – Minimisation method 0=Levenberg-Marquardt, 1=Scaled Conjugate Gradient. Maps to a command-line argument: --minmet=%d.

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

  • out_base (a pathlike object or string representing a file) – Base-name of output files (spline coefficients (Hz) and movement parameters). Maps to a command-line argument: --out=%s.

  • out_corrected (a pathlike object or string representing a file) – Name of 4D image file with unwarped images. Maps to a command-line argument: --iout=%s.

  • out_field (a pathlike object or string representing a file) – Name of image file with field (Hz). Maps to a command-line argument: --fout=%s.

  • out_jac_prefix (a string) – Prefix for the warpfield images. Maps to a command-line argument: --jacout=%s. (Nipype default value: jac)

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

  • out_mat_prefix (a string) – Prefix for the realignment matrices. Maps to a command-line argument: --rbmout=%s. (Nipype default value: xfm)

  • out_warp_prefix (a string) – Prefix for the warpfield images (in mm). Maps to a command-line argument: --dfout=%s. (Nipype default value: warpfield)

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

  • reg_lambda (a float) – Weight of regularisation, default depending on –ssqlambda and –regmod switches. Maps to a command-line argument: --lambda=%0.f.

  • regmod (‘bending_energy’ or ‘membrane_energy’) – Regularisation term implementation. Defaults to bending_energy. Note that the two functions have vastly different scales. The membrane energy is based on the first derivatives and the bending energy on the second derivatives. The second derivatives will typically be much smaller than the first derivatives, so input lambda will have to be larger for bending_energy to yield approximately the same level of regularisation. Maps to a command-line argument: --regmod=%s.

  • regrid (1 or 0) – If set (=1), the calculations are done in a different grid. Maps to a command-line argument: --regrid=%d.

  • scale (0 or 1) – If set (=1), the images are individually scaled to a common mean. Maps to a command-line argument: --scale=%d.

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

  • ssqlambda (1 or 0) – Weight lambda by the current value of the ssd. If used (=1), the effective weight of regularisation term becomes higher for the initial iterations, therefore initial steps are a little smoother than they would without weighting. This reduces the risk of finding a local minimum. Maps to a command-line argument: --ssqlambda=%d.

  • subsamp (an integer) – Sub-sampling scheme. Maps to a command-line argument: --subsamp=%d.

  • warp_res (a float) – (approximate) resolution (in mm) of warp basis for the different sub-sampling levels. Maps to a command-line argument: --warpres=%f.

Outputs:
  • out_corrected (a pathlike object or string representing a file) – Name of 4D image file with unwarped images.

  • out_enc_file (a pathlike object or string representing a file) – Encoding directions file output for applytopup.

  • out_field (a pathlike object or string representing a file) – Name of image file with field (Hz).

  • out_fieldcoef (a pathlike object or string representing an existing file) – File containing the field coefficients.

  • out_jacs (a list of items which are a pathlike object or string representing an existing file) – Jacobian images.

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

  • out_mats (a list of items which are a pathlike object or string representing an existing file) – Realignment matrices.

  • out_movpar (a pathlike object or string representing an existing file) – Movpar.txt output file.

  • out_warps (a list of items which are a pathlike object or string representing an existing file) – Warpfield images.