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: dicom_parser.utils.choice_enum.ChoiceEnum

DICOM value-representations (VRs).

AE = 'Application Entity'
AS = 'Age String'
AT = 'Attribute Tag'
CS = 'Code String'
DA = 'Date'
DS = 'Decimal String'
DT = 'Date Time'
FD = 'Floating Point Double'
FL = 'Floating Point Single'
IS = 'Integer String'
LO = 'Long String'
LT = 'Long Text'
OB = 'Other Byte'
OD = 'Other Double'
OF = 'Other Float'
OL = 'Other Long'
OV = 'Other 64-bit Very Long'
OW = 'Other Word'
PN = 'Person Name'
SH = 'Short String'
SL = 'Signed Long'
SQ = 'Sequence of Items'
SS = 'Signed Short'
ST = 'Short Text'
SV = 'Signed 64-bit Very Long'
TM = 'Time'
UC = 'Unlimited Characters'
UI = 'Unique Identifer'
UL = 'Unsigned Long'
UN = 'Unknown'
UR = 'Universal Resource'
US = 'Unsigned Short'
UT = 'Unlimited Text'
UV = 'Unsigned 64-bit Very Long'
exception dicom_parser.utils.value_representation.ValueRepresentationError

Bases: Exception

dicom_parser.utils.value_representation.get_value_representation(key: str) → dicom_parser.utils.value_representation.ValueRepresentation

Module contents