pydicom.dataset.PrivateBlock

class pydicom.dataset.PrivateBlock(key: Tuple[int, str], dataset: pydicom.dataset.Dataset, private_creator_element: int)[source]

Helper class for a private block in the Dataset.

New in version 1.3.

See the DICOM Standard, Part 5, Section 7.8.1 - Private Data Element Tags

group

The private group where the private block is located as a 32-bit int.

Type

int

private_creator

The private creator string related to the block.

Type

str

dataset

The parent dataset.

Type

Dataset

block_start

The start element of the private block as a 32-bit int. Note that the 2 low order hex digits of the element are always 0.

Type

int

__init__(key: Tuple[int, str], dataset: pydicom.dataset.Dataset, private_creator_element: int) None[source]

Initializes an object corresponding to a private tag block.

Parameters
  • key (tuple) – The private (tag group, creator) as (int, str). The group must be an odd number.

  • dataset (Dataset) – The parent Dataset.

  • private_creator_element (int) – The element of the private creator tag as a 32-bit int.

Methods

__init__(key, dataset, private_creator_element)

Initializes an object corresponding to a private tag block.

add_new(element_offset, VR, value)

Add a private element to the parent Dataset.

get_tag(element_offset)

Return the private tag ID for the given element_offset.

add_new(element_offset: int, VR: str, value: object) None[source]

Add a private element to the parent Dataset.

Adds the private tag with the given VR and value to the parent Dataset at the tag ID defined by the private block and the given element_offset.

Parameters
  • element_offset (int) – The lower 16 bits (e.g. 2 hex numbers) of the element tag to be added.

  • VR (str) – The 2 character DICOM value representation.

  • value – The value of the data element. See Dataset.add_new() for a description.

get_tag(element_offset: int) pydicom.tag.BaseTag[source]

Return the private tag ID for the given element_offset.

Parameters

element_offset (int) – The lower 16 bits (e.g. 2 hex numbers) of the element tag.

Returns

  • The tag ID defined by the private block location and the

  • given element offset.

Raises

ValueError – If element_offset is too large.