Closed GeertLitjens closed 2 years ago
Thanks for the bug report. Yes the openslide data comes as ARGB. The jpeg-encoder can handle (ignore) the extra channel by setting the input color space. I have to test if the jpeg2000 does the same (there is a colorspace flag). Otherwise we must strip it before sending it to the encoder. It is not allowed to have anything else than 1 or 3 SamplesPerPixel.
Took me a while to figure this out, but when converting from OpenSlide and encoding to JPEG2000, the DICOM Tag SamplesPerPixel is set to 3, however, OpenSlide is returning ARGB and this is also stored in the JPEG2000-encoded. This makes it challenging to allocate the correct buffers in third-party applications. There are two solutions, which is why I didn't fix it myself:
As I don't know very well if DICOM handles an alpha channel very well, I thought stripping it might be better?