Hello,
what I try to do is, saving the Pixel Data as 16bit per pixel to a file.
If the DICOM File is in "Explicit VR Little Endian Transfer Syntax", it is easy.
I call
The easiest way is probably to call DicomImage::getOutputData(). As for image compression, you need to register the corresponding Decoders to your application. The latter is also described in the documentation ... or have a look at the source code of "dcm2pnm".
That means you would like to avoid the application of the modality LUT transformation? This can be done by using CIF_IgnoreModalityTransformation as a flag for the DicomImage constructor.
If you would also like to avoid any alignment of the pixels (e.g. shifting or masking) or changes to the color model (in case of color images) then the DicomImage class is probably not what you want/need.
Thanks for your reply.
What I need to do is convert the dicom file to another format.
Naturally, I have to know exactly what changes are made to the raw data.
It would also be OK if the LUT transformation for example is applied, as long as I know this and can store this information (LUT was applied) somewhere.
Is there a documentation what transformations the DicomImage class might use somewhere?
Is there a documentation what transformations the DicomImage class might use somewhere?
Reading the documentation of the DicomImage class, especially the part on the getOutputData() methods, would be a good starting point.
However, if you really need a "lossless" transformation, you should limit yourself to the functionality provided by "dcmdata".
But generally this is only the case for very simple encodings, like OW data with BitsAllocated = 16, HightBit = BitsStored-1, monochrome color model and so on.
I'd have to decompress the files myself?
This depends on the compression used. If it is RLE or conventional JPEG, you just need to register the appropriate decoders and call chooseRepresentation() on the dataset. See example for JPEG compression in the documentation.