Maarten Bamelis
Maarten Bamelis

Reputation: 2423

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...

Upvotes: 0

Views: 319

Answers (2)

David Clunie
David Clunie

Reputation: 181

In the interim, com.pixelmed.dicom.JSONRepresentationOfDicomObjectFactory toDICOM may help.

Upvotes: 0

J. Riesmeier
J. Riesmeier

Reputation: 1702

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).

Upvotes: 1

Related Questions