Private tag validation per DICOM PS3.6 Section 6.1.2.1.
Private tags use odd-numbered groups (excluding 0x0001). Within each
private group, a "block" is identified by a creator element at
(gggg,00xx) where xx ranges from 0x10 to 0xFF. The creator
element has VR LO and its value identifies the definer of the block.
Private data elements in block xx occupy (gggg,xx00) through
(gggg,xxFF). Every private data element must have a corresponding
creator element for the data set to be valid.
Examples
iex> Dicom.PrivateTag.private?({0x0009, 0x1001})
true
iex> Dicom.PrivateTag.private_block({0x0009, 0x1001})
16
iex> Dicom.PrivateTag.creator_tag({0x0009, 0x1001})
{0x0009, 0x0010}
Summary
Functions
Returns true if the tag is a private creator element.
Returns the creator string for a private data element, or nil.
Returns the creator tag for a given private tag.
Returns true if the tag is in a private group.
Extracts the block number from a private tag's element number.
Validates that every private data element has a corresponding creator.
Types
@type tag() :: Dicom.DataElement.tag()
Functions
Returns true if the tag is a private creator element.
Creator elements occupy element numbers 0x0010 through 0x00FF within a private (odd) group.
@spec creator_for(Dicom.DataSet.t(), tag()) :: String.t() | nil
Returns the creator string for a private data element, or nil.
Looks up the creator element (gggg,00xx) in the data set and returns
its value. Returns nil if the tag is not private or the creator is absent.
Returns the creator tag for a given private tag.
For a data element (gggg,xxyy), the creator is (gggg,00xx).
For a creator element (gggg,00xx), returns the tag unchanged.
Returns true if the tag is in a private group.
Private groups have odd group numbers, excluding group 0x0001 (the DICOM Command group).
@spec private_block(tag()) :: non_neg_integer()
Extracts the block number from a private tag's element number.
For creator elements (gggg,00xx) the block is xx.
For data elements (gggg,xxyy) the block is the high byte xx.
@spec validate_creators(Dicom.DataSet.t()) :: {:ok, Dicom.DataSet.t()} | {:error, [{tag(), :missing_creator}]}
Validates that every private data element has a corresponding creator.
Scans all elements in the data set. For each private data element
(element > 0x00FF in an odd group), checks that a creator element
exists at (gggg,00xx).
Returns {:ok, data_set} when all creators are present, or
{:error, [{tag, :missing_creator}]} listing every orphaned element.