cleanX.cli.main module

class cleanX.cli.main.Config(source=None)

Bases: object

Store for various settings necessary to run the functions from cleanX from command-line.

Recognized configuration variables:

  • PREFERRED_DICOM_PARSER can be either "pydicom" or "SimpleITK". Controls which DICOM parser to use. Only makes sense if both modules are available. The default is "pydicom".

  • GLOB_IS_RECURSIVE can be True or False. controls how glob() patterns are interpreted when they use ** command. The default is False.

  • JOURNAL_HOME is a path to the directory where journals for journaling pipeline are stored. This defaults to ~/cleanx/journal/ if not specified.

defaults = {'GLOB_IS_RECURSIVE': True, 'JOURNAL_HOME': '/home/runner/cleanx/journal/', 'PREFERRED_DICOM_PARSER': 'pydicom'}
__init__(source=None)

Initializes configuration with source. Source should be a JSON file with a dictionary, where keys will be interpreted as configuration variables and values as those variables values.

Parameters:

source (Suitable for open()) – Path to the configuration file.

parse()

Parse configuration file.

merge(defaults, extras)

Merge default configuration with overrides from the configuration file.

add_setting(k, v)

Override existing setting with the given setting.

Parameters:
  • k (str) – The name of the setting to replace.

  • v – The new value of the setting.

get_setting(k)

Read the configuration setting.

Parameters:

k (str) – The configuration variable whose value should be found.

Returns:

The current value of the configuration variable k.