View Source ExDicom.Reader.FindAndSetUNElementLength (EX_DICOM v0.1.0)
Internal helper functions for parsing DICOM elements.
Summary
Functions
Reads from the byte stream until it finds the magic number for the Sequence Delimitation Item and then sets the length of the element.
Functions
Reads from the byte stream until it finds the magic number for the Sequence Delimitation Item and then sets the length of the element.
Parameters
- byte_stream - The byte stream to read from. Must implement the following functions:
- read_uint16/0 - Reads an unsigned 16-bit integer from the stream
- read_uint32/0 - Reads an unsigned 32-bit integer from the stream
- warnings/1 - Logs warning messages
- seek/1 - Moves the stream position by given offset Additionally, must have these fields:
- position - Current position in the stream
- byte_array - The underlying byte array
- element - The DICOM element to update. Must have these fields:
- tag - The element's tag
- data_offset - Offset to the element's data Length will be set on this element.
Returns
The updated element with its length field set.
Examples
iex> byte_stream = MockByteStream.new(...)
iex> element = %{tag: "x00100010", data_offset: 0}
iex> FindAndSetUNElementLength.find_and_set_un_element_length(byte_stream, element)
%{tag: "x00100010", data_offset: 0, length: 42}
Errors
* ArgumentError - If byte_stream is nil or doesn't implement required functions