View Source ExDicom (EX_DICOM v0.1.0)
Main module for DICOM file parsing functionality.
Summary
Functions
Parses a DICOM file from the given file path.
Writes a DICOM dataset to a file at the specified path.
Functions
@spec parse_file(String.t()) :: {:ok, ExDicom.DataSet.t()} | {:error, String.t()}
Parses a DICOM file from the given file path.
Parameters
- file_path - Path to the DICOM file to parse
Returns
{:ok, dataset}
- Successfully parsed DICOM data{:error, reason}
- Error occurred during parsing
Examples
iex> {:error, message} = ExDicom.parse_file("non_existent.dcm")
iex> is_binary(message)
true
@spec write_file(ExDicom.DataSet.t(), String.t()) :: :ok | {:error, String.t()}
Writes a DICOM dataset to a file at the specified path.
Parameters
- dataset - The DICOM dataset to write
- file_path - Path where the DICOM file should be written
Returns
:ok
- Successfully wrote DICOM data{:error, reason}
- Error occurred during writing
Examples
iex> {:ok, dataset} = ExDicom.parse_file("test/fixtures/brain.dcm")
iex> path = "test/fixtures/output.dcm"
iex> result = ExDicom.write_file(dataset, path)
iex> File.rm!(path)
iex> result
:ok