View Source ExDicom.Encoder (EX_DICOM v0.2.0)

Provides functionality to fully re-encode a DICOM DataSet into a valid DICOM Part 10 file.

Important: This is a simplified example focusing on explicit little-endian encoding, and does not handle complex VRs, sequences, deflated data, etc.

Summary

Functions

Re-encodes the entire dataset into a DICOM Part 10 file format (P10).

Functions

encode_to_p10(dataset)

@spec encode_to_p10(ExDicom.DataSet.t()) :: {:ok, binary()} | {:error, String.t()}

Re-encodes the entire dataset into a DICOM Part 10 file format (P10).

  • Writes the 128-byte preamble + 'DICM'
  • Writes group 0x0002 (meta header) in explicit little-endian
  • Writes the rest of the dataset, also in explicit little-endian (for simplicity)

Returns {:ok, binary} or {:error, reason}.