c++17dicomdcmtk

Use DCMTK to read a JSON-formatted DICOM dataset


OFFIS DICOM Toolkit (DCMTK) offers functionality to convert a DICOM dataset to JSON (see below) but can the toolkit be used to read a JSON-formatted dataset somehow?


The C++ implementation can write a dataset in JSON format:

#include <dcmtk/dcmdata/dcdataset.h>
#include <dcmtk/dcmdata/dcjson.h>

#include <iostream>

int main(int, char**) {
    auto dataset = DcmDataset{};
    auto format = DcmJsonFormatPretty{};

    dataset.writeJson(std::cout, format);
    return 0;
}

But no method seems to be there for reading a JSON-formatted dataset.

The toolkit also ships with a utility called dcm2json that converts a DICOM file to the standard JSON-format; yet no utility for converting from JSON back to a DICOM file...


Solution

  • Currently, there is no such tool or ready-to-use feature in the DCMTK, but there are plans to change this in the near future (i.e. this year).