Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
keller-mark opened this issue Jul 28, 2021 · 6 comments
Open

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

keller-mark opened this issue Jul 28, 2021 · 6 comments

Comments

@keller-mark
Copy link
Member

keller-mark commented Jul 28, 2021

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
Copy link
Collaborator

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

@keller-mark
Copy link
Member Author

keller-mark commented Jul 28, 2021

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 version="1.0" encoding="utf-8"?>
<!-- Warning: this comment is an OME-XML metadata block, which contains crucial dimensional parameters and other important metadata. Please edit cautiously (if at all), and back up the original data before doing so. For more information, see the OME-TIFF web site: https://docs.openmicroscopy.org/latest/ome-model/ome-tiff/. -->
<OME Creator="OME Bio-Formats 6.6.1" UUID="urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6"
    xmlns="http://www.openmicroscopy.org/Schemas/OME/2016-06" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.openmicroscopy.org/Schemas/OME/2016-06 http://www.openmicroscopy.org/Schemas/OME/2016-06/ome.xsd">
    <Image ID="Image:0" Name="selected.tif">
        <Description />
        <Pixels BigEndian="true" DimensionOrder="XYCZT" ID="Pixels:0" Interleaved="false" PhysicalSizeX="1.0"
            PhysicalSizeXUnit="µm" PhysicalSizeY="1.0" PhysicalSizeYUnit="µm" SignificantBits="8" SizeC="3" SizeT="1"
            SizeX="5721" SizeY="9392" SizeZ="9" Type="uint8">
            <Channel ID="Channel:0:0" Name="DAPI" SamplesPerPixel="1">
                <LightPath />
            </Channel>
            <Channel ID="Channel:0:1" Name="Membrane" SamplesPerPixel="1">
                <LightPath />
            </Channel>
            <Channel ID="Channel:0:2" Name="PolyA" SamplesPerPixel="1">
                <LightPath />
            </Channel>
            <TiffData FirstC="0" FirstT="0" FirstZ="0" IFD="0" PlaneCount="1">
                <UUID FileName="selected.ome.tiff">urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6</UUID>
            </TiffData>
            <TiffData FirstC="1" FirstT="0" FirstZ="0" IFD="1" PlaneCount="1">
                <UUID FileName="selected.ome.tiff">urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6</UUID>
            </TiffData>
            <TiffData FirstC="2" FirstT="0" FirstZ="0" IFD="2" PlaneCount="1">
                <UUID FileName="selected.ome.tiff">urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6</UUID>
            </TiffData>
            <TiffData FirstC="0" FirstT="0" FirstZ="1" IFD="3" PlaneCount="1">
                <UUID FileName="selected.ome.tiff">urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6</UUID>
            </TiffData>
            <TiffData FirstC="1" FirstT="0" FirstZ="1" IFD="4" PlaneCount="1">
                <UUID FileName="selected.ome.tiff">urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6</UUID>
            </TiffData>
            <TiffData FirstC="2" FirstT="0" FirstZ="1" IFD="5" PlaneCount="1">
                <UUID FileName="selected.ome.tiff">urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6</UUID>
            </TiffData>
            <TiffData FirstC="0" FirstT="0" FirstZ="2" IFD="6" PlaneCount="1">
                <UUID FileName="selected.ome.tiff">urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6</UUID>
            </TiffData>
            <TiffData FirstC="1" FirstT="0" FirstZ="2" IFD="7" PlaneCount="1">
                <UUID FileName="selected.ome.tiff">urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6</UUID>
            </TiffData>
            <TiffData FirstC="2" FirstT="0" FirstZ="2" IFD="8" PlaneCount="1">
                <UUID FileName="selected.ome.tiff">urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6</UUID>
            </TiffData>
            <TiffData FirstC="0" FirstT="0" FirstZ="3" IFD="9" PlaneCount="1">
                <UUID FileName="selected.ome.tiff">urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6</UUID>
            </TiffData>
            <TiffData FirstC="1" FirstT="0" FirstZ="3" IFD="10" PlaneCount="1">
                <UUID FileName="selected.ome.tiff">urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6</UUID>
            </TiffData>
            <TiffData FirstC="2" FirstT="0" FirstZ="3" IFD="11" PlaneCount="1">
                <UUID FileName="selected.ome.tiff">urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6</UUID>
            </TiffData>
            <TiffData FirstC="0" FirstT="0" FirstZ="4" IFD="12" PlaneCount="1">
                <UUID FileName="selected.ome.tiff">urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6</UUID>
            </TiffData>
            <TiffData FirstC="1" FirstT="0" FirstZ="4" IFD="13" PlaneCount="1">
                <UUID FileName="selected.ome.tiff">urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6</UUID>
            </TiffData>
            <TiffData FirstC="2" FirstT="0" FirstZ="4" IFD="14" PlaneCount="1">
                <UUID FileName="selected.ome.tiff">urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6</UUID>
            </TiffData>
            <TiffData FirstC="0" FirstT="0" FirstZ="5" IFD="15" PlaneCount="1">
                <UUID FileName="selected.ome.tiff">urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6</UUID>
            </TiffData>
            <TiffData FirstC="1" FirstT="0" FirstZ="5" IFD="16" PlaneCount="1">
                <UUID FileName="selected.ome.tiff">urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6</UUID>
            </TiffData>
            <TiffData FirstC="2" FirstT="0" FirstZ="5" IFD="17" PlaneCount="1">
                <UUID FileName="selected.ome.tiff">urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6</UUID>
            </TiffData>
            <TiffData FirstC="0" FirstT="0" FirstZ="6" IFD="18" PlaneCount="1">
                <UUID FileName="selected.ome.tiff">urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6</UUID>
            </TiffData>
            <TiffData FirstC="1" FirstT="0" FirstZ="6" IFD="19" PlaneCount="1">
                <UUID FileName="selected.ome.tiff">urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6</UUID>
            </TiffData>
            <TiffData FirstC="2" FirstT="0" FirstZ="6" IFD="20" PlaneCount="1">
                <UUID FileName="selected.ome.tiff">urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6</UUID>
            </TiffData>
            <TiffData FirstC="0" FirstT="0" FirstZ="7" IFD="21" PlaneCount="1">
                <UUID FileName="selected.ome.tiff">urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6</UUID>
            </TiffData>
            <TiffData FirstC="1" FirstT="0" FirstZ="7" IFD="22" PlaneCount="1">
                <UUID FileName="selected.ome.tiff">urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6</UUID>
            </TiffData>
            <TiffData FirstC="2" FirstT="0" FirstZ="7" IFD="23" PlaneCount="1">
                <UUID FileName="selected.ome.tiff">urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6</UUID>
            </TiffData>
            <TiffData FirstC="0" FirstT="0" FirstZ="8" IFD="24" PlaneCount="1">
                <UUID FileName="selected.ome.tiff">urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6</UUID>
            </TiffData>
            <TiffData FirstC="1" FirstT="0" FirstZ="8" IFD="25" PlaneCount="1">
                <UUID FileName="selected.ome.tiff">urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6</UUID>
            </TiffData>
            <TiffData FirstC="2" FirstT="0" FirstZ="8" IFD="26" PlaneCount="1">
                <UUID FileName="selected.ome.tiff">urn:uuid:1ecf7448-56c5-45cb-ab2f-492b6e455ce6</UUID>
            </TiffData>
        </Pixels>
    </Image>
    <StructuredAnnotations>
        <XMLAnnotation ID="Annotation:0" Namespace="openmicroscopy.org/OriginalMetadata">
            <Value>
                <OriginalMetadata>
                    <Key>BitsPerSample</Key>
                    <Value>8</Value>
                </OriginalMetadata>
            </Value>
        </XMLAnnotation>
        <XMLAnnotation ID="Annotation:1" Namespace="openmicroscopy.org/OriginalMetadata">
            <Value>
                <OriginalMetadata>
                    <Key>XResolution</Key>
                    <Value>1.0</Value>
                </OriginalMetadata>
            </Value>
        </XMLAnnotation>
        <XMLAnnotation ID="Annotation:2" Namespace="openmicroscopy.org/OriginalMetadata">
            <Value>
                <OriginalMetadata>
                    <Key>hyperstack</Key>
                    <Value>true</Value>
                </OriginalMetadata>
            </Value>
        </XMLAnnotation>
        <XMLAnnotation ID="Annotation:3" Namespace="openmicroscopy.org/OriginalMetadata">
            <Value>
                <OriginalMetadata>
                    <Key>ImageJ</Key>
                    <Value>1.53c</Value>
                </OriginalMetadata>
            </Value>
        </XMLAnnotation>
        <XMLAnnotation ID="Annotation:4" Namespace="openmicroscopy.org/OriginalMetadata">
            <Value>
                <OriginalMetadata>
                    <Key>MetaDataPhotometricInterpretation</Key>
                    <Value>Monochrome</Value>
                </OriginalMetadata>
            </Value>
        </XMLAnnotation>
        <XMLAnnotation ID="Annotation:5" Namespace="openmicroscopy.org/OriginalMetadata">
            <Value>
                <OriginalMetadata>
                    <Key>SamplesPerPixel</Key>
                    <Value>1</Value>
                </OriginalMetadata>
            </Value>
        </XMLAnnotation>
        <XMLAnnotation ID="Annotation:6" Namespace="openmicroscopy.org/OriginalMetadata">
            <Value>
                <OriginalMetadata>
                    <Key>NewSubfileType</Key>
                    <Value>0</Value>
                </OriginalMetadata>
            </Value>
        </XMLAnnotation>
        <XMLAnnotation ID="Annotation:7" Namespace="openmicroscopy.org/OriginalMetadata">
            <Value>
                <OriginalMetadata>
                    <Key>ImageWidth</Key>
                    <Value>5721</Value>
                </OriginalMetadata>
            </Value>
        </XMLAnnotation>
        <XMLAnnotation ID="Annotation:8" Namespace="openmicroscopy.org/OriginalMetadata">
            <Value>
                <OriginalMetadata>
                    <Key>NumberOfChannels</Key>
                    <Value>1</Value>
                </OriginalMetadata>
            </Value>
        </XMLAnnotation>
        <XMLAnnotation ID="Annotation:9" Namespace="openmicroscopy.org/OriginalMetadata">
            <Value>
                <OriginalMetadata>
                    <Key>ResolutionUnit</Key>
                    <Value>None</Value>
                </OriginalMetadata>
            </Value>
        </XMLAnnotation>
        <XMLAnnotation ID="Annotation:10" Namespace="openmicroscopy.org/OriginalMetadata">
            <Value>
                <OriginalMetadata>
                    <Key>ImageLength</Key>
                    <Value>9392</Value>
                </OriginalMetadata>
            </Value>
        </XMLAnnotation>
        <XMLAnnotation ID="Annotation:11" Namespace="openmicroscopy.org/OriginalMetadata">
            <Value>
                <OriginalMetadata>
                    <Key>PhotometricInterpretation</Key>
                    <Value>BlackIsZero</Value>
                </OriginalMetadata>
            </Value>
        </XMLAnnotation>
        <XMLAnnotation ID="Annotation:12" Namespace="openmicroscopy.org/OriginalMetadata">
            <Value>
                <OriginalMetadata>
                    <Key>Color mode</Key>
                    <Value>grayscale</Value>
                </OriginalMetadata>
            </Value>
        </XMLAnnotation>
        <XMLAnnotation ID="Annotation:13" Namespace="openmicroscopy.org/OriginalMetadata">
            <Value>
                <OriginalMetadata>
                    <Key>YResolution</Key>
                    <Value>1.0</Value>
                </OriginalMetadata>
            </Value>
        </XMLAnnotation>
        <XMLAnnotation ID="Annotation:14" Namespace="openmicroscopy.org/OriginalMetadata">
            <Value>
                <OriginalMetadata>
                    <Key>MetaMorph</Key>
                    <Value>no</Value>
                </OriginalMetadata>
            </Value>
        </XMLAnnotation>
        <XMLAnnotation ID="Annotation:15" Namespace="openmicroscopy.org/OriginalMetadata">
            <Value>
                <OriginalMetadata>
                    <Key>loop</Key>
                    <Value>false</Value>
                </OriginalMetadata>
            </Value>
        </XMLAnnotation>
        <XMLAnnotation ID="Annotation:16" Namespace="openmicroscopy.org/OriginalMetadata">
            <Value>
                <OriginalMetadata>
                    <Key>Compression</Key>
                    <Value>Uncompressed</Value>
                </OriginalMetadata>
            </Value>
        </XMLAnnotation>
    </StructuredAnnotations>
</OME>

@keller-mark
Copy link
Member Author

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

@keller-mark
Copy link
Member Author

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

@ilan-gold
Copy link
Collaborator

ilan-gold commented Jul 29, 2021

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
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants