View Source ExDicom.Reader.ReadSequenceItem (EX_DICOM v0.1.0)

Internal helper functions for parsing DICOM elements

Summary

Functions

Reads the tag and length of a sequence item.

Functions

read_sequence_item(byte_stream)

@spec read_sequence_item(ExDicom.ByteStream.t() | nil) ::
  {:ok, %{tag: String.t(), length: integer(), data_offset: integer()},
   ExDicom.ByteStream.t()}
  | no_return()

Reads the tag and length of a sequence item.

Returns a tuple of {:ok, element, byte_stream} where:

  • element is a map with the following keys:
    • :tag - string for the tag of this element in the format xggggeeee
    • :length - the number of bytes in this item or 4294967295 if undefined
    • :data_offset - the offset into the byteStream of the data for this item
  • byte_stream is the remaining byte stream after reading

Parameters

  • byte_stream - The byte stream to read from. Must implement the ByteStream protocol

Returns

  • {:ok, element, byte_stream} - Successfully read sequence item
  • raises ArgumentError - If byte_stream is nil
  • raises RuntimeError - If the sequence item tag (FFFE,E000) is not found