hms-dbmi / viv

Library for multiscale visualization of high-resolution multiplexed bioimaging data on the web. Directly renders Zarr and OME-TIFF.
http://avivator.gehlenborglab.org
MIT License
285 stars 46 forks source link

Use "Color mode" OME-XML field in guessRgb function #474

Open keller-mark opened 3 years ago

keller-mark commented 3 years ago

User story

I created a 3-channel 8-bit Tiff using ImageJ and selected "Grayscale" as the color mode when I created the hyperstack. However Viv (via Vitessce) thinks it is an RGB image due to the 3 channels.

Preferred solution

Use the "Color mode" OME-XML field in the guessRgb function if it is available.

Screen Shot 2021-07-28 at 2 33 47 PM

ilan-gold commented 3 years ago

@keller-mark Is this a part of the OMEXML data model? Could you provide the whole OMEXML?

keller-mark commented 3 years ago

I am not sure if Color mode is part of the OME-XML data model. Alternatively, is there a way to explicitly prevent the RGB assumption for 3-channel 8-bit images (and available in Vitessce)? I tried specifying the channels and selections separately in spatialRasterLayers but it still renders as RGB.

This is the full OME-XML: ```xml urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6 urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6 urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6 urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6 urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6 urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6 urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6 urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6 urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6 urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6 urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6 urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6 urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6 urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6 urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6 urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6 urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6 urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6 urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6 urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6 urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6 urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6 urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6 urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6 urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6 urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6 urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6 BitsPerSample 8 XResolution 1.0 hyperstack true ImageJ 1.53c MetaDataPhotometricInterpretation Monochrome SamplesPerPixel 1 NewSubfileType 0 ImageWidth 5721 NumberOfChannels 1 ResolutionUnit None ImageLength 9392 PhotometricInterpretation BlackIsZero Color mode grayscale YResolution 1.0 MetaMorph no loop false Compression Uncompressed ```
keller-mark commented 3 years ago

Maybe alternatively, if the 3 channels have Names, it should not be assumed to be RGB?

keller-mark commented 3 years ago

(I can also prevent the behavior by converting my image to 16-bit, but this makes the file much larger)

ilan-gold commented 3 years ago

No I think it's time to create some sort of option for showing or hiding the controls if the data is not interleaved but 3 channels/8bit. You're not the first person to bring this up.

ilan-gold commented 3 years ago

My concern about looking at the names is if people name things something like "red" or "g"