nipype.interfaces.fsl.model 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.

Cluster

Link to code

Bases: FSLCommand

Wrapped executable: cluster.

Uses FSL cluster to perform clustering on statistical output

Examples

>>> cl = Cluster()
>>> cl.inputs.threshold = 2.3
>>> cl.inputs.in_file = 'zstat1.nii.gz'
>>> cl.inputs.out_localmax_txt_file = 'stats.txt'
>>> cl.inputs.use_mm = True
>>> cl.cmdline
'cluster --in=zstat1.nii.gz --olmax=stats.txt --thresh=2.3000000000 --mm'
Mandatory Inputs:
  • in_file (a pathlike object or string representing an existing file) – Input volume. Maps to a command-line argument: --in=%s.

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

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

  • connectivity (an integer) – The connectivity of voxels (default 26). Maps to a command-line argument: --connectivity=%d.

  • cope_file (a pathlike object or string representing a file) – Cope volume. Maps to a command-line argument: --cope=%s.

  • dlh (a float) – Smoothness estimate = sqrt(det(Lambda)). Maps to a command-line argument: --dlh=%.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: {})

  • find_min (a boolean) – Find minima instead of maxima. Maps to a command-line argument: --min. (Nipype default value: False)

  • fractional (a boolean) – Interprets the threshold as a fraction of the robust range. Maps to a command-line argument: --fractional. (Nipype default value: False)

  • minclustersize (a boolean) – Prints out minimum significant cluster size. Maps to a command-line argument: --minclustersize. (Nipype default value: False)

  • no_table (a boolean) – Suppresses printing of the table info. Maps to a command-line argument: --no_table. (Nipype default value: False)

  • num_maxima (an integer) – No of local maxima to report. Maps to a command-line argument: --num=%d.

  • out_index_file (a boolean or a pathlike object or string representing a file) – Output of cluster index (in size order). Maps to a command-line argument: --oindex=%s.

  • out_localmax_txt_file (a boolean or a pathlike object or string representing a file) – Local maxima text file. Maps to a command-line argument: --olmax=%s.

  • out_localmax_vol_file (a boolean or a pathlike object or string representing a file) – Output of local maxima volume. Maps to a command-line argument: --olmaxim=%s.

  • out_max_file (a boolean or a pathlike object or string representing a file) – Filename for output of max image. Maps to a command-line argument: --omax=%s.

  • out_mean_file (a boolean or a pathlike object or string representing a file) – Filename for output of mean image. Maps to a command-line argument: --omean=%s.

  • out_pval_file (a boolean or a pathlike object or string representing a file) – Filename for image output of log pvals. Maps to a command-line argument: --opvals=%s.

  • out_size_file (a boolean or a pathlike object or string representing a file) – Filename for output of size image. Maps to a command-line argument: --osize=%s.

  • out_threshold_file (a boolean or a pathlike object or string representing a file) – Thresholded image. Maps to a command-line argument: --othresh=%s.

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

  • peak_distance (a float) – Minimum distance between local maxima/minima, in mm (default 0). Maps to a command-line argument: --peakdist=%.10f.

  • pthreshold (a float) – P-threshold for clusters. Maps to a command-line argument: --pthresh=%.10f. Requires inputs: dlh, volume.

  • std_space_file (a pathlike object or string representing a file) – Filename for standard-space volume. Maps to a command-line argument: --stdvol=%s.

  • use_mm (a boolean) – Use mm, not voxel, coordinates. Maps to a command-line argument: --mm. (Nipype default value: False)

  • volume (an integer) – Number of voxels in the mask. Maps to a command-line argument: --volume=%d.

  • warpfield_file (a pathlike object or string representing a file) – File containing warpfield. Maps to a command-line argument: --warpvol=%s.

  • xfm_file (a pathlike object or string representing a file) – Filename for Linear: input->standard-space transform. Non-linear: input->highres transform. Maps to a command-line argument: --xfm=%s.

Outputs:
  • index_file (a pathlike object or string representing a file) – Output of cluster index (in size order).

  • localmax_txt_file (a pathlike object or string representing a file) – Local maxima text file.

  • localmax_vol_file (a pathlike object or string representing a file) – Output of local maxima volume.

  • max_file (a pathlike object or string representing a file) – Filename for output of max image.

  • mean_file (a pathlike object or string representing a file) – Filename for output of mean image.

  • pval_file (a pathlike object or string representing a file) – Filename for image output of log pvals.

  • size_file (a pathlike object or string representing a file) – Filename for output of size image.

  • threshold_file (a pathlike object or string representing a file) – Thresholded image.

Cluster.filemap = {'out_index_file': 'index', 'out_localmax_txt_file': 'localmax.txt', 'out_localmax_vol_file': 'localmax', 'out_max_file': 'max', 'out_mean_file': 'mean', 'out_pval_file': 'pval', 'out_size_file': 'size', 'out_threshold_file': 'threshold'}

ContrastMgr

Link to code

Bases: FSLCommand

Wrapped executable: contrast_mgr.

Use FSL contrast_mgr command to evaluate contrasts

In interface mode this file assumes that all the required inputs are in the same location. This has deprecated for FSL versions 5.0.7+ as the necessary corrections file is no longer generated by FILMGLS.

Mandatory Inputs:
  • corrections (a pathlike object or string representing an existing file) – Statistical corrections used within FILM modelling.

  • dof_file (a pathlike object or string representing an existing file) – Degrees of freedom.

  • param_estimates (a list of items which are a pathlike object or string representing an existing file) – Parameter estimates for each column of the design matrix.

  • sigmasquareds (a pathlike object or string representing an existing file) – Summary of residuals, See Woolrich, et. al., 2001.

  • tcon_file (a pathlike object or string representing an existing file) – Contrast file containing T-contrasts. 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.

  • contrast_num (an integer >= 1) – Contrast number to start labeling copes from. Maps to a command-line argument: -cope.

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

  • fcon_file (a pathlike object or string representing an existing file) – Contrast file containing F-contrasts. Maps to a command-line argument: -f %s.

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

  • suffix (a string) – Suffix to put on the end of the cope filename before the contrast number, default is nothing. Maps to a command-line argument: -suffix %s.

Outputs:
  • copes (a list of items which are a pathlike object or string representing an existing file) – Contrast estimates for each contrast.

  • fstats (a list of items which are a pathlike object or string representing an existing file) – F-stat file for each contrast.

  • neffs (a list of items which are a pathlike object or string representing an existing file) – Neff file ?? for each contrast.

  • tstats (a list of items which are a pathlike object or string representing an existing file) – T-stat file for each contrast.

  • varcopes (a list of items which are a pathlike object or string representing an existing file) – Variance estimates for each contrast.

  • zfstats (a list of items which are a pathlike object or string representing an existing file) – Z-stat file for each F contrast.

  • zstats (a list of items which are a pathlike object or string representing an existing file) – Z-stat file for each contrast.

DualRegression

Link to code

Bases: FSLCommand

Wrapped executable: dual_regression.

Wrapper Script for Dual Regression Workflow

Examples

>>> dual_regression = DualRegression()
>>> dual_regression.inputs.in_files = ["functional.nii", "functional2.nii", "functional3.nii"]
>>> dual_regression.inputs.group_IC_maps_4D = "allFA.nii"
>>> dual_regression.inputs.des_norm = False
>>> dual_regression.inputs.one_sample_group_mean = True
>>> dual_regression.inputs.n_perm = 10
>>> dual_regression.inputs.out_dir = "my_output_directory"
>>> dual_regression.cmdline
'dual_regression allFA.nii 0 -1 10 my_output_directory functional.nii functional2.nii functional3.nii'
>>> dual_regression.run() 
Mandatory Inputs:
  • group_IC_maps_4D (a pathlike object or string representing an existing file) – 4D image containing spatial IC maps (melodic_IC) from the whole-group ICA analysis. Maps to a command-line argument: %s (position: 1).

  • in_files (a list of items which are a pathlike object or string representing an existing file) – List all subjects’ preprocessed, standard-space 4D datasets. Maps to a command-line argument: %s (position: -1).

  • n_perm (an integer) – Number of permutations for randomise; set to 1 for just raw tstat output, set to 0 to not run randomise at all. Maps to a command-line argument: %i (position: 5).

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

  • con_file (a pathlike object or string representing an existing file) – Design contrasts for final cross-subject modelling with randomise. Maps to a command-line argument: %s (position: 4).

  • des_norm (a boolean) – Whether to variance-normalise the timecourses used as the stage-2 regressors; True is default and recommended. Maps to a command-line argument: %i (position: 2). (Nipype default value: True)

  • design_file (a pathlike object or string representing an existing file) – Design matrix for final cross-subject modelling with randomise. Maps to a command-line argument: %s (position: 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: {})

  • one_sample_group_mean (a boolean) – Perform 1-sample group-mean test instead of generic permutation test. Maps to a command-line argument: -1 (position: 3).

  • out_dir (a pathlike object or string representing a directory) – This directory will be created to hold all output and logfiles. Maps to a command-line argument: %s (position: 6). (Nipype default value: output)

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

Outputs:

out_dir (a pathlike object or string representing an existing directory)

FEAT

Link to code

Bases: FSLCommand

Wrapped executable: feat.

Uses FSL feat to calculate first level stats

Mandatory Inputs:

fsf_file (a pathlike object or string representing an existing file) – File specifying the feat design spec file. 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.

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

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

Outputs:

feat_dir (a pathlike object or string representing an existing directory)

FEATModel

Link to code

Bases: FSLCommand

Wrapped executable: feat_model.

Uses FSL feat_model to generate design.mat files

Mandatory Inputs:
  • ev_files (a list of items which are a pathlike object or string representing an existing file) – Event spec files generated by level1design. Maps to a command-line argument: %s (position: 1).

  • fsf_file (a pathlike object or string representing an existing file) – File specifying the feat design spec file. 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.

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

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

Outputs:
  • con_file (a pathlike object or string representing an existing file) – Contrast file containing contrast vectors.

  • design_cov (a pathlike object or string representing an existing file) – Graphical representation of design covariance.

  • design_file (a pathlike object or string representing an existing file) – Mat file containing ascii matrix for design.

  • design_image (a pathlike object or string representing an existing file) – Graphical representation of design matrix.

  • fcon_file (a pathlike object or string representing a file) – Contrast file containing contrast vectors.

FEATRegister

Link to code

Bases: BaseInterface

Register feat directories to a specific standard

Mandatory Inputs:
  • feat_dirs (a list of items which are a pathlike object or string representing an existing directory) – Lower level feat dirs.

  • reg_image (a pathlike object or string representing an existing file) – Image to register to (will be treated as standard).

Optional Inputs:

reg_dof (an integer) – Registration degrees of freedom. (Nipype default value: 12)

Outputs:

fsf_file (a pathlike object or string representing an existing file) – FSL feat specification file.

FILMGLS

Link to code

Bases: FSLCommand

Wrapped executable: film_gls.

Use FSL film_gls command to fit a design matrix to voxel timeseries

Examples

Initialize with no options, assigning them when calling run:

>>> from nipype.interfaces import fsl
>>> fgls = fsl.FILMGLS()
>>> res = fgls.run('in_file', 'design_file', 'thresh', rn='stats') 

Assign options through the inputs attribute:

>>> fgls = fsl.FILMGLS()
>>> fgls.inputs.in_file = 'functional.nii'
>>> fgls.inputs.design_file = 'design.mat'
>>> fgls.inputs.threshold = 10
>>> fgls.inputs.results_dir = 'stats'
>>> res = fgls.run() 

Specify options when creating an instance:

>>> fgls = fsl.FILMGLS(in_file='functional.nii', design_file='design.mat', threshold=10, results_dir='stats')
>>> res = fgls.run() 
Mandatory Inputs:

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

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

  • autocorr_estimate_only (a boolean) – Perform autocorrelation estimatation only. Maps to a command-line argument: -ac. Mutually exclusive with inputs: autocorr_estimate_only, fit_armodel, tukey_window, multitaper_product, use_pava, autocorr_noestimate.

  • autocorr_noestimate (a boolean) – Do not estimate autocorrs. Maps to a command-line argument: -noest. Mutually exclusive with inputs: autocorr_estimate_only, fit_armodel, tukey_window, multitaper_product, use_pava, autocorr_noestimate.

  • brightness_threshold (an integer >= 0) – Susan brightness threshold, otherwise it is estimated. Maps to a command-line argument: -epith %d.

  • design_file (a pathlike object or string representing an existing file) – Design matrix file. Maps to a command-line argument: %s (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: {})

  • fit_armodel (a boolean) – Fits autoregressive model - default is to use tukey with M=sqrt(numvols). Maps to a command-line argument: -ar. Mutually exclusive with inputs: autocorr_estimate_only, fit_armodel, tukey_window, multitaper_product, use_pava, autocorr_noestimate.

  • full_data (a boolean) – Output full data. Maps to a command-line argument: -v.

  • mask_size (an integer) – Susan mask size. Maps to a command-line argument: -ms %d.

  • multitaper_product (an integer) – Multitapering with slepian tapers and num is the time-bandwidth product. Maps to a command-line argument: -mt %d. Mutually exclusive with inputs: autocorr_estimate_only, fit_armodel, tukey_window, multitaper_product, use_pava, autocorr_noestimate.

  • output_pwdata (a boolean) – Output prewhitened data and average design matrix. Maps to a command-line argument: -output_pwdata.

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

  • results_dir (a pathlike object or string representing a directory) – Directory to store results in. Maps to a command-line argument: -rn %s. (Nipype default value: results)

  • smooth_autocorr (a boolean) – Smooth auto corr estimates. Maps to a command-line argument: -sa.

  • threshold (a floating point number >= 0.0) – Threshold. Maps to a command-line argument: %f (position: -1). (Nipype default value: 1000.0)

  • tukey_window (an integer) – Tukey window size to estimate autocorr. Maps to a command-line argument: -tukey %d. Mutually exclusive with inputs: autocorr_estimate_only, fit_armodel, tukey_window, multitaper_product, use_pava, autocorr_noestimate.

  • use_pava (a boolean) – Estimates autocorr using PAVA. Maps to a command-line argument: -pava.

Outputs:
  • corrections (a pathlike object or string representing an existing file) – Statistical corrections used within FILM modeling.

  • dof_file (a pathlike object or string representing an existing file) – Degrees of freedom.

  • logfile (a pathlike object or string representing an existing file) – FILM run logfile.

  • param_estimates (a list of items which are a pathlike object or string representing an existing file) – Parameter estimates for each column of the design matrix.

  • residual4d (a pathlike object or string representing an existing file) – Model fit residual mean-squared error for each time point.

  • results_dir (a pathlike object or string representing an existing directory) – Directory storing model estimation output.

  • sigmasquareds (a pathlike object or string representing an existing file) – Summary of residuals, See Woolrich, et. al., 2001.

  • thresholdac (a pathlike object or string representing an existing file) – The FILM autocorrelation parameters.

FLAMEO

Link to code

Bases: FSLCommand

Wrapped executable: flameo.

Use FSL flameo command to perform higher level model fits

Examples

Initialize FLAMEO with no options, assigning them when calling run:

>>> from nipype.interfaces import fsl
>>> flameo = fsl.FLAMEO()
>>> flameo.inputs.cope_file = 'cope.nii.gz'
>>> flameo.inputs.var_cope_file = 'varcope.nii.gz'
>>> flameo.inputs.cov_split_file = 'cov_split.mat'
>>> flameo.inputs.design_file = 'design.mat'
>>> flameo.inputs.t_con_file = 'design.con'
>>> flameo.inputs.mask_file = 'mask.nii'
>>> flameo.inputs.run_mode = 'fe'
>>> flameo.cmdline
'flameo --copefile=cope.nii.gz --covsplitfile=cov_split.mat --designfile=design.mat --ld=stats --maskfile=mask.nii --runmode=fe --tcontrastsfile=design.con --varcopefile=varcope.nii.gz'
Mandatory Inputs:
  • cope_file (a pathlike object or string representing an existing file) – Cope regressor data file. Maps to a command-line argument: --copefile=%s.

  • cov_split_file (a pathlike object or string representing an existing file) – Ascii matrix specifying the groups the covariance is split into. Maps to a command-line argument: --covsplitfile=%s.

  • design_file (a pathlike object or string representing an existing file) – Design matrix file. Maps to a command-line argument: --designfile=%s.

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

  • run_mode (‘fe’ or ‘ols’ or ‘flame1’ or ‘flame12’) – Inference to perform. Maps to a command-line argument: --runmode=%s.

  • t_con_file (a pathlike object or string representing an existing file) – Ascii matrix specifying t-contrasts. Maps to a command-line argument: --tcontrastsfile=%s.

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

  • burnin (an integer) – Number of jumps at start of mcmc to be discarded. Maps to a command-line argument: --burnin=%d.

  • dof_var_cope_file (a pathlike object or string representing an existing file) – Dof data file for varcope data. Maps to a command-line argument: --dofvarcopefile=%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: {})

  • f_con_file (a pathlike object or string representing an existing file) – Ascii matrix specifying f-contrasts. Maps to a command-line argument: --fcontrastsfile=%s.

  • fix_mean (a boolean) – Fix mean for tfit. Maps to a command-line argument: --fixmean.

  • infer_outliers (a boolean) – Infer outliers - not for fe. Maps to a command-line argument: --inferoutliers.

  • log_dir (a pathlike object or string representing a directory) – Maps to a command-line argument: --ld=%s. (Nipype default value: stats)

  • n_jumps (an integer) – Number of jumps made by mcmc. Maps to a command-line argument: --njumps=%d.

  • no_pe_outputs (a boolean) – Do not output pe files. Maps to a command-line argument: --nopeoutput.

  • outlier_iter (an integer) – Number of max iterations to use when inferring outliers. Default is 12. Maps to a command-line argument: --ioni=%d.

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

  • sample_every (an integer) – Number of jumps for each sample. Maps to a command-line argument: --sampleevery=%d.

  • sigma_dofs (an integer) – Sigma (in mm) to use for Gaussian smoothing the DOFs in FLAME 2. Default is 1mm, -1 indicates no smoothing. Maps to a command-line argument: --sigma_dofs=%d.

  • var_cope_file (a pathlike object or string representing an existing file) – Varcope weightings data file. Maps to a command-line argument: --varcopefile=%s.

Outputs:
  • copes (a list of items which are a pathlike object or string representing an existing file) – Contrast estimates for each contrast.

  • fstats (a list of items which are a pathlike object or string representing an existing file) – F-stat file for each contrast.

  • mrefvars (a list of items which are a pathlike object or string representing an existing file) – Mean random effect variances for each contrast.

  • pes (a list of items which are a pathlike object or string representing an existing file) – Parameter estimates for each column of the design matrix for each voxel.

  • res4d (a list of items which are a pathlike object or string representing an existing file) – Model fit residual mean-squared error for each time point.

  • stats_dir (a pathlike object or string representing a directory) – Directory storing model estimation output.

  • tdof (a list of items which are a pathlike object or string representing an existing file) – Temporal dof file for each contrast.

  • tstats (a list of items which are a pathlike object or string representing an existing file) – T-stat file for each contrast.

  • var_copes (a list of items which are a pathlike object or string representing an existing file) – Variance estimates for each contrast.

  • weights (a list of items which are a pathlike object or string representing an existing file) – Weights file for each contrast.

  • zfstats (a list of items which are a pathlike object or string representing an existing file) – Z stat file for each f contrast.

  • zstats (a list of items which are a pathlike object or string representing an existing file) – Z-stat file for each contrast.

GLM

Link to code

Bases: FSLCommand

Wrapped executable: fsl_glm.

FSL GLM:

Example

>>> import nipype.interfaces.fsl as fsl
>>> glm = fsl.GLM(in_file='functional.nii', design='maps.nii', output_type='NIFTI')
>>> glm.cmdline
'fsl_glm -i functional.nii -d maps.nii -o functional_glm.nii'
Mandatory Inputs:
  • design (a pathlike object or string representing an existing file) – File name of the GLM design matrix (text time courses for temporal regression or an image file for spatial regression). Maps to a command-line argument: -d %s (position: 2).

  • in_file (a pathlike object or string representing an existing file) – Input file name (text matrix or 3D/4D image file). Maps to a command-line argument: -i %s (position: 1).

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

  • contrasts (a pathlike object or string representing an existing file) – Matrix of t-statics contrasts. Maps to a command-line argument: -c %s.

  • dat_norm (a boolean) – Switch on normalization of the data time series to unit std deviation. Maps to a command-line argument: --dat_norm.

  • demean (a boolean) – Switch on demeaining of design and data. Maps to a command-line argument: --demean.

  • des_norm (a boolean) – Switch on normalization of the design matrix columns to unit std deviation. Maps to a command-line argument: --des_norm.

  • dof (an integer) – Set degrees of freedom explicitly. 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: {})

  • mask (a pathlike object or string representing an existing file) – Mask image file name if input is image. Maps to a command-line argument: -m %s.

  • out_cope (a pathlike object or string representing a file) – Output file name for COPE (either as txt or image. Maps to a command-line argument: --out_cope=%s.

  • out_data_name (a pathlike object or string representing a file) – Output file name for pre-processed data. Maps to a command-line argument: --out_data=%s.

  • out_f_name (a pathlike object or string representing a file) – Output file name for F-value of full model fit. Maps to a command-line argument: --out_f=%s.

  • out_file (a pathlike object or string representing a file) – Filename for GLM parameter estimates (GLM betas). Maps to a command-line argument: -o %s (position: 3).

  • out_p_name (a pathlike object or string representing a file) – Output file name for p-values of Z-stats (either as text file or image). Maps to a command-line argument: --out_p=%s.

  • out_pf_name (a pathlike object or string representing a file) – Output file name for p-value for full model fit. Maps to a command-line argument: --out_pf=%s.

  • out_res_name (a pathlike object or string representing a file) – Output file name for residuals. Maps to a command-line argument: --out_res=%s.

  • out_sigsq_name (a pathlike object or string representing a file) – Output file name for residual noise variance sigma-square. Maps to a command-line argument: --out_sigsq=%s.

  • out_t_name (a pathlike object or string representing a file) – Output file name for t-stats (either as txt or image. Maps to a command-line argument: --out_t=%s.

  • out_varcb_name (a pathlike object or string representing a file) – Output file name for variance of COPEs. Maps to a command-line argument: --out_varcb=%s.

  • out_vnscales_name (a pathlike object or string representing a file) – Output file name for scaling factors for variance normalisation. Maps to a command-line argument: --out_vnscales=%s.

  • out_z_name (a pathlike object or string representing a file) – Output file name for Z-stats (either as txt or image. Maps to a command-line argument: --out_z=%s.

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

  • var_norm (a boolean) – Perform MELODIC variance-normalisation on data. Maps to a command-line argument: --vn.

Outputs:
  • out_cope (a list of items which are a pathlike object or string representing an existing file) – Output file name for COPEs (either as text file or image).

  • out_data (a list of items which are a pathlike object or string representing an existing file) – Output file for preprocessed data.

  • out_f (a list of items which are a pathlike object or string representing an existing file) – Output file name for F-value of full model fit.

  • out_file (a pathlike object or string representing an existing file) – File name of GLM parameters (if generated).

  • out_p (a list of items which are a pathlike object or string representing an existing file) – Output file name for p-values of Z-stats (either as text file or image).

  • out_pf (a list of items which are a pathlike object or string representing an existing file) – Output file name for p-value for full model fit.

  • out_res (a list of items which are a pathlike object or string representing an existing file) – Output file name for residuals.

  • out_sigsq (a list of items which are a pathlike object or string representing an existing file) – Output file name for residual noise variance sigma-square.

  • out_t (a list of items which are a pathlike object or string representing an existing file) – Output file name for t-stats (either as text file or image).

  • out_varcb (a list of items which are a pathlike object or string representing an existing file) – Output file name for variance of COPEs.

  • out_vnscales (a list of items which are a pathlike object or string representing an existing file) – Output file name for scaling factors for variance normalisation.

  • out_z (a list of items which are a pathlike object or string representing an existing file) – Output file name for COPEs (either as text file or image).

L2Model

Link to code

Bases: BaseInterface

Generate subject specific second level model

Examples

>>> from nipype.interfaces.fsl import L2Model
>>> model = L2Model(num_copes=3) # 3 sessions
Mandatory Inputs:

num_copes (an integer >= 1) – Number of copes to be combined.

Outputs:
  • design_con (a pathlike object or string representing an existing file) – Design contrast file.

  • design_grp (a pathlike object or string representing an existing file) – Design group file.

  • design_mat (a pathlike object or string representing an existing file) – Design matrix file.

Level1Design

Link to code

Bases: BaseInterface

Generate FEAT specific files

Examples

>>> level1design = Level1Design()
>>> level1design.inputs.interscan_interval = 2.5
>>> level1design.inputs.bases = {'dgamma':{'derivs': False}}
>>> level1design.inputs.session_info = 'session_info.npz'
>>> level1design.run() 
Mandatory Inputs:
  • bases (a dictionary with keys which are ‘dgamma’ and with values which are a dictionary with keys which are ‘derivs’ and with values which are a boolean or a dictionary with keys which are ‘gamma’ and with values which are a dictionary with keys which are ‘derivs’ or ‘gammasigma’ or ‘gammadelay’ and with values which are any value or a dictionary with keys which are ‘custom’ and with values which are a dictionary with keys which are ‘bfcustompath’ and with values which are a string or a dictionary with keys which are ‘none’ and with values which are a dictionary with keys which are any value and with values which are any value or a dictionary with keys which are ‘none’ and with values which are None) – Name of basis function and options e.g., {‘dgamma’: {‘derivs’: True}}.

  • interscan_interval (a float) – Interscan interval (in secs).

  • model_serial_correlations (a boolean) – Option to model serial correlations using an autoregressive estimator (order 1). Setting this option is only useful in the context of the fsf file. If you set this to False, you need to repeat this option for FILMGLS by setting autocorr_noestimate to True.

  • session_info (any value) – Session specific information generated by modelgen.SpecifyModel.

Optional Inputs:
  • contrasts (a list of items which are a tuple of the form: (a string, ‘T’, a list of items which are a string, a list of items which are a float) or a tuple of the form: (a string, ‘T’, a list of items which are a string, a list of items which are a float, a list of items which are a float) or a tuple of the form: (a string, ‘F’, a list of items which are a tuple of the form: (a string, ‘T’, a list of items which are a string, a list of items which are a float) or a tuple of the form: (a string, ‘T’, a list of items which are a string, a list of items which are a float, a list of items which are a float))) – List of contrasts with each contrast being a list of the form - [(‘name’, ‘stat’, [condition list], [weight list], [session list])]. if session list is None or not provided, all sessions are used. For F contrasts, the condition list should contain previously defined T-contrasts.

  • orthogonalization (a dictionary with keys which are an integer and with values which are a dictionary with keys which are an integer and with values which are a boolean or an integer) – Which regressors to make orthogonal e.g., {1: {0:0,1:0,2:0}, 2: {0:1,1:1,2:0}} to make the second regressor in a 2-regressor model orthogonal to the first. (Nipype default value: {})

Outputs:
  • ev_files (a list of items which are a list of items which are a pathlike object or string representing an existing file) – Condition information files.

  • fsf_files (a list of items which are a pathlike object or string representing an existing file) – FSL feat specification files.

MELODIC

Link to code

Bases: FSLCommand

Wrapped executable: melodic.

Multivariate Exploratory Linear Optimised Decomposition into Independent Components

Examples

>>> melodic_setup = MELODIC()
>>> melodic_setup.inputs.approach = 'tica'
>>> melodic_setup.inputs.in_files = ['functional.nii', 'functional2.nii', 'functional3.nii']
>>> melodic_setup.inputs.no_bet = True
>>> melodic_setup.inputs.bg_threshold = 10
>>> melodic_setup.inputs.tr_sec = 1.5
>>> melodic_setup.inputs.mm_thresh = 0.5
>>> melodic_setup.inputs.out_stats = True
>>> melodic_setup.inputs.t_des = 'timeDesign.mat'
>>> melodic_setup.inputs.t_con = 'timeDesign.con'
>>> melodic_setup.inputs.s_des = 'subjectDesign.mat'
>>> melodic_setup.inputs.s_con = 'subjectDesign.con'
>>> melodic_setup.inputs.out_dir = 'groupICA.out'
>>> melodic_setup.cmdline
'melodic -i functional.nii,functional2.nii,functional3.nii -a tica --bgthreshold=10.000000 --mmthresh=0.500000 --nobet -o groupICA.out --Ostats --Scon=subjectDesign.con --Sdes=subjectDesign.mat --Tcon=timeDesign.con --Tdes=timeDesign.mat --tr=1.500000'
>>> melodic_setup.run() 
Mandatory Inputs:

in_files (a list of items which are a pathlike object or string representing an existing file) – Input file names (either single file name or a list). Maps to a command-line argument: -i %s (position: 0).

Optional Inputs:
  • ICs (a pathlike object or string representing an existing file) – Filename of the IC components file for mixture modelling. Maps to a command-line argument: --ICs=%s.

  • approach (a string) – Approach for decomposition, 2D: defl, symm (default), 3D: tica (default), concat. Maps to a command-line argument: -a %s.

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

  • bg_image (a pathlike object or string representing an existing file) – Specify background image for report (default: mean image). Maps to a command-line argument: --bgimage=%s.

  • bg_threshold (a float) – Brain/non-brain threshold used to mask non-brain voxels, as a percentage (only if –nobet selected). Maps to a command-line argument: --bgthreshold=%f.

  • cov_weight (a float) – Voxel-wise weights for the covariance matrix (e.g. segmentation information). Maps to a command-line argument: --covarweight=%f.

  • dim (an integer) – Dimensionality reduction into #num dimensions (default: automatic estimation). Maps to a command-line argument: -d %d.

  • dim_est (a string) – Use specific dim. estimation technique: lap, bic, mdl, aic, mean (default: lap). Maps to a command-line argument: --dimest=%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: {})

  • epsilon (a float) – Minimum error change. Maps to a command-line argument: --eps=%f.

  • epsilonS (a float) – Minimum error change for rank-1 approximation in TICA. Maps to a command-line argument: --epsS=%f.

  • log_power (a boolean) – Calculate log of power for frequency spectrum. Maps to a command-line argument: --logPower.

  • mask (a pathlike object or string representing an existing file) – File name of mask for thresholding. Maps to a command-line argument: -m %s.

  • max_restart (an integer) – Maximum number of restarts. Maps to a command-line argument: --maxrestart=%d.

  • maxit (an integer) – Maximum number of iterations before restart. Maps to a command-line argument: --maxit=%d.

  • migp (a boolean) – Switch on MIGP data reduction. Maps to a command-line argument: --migp.

  • migpN (an integer) – Number of internal Eigenmaps. Maps to a command-line argument: --migpN %d.

  • migp_factor (an integer) – Internal Factor of mem-threshold relative to number of Eigenmaps (default: 2). Maps to a command-line argument: --migp_factor %d.

  • migp_shuffle (a boolean) – Randomise MIGP file order (default: TRUE). Maps to a command-line argument: --migp_shuffle.

  • mix (a pathlike object or string representing an existing file) – Mixing matrix for mixture modelling / filtering. Maps to a command-line argument: --mix=%s.

  • mm_thresh (a float) – Threshold for Mixture Model based inference. Maps to a command-line argument: --mmthresh=%f.

  • no_bet (a boolean) – Switch off BET. Maps to a command-line argument: --nobet.

  • no_mask (a boolean) – Switch off masking. Maps to a command-line argument: --nomask.

  • no_mm (a boolean) – Switch off mixture modelling on IC maps. Maps to a command-line argument: --no_mm.

  • non_linearity (a string) – Nonlinearity: gauss, tanh, pow3, pow4. Maps to a command-line argument: --nl=%s.

  • num_ICs (an integer) – Number of IC’s to extract (for deflation approach). Maps to a command-line argument: -n %d.

  • out_all (a boolean) – Output everything. Maps to a command-line argument: --Oall.

  • out_dir (a pathlike object or string representing a directory) – Output directory name. Maps to a command-line argument: -o %s.

  • out_mean (a boolean) – Output mean volume. Maps to a command-line argument: --Omean.

  • out_orig (a boolean) – Output the original ICs. Maps to a command-line argument: --Oorig.

  • out_pca (a boolean) – Output PCA results. Maps to a command-line argument: --Opca.

  • out_stats (a boolean) – Output thresholded maps and probability maps. Maps to a command-line argument: --Ostats.

  • out_unmix (a boolean) – Output unmixing matrix. Maps to a command-line argument: --Ounmix.

  • out_white (a boolean) – Output whitening/dewhitening matrices. Maps to a command-line argument: --Owhite.

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

  • pbsc (a boolean) – Switch off conversion to percent BOLD signal change. Maps to a command-line argument: --pbsc.

  • rem_cmp (a list of items which are an integer) – Component numbers to remove. Maps to a command-line argument: -f %d.

  • remove_deriv (a boolean) – Removes every second entry in paradigm file (EV derivatives). Maps to a command-line argument: --remove_deriv.

  • report (a boolean) – Generate Melodic web report. Maps to a command-line argument: --report.

  • report_maps (a string) – Control string for spatial map images (see slicer). Maps to a command-line argument: --report_maps=%s.

  • s_con (a pathlike object or string representing an existing file) – T-contrast matrix across subject-domain. Maps to a command-line argument: --Scon=%s.

  • s_des (a pathlike object or string representing an existing file) – Design matrix across subject-domain. Maps to a command-line argument: --Sdes=%s.

  • sep_vn (a boolean) – Switch off joined variance normalization. Maps to a command-line argument: --sep_vn.

  • sep_whiten (a boolean) – Switch on separate whitening. Maps to a command-line argument: --sep_whiten.

  • smode (a pathlike object or string representing an existing file) – Matrix of session modes for report generation. Maps to a command-line argument: --smode=%s.

  • t_con (a pathlike object or string representing an existing file) – T-contrast matrix across time-domain. Maps to a command-line argument: --Tcon=%s.

  • t_des (a pathlike object or string representing an existing file) – Design matrix across time-domain. Maps to a command-line argument: --Tdes=%s.

  • tr_sec (a float) – TR in seconds. Maps to a command-line argument: --tr=%f.

  • update_mask (a boolean) – Switch off mask updating. Maps to a command-line argument: --update_mask.

  • var_norm (a boolean) – Switch off variance normalization. Maps to a command-line argument: --vn.

Outputs:
  • out_dir (a pathlike object or string representing an existing directory)

  • report_dir (a pathlike object or string representing an existing directory)

MultipleRegressDesign

Link to code

Bases: BaseInterface

Generate multiple regression design

Note

FSL does not demean columns for higher level analysis.

Please see FSL documentation for more details on model specification for higher level analysis.

Examples

>>> from nipype.interfaces.fsl import MultipleRegressDesign
>>> model = MultipleRegressDesign()
>>> model.inputs.contrasts = [['group mean', 'T',['reg1'],[1]]]
>>> model.inputs.regressors = dict(reg1=[1, 1, 1], reg2=[2.,-4, 3])
>>> model.run() 
Mandatory Inputs:
  • contrasts (a list of items which are a tuple of the form: (a string, ‘T’, a list of items which are a string, a list of items which are a float) or a tuple of the form: (a string, ‘F’, a list of items which are a tuple of the form: (a string, ‘T’, a list of items which are a string, a list of items which are a float))) – List of contrasts with each contrast being a list of the form - [(‘name’, ‘stat’, [condition list], [weight list])]. if session list is None or not provided, all sessions are used. For F contrasts, the condition list should contain previously defined T-contrasts without any weight list.

  • regressors (a dictionary with keys which are a string and with values which are a list of items which are a float) – Dictionary containing named lists of regressors.

Optional Inputs:

groups (a list of items which are an integer) – List of group identifiers (defaults to single group).

Outputs:
  • design_con (a pathlike object or string representing an existing file) – Design t-contrast file.

  • design_fts (a pathlike object or string representing an existing file) – Design f-contrast file.

  • design_grp (a pathlike object or string representing an existing file) – Design group file.

  • design_mat (a pathlike object or string representing an existing file) – Design matrix file.

Randomise

Link to code

Bases: FSLCommand

Wrapped executable: randomise.

FSL Randomise: feeds the 4D projected FA data into GLM modelling and thresholding in order to find voxels which correlate with your model

Example

>>> import nipype.interfaces.fsl as fsl
>>> rand = fsl.Randomise(in_file='allFA.nii', mask = 'mask.nii', tcon='design.con', design_mat='design.mat')
>>> rand.cmdline
'randomise -i allFA.nii -o "randomise" -d design.mat -t design.con -m mask.nii'
Mandatory Inputs:

in_file (a pathlike object or string representing an existing file) – 4D input file. Maps to a command-line argument: -i %s (position: 0).

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

  • base_name (a string) – The rootname that all generated files will have. Maps to a command-line argument: -o "%s" (position: 1). (Nipype default value: randomise)

  • c_thresh (a float) – Carry out cluster-based thresholding. Maps to a command-line argument: -c %.1f.

  • cm_thresh (a float) – Carry out cluster-mass-based thresholding. Maps to a command-line argument: -C %.1f.

  • demean (a boolean) – Demean data temporally before model fitting. Maps to a command-line argument: -D.

  • design_mat (a pathlike object or string representing an existing file) – Design matrix file. Maps to a command-line argument: -d %s (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: {})

  • f_c_thresh (a float) – Carry out f cluster thresholding. Maps to a command-line argument: -F %.2f.

  • f_cm_thresh (a float) – Carry out f cluster-mass thresholding. Maps to a command-line argument: -S %.2f.

  • f_only (a boolean) – Calculate f-statistics only. Maps to a command-line argument: --fonly.

  • fcon (a pathlike object or string representing an existing file) – F contrasts file. Maps to a command-line argument: -f %s.

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

  • num_perm (an integer) – Number of permutations (default 5000, set to 0 for exhaustive). Maps to a command-line argument: -n %d.

  • one_sample_group_mean (a boolean) – Perform 1-sample group-mean test instead of generic permutation test. Maps to a command-line argument: -1.

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

  • p_vec_n_dist_files (a boolean) – Output permutation vector and null distribution text files. Maps to a command-line argument: -P.

  • raw_stats_imgs (a boolean) – Output raw ( unpermuted ) statistic images. Maps to a command-line argument: -R.

  • seed (an integer) – Specific integer seed for random number generator. Maps to a command-line argument: --seed=%d.

  • show_info_parallel_mode (a boolean) – Print out information required for parallel mode and exit. Maps to a command-line argument: -Q.

  • show_total_perms (a boolean) – Print out how many unique permutations would be generated and exit. Maps to a command-line argument: -q.

  • tcon (a pathlike object or string representing an existing file) – T contrasts file. Maps to a command-line argument: -t %s (position: 3).

  • tfce (a boolean) – Carry out Threshold-Free Cluster Enhancement. Maps to a command-line argument: -T.

  • tfce2D (a boolean) – Carry out Threshold-Free Cluster Enhancement with 2D optimisation. Maps to a command-line argument: --T2.

  • tfce_C (a float) – TFCE connectivity (6 or 26; default=6). Maps to a command-line argument: --tfce_C=%.2f.

  • tfce_E (a float) – TFCE extent parameter (default=0.5). Maps to a command-line argument: --tfce_E=%.2f.

  • tfce_H (a float) – TFCE height parameter (default=2). Maps to a command-line argument: --tfce_H=%.2f.

  • var_smooth (an integer) – Use variance smoothing (std is in mm). Maps to a command-line argument: -v %d.

  • vox_p_values (a boolean) – Output voxelwise (corrected and uncorrected) p-value images. Maps to a command-line argument: -x.

  • x_block_labels (a pathlike object or string representing an existing file) – Exchangeability block labels file. Maps to a command-line argument: -e %s.

Outputs:
  • f_corrected_p_files (a list of items which are a pathlike object or string representing an existing file) – F contrast FWE (Family-wise error) corrected p values files.

  • f_p_files (a list of items which are a pathlike object or string representing an existing file) – F contrast uncorrected p values files.

  • fstat_files (a list of items which are a pathlike object or string representing an existing file) – F contrast raw statistic.

  • t_corrected_p_files (a list of items which are a pathlike object or string representing an existing file) – T contrast FWE (Family-wise error) corrected p values files.

  • t_p_files (a list of items which are a pathlike object or string representing an existing file) – F contrast uncorrected p values files.

  • tstat_files (a list of items which are a pathlike object or string representing an existing file) – T contrast raw statistic.

SMM

Link to code

Bases: FSLCommand

Wrapped executable: mm --ld=logdir.

Spatial Mixture Modelling. For more detail on the spatial mixture modelling see Mixture Models with Adaptive Spatial Regularisation for Segmentation with an Application to FMRI Data; Woolrich, M., Behrens, T., Beckmann, C., and Smith, S.; IEEE Trans. Medical Imaging, 24(1):1-11, 2005.

Mandatory Inputs:
  • mask (a pathlike object or string representing an existing file) – Mask file. Maps to a command-line argument: --mask="%s" (position: 1).

  • spatial_data_file (a pathlike object or string representing an existing file) – Statistics spatial map. Maps to a command-line argument: --sdf="%s" (position: 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: {})

  • no_deactivation_class (a boolean) – Enforces no deactivation class. Maps to a command-line argument: --zfstatmode (position: 2).

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

Outputs:
  • activation_p_map (a pathlike object or string representing an existing file)

  • deactivation_p_map (a pathlike object or string representing an existing file)

  • null_p_map (a pathlike object or string representing an existing file)

SmoothEstimate

Link to code

Bases: FSLCommand

Wrapped executable: smoothest.

Estimates the smoothness of an image

Examples

>>> est = SmoothEstimate()
>>> est.inputs.zstat_file = 'zstat1.nii.gz'
>>> est.inputs.mask_file = 'mask.nii'
>>> est.cmdline
'smoothest --mask=mask.nii --zstat=zstat1.nii.gz'
Mandatory Inputs:
  • dof (an integer) – Number of degrees of freedom. Maps to a command-line argument: --dof=%d. Mutually exclusive with inputs: zstat_file.

  • mask_file (a pathlike object or string representing an existing file) – Brain mask volume. 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.

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

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

  • residual_fit_file (a pathlike object or string representing an existing file) – Residual-fit image file. Maps to a command-line argument: --res=%s. Requires inputs: dof.

  • zstat_file (a pathlike object or string representing an existing file) – Zstat image file. Maps to a command-line argument: --zstat=%s. Mutually exclusive with inputs: dof.

Outputs:
  • dlh (a float) – Smoothness estimate sqrt(det(Lambda)).

  • resels (a float) – Volume of resel, in voxels, defined as FWHM_x * FWHM_y * FWHM_z.

  • volume (an integer) – Number of voxels in mask.

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

Collate expected outputs and apply output traits validation.

nipype.interfaces.fsl.model.load_template(name)

Load a template from the model_templates directory

Parameters:

name (str) – The name of the file to load

Returns:

template

Return type:

string.Template