use spm_contrasts to estimate contrasts of interest
>>> import nipype.interfaces.spm as spm
>>> est = spm.EstimateContrast()
>>> est.inputs.spm_mat_file = 'SPM.mat'
>>> cont1 = ('Task>Baseline','T', ['Task-Odd','Task-Even'],[0.5,0.5])
>>> cont2 = ('Task-Odd>Task-Even','T', ['Task-Odd','Task-Even'],[1,-1])
>>> contrasts = [cont1,cont2]
>>> est.inputs.contrasts = contrasts
>>> est.run() # doctest: +SKIP
Inputs:
[Optional]
beta_images : (an existing file name)
Parameter estimates of the design matrix
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.
group_contrast : (a boolean)
higher level contrast
exclusive: ignore_derivs
ignore_derivs : (a boolean)
ignore derivatives for estimation
exclusive: group_contrast
matlab_cmd : (a string)
Unknown
mfile : (a boolean)
Run m-code using m-file
paths : (a directory name)
Paths to add to matlabpath
residual_image : (an existing file name)
Mean-squared image of the residuals
spm_mat_file : (an existing file name)
Absolute path to SPM.mat
Outputs:
con_images : (an existing file name)
contrast images from a t-contrast
ess_images : (an existing file name)
contrast images from an F-contrast
spmF_images : (an existing file name)
stat images from an F-contrast
spmT_images : (an existing file name)
stat images from a t-contrast
spm_mat_file : (a file name)
Updated SPM mat file
Use spm_spm to estimate the parameters of a model
http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=71
>>> est = EstimateModel()
>>> est.inputs.spm_mat_file = 'SPM.mat'
>>> est.run() # doctest: +SKIP
Inputs:
[Optional]
estimation_method : (a dictionary with keys which are 'Classical' or 'Bayesian2' or 'Bayesian' and with values which are any value)
Classical, Bayesian2, Bayesian (dict)
flags : (a string)
optional arguments (opt)
matlab_cmd : (a string)
Unknown
mfile : (a boolean)
Run m-code using m-file
paths : (a directory name)
Paths to add to matlabpath
spm_mat_file : (an existing file name)
absolute path to SPM.mat
Outputs:
RPVimage : (an existing file name)
Resels per voxel image
beta_images : (an existing file name)
design parameter estimates
mask_image : (an existing file name)
binary mask to constrain estimation
residual_image : (an existing file name)
Mean-squared image of the residuals
spm_mat_file : (a file name)
Updated SPM mat file
Base class for factorial designs
http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=79
Inputs:
[Optional]
covariates : (a dictionary with keys which are 'vector' or 'name' or 'interaction' or 'centering' and with values which are any value)
covariate dictionary {vector, name, interaction, centering}
explicit_mask_file : (a file name)
use an implicit mask file to threshold
global_calc_mean : (a boolean)
use mean for global calculation
exclusive: global_calc_omit,global_calc_values
global_calc_omit : (a boolean)
omit global calculation
exclusive: global_calc_mean,global_calc_values
global_calc_values : (a list of items which are a float)
omit global calculation
exclusive: global_calc_mean,global_calc_omit
global_normalization : (1 or 2 or 3)
global normalization None-1, Proportional-2, ANCOVA-3
matlab_cmd : (a string)
Unknown
mfile : (a boolean)
Run m-code using m-file
no_grand_mean_scaling : (a boolean)
do not perform grand mean scaling
paths : (a directory name)
Paths to add to matlabpath
spm_mat_dir : (an existing directory name)
directory to store SPM.mat file (opt)
threshold_mask_absolute : (a float)
threshold using a proportion of the global value
exclusive: threshold_mask_absolute,threshold_mask_none
threshold_mask_none : (a boolean)
do not use threshold masking
exclusive: threshold_mask_absolute,threshold_mask_relative
use_implicit_threshold : (a boolean)
use implicit mask NaNs or zeros to threshold
Outputs:
spm_mat_file : (an existing file name)
SPM mat file
Generate an SPM design matrix
http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=61
>>> level1design = Level1Design()
>>> level1design.inputs.timing_units = 'secs'
>>> level1design.inputs.interscan_interval = 2.5
>>> level1design.inputs.bases = {'hrf':{'derivs': [0,0]}}
>>> level1design.inputs.session_info = 'session_info.npz'
>>> level1design.run() # doctest: +SKIP
Inputs:
[Optional]
bases : (a dictionary with keys which are 'hrf' or 'fourier' or 'fourier_han' or 'gamma' or 'fir' and with values which are any value)
dict {'name':{'basesparam1':val,...}}
name : string
Name of basis function (hrf, fourier, fourier_han,
gamma, fir)
hrf :
derivs : 2-element list
Model HRF Derivatives. No derivatives: [0,0],
Time derivatives : [1,0], Time and Dispersion
derivatives: [1,1]
fourier, fourier_han, gamma, fir:
length : int
Post-stimulus window length (in seconds)
order : int
Number of basis functions
factor_info : (a list of items which are a dictionary with keys which are 'name' or 'levels' and with values which are any value)
Factor specific information file (opt)
global_intensity_normalization : ('none' or 'scaling')
Global intensity normalization - scaling or none (opt)
interscan_interval : (a float)
Interscan interval in secs
mask_image : (an existing file name)
Image for explicitly masking the analysis (opt)
mask_threshold : ('-Inf' or a float)
Thresholding for the mask (opt, '-Inf')
matlab_cmd : (a string)
Unknown
mfile : (a boolean)
Run m-code using m-file
microtime_onset : (a float)
The onset/time-bin in seconds for alignment (opt)
microtime_resolution : (an integer)
Number of time-bins per scan in secs (opt)
model_serial_correlations : ('AR(1)' or 'none')
Model serial correlations AR(1) or none (opt)
paths : (a directory name)
Paths to add to matlabpath
session_info Session specific information generated by ``modelgen.SpecifyModel``
spm_mat_dir : (an existing directory name)
directory to store SPM.mat file (opt)
timing_units : ('secs' or 'scans')
units for specification of onsets
volterra_expansion_order : (1 or 2)
Model interactions - yes:1, no:2 (opt)
Outputs:
spm_mat_file : (an existing file name)
SPM mat file
Perform a two-sample ttest using two groups of images
>>> from nipype.interfaces.spm import MultipleRegression
>>> mreg= MultipleRegression()
>>> covariates = dict(names=['reg1', 'reg2'], centering=[1,1])
>>> covariates['vectors'] = [[12,24],[0.6 -0.9]]
>>> mreg.inputs.covariates = covariates
>>> mreg.inputs.images = ['cont1.nii', 'cont1.nii']
>>> mreg.inputs.contrasts = [['reg2 > reg1', 'T', ['reg1','reg2'], [-1,1]]]
>>> mreg.run() # doctest: +SKIP
Inputs:
[Mandatory]
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.
covariates : (a dictionary with keys which are 'vectors' or 'names' or 'centering' and with values which are any value)
dict of covariates {vectors, names, centering}
images : (a list of items which are an existing file name)
con images from group 1
[Optional]
include_intercept : (a boolean)
Include intercept in model
matlab_cmd : (a string)
Unknown
mfile : (a boolean)
Run m-code using m-file
paths : (a directory name)
Paths to add to matlabpath
Outputs:
con_images : (an existing file name)
contrast images from a t-contrast
ess_images : (an existing file name)
contrast images from an F-contrast
spmF_images : (an existing file name)
stat images from an F-contrast
spmT_images : (an existing file name)
stat images from a t-contrast
Create SPM design for multiple regression
>>> mreg = MultipleRegressionDesign()
>>> mreg.inputs.in_files = ['cont1.nii','cont2.nii']
>>> mreg.run() # doctest: +SKIP
Inputs:
[Mandatory]
in_files : (a list of at least 2 items which are an existing file name)
List of files
[Optional]
covariates : (a dictionary with keys which are 'vector' or 'name' or 'interaction' or 'centering' and with values which are any value)
covariate dictionary {vector, name, interaction, centering}
explicit_mask_file : (a file name)
use an implicit mask file to threshold
global_calc_mean : (a boolean)
use mean for global calculation
exclusive: global_calc_omit,global_calc_values
global_calc_omit : (a boolean)
omit global calculation
exclusive: global_calc_mean,global_calc_values
global_calc_values : (a list of items which are a float)
omit global calculation
exclusive: global_calc_mean,global_calc_omit
global_normalization : (1 or 2 or 3)
global normalization None-1, Proportional-2, ANCOVA-3
include_intercept : (a boolean)
Include intercept in design
matlab_cmd : (a string)
Unknown
mfile : (a boolean)
Run m-code using m-file
no_grand_mean_scaling : (a boolean)
do not perform grand mean scaling
paths : (a directory name)
Paths to add to matlabpath
spm_mat_dir : (an existing directory name)
directory to store SPM.mat file (opt)
threshold_mask_absolute : (a float)
threshold using a proportion of the global value
exclusive: threshold_mask_absolute,threshold_mask_none
threshold_mask_none : (a boolean)
do not use threshold masking
exclusive: threshold_mask_absolute,threshold_mask_relative
use_implicit_threshold : (a boolean)
use implicit mask NaNs or zeros to threshold
user_covariates : (a dictionary with keys which are 'vector' or 'name' or 'centering' and with values which are any value)
covariate dictionary {vector, name, centering}
Outputs:
spm_mat_file : (an existing file name)
SPM mat file
use spm to perform a one-sample ttest on a set of images
>>> import nipype.interfaces.spm as spm
>>> ttest = spm.OneSampleTTest()
>>> ttest.inputs.con_images = ['cont1.nii', 'cont2.nii']
>>> ttest.run() # doctest: +SKIP
Inputs:
[Mandatory]
con_images : (a file name)
Unknown
[Optional]
matlab_cmd : (a string)
Unknown
mfile : (a boolean)
Run m-code using m-file
paths : (a directory name)
Paths to add to matlabpath
Outputs:
con_images : (a file name)
Unknown
spmT_images : (a file name)
Unknown
Create SPM design for one sample t-test
>>> ttest = OneSampleTTestDesign()
>>> ttest.inputs.in_files = ['cont1.nii', 'cont2.nii']
>>> ttest.run() # doctest: +SKIP
Inputs:
[Mandatory]
in_files : (a list of at least 2 items which are an existing file name)
input files
[Optional]
covariates : (a dictionary with keys which are 'vector' or 'name' or 'interaction' or 'centering' and with values which are any value)
covariate dictionary {vector, name, interaction, centering}
explicit_mask_file : (a file name)
use an implicit mask file to threshold
global_calc_mean : (a boolean)
use mean for global calculation
exclusive: global_calc_omit,global_calc_values
global_calc_omit : (a boolean)
omit global calculation
exclusive: global_calc_mean,global_calc_values
global_calc_values : (a list of items which are a float)
omit global calculation
exclusive: global_calc_mean,global_calc_omit
global_normalization : (1 or 2 or 3)
global normalization None-1, Proportional-2, ANCOVA-3
matlab_cmd : (a string)
Unknown
mfile : (a boolean)
Run m-code using m-file
no_grand_mean_scaling : (a boolean)
do not perform grand mean scaling
paths : (a directory name)
Paths to add to matlabpath
spm_mat_dir : (an existing directory name)
directory to store SPM.mat file (opt)
threshold_mask_absolute : (a float)
threshold using a proportion of the global value
exclusive: threshold_mask_absolute,threshold_mask_none
threshold_mask_none : (a boolean)
do not use threshold masking
exclusive: threshold_mask_absolute,threshold_mask_relative
use_implicit_threshold : (a boolean)
use implicit mask NaNs or zeros to threshold
Outputs:
spm_mat_file : (an existing file name)
SPM mat file
Create SPM design for paired t-test
>>> pttest = PairedTTestDesign()
>>> pttest.inputs.paired_files = [['cont1.nii','cont1a.nii'],['cont2.nii','cont2a.nii']]
>>> pttest.run() # doctest: +SKIP
Inputs:
[Mandatory]
paired_files : (a list of at least 2 items which are a list of from 2 to 2 items which are an existing file name)
List of paired files
[Optional]
ancova : (a boolean)
Specify ancova-by-factor regressors
covariates : (a dictionary with keys which are 'vector' or 'name' or 'interaction' or 'centering' and with values which are any value)
covariate dictionary {vector, name, interaction, centering}
explicit_mask_file : (a file name)
use an implicit mask file to threshold
global_calc_mean : (a boolean)
use mean for global calculation
exclusive: global_calc_omit,global_calc_values
global_calc_omit : (a boolean)
omit global calculation
exclusive: global_calc_mean,global_calc_values
global_calc_values : (a list of items which are a float)
omit global calculation
exclusive: global_calc_mean,global_calc_omit
global_normalization : (1 or 2 or 3)
global normalization None-1, Proportional-2, ANCOVA-3
grand_mean_scaling : (a boolean)
Perform grand mean scaling
matlab_cmd : (a string)
Unknown
mfile : (a boolean)
Run m-code using m-file
no_grand_mean_scaling : (a boolean)
do not perform grand mean scaling
paths : (a directory name)
Paths to add to matlabpath
spm_mat_dir : (an existing directory name)
directory to store SPM.mat file (opt)
threshold_mask_absolute : (a float)
threshold using a proportion of the global value
exclusive: threshold_mask_absolute,threshold_mask_none
threshold_mask_none : (a boolean)
do not use threshold masking
exclusive: threshold_mask_absolute,threshold_mask_relative
use_implicit_threshold : (a boolean)
use implicit mask NaNs or zeros to threshold
Outputs:
spm_mat_file : (an existing file name)
SPM mat file
Topological FDR thresholding based on cluster extent/size. Smoothness is estimated from GLM residuals but is assumed to be the same for all of the voxels.
>>> thresh = Threshold()
>>> thresh.inputs.spm_mat_file = 'SPM.mat'
>>> thresh.inputs.spmT_images = 'spmT_0001.img'
>>> thresh.inputs.contrast_index = 1
>>> thresh.inputs.extent_fdr_p_threshold = 0.05
>>> thresh.run() # doctest: +SKIP
Inputs:
[Mandatory]
RPVimage : (an existing file name)
Resels per voxel image
beta_images : (an existing file name)
design parameter estimates
contrast_index : (an integer)
which contrast (T map) to use
mask_image : (an existing file name)
binary mask to constrain estimation
residual_image : (an existing file name)
Mean-squared image of the residuals
spmT_images : (an existing file name)
stat images from a t-contrast
spm_mat_file : (an existing file name)
absolute path to SPM.mat
[Optional]
extent_fdr_p_threshold : (a float)
p threshold on FDR corrected cluster size probabilities
extent_threshold : (an integer)
minimum cluster size
height_threshold : (a float)
p-value for initial thresholding (defining clusters)
matlab_cmd : (a string)
Unknown
mfile : (a boolean)
Run m-code using m-file
paths : (a directory name)
Paths to add to matlabpath
use_fwe_correction : (a boolean)
whether to use FWE (Bonferroni) correction for initial threshold
Outputs:
thresholded_map : (an existing file name)
Unknown
Perform a two-sample ttest using two groups of images
4 contrasts are automatically created corresponding to:
>>> import nipype.interfaces.spm as spm
>>> ttest = spm.TwoSampleTTest()
>>> ttest.inputs.images_group1 = ['cont1.nii', 'cont2.nii']
>>> ttest.inputs.images_group2 = ['cont1a.nii', 'cont2a.nii']
>>> ttest.dependent = False
>>> ttest.unequal_variance = True
>>> ttest.run() # doctest: +SKIP
Inputs:
[Mandatory]
images_group1 : (a list of items which are an existing file name)
con images from group 1
images_group2 : (a list of items which are an existing file name)
con images from group 2
[Optional]
dependent : (a boolean)
Are the measurements independent between levels
matlab_cmd : (a string)
Unknown
mfile : (a boolean)
Run m-code using m-file
paths : (a directory name)
Paths to add to matlabpath
unequal_variance : (a boolean)
Are the variances equal or unequal between groups
Outputs:
con_images : (a list of items which are a file name)
contrast images from a t-contrast
spmT_images : (a list of items which are a file name)
stat images from a t-contrast
Create SPM design for two sample t-test
>>> ttest = TwoSampleTTestDesign()
>>> ttest.inputs.group1_files = ['cont1.nii', 'cont2.nii']
>>> ttest.inputs.group2_files = ['cont1a.nii', 'cont2a.nii']
>>> ttest.run() # doctest: +SKIP
Inputs:
[Mandatory]
group1_files : (a list of at least 2 items which are an existing file name)
Group 1 input files
group2_files : (a list of at least 2 items which are an existing file name)
Group 2 input files
[Optional]
covariates : (a dictionary with keys which are 'vector' or 'name' or 'interaction' or 'centering' and with values which are any value)
covariate dictionary {vector, name, interaction, centering}
dependent : (a boolean)
Are the measurements dependent between levels
explicit_mask_file : (a file name)
use an implicit mask file to threshold
global_calc_mean : (a boolean)
use mean for global calculation
exclusive: global_calc_omit,global_calc_values
global_calc_omit : (a boolean)
omit global calculation
exclusive: global_calc_mean,global_calc_values
global_calc_values : (a list of items which are a float)
omit global calculation
exclusive: global_calc_mean,global_calc_omit
global_normalization : (1 or 2 or 3)
global normalization None-1, Proportional-2, ANCOVA-3
matlab_cmd : (a string)
Unknown
mfile : (a boolean)
Run m-code using m-file
no_grand_mean_scaling : (a boolean)
do not perform grand mean scaling
paths : (a directory name)
Paths to add to matlabpath
spm_mat_dir : (an existing directory name)
directory to store SPM.mat file (opt)
threshold_mask_absolute : (a float)
threshold using a proportion of the global value
exclusive: threshold_mask_absolute,threshold_mask_none
threshold_mask_none : (a boolean)
do not use threshold masking
exclusive: threshold_mask_absolute,threshold_mask_relative
unequal_variance : (a boolean)
Are the variances equal or unequal between groups
use_implicit_threshold : (a boolean)
use implicit mask NaNs or zeros to threshold
Outputs:
spm_mat_file : (an existing file name)
SPM mat file