lossless

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
George
Posts: 52
Joined: Sun, 2023-11-12, 16:50

lossless

#1 Post by George »

Hello,

sorry for this simple question but does dcmtk tools like img2dcm and the code below perform any lossless behavior in compression for the data


DicomImage *dicomImage = new DicomImage(dicomConverted.c_str(), CIF_UsePartialAccessToPixelData, frameNumber, 1 );
if (dicomImage->getStatus() != EIS_Normal)
{
LOG("Error: Unable to load DICOM file: ");
delete dicomImage;
continue;
}

.....

if ( dicomImage->writeBMP(concat.c_str(), 24) != 1)
{
LOG("Error writing BMP: ");
}


Best Regards
George

Michael Onken
DCMTK Developer
Posts: 2051
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

Re: lossless

#2 Post by Michael Onken »

img2dcm does not apply any compression or decompression, it uses the input pixel data mostly as is.
DicomImage only uses decompression if the related decompression codecs have been registered. See dcm2pnm.cc for an example.

BR Michael

George
Posts: 52
Joined: Sun, 2023-11-12, 16:50

Re: lossless

#3 Post by George »

Hello,

I have another issue, I tried to use this file after using gdcmconv on it to decompress it and then I tried to use the previous code ( added again below ), the problem is that it printed a black image instead.

Code: Select all

DicomImage *dicomImage = new DicomImage(dicomConverted.c_str(), CIF_UsePartialAccessToPixelData, frameNumber, 1 );
if (dicomImage->getStatus() != EIS_Normal)
{
LOG("Error: Unable to load DICOM file: ");
delete dicomImage;
continue;
}

.....

if ( dicomImage->writeBMP(concat.c_str(), 24) != 1)
{
LOG("Error writing BMP: ");
}
The file is this one again:

https://drive.google.com/file/d/1Eld9fU ... drive_link

Best Regards
George

Michael Onken
DCMTK Developer
Posts: 2051
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

Re: lossless

#4 Post by Michael Onken »

Dear George,

For a a different problem, please open a different thread please (next time).

Regarding the file: Again it looks like you have not done any analysis yourself and did not look at what I answered earlier. The given file is *not* decompressed but compressed with JPEG 2000 (easy to spot by just within the first 10 lines running dcmdump on the file, as advised earlier).

Your code does not include registration any decompression codecs that would be required to decompress a DICOM file, as advised earlier.

On top, DCMTK does not support decompression of JPEG2000 images out of the box. You can add this functionality yourself or look at the "DCMJP2K" extension sold by the colleagues at OFFIS.

Since you post a lot of questions and answering these costs a substantial amount of time, I will not answer them in this frequency any more. If you require ongoing support to this extent, it is advisable to conclude a commercial support contract with a DICOM specialist.

Best regards,
Michael

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Baidu [Spider], Bing [Bot] and 1 guest