View Source ExDicom.DataSet (EX_DICOM v0.1.0)

Encapsulates a collection of DICOM Elements and provides various functions to access the data.

Rules for handling padded spaces:

  • DS = Strip leading and trailing spaces
  • DT = Strip trailing spaces
  • IS = Strip leading and trailing spaces
  • PN = Strip trailing spaces
  • TM = Strip trailing spaces
  • AE = Strip leading and trailing spaces
  • CS = Strip leading and trailing spaces
  • SH = Strip leading and trailing spaces
  • LO = Strip leading and trailing spaces
  • LT = Strip trailing spaces
  • ST = Strip trailing spaces
  • UT = Strip trailing spaces

Summary

Functions

Parses an element tag according to the 'AT' VR definition.

Finds the element for tag and returns a 64-bit float if it exists and has data.

Finds the element for tag and returns a 32-bit float if it exists and has data.

Parses a string to a float for the specified index in a multi-valued element.

Finds the element for tag and returns a signed int 16 if it exists and has data.

Finds the element for tag and returns a signed int 32 if it exists and has data.

Parses a string to an integer for the specified index in a multi-valued element.

Creates a new DicomDataset struct.

Returns the number of string values for the element.

Returns a string for the element. For VR types of AE, CS, SH and LO. If index is provided, returns the component at that index in a multi-valued string.

Returns a string with leading spaces preserved and trailing spaces removed. For VRs of type UT, ST and LT.

Finds the element for tag and returns an unsigned int 16 if it exists and has data.

Finds the element for tag and returns an unsigned int 32 if it exists and has data.

Types

byte_array()

@type byte_array() :: binary()

element()

@type element() :: %{
  data_offset: non_neg_integer(),
  length: non_neg_integer(),
  parser: parser() | nil,
  Value: any() | nil
}

elements()

@type elements() :: %{required(String.t()) => element()}

index()

@type index() :: non_neg_integer()

parser()

@type parser() :: module()

t()

@type t() :: %ExDicom.DataSet{
  byte_array: byte_array(),
  byte_array_parser: parser(),
  elements: elements(),
  position: term(),
  warnings: term()
}

tag()

@type tag() :: String.t()

Functions

attribute_tag(dataset, tag)

@spec attribute_tag(t(), tag()) :: String.t() | nil

Parses an element tag according to the 'AT' VR definition.

double(dataset, tag, index \\ 0)

@spec double(t(), tag(), index()) :: float() | nil

Finds the element for tag and returns a 64-bit float if it exists and has data.

float(dataset, tag, index \\ 0)

@spec float(t(), tag(), index()) :: float() | nil

Finds the element for tag and returns a 32-bit float if it exists and has data.

float_string(dataset, tag, index \\ 0)

@spec float_string(t(), tag(), integer() | nil) :: float() | nil

Parses a string to a float for the specified index in a multi-valued element.

int16(dataset, tag, index \\ 0)

@spec int16(t(), tag(), index()) :: integer() | nil

Finds the element for tag and returns a signed int 16 if it exists and has data.

int32(dataset, tag, index \\ 0)

@spec int32(t(), tag(), index()) :: integer() | nil

Finds the element for tag and returns a signed int 32 if it exists and has data.

int_string(dataset, tag, index \\ 0)

@spec int_string(t(), tag(), integer() | nil) :: integer() | nil

Parses a string to an integer for the specified index in a multi-valued element.

new(byte_array_parser, byte_array, elements)

@spec new(parser(), byte_array(), elements()) :: t()

Creates a new DicomDataset struct.

num_string_values(dataset, tag)

@spec num_string_values(t(), tag()) :: integer() | nil

Returns the number of string values for the element.

string(dataset, tag, index \\ nil)

@spec string(t(), tag(), integer() | nil) :: String.t() | nil

Returns a string for the element. For VR types of AE, CS, SH and LO. If index is provided, returns the component at that index in a multi-valued string.

text(dataset, tag, index \\ nil)

@spec text(t(), tag(), integer() | nil) :: String.t() | nil

Returns a string with leading spaces preserved and trailing spaces removed. For VRs of type UT, ST and LT.

uint16(dataset, tag, index \\ 0)

@spec uint16(t(), tag(), index()) :: integer() | nil

Finds the element for tag and returns an unsigned int 16 if it exists and has data.

uint32(dataset, tag, index \\ 0)

@spec uint32(t(), tag(), index()) :: integer() | nil

Finds the element for tag and returns an unsigned int 32 if it exists and has data.