I have a few questions regarding Overlays in DCMTK. Class DicomImage provides a few functions for reading Overlays. My goal is to render an image of an Overlay (it might be in any format, i.e. bmp).
I'm using internal library for creating image objects for further rendering. I cannot say much about this library, but it's main function takes following parameters: width, height, channels, colorspace, and I'm just copying (width * height) bytes from buffer pointed by dcmImage->getFullOverlayData(0, width, height) to Image object provided by library. This approach works for manually reading images from PixelData tag.
Unfortunately, overlay image rendered that way is distorted and looks as follows:
![Image](https://i.ibb.co/nD7Gp1q/overlay-bad.png)
The original image looks like this:
![Image](https://i.ibb.co/pZHFRJB/overlay-good.png)
Could you please point me to the right direction? How to interpret data obtained from getFullOverlayData?
Another note:
I did some experiments with OverlayData (grp number 6000, so just a 'plane 0'). Whenever I read tag value of OverlayData as string and print it, i receive a string in format
"ffff\ffff\ffff\ffff\ffff\ffff\ffff\ffff\ffff\ffff\ffff\ffff\ffff\ffff\
\ffff\ffff\ffff\ffff\ffff\ffff\ffff\ffff\ffff\ffff\ffff\ffff\ffff\f\
fff\ffff\ffff\ffff\fffe\ffff"
which suggests, that each pixel is represented by 2 bytes (4 hexadecimal digits), but VR of "OverlayData" is "OB".
I have printed first K pixels of getFullOverlayData buffer (in C++, firstly casting buffer to uint_16*, and then by casting *(buffer + index) value to int) and it differs from the values represented by mentioned above string (the one readed from OverlayData as string).
Edit:
Another questions:
1. DICOM documentation states, that VR of OverlayData is "OB or OW", but reading VR name of OverlayData in DCMTK returns "OB" (I use DcmTag.getVR().gerValidVRName()).
2. Reading normal 2D Images via DCMTK and my internal library works correctly, but whenever I want to render image with Overlays by using DicomImage->showAllOverlays() function, the overlays rendered are also distorted (in the same way, as on image above).
Apologies for chaos in this post and thank you in advance for response,
Michal