marksgraham / OCT-Converter

Tools for extracting the raw optical coherence tomography (OCT) and fundus data from proprietary file formats.
https://pypi.org/project/oct-converter/
MIT License
200 stars 72 forks source link

Fix fundus RGB axes in fda #105

Closed drombas closed 1 year ago

drombas commented 1 year ago

Closes #104

Sets fundus R and B channels to the right order.

marksgraham commented 1 year ago

Hey,

I've realised the reason I hadn't noticed the bug was because cv2 assumes BGR channel order, instead of the more conventional RGB. So when you save the fundus as an image to disk it looks ok.

So along with this change we need to add

# change channel order from RGB to BGR and save with cv2
image = cv2.cvtColor(self.image, cv2.COLOR_RGB2BGR)
cv2.imwrite(filepath, image)

to here

drombas commented 1 year ago

Thanks @marksgraham. Just to check: fundus images from other file formats were in RGB and were saved correctly by cv2 before?

marksgraham commented 1 year ago

Hi @drombas

I've just updated fds to store as RGB, thanks for the reminder. .e2e fundus is grayscale in the examples I have. The other reader that extracts fundus is zeissdicom, but I don't have any data with fundus I can use to check.