cmp.pipelines.anatomical.anatomical module

Anatomical pipeline Class definition.

class cmp.pipelines.anatomical.anatomical.AnatomicalPipeline(project_info)[source]

Bases: cmp.pipelines.common.Pipeline

Class that extends a Pipeline and represents the processing pipeline for structural MRI.

It is composed of the segmentation stage that performs FreeSurfer recon-all and the parcellation stage that creates the Lausanne brain parcellations.

check_config()[source]

Check if custom white matter mask and custom atlas files specified in the configuration exist.

Returns

message – String empty if all the checks pass, otherwise it contains the error message

Return type

string

check_input(layout, gui=True)[source]

Check if inputs of the anatomical pipeline are available.

Parameters
  • layout (bids.BIDSLayout) – Instance of BIDSLayout

  • gui (traits.Bool) – Boolean used to display different messages but not really meaningful anymore since the GUI components have been migrated to cmp.bidsappmanager

Returns

valid_inputs – True if inputs are available

Return type

traits.Bool

check_output()[source]

Check if outputs of an AnatomicalPipeline are available.

Returns

  • valid_output <Bool> – True if all outputs are found

  • error_message <string> – Error message if an output is not found.

create_datagrabber_node(base_directory)[source]

Create the appropriate Nipype DataGrabber node.`

Parameters

base_directory (Directory) – Main CMP output directory of a subject e.g. /output_dir/cmp/sub-XX/(ses-YY)

Returns

datasource – Output Nipype Node with DataGrabber interface

Return type

Output Nipype DataGrabber Node

create_datasinker_node(base_directory)[source]

Create the appropriate Nipype DataSink node depending on the parcellation_scheme

Parameters

base_directory (Directory) – Main CMP output directory of a subject e.g. /output_dir/cmp/sub-XX/(ses-YY)

Returns

sinker – Output Nipype Node with DataSink interface

Return type

Output Nipype DataSink Node

create_pipeline_flow(cmp_deriv_subject_directory, nipype_deriv_subject_directory)[source]

Create the pipeline workflow.

Parameters
  • cmp_deriv_subject_directory (Directory) – Main CMP output directory of a subject e.g. /output_dir/cmp/sub-XX/(ses-YY)

  • nipype_deriv_subject_directory (Directory) – Intermediate Nipype output directory of a subject e.g. /output_dir/nipype/sub-XX/(ses-YY)

Returns

anat_flow – An instance of nipype.pipeline.engine.Workflow

Return type

nipype.pipeline.engine.Workflow

define_custom_mapping(custom_last_stage)[source]

Define the pipeline to be executed until a specific stages.

Not used yet by CMP3.

Parameters

custom_last_stage (string) – Last stage to execute. Valid values are “Segmentation” and “Parcellation”

global_conf = <cmp.pipelines.anatomical.anatomical.GlobalConfig object>
init_subject_derivatives_dirs()[source]

Return the paths to Nipype and CMP derivatives folders of a given subject / session.

Notes

self.subject is updated to “sub-<participant_label>_ses-<session_label>” when subject has multiple sessions.

input_folders = ['anat']
now = '20221025_1349'
ordered_stage_list = ['Segmentation', 'Parcellation']
process()[source]

Executes the anatomical pipeline workflow and returns True if successful.

class cmp.pipelines.anatomical.anatomical.GlobalConfig[source]

Bases: traits.has_traits.HasTraits

Global pipeline configurations.

process_type

Processing pipeline type

Type

‘anatomical’

subjects

List of subjects ID (in the form sub-XX)

Type

traits.List

subject

Subject to be processed (in the form sub-XX)

Type

traits.Str

subject_session

Subject session to be processed (in the form ses-YY)

Type

traits.Str