DICOM Value Representations (VR).
Defines the data types used in DICOM attributes: Person Name (PN), Date (DA), Unique Identifier (UI), Other Byte (OB), etc.
Reference: DICOM PS3.5 Section 6.2.
Summary
Functions
Returns a sorted list of all 34 VR atoms.
Returns true if the VR represents binary/pixel data.
Returns the list of binary VR atoms.
Returns the human-readable description for a VR per PS3.5 Table 6.2-1.
Returns true if the VR has a fixed byte length (AT, FL, FD, SL, SS, UL, US, SV, UV).
Parses a 2-byte VR string into an atom.
Returns true if the VR uses explicit length encoding with a 4-byte length field (the "long" VRs that use 2 reserved bytes + 4-byte length in Explicit VR).
Returns the maximum character/byte length for a VR, or :unlimited.
Returns true if the VR represents a numeric type.
Returns the list of numeric VR atoms.
Pads a binary value to even length per DICOM requirements.
Returns the padding byte for this VR.
Returns true if the VR represents a string type.
Returns the list of string VR atoms.
Converts a VR atom to its 2-byte binary representation.
Types
Functions
@spec all() :: [t()]
Returns a sorted list of all 34 VR atoms.
Examples
iex> :PN in Dicom.VR.all()
true
iex> length(Dicom.VR.all())
34
Returns true if the VR represents binary/pixel data.
@spec binary_vrs() :: [t()]
Returns the list of binary VR atoms.
Returns the human-readable description for a VR per PS3.5 Table 6.2-1.
Examples
iex> Dicom.VR.description(:PN)
"Person Name"
iex> Dicom.VR.description(:DA)
"Date"
Returns true if the VR has a fixed byte length (AT, FL, FD, SL, SS, UL, US, SV, UV).
Parses a 2-byte VR string into an atom.
Examples
iex> Dicom.VR.from_binary("PN")
{:ok, :PN}
iex> Dicom.VR.from_binary("XX")
{:error, :unknown_vr}
Returns true if the VR uses explicit length encoding with a 4-byte length field (the "long" VRs that use 2 reserved bytes + 4-byte length in Explicit VR).
@spec max_length(t()) :: pos_integer() | :unlimited
Returns the maximum character/byte length for a VR, or :unlimited.
Examples
iex> Dicom.VR.max_length(:PN)
64
iex> Dicom.VR.max_length(:UT)
:unlimited
Returns true if the VR represents a numeric type.
@spec numeric_vrs() :: [t()]
Returns the list of numeric VR atoms.
Pads a binary value to even length per DICOM requirements.
All DICOM value fields must have even length. If the value has odd length, a single padding byte is appended based on the VR.
Returns the padding byte for this VR.
Per PS3.5 Section 6.2: UI values are padded with NULL (0x00), other string VRs are padded with SPACE (0x20), and binary VRs are padded with 0x00.
Returns true if the VR represents a string type.
@spec string_vrs() :: [t()]
Returns the list of string VR atoms.
Converts a VR atom to its 2-byte binary representation.