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
cmtklib.config.anat_save_config(pipeline, config_path)[source]

Save the configuration file of an anatomical pipeline.

Parameters
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_sameTrue 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.ProjectInfo) – 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
cmtklib.config.dmri_save_config(pipeline, config_path)[source]

Save the INI configuration file of a diffusion pipeline.

Parameters
cmtklib.config.fmri_load_config_json(pipeline, config_path)[source]

Load the JSON configuration file of a fMRI pipeline.

Parameters
cmtklib.config.fmri_save_config(pipeline, config_path)[source]

Save the INI configuration file of a fMRI pipeline.

Parameters
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
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
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
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
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 strings

  • debug (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