nipype.interfaces.nilearn module

Nilearn is a Python library for fast and easy statistical learning on NeuroImaging data.

NilearnBaseInterface

Link to code

SignalExtraction

Link to code

Bases: NilearnBaseInterface, SimpleInterface

Extracts signals over tissue classes or brain regions

>>> seinterface = SignalExtraction()
>>> seinterface.inputs.in_file = 'functional.nii'
>>> seinterface.inputs.label_files = 'segmentation0.nii.gz'
>>> seinterface.inputs.out_file = 'means.tsv'
>>> segments = ['CSF', 'GrayMatter', 'WhiteMatter']
>>> seinterface.inputs.class_labels = segments
>>> seinterface.inputs.detrend = True
>>> seinterface.inputs.include_global = True
Mandatory Inputs:
  • class_labels (a list of items which are any value) – Human-readable labels for each segment in the label file, in order. The length of class_labels must be equal to the number of segments (background excluded). This list corresponds to the class labels in label_file in ascending order.

  • in_file (a pathlike object or string representing an existing file) – 4-D fMRI nii file.

  • label_files (a list of items which are a pathlike object or string representing an existing file) – A 3-D label image, with 0 denoting background, or a list of 3-D probability maps (one per label) or the equivalent 4D file.

Optional Inputs:
  • detrend (a boolean) – If True, perform detrending using nilearn. (Nipype default value: False)

  • incl_shared_variance (a boolean) – By default (True), returns simple time series calculated from each region independently (e.g., for noise regression). If False, returns unique signals for each region, discarding shared variance (e.g., for connectivity. Only has effect with 4D probability maps. (Nipype default value: True)

  • include_global (a boolean) – If True, include an extra column labeled “GlobalSignal”, with values calculated from the entire brain (instead of just regions). (Nipype default value: False)

  • out_file (a pathlike object or string representing a file) – The name of the file to output to. signals.tsv by default. (Nipype default value: signals.tsv)

Outputs:

out_file (a pathlike object or string representing an existing file) – Tsv file containing the computed signals, with as many columns as there are labels and as many rows as there are timepoints in in_file, plus a header row with values from class_labels.