Skip to content

Example: Read DICOM JSON

The following code reads a DICOM JSON file as a data set and prints its contents to stdout.

gleam
import dcmfx_core/data_set
import dcmfx_json
import gleam/option.{None}
import simplifile

const input_file = "../../example.dcm.json"

pub fn main() {
  let assert Ok(json_data) = simplifile.read(input_file)
  let assert Ok(ds) = dcmfx_json.json_to_data_set(json_data)
  data_set.print(ds, None)
}

View on GitHub