Grey Level Image looking Blue (or other color)

Hey guys recurrently I get into this situation. I have a gray scale medical image, but when I load the image inside 3D slicer… the image appears BLUE!
Take a look. It is like this:

But appears like this:

Could’n find out why.
Any help is welcomed.

Leo.

Did you change the color lookup table in the -->Volumes Module -->Display -->Lookup table
image

1 Like

I guess it is a secondary capture, stored as a color image. Older ITK versions did not always read color channels correctly, but current version should work well. Does the image appear correctly if you use the latest Slicer Preview Release?

1 Like

@lassoan, @steffen-o,
I just got it. The original file is BPM… once converted to jpg or png…, it appears in GREY as it should.

If you have any practical way to do that without needing any other secondary software, but inside 3D Slicer, that would be great.

Thanks, Leo.

It seems that ITK’s BMP reader still mixes up the channels if you use transparency. You can fix the order using this code snippet:

volumeNode=slicer.util.loadVolume(r'c:\Users\andra\OneDrive\15-14-49.bmp')
a=slicer.util.arrayFromVolume(volumeNode)
a[:]=a[:,:,:,[1,2,3,0]]  # reorder color channels
slicer.util.arrayFromVolumeModified(volumeNode)

BMP is a very old file format that and transparency was never widely used or supported by applications. I would recommend to switch to the much more widely used png file format. I’ve submitted a bug report to ITK, but I will not be surprised if they don’t fix a very rarely used feature of an ancient file format.