View Source Dicom.BinaryFormat (Dicom.ex v0.3.0)
DICOM binary format serialization/deserialization as defined in PS 3.5.
Summary
Types
Options for the de(serialization) of DICOM binaries.
Functions
Read the next data element from a binary.
Serialize a DIMSE command data set.
Serialize a data element according to the given serialization_options
.
Serializes data_set
into a full binary string following DICOM part 10.
Types
@type serialization_options() :: [endianness: :little | :big, explicit: boolean()]
Options for the de(serialization) of DICOM binaries.
Both little and big endian byte ordering is supported by
setting endianness
to :little
or :big
respectively.
Big endian encoding is discouraged for new files.
Setting explicit
to true
serializes the data elements
with their value representations (VRs) included. If it
is set to false
, implicit VR encoding is used. Readers
of implicit VR data sets must have access to a tag dictionary
defining the VRs for all contained data elements.
Functions
@spec from_file(Path.t()) :: {:ok, Dicom.DataSet.t()} | {:error, atom()}
@spec from_file!(Path.t()) :: Dicom.DataSet.t()
@spec read_next_data_element( data :: binary(), opts :: serialization_options() ) :: {:ok, {Dicom.DataElement.t(), binary()}} | {:error, atom()}
Read the next data element from a binary.
This function fails if the binary does not contain at least one complete data element. Any additional data following the data element is returned as the second element in the returned tuple.
Serialize a DIMSE command data set.
Command data sets are always encoded with little endian, implicit VR transfer syntax. In addition, the byte length of the command data set is prefixed as first element.
@spec serialize_data_element(Dicom.DataElement.t(), serialization_options()) :: binary()
Serialize a data element according to the given serialization_options
.
Serializes data_set
into a full binary string following DICOM part 10.