Provides a various set of tools for DICOM header manipulation.


usage: pymedphys dicom [-h]

Positional Arguments

dicom Possible choices: anonymise, adjust-machine-name, adjust-RED, adjust-RED-by-structure-name



Anonymise DICOM files.

pymedphys dicom anonymise [-h] [-d] [-f] [-c] [-k [KEYWORD [KEYWORD ...]]]
                          [-p] [-u | -i]
Positional Arguments
input_path Input file or directory path. If a directory is supplied, all DICOM files within the directory and its subdirectories will be anonymised
Named Arguments
-d, --delete_original_files

Use this flag to delete the original, non-anonymised files in the processed directory. Each original file will only be deleted if anonymisation completed successfully for that file.

Default: False

-f, --preserve_filenames

Use this flag to preserve the original filenames in the anonymised DICOM filenames. Note that ‘_Anonymised.dcm’ will still be appended. Use with caution, since DICOM filenames may contain identifying information

Default: False

-c, --clear_values

Use this flag to simply clear the values of all of the identifying elements in the anonymised DICOM files, as opposed to replacing them with ‘dummy’ values.

Default: False

-k, --keywords_to_leave_unchanged
 A space-separated list of DICOM keywords (e.g. ‘PatientName’) to exclude from anonymisation and error checking.
-p, --keep_private_tags

Use this flag to preserve private tags in the anonymised DICOM files.

Default: False

-u, --delete_unknown_tags

Use this flag to delete any unrecognised tags from the anonymised DICOM files.

Default: False

-i, --ignore_unknown_tags

Use this flag to ignore any unrecognised tags in the anonymised DICOM files.

Default: False


Change the machine name in an RT plan DICOM file

pymedphys dicom adjust-machine-name [-h]
                                    input_file output_file new_machine_name
Positional Arguments


Adjust the RED of structures within an RT structure DICOM file

pymedphys dicom adjust-RED [-h] [-i]
                           input_file output_file adjustment_map
                           [adjustment_map ...]
Positional Arguments
adjustment_map An alternating list of structure name and then its associated RED. For example, pymedphys dicom adjust-RED input.dcm output.dcm struct_name 1.5 another_struct_name 0.2
Named Arguments
-i, --ignore_missing_structure

Use this flag to no longer raise an error when a defined structure name doesn’t exist within the input DICOM file.

Default: False


Use structure naming conventions to automatically adjust the relative electron density of a structure within a DICOM RT Structure set. For example, naming a structure a_structure_name RED=1.15 will cause that structure to have an override of 1.15 applied.

pymedphys dicom adjust-RED-by-structure-name [-h] input_file output_file
Positional Arguments
input_file input_file
output_file output_file