NIPY logo

Table Of Contents

Previous topic

nipype.algorithms.misc

Next topic

nipype.algorithms.rapidart

This Page

nipype.algorithms.modelgen

SpecifyModel

Makes a model specification compatible with spm/fsl designers.

The subject_info field should contain paradigm information in the form of a Bunch of a list of Bunch. The Bunch should contain the following information.

Required for most designs

  • conditions : list of names
  • onsets : lists of onsets corresponding to each condition
  • durations : lists of durations corresponding to each condition. Should be left to a single 0 if all events are being modelled as impulses.

Optional

  • regressor_names : list of str

    list of names corresponding to each column. Should be None if automatically assigned.

  • regressors : list of lists

    values for each regressor - must correspond to the number of volumes in the functional run

  • amplitudes : lists of amplitudes for each event. This will be ignored by SPM’s Level1Design.

The following two (tmod, pmod) will be ignored by any Level1Design class other than SPM:

  • tmod : lists of conditions that should be temporally modulated. Should default to None if not being used.
  • pmod : list of Bunch corresponding to conditions
    • name : name of parametric modulator
    • param : values of the modulator
    • poly : degree of modulation

Alternatively, you can provide information through event files.

The event files have to be in 1,2 or 3 column format with the columns corresponding to Onsets, Durations and Amplitudes and they have to have the name event_name.runXXX... e.g.: Words.run001.txt. The event_name part will be used to create the condition names.

Examples

>>> from nipype.interfaces.base import Bunch
>>> s = SpecifyModel()
>>> s.inputs.input_units = 'secs'
>>> s.inputs.functional_runs = ['functional2.nii', 'functional3.nii']
>>> s.inputs.time_repetition = 6
>>> s.inputs.high_pass_filter_cutoff = 128.
>>> info = [Bunch(conditions=['cond1'], onsets=[[2, 50, 100, 180]], durations=[[1]]),             Bunch(conditions=['cond1'], onsets=[[30, 40, 100, 150]], durations=[[1]])]
>>> s.inputs.subject_info = info

Using pmod:

>>> info = [Bunch(conditions=['cond1', 'cond2'], onsets=[[2, 50],[100, 180]], durations=[[0],[0]], pmod=[Bunch(name=['amp'],poly=[2],param=[[1,2]]), None]),         Bunch(conditions=['cond1', 'cond2'], onsets=[[20, 120],[80, 160]], durations=[[0],[0]], pmod=[Bunch(name=['amp'],poly=[2],param=[[1,2]]), None])]
>>> s.inputs.subject_info = info

Inputs:

[Mandatory]
event_info : (a list of items which are an existing file name)
        list of event description files 1,2 or 3 column format corresponding to onsets, durations and amplitudes
        exclusive: subject_info
functional_runs : (a list of items which are an existing file name or an existing file name)
        Data files for model. List of 4D files or list oflist of 3D files per session
high_pass_filter_cutoff : (a float)
        High-pass filter cutoff in secs
input_units : ('secs' or 'scans')
        Units of event onsets and durations (secs or scans)Output units are always in secs
subject_info    Bunch of List(Bunch) subject specific condition information. see :class:`SpecifyModel` or SpecifyModel.__doc__ for details
        exclusive: event_info
time_repetition : (a float)
        Time between the start of one volume to the start of the next image volume.

[Optional]
ignore_exception : (a boolean)
        Print an error message instead of throwing an exception in case the interface fails to run
outlier_files : (an existing file name)
        Files containing scan outlier indices that should be tossed
realignment_parameters : (an existing file name)
        Realignment parameters returned by motion correction algorithm

Outputs:

session_info    session info for level1designs

SpecifySPMModel

Adds SPM specific options to SpecifyModel

adds:
  • concatenate_runs
  • output_units

Examples

>>> from nipype.interfaces.base import Bunch
>>> s = SpecifySPMModel()
>>> s.inputs.input_units = 'secs'
>>> s.inputs.output_units = 'scans'
>>> s.inputs.high_pass_filter_cutoff = 128.
>>> s.inputs.functional_runs = ['functional2.nii', 'functional3.nii']
>>> s.inputs.time_repetition = 6
>>> s.inputs.concatenate_runs = True
>>> info = [Bunch(conditions=['cond1'], onsets=[[2, 50, 100, 180]], durations=[[1]]),             Bunch(conditions=['cond1'], onsets=[[30, 40, 100, 150]], durations=[[1]])]
>>> s.inputs.subject_info = info

Inputs:

[Mandatory]
event_info : (a list of items which are an existing file name)
        list of event description files 1,2 or 3 column format corresponding to onsets, durations and amplitudes
        exclusive: subject_info
functional_runs : (a list of items which are an existing file name or an existing file name)
        Data files for model. List of 4D files or list oflist of 3D files per session
high_pass_filter_cutoff : (a float)
        High-pass filter cutoff in secs
input_units : ('secs' or 'scans')
        Units of event onsets and durations (secs or scans)Output units are always in secs
subject_info    Bunch of List(Bunch) subject specific condition information. see :class:`SpecifyModel` or SpecifyModel.__doc__ for details
        exclusive: event_info
time_repetition : (a float)
        Time between the start of one volume to the start of the next image volume.

[Optional]
concatenate_runs : (a boolean)
        Concatenate all runs to look like a single session.
ignore_exception : (a boolean)
        Print an error message instead of throwing an exception in case the interface fails to run
outlier_files : (an existing file name)
        Files containing scan outlier indices that should be tossed
output_units : ('secs' or 'scans')
        Units of design event onsets and durations (secs or scans)
realignment_parameters : (an existing file name)
        Realignment parameters returned by motion correction algorithm

Outputs:

session_info    session info for level1designs

SpecifySparseModel

Makes a model specification compatible with spm/fsl designers for sparse and sparse-clustered designs

see Ghosh et al. (2009) OHBM 2009 http://dl.dropbox.com/u/363467/OHBM2009_HRF.pdf

Examples

>>> from nipype.interfaces.base import Bunch
>>> s = SpecifySparseModel()
>>> s.inputs.input_units = 'secs'
>>> s.inputs.functional_runs = ['functional2.nii', 'functional3.nii']
>>> s.inputs.time_repetition = 6
>>> s.inputs.time_acquisition = 2
>>> s.inputs.high_pass_filter_cutoff = 128.
>>> s.inputs.model_hrf = True
>>> info = [Bunch(conditions=['cond1'], onsets=[[2, 50, 100, 180]], durations=[[1]]),             Bunch(conditions=['cond1'], onsets=[[30, 40, 100, 150]], durations=[[1]])]
>>> s.inputs.subject_info = info

Inputs:

[Mandatory]
event_info : (a list of items which are an existing file name)
        list of event description files 1,2 or 3 column format corresponding to onsets, durations and amplitudes
        exclusive: subject_info
functional_runs : (a list of items which are an existing file name or an existing file name)
        Data files for model. List of 4D files or list oflist of 3D files per session
high_pass_filter_cutoff : (a float)
        High-pass filter cutoff in secs
input_units : ('secs' or 'scans')
        Units of event onsets and durations (secs or scans)Output units are always in secs
subject_info    Bunch of List(Bunch) subject specific condition information. see :class:`SpecifyModel` or SpecifyModel.__doc__ for details
        exclusive: event_info
time_acquisition : (a float)
        Time in seconds to acquire a single image volume
time_repetition : (a float)
        Time between the start of one volume to the start of the next image volume.

[Optional]
ignore_exception : (a boolean)
        Print an error message instead of throwing an exception in case the interface fails to run
model_hrf : (a boolean)
        model sparse events with hrf
outlier_files : (an existing file name)
        Files containing scan outlier indices that should be tossed
realignment_parameters : (an existing file name)
        Realignment parameters returned by motion correction algorithm
save_plot : (a boolean)
        save plot of sparse design calculation (Requires matplotlib)
scale_regressors : (a boolean)
        Scale regressors by the peak
scan_onset : (a float)
        Start of scanning relative to onset of run in secs
stimuli_as_impulses : (a boolean)
        Treat each stimulus to be impulse like.
use_temporal_deriv : (a boolean)
        Create a temporal derivative in addition to regular regressor
        requires: model_hrf
volumes_in_cluster : (an integer >= 1)
        Number of scan volumes in a cluster

Outputs:

session_info    session info for level1designs
sparse_png_file : (a file name)
        PNG file showing sparse design
sparse_svg_file : (a file name)
        SVG file showing sparse design

SpecifySparseSPMModel