DCMTK  Version 3.6.2
OFFIS DICOM Toolkit
dcmdata: a data encoding/decoding library and utility apps

This module contains classes to manage DICOM data structures and files. It also provides support for DICOMDIR files as required for DICOM storage media.

The main interface classes are:

Here are some further classes that are of interest:

Tools

This module contains the following command line tools:

Files

The following file provides further documentation:

Examples

The following example shows how to load a DICOM file and output the patient's name:

DcmFileFormat fileformat;
OFCondition status = fileformat.loadFile("test.dcm");
if (status.good())
{
OFString patientName;
if (fileformat.getDataset()->findAndGetOFString(DCM_PatientName, patientName).good())
{
cout << "Patient's Name: " << patientName << endl;
} else
cerr << "Error: cannot access Patient's Name!" << endl;
} else
cerr << "Error: cannot read DICOM file (" << status.text() << ")" << endl;

The following example shows how to create a DICOM dataset and save it to a file:

char uid[100];
DcmFileFormat fileformat;
DcmDataset *dataset = fileformat.getDataset();
dataset->putAndInsertString(DCM_SOPClassUID, UID_SecondaryCaptureImageStorage);
dataset->putAndInsertString(DCM_PatientName, "Doe^John");
/* ... */
dataset->putAndInsertUint8Array(DCM_PixelData, pixelData, pixelLength);
OFCondition status = fileformat.saveFile("test.dcm", EXS_LittleEndianExplicit);
if (status.bad())
cerr << "Error: cannot write DICOM file (" << status.text() << ")" << endl;

The following example shows how to create a general purpose DICOMDIR from multiple files:

OFCondition status = dicomdir.createNewDicomDir();
if (status.good())
{
while ( /* there are files */ )
dicomdir.addDicomFile( /* current filename */ );
status = dicomdir.writeDicomDir();
if (status.bad())
cerr << "Error: cannot write DICOMDIR (" << status.text() << ")" << endl;
} else
cerr << "Error: cannot create DICOMDIR (" << status.text() << ")" << endl;


Generated on Mon Jul 17 2017 for DCMTK Version 3.6.2 by Doxygen 1.8.13