DICOM Files — PyMedPhys

Toggle navigation sidebar
Toggle in-page Table of Contents

# DICOM Files

Provides a various set of tools for DICOM header manipulation.

    usage: pymedphys dicom [-h]
                           {anonymise,merge-contours,adjust-machine-name,adjust-RED,adjust-RED-by-structure-name,listen,send}
                           ...

## Positional Arguments

`dicom`

  Possible choices: anonymise, merge-contours, adjust-machine-name, adjust-RED, adjust-RED-by-structure-name, listen, send

## Sub-commands

### anonymise

Anonymise DICOM files.

    pymedphys dicom anonymise [-h] [-o OUTPUT_PATH] [-d] [-f] [-c] [-k [KEYWORD ...]] [-p] [-u | -i] input_path

#### 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

`-o, --output_path`

  Output file or directory path.

`-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

### merge-contours

Merge overlapping contours within a DICOM structure file

    pymedphys dicom merge-contours [-h] [--structures STRUCTURES [STRUCTURES ...]] input_file output_file

#### Positional Arguments

`input_file`
`output_file`

#### Named Arguments

`--structures`

  The structures for which to run the merge on. If not provided, then all structures will be processed.

### adjust-machine-name

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

`input_file`
`output_file`
`new_machine_name`

### adjust-RED

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

`input_file`
`output_file`
`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

### adjust-RED-by-structure-name

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

### listen

Start a DICOM listener on the specified port

    pymedphys dicom listen [-h] [--host HOST] [-d STORAGE_DIRECTORY] [-a AETITLE] port

#### Positional Arguments

`port`

  The port on which to listen

#### Named Arguments

`--host`

  The host/IP to bind to

  Default: “0.0.0.0”

`-d, --storage_directory`

  Default: “.”

`-a, --aetitle`

  The AE Title of this listen service

  Default: “PYMEDPHYS”

### send

Send DICOM objects to a DICOM endpoint

    pymedphys dicom send [-h] [-a AETITLE] host port [dcmfiles ...]

#### Positional Arguments

`host`

  The host name/IP of the DICOM listener

`port`

  The port of the DICOM listener

`dcmfiles`

  Path to DICOM objects to send

#### Named Arguments

`-a, --aetitle`

  The Called AE Title

  Default: “PYMEDPHYS”