getOutputData returns 0 for compressed image. Why?
Moderator: Moderator Team
getOutputData returns 0 for compressed image. Why?
I want to view image data from DICOM file. I have DICOM file that contains JPEG grayscale(or color) image. The DicomImage::getOutputData returns 0, why? However if I have uncompressed image all is OK.
-
- Posts: 13
- Joined: Tue, 2005-06-28, 16:48
Did you register the JPEG codecs before trying to load the file? Have you checked DicomImage::getStatus()? Just for grins try this code if that doesn't get you somewhere.
Code: Select all
//-------------------------------------------------------------------------------------------------
// DCMTK Includes
//-------------------------------------------------------------------------------------------------
#include "dcmtk/config/osconfig.h"
#define INCLUDE_CSTDIO
#define INCLUDE_CSTRING
#include "dcmtk/ofstd/ofstdinc.h"
#include "dcmtk/dcmdata/dctk.h" /* for various dcmdata headers */
#include "dcmtk/dcmdata/dcdebug.h" /* for SetDebugLevel */
#include "dcmtk/dcmimgle/dcmimage.h" /* for DicomImage */
#include "dcmtk/dcmimage/diregist.h" /* include to support color images */
#include "dcmtk/dcmdata/dcrledrg.h" /* for DcmRLEDecoderRegistration */
#include "dcmtk/dcmjpeg/djdecode.h" /* for dcmjpeg decoders */
#include "dcmtk/dcmjpeg/dipijpeg.h" /* for dcmimage JPEG plugin */
//-------------------------------------------------------------------------------------------------
// Main
//-------------------------------------------------------------------------------------------------
int main(int argc, char* argv[]) {
DcmRLEDecoderRegistration::registerCodecs();
DJDecoderRegistration::registerCodecs();
DcmFileFormat file;
OFCondition status = file.loadFile("C:\\dicom\\test.dcm");
if (status.good()){
DicomImage image(file.getDataset(), EXS_Unknown);
// or DicomImage image("C:\\dicom\\test.dcm");
if (image.getStatus() == EIS_Normal) {
image.setMinMaxWindow();
image.writeBMP("C:\\dicom\\test.bmp", 24);
}
OFString patientsName;
if (file.getDataset()->findAndGetOFString(DCM_PatientsName, patientsName).good()) {
cout << "Patient's Name: " << patientsName << endl;
} else
cerr << "Error: cannot access Patient's Name!" << endl;
} else
cerr << "Error: cannot read DICOM file (" << status.text() << ")" << endl;
return 0;
}
Who is online
Users browsing this forum: Bing [Bot] and 1 guest