DICOM Tags

pumpia.file_handling.dicom_tags.get_tag(dicom_image: Dataset | DataElement, tag: Tag, frame: int | None = None, get_first: Literal[False] = False) DataElement | list[DataElement]
pumpia.file_handling.dicom_tags.get_tag(dicom_image: Dataset | DataElement, tag: Tag, frame: int | None = None, get_first: Literal[True] = True) DataElement

Returns the dicom element from the pydicom Dataset defined by tag. If the Dataset is an enhanced dicom then the frame can be provided for frame specific elements.

Parameters:
  • dicom_image (Dataset | DataElement) – pydicom Dataset/DataElement to be searched

  • tag (Tag) – tag of element to be returned

  • frame (int, optional) – frame number (starting at 1) if relevant, by default None

  • get_first (bool, optional) – whether to get the first value for a matching tag in dicom_image

Returns:

pydicom DataElement of the provided tag, or a list of pydicom DataElements for the provided tag. Use DataElement.value attribute to get the value of the element.

Return type:

DataElement | list[DataElement]

Raises:

KeyError – raised if an element is not found.

pumpia.file_handling.dicom_tags.get_value(dicom_image: Dataset | DataElement, tag: Tag, frame: int | None = None, get_first: Literal[False] = False) Any | list[Any]
pumpia.file_handling.dicom_tags.get_value(dicom_image: Dataset | DataElement, tag: Tag, frame: int | None = None, get_first: Literal[True] = True) Any

Returns the value of the dicom element from the pydicom Dataset defined by tag. If the Dataset is an enhanced dicom then the frame can be provided for frame specific elements.

Parameters:
  • dicom_image (Dataset | DataElement) – pydicom Dataset/DataElement to be searched

  • tag (Tag) – tag of element to be returned

  • frame (int, optional) – frame number (starting at 1) if relevant, by default None

  • get_first (bool, optional) – whether to get the first value for a matching tag in dicom_image

Returns:

pydicom DataElement of the provided tag, or a list of pydicom DataElements for the provided tag. Use DataElement.value attribute to get the value of the element.

Return type:

DataElement | list[DataElement]

Raises:

KeyError – raised if an element is not found.

class pumpia.file_handling.dicom_tags.Tag(name: str, keyword: str, group: int, element: int, links: list[TagLink] = <factory>, alternative_tags: list[tuple[int, int]]=<factory>)

dataclass representing a dicom tag

Parameters:
  • name (str) – the name of the tag as defined in the dicom standards.

  • keyword (str) – the keyword of the tag as defined in the dicom standards.

  • group (int) – the group of the dicom tag

  • element (int) – the element of the dicom tag

  • links (list[TagLink]) – a list of TagLinks that hold any sequences the tag may be part of.

  • alternative_tags (list[tuple[int, int]]) – a list of alternative tuples that could represent this tag

name
Type:

str

keyword
Type:

str

group
Type:

int

element
Type:

int

Type:

list[TagLink]

alternative_tags
Type:

list[tuple[int, int]]

as_tuple

This tag as a tuple of (group, element).

Type:

tuple[int, int]

get() tuple[int, int]

return the dicom tag as a tuple of (group, element).

pumpia.file_handling.dicom_tags.DicomTags

Module containing all DICOM Tags.

pumpia.file_handling.dicom_tags.XRAYTags

Module containing X-ray DICOM Tags.

pumpia.file_handling.dicom_tags.CTTags

Module containing CT DICOM Tags.

pumpia.file_handling.dicom_tags.NucMedTags

Module containing Nuclear Medicine DICOM Tags.

pumpia.file_handling.dicom_tags.MRTags

Module containing MRI DICOM Tags.

pumpia.file_handling.dicom_tags.USTags

Module containing Ultrasound DICOM Tags.