<< Back to the main page

Reading DICOM files

Reading DICOM file using QDCM is very easy:

DcmFile file("dicom.dcm");
DcmDataset dataset = file.read();
if (file.isError()) {
    qDebug() << "Error reading DICOM file:" << file.errorText();
} else {
    // Process the dataset here

Please pay attention that returned DICOM dataset may be invalid if reading operation or parsing went wrong. You must always check the file error condition before using the returned dataset.

When reading DICOM files, QDCM will guess the transfer syntax to be used as well as the presence of 128 bytes header. Quite often DICOM files are saved without this header. Such files will be as well successfully read by QDCM.

©2012 by Arthur Benilov

Project Web Hosted by