dicom_parser.utils package

Submodules

dicom_parser.utils.choice_enum module

Definition of the ChoiceEnum class, which is used to facilitate the usage of Enum definitions with Django Field choices.

class dicom_parser.utils.choice_enum.ChoiceEnum

Bases: enum.Enum

A small adaptation to python’s built-in Enum class.

choices = <bound method ChoiceEnum.choices of <enum 'ChoiceEnum'>>

dicom_parser.utils.peek module

Based on this StackOverflow answer.

dicom_parser.utils.peek.peek(iterable: generator) → tuple

From Wikipedia: “peek is an operation which returns the value of the top of the collection without removing the value from the data.”

Parameters

iterable (GeneratorType) – A generator object to peek into.

Returns

A tuple containing the first item and the original generator, unless it is empty, then (None, None).

Return type

tuple

dicom_parser.utils.read_file module

dicom_parser.utils.read_file.read_file(raw_input, read_data: bool = False) → pydicom.dataset.FileDataset

Return pydicom’s FileDataset instance based on the provided input.

Parameters
  • raw_input (FileDataset, str, or Path) – The DICOM image to be parsed

  • read_data (bool) – Whether to include the pixel data or not

Returns

Image data

Return type

FileDataset

dicom_parser.utils.value_representation module

This file contains an Enum with the two-character codes of the various DICOM value-representations (VRs) (also see here) for header data elements.

class dicom_parser.utils.value_representation.ValueRepresentation

Bases: enum.Enum

DICOM value-representations (VRs).

AGE_STRING = 'AS'
APPLICATION_ENTITY = 'AE'
ATTRIBUTE_TAG = 'AT'
CODE_STRING = 'CS'
DATE = 'DA'
DATE_TIME = 'DT'
DECIMAL_STRING = 'DS'
FLOATING_POINT_DOUBLE = 'FD'
FLOATING_POINT_SINGLE = 'FL'
INTEGER_STRING = 'IS'
LONG_STRING = 'LO'
LONG_TEXT = 'LT'
OTHER_64_BIT_VERY_LONG = 'OV'
OTHER_BYTE = 'OB'
OTHER_DOUBLE = 'OD'
OTHER_FLOAT = 'OF'
OTHER_LONG = 'OL'
OTHER_WORD = 'OW'
PERSON_NAME = 'PN'
SEQUENCE_OF_ITEMS = 'SQ'
SHORT_STRING = 'SH'
SHORT_TEXT = 'ST'
SIGNED_64_BIT_VERY_LONG = 'SV'
SIGNED_LONG = 'SL'
SIGNED_SHORT = 'SS'
TIME = 'TM'
UNIQUE_IDENTIFIER = 'UI'
UNIVERSAL_RESOURCE = 'UR'
UNKNOWN = 'UN'
UNLIMITED_CHARACTERS = 'UC'
UNLIMITED_TEXT = 'UT'
UNSIGNED_64_BIT_VERY_LONG = 'UV'
UNSIGNED_LONG = 'UL'
UNSIGNED_SHORT = 'US'

Module contents