cmtklib.config module¶
Module that defines methods for handling CMP3 configuration files.
-
cmtklib.config.
anat_load_config_json
(pipeline, config_path)[source]¶ Load the JSON configuration file of an anatomical pipeline.
- Parameters
pipeline (Instance(cmp.pipelines.anatomical.anatomical.AnatomicalPipeline)) – Instance of AnatomicalPipeline
config_path (string) – Path of the JSON configuration file
-
cmtklib.config.
anat_save_config
(pipeline, config_path)[source]¶ Save the configuration file of an anatomical pipeline.
- Parameters
pipeline (Instance(cmp.pipelines.anatomical.anatomical.AnatomicalPipeline)) – Instance of AnatomicalPipeline
config_path (string) – Path of the JSON configuration file
-
cmtklib.config.
check_configuration_format
(config_path)[source]¶ Check format of the configuration file.
- Parameters
config_path (string) – Path to pipeline configuration file
- Returns
ext – Format extension of the pipeline configuration file
- Return type
‘.ini’ or ‘.json’
-
cmtklib.config.
check_configuration_version
(config)[source]¶ Check the version of CMP3 used to generate a configuration.
- Parameters
config (Dict) – Dictionary of configuration parameters loaded from JSON file
- Returns
is_same –
True
if the version used to generate the configuration matches the version currently used (cmp.info.__version__
).- Return type
bool
-
cmtklib.config.
convert_config_ini_2_json
(config_ini_path)[source]¶ Convert a configuration file in old INI format to new JSON format.
- Parameters
config_ini_path (string) – Path to configuration file in old INI format
- Returns
config_json_path – Path to converted configuration file in new JSON format
- Return type
string
-
cmtklib.config.
create_configparser_from_pipeline
(pipeline, debug=False)[source]¶ Create a
ConfigParser
object from a Pipeline instance.- Parameters
pipeline (Instance(Pipeline)) – Instance of pipeline
debug (bool) – If
True
, show additional prints
- Returns
config – Instance of ConfigParser
- Return type
Instance(
configparser.ConfigParser
)
-
cmtklib.config.
create_subject_configuration_from_ref
(project, ref_conf_file, pipeline_type, multiproc_number_of_cores=1)[source]¶ Create the pipeline configuration file for an individual subject from a reference given as input.
- Parameters
project (cmp.project.CMP_Project_Info) – Instance of
cmp.project.CMP_Project_Info
ref_conf_file (string) – Reference configuration file
pipeline_type ('anatomical', 'diffusion', 'fMRI') – Type of pipeline
multiproc_number_of_cores (int) – Number of threads used by Nipype
- Returns
subject_conf_file – Configuration file of the individual subject
- Return type
string
-
cmtklib.config.
dmri_load_config_json
(pipeline, config_path)[source]¶ Load the JSON configuration file of a diffusion pipeline.
- Parameters
pipeline (Instance(cmp.pipelines.diffusion.diffusion.DiffusionPipeline)) – Instance of DiffusionPipeline
config_path (string) – Path of the JSON configuration file
-
cmtklib.config.
dmri_save_config
(pipeline, config_path)[source]¶ Save the INI configuration file of a diffusion pipeline.
- Parameters
pipeline (Instance(cmp.pipelines.diffusion.diffusion.DiffusionPipeline)) – Instance of DiffusionPipeline
config_path (string) – Path of the JSON configuration file
-
cmtklib.config.
fmri_load_config_json
(pipeline, config_path)[source]¶ Load the JSON configuration file of a fMRI pipeline.
- Parameters
pipeline (Instance(cmp.pipelines.functional.fMRI.fMRIPipeline)) – Instance of fMRIPipeline
config_path (string) – Path of the JSON configuration file
-
cmtklib.config.
fmri_save_config
(pipeline, config_path)[source]¶ Save the INI configuration file of a fMRI pipeline.
- Parameters
pipeline (Instance(cmp.pipelines.functional.fMRI.fMRIPipeline)) – Instance of fMRIPipeline
config_path (string) – Path of the JSON configuration file
-
cmtklib.config.
get_anat_process_detail_json
(project_info, section, detail)[source]¶ Get the value for a parameter key (detail) in the stage section of the anatomical JSON config file.
- Parameters
project_info (Instance(cmp.project.CMP_Project_Info)) – Instance of
cmp.project.CMP_Project_Info
classsection (string) – Stage section name
detail (string) – Parameter key
- Returns
- Return type
The parameter value
-
cmtklib.config.
get_dmri_process_detail_json
(project_info, section, detail)[source]¶ Get the value for a parameter key (detail) in the stage section of the diffusion JSON config file.
- Parameters
project_info (Instance(cmp.project.CMP_Project_Info)) – Instance of
cmp.project.CMP_Project_Info
classsection (string) – Stage section name
detail (string) – Parameter key
- Returns
- Return type
The parameter value
-
cmtklib.config.
get_fmri_process_detail_json
(project_info, section, detail)[source]¶ Get the value for a parameter key (detail) in the stage section of the fMRI JSON config file.
- Parameters
project_info (Instance(cmp.project.CMP_Project_Info)) – Instance of
cmp.project.CMP_Project_Info
classsection (string) – Stage section name
detail (string) – Parameter key
- Returns
- Return type
The parameter value
-
cmtklib.config.
get_process_detail_json
(project_info, section, detail)[source]¶ Get the value for a parameter key (detail) in the global section of the JSON config file.
- Parameters
project_info (Instance(cmp.project.CMP_Project_Info)) – Instance of
cmp.project.CMP_Project_Info
classsection (string) – Stage section name
detail (string) – Parameter key
- Returns
- Return type
The parameter value
-
cmtklib.config.
save_configparser_as_json
(config, config_json_path, ini_mode=False, debug=False)[source]¶ Save a ConfigParser to JSON file.
- Parameters
config (Instance(configparser.ConfigParser)) – Instance of ConfigParser
config_json_path (string) – Output path of JSON configuration file
ini_mode (bool) – If
True
, handles all content stored in stringsdebug (bool) – If
True
, show additional prints
-
cmtklib.config.
set_pipeline_attributes_from_config
(pipeline, config, debug=False)[source]¶ Set the pipeline stage attributes given a configuration.
- Parameters
pipeline (Instance(Pipeline)) – Instance of pipeline
config (Dict) – Dictionary of configuration parameter loaded from the JSON configuration file
debug (bool) – If
True
, show additional prints