Issue is, it accuses an error of
"E: can't determine 'PhotometricInterpretation' of decompressed image
E: mandatory attribute 'PhotometricInterpretation' is missing or can't be determined"
But the Photometric interpretation is there, (MONOCHROME2)
Any hints what I could be doing wrong? Bellow a very short example that I can reproduce the issue:
Code: Select all
int main(int argc, char *argv[])
{
OFLog::configure(OFLogger::INFO_LOG_LEVEL);
std::ifstream file("/tmp/test_image.dcm", std::ios::binary);
file.seekg(0, std::ios::end);
std::streamsize size = file.tellg();
file.seekg(0, std::ios::beg);
std::vector<char> buffer(size);
if (!file.read(buffer.data(), size))
{
std::cout<<"Did not work"<<std::endl;
}
DcmInputStream* dcmInputStream = new DcmInputBufferStream();
((DcmInputBufferStream*)dcmInputStream)->setBuffer(&(buffer.front()), size);
((DcmInputBufferStream*)dcmInputStream)->setEos();
DcmFileFormat dicom_format;
dicom_format.transferInit();
dcmEnableAutomaticInputDataCorrection.set(OFTrue);
dcmAcceptOddAttributeLength.set(OFTrue);
dcmAutoDetectDatasetXfer.set(OFTrue);
dicom_format.getDataset()->read(*dcmInputStream,
EXS_JPEGProcess1TransferSyntax,
EGL_noChange,
size);
dicom_format.transferEnd();
std::cout<<"Before Image creation"<<std::endl;
DicomImage *image = new DicomImage( &dicom_format,
EXS_JPEGProcess1TransferSyntax,
CIF_UsePartialAccessToPixelData, 0, 1);
std::cout<<"After image creation... here the error already happened"<<std::endl;
if (image->getStatus() == EIS_Normal)
{
int a;
do {
DCMIMGLE_INFO("processing frame " << image->getFirstFrame() + 1 << " to "
<< image->getFirstFrame() + image->getFrameCount());
std::cin>>a;
} while (image->processNextFrames());
}
delete image;
return 0;
}
If I just read it from with DCMTK file it works perfectly. But I need to discover hwo to use DCMTK from in memory buffers. Surely I am doing something very wrong.