Configuration#

Open In Colab

PyDicer provides various options which you may configure to change the behaviour of the tool.

[1]:
try:
    from pydicer import PyDicer
except ImportError:
    !pip install pydicer
    from pydicer import PyDicer

import logging

from pydicer.utils import fetch_converted_test_data

working_directory = fetch_converted_test_data("./testdata_lctsc", dataset="LCTSC")

pydicer = PyDicer(working_directory)

Getting and Setting Options#

Use the get_config and set_config functions of the config module to get and set configuration options respectively.

[2]:
logging_verbosity = pydicer.config.get_config("verbosity")
print(f"Current logging verbosity: {logging_verbosity}")

# Set to logging level DEBUG
pydicer.config.set_config("verbosity", logging.DEBUG)

logging_verbosity = pydicer.config.get_config("verbosity")
print(f"New logging verbosity: {logging_verbosity}")
Current logging verbosity: 0
New logging verbosity: 10

Options Available#

Logging Verbosity#

Level of output for standard out. Value indicates the Python built-in log level. A value of 0 (not set) will display the process bar. Logs of all levels are available in the .pydicer directory.

Valid options are: [logging.NOTSET, logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR]

[3]:
pydicer.config.set_config("verbosity", logging.DEBUG)

Frame of Reference Fallback Linkage#

Determine whether to fallback on linking objects via their Frame of Reference UID if no more stable link exists.

Valid options are: True or False

[4]:
pydicer.config.set_config("for_fallback_linkage", True)

Enforce .dcm file extension#

If True only files with the .dcm or .DCM extension will be preprocessed. Otherwise any file in the DICOM directory will be preprocessed.

Valid options are: True or False

[5]:
pydicer.config.set_config("enforce_dcm_ext", True)

Interpolate Missing Slices#

When missing slices are detected these will be interpolated if True. Otherwise these cases will be sent to quarantine.

Valid options are: True or False

[6]:
pydicer.config.set_config("interp_missing_slices", True)

Ignore Duplicate Slices#

If two slices at the same location with different pixel data are found then the first slice is used if ignore_duplicate_slices is True. Otherwise an error is raised and these images are sent to quarantine.

Valid options are: True or False

[7]:
pydicer.config.set_config("ignore_duplicate_slices", False)

Generate NRRD#

Whether or not to generate an additional NRRD file when converting RTSTRUCT. This allows loading easily into 3D slicer, but it takes up more disk space and takes time to generate the file.

Valid options are: True or False

[8]:
pydicer.config.set_config("generate_nrrd", False)

NRRD Colormap#

If NRRD files are to be generated, this defines the Matplotlib colormap to use when saving NRRD file of structures.

Valid options are any Matplotlib colormap.

[9]:
pydicer.config.set_config("nrrd_colormap", "rainbow")
[ ]: