View Source ExDicom.Util.Misc (EX_DICOM v0.2.0)
Utility functions for DICOM parsing and data handling.
Summary
Types
Type representing a parsed person name with standard DICOM components.
Functions
Parses a PN (Person Name) formatted string into a map with standardized name components.
Tests if a given tag in the format xggggeeee is a private tag. Private tags are identified by having an odd group number.
Tests if the given VR (Value Representation) is a string type.
Types
Functions
@spec parse_pn(String.t() | nil) :: person_name() | nil
Parses a PN (Person Name) formatted string into a map with standardized name components.
Parameters
- person_name - A string in the PN VR format (components separated by ^)
Returns
- A map with :family_name, :given_name, :middle_name, :prefix, and :suffix keys
nil
if input is nil
Examples
iex> ExDicom.Util.parse_pn("Smith^John^A^Dr^Jr")
%{
family_name: "Smith",
given_name: "John",
middle_name: "A",
prefix: "Dr",
suffix: "Jr"
}
iex> ExDicom.Util.parse_pn(nil)
nil
Tests if a given tag in the format xggggeeee is a private tag. Private tags are identified by having an odd group number.
Parameters
- tag - The DICOM tag in format xggggeeee
Returns
true
if the tag is privatefalse
if the tag is not private
Raises
- RuntimeError if the fourth character of the tag cannot be parsed as hex
Examples
iex> ExDicom.Util.private_tag?("x00090010")
true
iex> ExDicom.Util.private_tag?("x00080010")
false
Tests if the given VR (Value Representation) is a string type.
Parameters
- vr - The VR code to test
Returns
true
if string typefalse
if not string typenil
if unknown VR or UN type
Examples
iex> ExDicom.Util.string_vr?("PN")
true
iex> ExDicom.Util.string_vr?("UN")
nil