cmp.project module¶
Definition of classes and functions for handling non-GUI general events.
-
class
cmp.project.
CMP_Project_Info
[source]¶ Bases:
traits.has_traits.HasTraits
Class used to store all properties of a processing project.
-
base_directory
¶ BIDS dataset root directory
- Type
traits.Directory
-
output_directory
¶ Output directory
- Type
traits.Directory
-
bids_layout
¶ Instance of pybids
BIDSLayout
- Type
bids.BIDSLayout
-
subjects
¶ List of subjects in the dataset
- Type
traits.List
-
subject
¶ Subject being processed in the form
sub-XX
-
subject_sessions
¶ List of sessions for the subject being processed
- Type
traits.List
-
subject_session
¶ Session of the subject being processed in the form
ses-YY
- Type
trait.Str
-
diffusion_imaging_model
¶ Diffusion imaging model that can be ‘DSI’, ‘DTI’, or ‘multi-shell’
- Type
traits.Str
-
dmri_bids_acqs
¶ List diffusion imaging models extracted from
acq-<label>
filename part.- Type
traits.List
-
dmri_bids_acq
¶ Diffusion imaging model being processed
-
anat_runs
¶ List of run labels for T1w scans with multiple runs
- Type
traits.List
-
anat_run
¶ Run being processed for T1w scans with multiple runs
- Type
traits.Str
-
dmri_runs
¶ List of run labels for DWI scans with multiple runs
- Type
traits.List
-
dmri_run
¶ Run being processed for DWI scans with multiple runs
- Type
traits.Str
-
fmri_runs
¶ List of run labels for fMRI scans with multiple runs
- Type
traits.List
-
fmri_run
¶ Run being processed for fMRI scans with multiple runs
- Type
traits.Str
-
parcellation_scheme
¶ Parcellation scheme used (Default: ‘Lausanne2008’)
- Type
traits.Str
-
atlas_info
¶ Dictionary storing parcellation atlas information See
ParcellationStage
for more details- Type
traits.Dict
-
freesurfer_subjects_dir
¶ Freesurfer subjects directory
- Type
traits.Str
-
freesurfer_subject_id
¶ Freesurfer subject ID
- Type
traits.Str
-
t1_available
¶ True if T1w scans were found (Default: False)
- Type
Bool
-
dmri_available
¶ True if DWI scans were found (Default: False)
- Type
Bool
-
fmri_available
¶ True if fMRI scans were found (Default: False)
- Type
Bool
-
anat_config_error_msg
¶ Error message for the anatomical pipeline configuration file
- Type
traits.Str
-
anat_config_to_load
¶ Path to a configuration file for the anatomical pipeline
- Type
traits.Str
-
anat_available_config
¶ List of configuration files for the anatomical pipeline
- Type
traits.List
-
anat_stage_names
¶ List of anatomical pipeline stage names
- Type
traits.List
-
anat_custom_last_stage
¶ Custom last anatomical pipeline stage to be processed
- Type
traits.Str
-
dmri_config_error_msg
¶ Error message for the diffusion pipeline configuration file
- Type
traits.Str
-
dmri_config_to_load
¶ Path to a configuration file for the diffusion pipeline
- Type
traits.Str
-
dmri_available_config
¶ List of configuration files for the anatomical pipeline
- Type
traits.List
-
dmri_stage_names
¶ List of diffusion pipeline stage names
- Type
traits.List
-
dmri_custom_last_stage
¶ Custom last diffusion pipeline stage to be processed
- Type
traits.Str
-
fmri_config_error_msg
¶ Error message for the fMRI pipeline configuration file
- Type
traits.Str
-
fmri_config_to_load
¶ Path to a configuration file for the fMRI pipeline
- Type
traits.Str
-
fmri_available_config
¶ List of configuration files for the fMRI pipeline
- Type
traits.List
-
fmri_stage_names
¶ List of fMRI pipeline stage names
- Type
traits.List
-
fmri_custom_last_stage
¶ Custom last fMRI pipeline stage to be processed
- Type
traits.Str
-
number_of_cores
¶ Number of cores used by Nipype workflow execution engine to distribute independent processing nodes (Must be in the range of your local resources)
- Type
int
-
-
cmp.project.
init_anat_project
(project_info, is_new_project, debug=False)[source]¶ Initialize the anatomical processing pipeline.
- Parameters
project_info (cmp.project.CMP_Project_Info) – Instance of
cmp.project.CMP_Project_Info
objectis_new_project (bool) – Specify if it corresponds or not to a new project. If
True
, it will create initial pipeline configuration files.debug (bool) – If
True
, display extra prints to support debugging
- Returns
anat_pipeline –
AnatomicalPipeline
object instance- Return type
Instance(cmp.pipelines.anatomical.anatomical.AnatomicalPipeline)
-
cmp.project.
init_dmri_project
(project_info, bids_layout, is_new_project, gui=True, debug=False)[source]¶ Initialize the diffusion processing pipeline.
- Parameters
project_info (cmp.project.CMP_Project_Info) – Instance of
cmp.project.CMP_Project_Info
objectbids_layout (bids.BIDSLayout) – Instance of
BIDSLayout
objectis_new_project (bool) – Specify if it corresponds or not to a new project. If
True
, it will create initial pipeline configuration files.gui (bool) – Might be obsolete and removed in future versions
debug (bool) – If
True
, display extra prints to support debugging
- Returns
dmri_pipeline –
DiffusionPipeline
object instance- Return type
Instance(cmp.pipelines.diffusion.diffusion.DiffusionPipeline)
-
cmp.project.
init_fmri_project
(project_info, bids_layout, is_new_project, gui=True, debug=False)[source]¶ Initialize the fMRI processing pipeline.
- Parameters
project_info (cmp.project.CMP_Project_Info) – Instance of
cmp.project.CMP_Project_Info
objectbids_layout (bids.BIDSLayout) – Instance of
BIDSLayout
objectis_new_project (bool) – Specify if it corresponds or not to a new project. If
True
, it will create initial pipeline configuration files.gui (bool) – Might be obsolete and removed in future versions
debug (bool) – If
True
, display extra prints to support debugging
- Returns
fmri_pipeline –
fMRIPipeline
object instance- Return type
-
cmp.project.
refresh_folder
(bids_directory, derivatives_directory, subject, input_folders, session=None)[source]¶ Creates (if needed) the folder hierarchy.
- Parameters
bids_directory (os.path) – BIDS dataset root directory
derivatives_directory (os.path) – Output (derivatives) directory
subject (string) – BIDS subject label (
sub-XX
)input_folders (List of string) – List of folder to be created in
derivatives_directory
/’cmp’/subject
session (string) – BIDS session label (
ses-YY
)
-
cmp.project.
run_individual
(bids_dir, output_dir, participant_label, session_label, anat_pipeline_config, dwi_pipeline_config, func_pipeline_config, number_of_threads=1)[source]¶ Function that creates the processing pipeline for complete coverage.
- Parameters
bids_dir (string) – BIDS dataset root directory
output_dir (string) – Output (derivatives) directory
participant_label (string) – BIDS participant / subject label (
sub-XX
)session_label (string) – BIDS session label (
ses-XX
)anat_pipeline_config (string) – Path to anatomical pipeline configuration file
dwi_pipeline_config (string) – Path to diffusion pipeline configuration file
func_pipeline_config (string) – Path to fMRI pipeline configuration file
number_of_threads (int) – Number of threads used by programs relying on the OpenMP library
-
cmp.project.
update_anat_last_processed
(project_info, pipeline)[source]¶ Update last processing information of a
AnatomicalPipeline
.- Parameters
project_info (cmp.project.CMP_Project_Info) – Instance of
CMP_Project_Info
objectpipeline (cmp.pipelines.anatomical.anatomical.AnatomicalPipeline) – Instance of
AnatomicalPipeline
object
-
cmp.project.
update_dmri_last_processed
(project_info, pipeline)[source]¶ Update last processing information of an
DiffusionPipeline
.- Parameters
project_info (cmp.project.CMP_Project_Info) – Instance of
CMP_Project_Info
objectpipeline (cmp.pipelines.diffusion.diffusion.DiffusionPipeline) – Instance of
DiffusionPipeline
object
-
cmp.project.
update_fmri_last_processed
(project_info, pipeline)[source]¶ Update last processing information of an
fMRIPipeline
.- Parameters
project_info (cmp.project.CMP_Project_Info) – Instance of
CMP_Project_Info
objectpipeline (cmp.pipelines.functional.fMRI.fMRIPipeline) – Instance of
fMRIPipeline
object