suyashkumar / dicom

⚡High Performance DICOM Medical Image Parser in Go.
MIT License
950 stars 138 forks source link

Support for RGB for pixeldata #336

Open vitalii-komenda opened 3 months ago

vitalii-komenda commented 3 months ago

Currently only gray colours are possible.

Would it be feasible to add RGB support like in pydicom

suyashkumar commented 3 months ago

Hi! For encapsulated PixelData since it's typically some form of JPEG that we decode directly it should support color. For NativePixel data we should probably revamp the way we convert the parsed dicom values to images, but it shouldn't be too bad. iirc an RGB image will just have a SamplesPerPixel value of 3 and we can just grab the RGB values to build a go image.

Another slightly annoying thing about Go images (at least for grayscale) is that they only support uint16s for grayscale images. Same for RGBA, we have uint16s for each R, G, B, A channels.

Anyway, is this something you'd be interested in contributing to?

In the current code, you'd likely need to make the updates here. You may also need to add the photomeric interpretation to the NativeFrame during parsing.

suyashkumar commented 3 months ago

Actually, something that might interfere with these changes is that I might change the way we store the data in native frames that I discovered here. But if you'd like to start, feel free to give it a try! Otherwise I'll try to take a look sometime this week or next.

suyashkumar commented 2 months ago

The changes I mentioned in the comment above have landed:https://github.com/suyashkumar/dicom/pull/315 so should be anyone should be unblocked to take a peek at this