dcmtk

DCMTK C++ : how to get data pixels from dicom files

人盡茶涼 提交于 2019-12-08 07:00:53
问题 I'm using DCMTK for a C++ project and want to retrieve pixels from dicom files. I used thid basic example : DicomImage *image = new DicomImage("test.dcm"); if (image != NULL) { if (image->getStatus() == EIS_Normal) { if (image->isMonochrome()) { image->setMinMaxWindow(); Uint8 *pixelData = (Uint8 *)(image->getOutputData(8 /* bits */)); if (pixelData != NULL) { /* do something useful with the pixel data */ } } } else cerr << "Error: cannot load DICOM image (" << DicomImage::getString(image-