Skip to content

Can't get well plate information from OMEXML #167

@JKelle

Description

@JKelle

I'm not able to get plate or well information from the OMEXML object. I tried with a couple operetta format well plate images and an InCELL format image, both have this behavior. Here is a minimal example using one of the sample xml file downloaded from https://downloads.openmicroscopy.org/images/OME-XML/2016-06/one-screen-one-plate-four-wells.ome.xml

import bioformats
import javabridge

javabridge.start_vm(class_path=bioformats.JARS, run_headless=True)

# file downloaded from https://downloads.openmicroscopy.org/images/OME-XML/2016-06/one-screen-one-plate-four-wells.ome.xml
path = "one-screen-one-plate-four-wells.ome.xml"
with open(path) as f:
    raw_xml_string = f.read()
xml = bioformats.OMEXML(raw_xml_string)
print("number of plates:", len(xml.plates))
print(f"{xml.plates.ns=}")

javabridge.kill_vm()

The output of this script is

$ python plates_example.py
number of plates: 0
xml.plates.ns={'ome': 'http://www.openmicroscopy.org/Schemas/OME/2016-06', 'sa': None, 'spw': None}

I'm trying to iterate over the Wells to get each one's Row, Column, and Image IDs. Am I not using the xml object correctly, or is this a python-bioformats bug with parsing the tags from the xml?

Here is the content of the downloaded xml file mentioned above. It clearly has a Plate tag and several Well tags.

<?xml version="1.0" encoding="UTF-8"?>
<OME 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">
  <Plate ID="Plate:1">
    <Description>Plate 1 description.</Description>
    <Well ID="Well:1.1.1" Column="1" Row="1">
      <WellSample ID="WellSample:1.1.1.1" Index="1">
        <ImageRef ID="Image:0"/>
      </WellSample>
      <WellSample ID="WellSample:1.1.1.2" Index="5">
        <ImageRef ID="Image:1"/>
      </WellSample>
      <ReagentRef ID="Reagent:1"/>
    </Well>
    <Well ID="Well:1.2.1" Column="2" Row="1">
      <WellSample ID="WellSample:1.2.1.1" Index="2">
        <ImageRef ID="Image:2"/>
      </WellSample>
      <WellSample ID="WellSample:1.2.1.2" Index="6">
        <ImageRef ID="Image:3"/>
      </WellSample>
      <ReagentRef ID="Reagent:1"/>
    </Well>
    <Well ID="Well:1.1.2" Column="1" Row="2">
      <WellSample ID="WellSample:1.1.2.1" Index="3">
        <ImageRef ID="Image:4"/>
      </WellSample>
      <WellSample ID="WellSample:1.1.2.2" Index="7">
        <ImageRef ID="Image:5"/>
      </WellSample>
      <WellSample ID="WellSample:1.1.2.3" Index="11">
        <ImageRef ID="Image:6"/>
      </WellSample>
      <WellSample ID="WellSample:1.1.2.4" Index="15">
        <ImageRef ID="Image:7"/>
      </WellSample>
      <WellSample ID="WellSample:1.1.2.5" Index="19">
        <ImageRef ID="Image:8"/>
      </WellSample>
      <ReagentRef ID="Reagent:1"/>
    </Well>
    <Well ID="Well:1.2.2" Column="2" Row="2">
      <WellSample ID="WellSample:1.2.2.1" Index="4">
        <ImageRef ID="Image:9"/>
      </WellSample>
      <WellSample ID="WellSample:1.2.2.2" Index="8">
        <ImageRef ID="Image:10"/>
      </WellSample>
      <ReagentRef ID="Reagent:1"/>
    </Well>
    <PlateAcquisition ID="PlateAcquisition:Plate:1:ScreenAcquisition:1"
                          StartTime="2010-02-23T12:49:30" EndTime="2010-02-23T12:50:30">
      <WellSampleRef ID="WellSample:1.1.1.1"/>
      <WellSampleRef ID="WellSample:1.2.1.1"/>
      <WellSampleRef ID="WellSample:1.1.2.1"/>
      <WellSampleRef ID="WellSample:1.2.2.1"/>
    </PlateAcquisition>
    <PlateAcquisition ID="PlateAcquisition:Plate:1:ScreenAcquisition:2"
                          StartTime="2010-02-23T12:50:30" EndTime="2010-02-23T12:51:29">
      <WellSampleRef ID="WellSample:1.1.1.2"/>
      <WellSampleRef ID="WellSample:1.2.1.2"/>
      <WellSampleRef ID="WellSample:1.1.2.2"/>
      <WellSampleRef ID="WellSample:1.2.2.2"/>
    </PlateAcquisition>
  </Plate>
  <Screen ID="Screen:1" ProtocolDescription="" ProtocolIdentifier="" ReagentSetDescription=""
              ReagentSetIdentifier="" Name="" Type="">
    <Description/>
    <Reagent ID="Reagent:1" Name="" ReagentIdentifier="">
      <Description/>
    </Reagent>
    <PlateRef ID="Plate:1"/>
  </Screen>
  <Image ID="Image:0" Name="6x6x1x8-swatch.tif">
    <AcquisitionDate>2010-02-23T12:51:30</AcquisitionDate>
    <Pixels DimensionOrder="XYCZT" ID="Pixels:0:0" PhysicalSizeX="10000.0"
                PhysicalSizeY="10000.0" Type="uint8" SizeC="1" SizeT="1" SizeX="6" SizeY="4" SizeZ="1">
      <Channel Color="-2147483648" ID="Channel:0"/>
      <BinData BigEndian="false" Length="32"
                   >/wCrzur//wB5oMPi/wBIbJO3AP8ePGCF</BinData>
    </Pixels>
  </Image>
  <Image ID="Image:1" Name="6x6x1x8-swatch.tif-1">
    <AcquisitionDate>2010-02-23T12:51:30</AcquisitionDate>
    <Pixels DimensionOrder="XYCZT" ID="Pixels:1:0" PhysicalSizeX="10000.0"
                PhysicalSizeY="10000.0" Type="uint8" SizeC="1" SizeT="1" SizeX="6" SizeY="4" SizeZ="1">
      <Channel Color="-2147483648" ID="Channel:1"/>
      <BinData BigEndian="false" Length="32"
                   >/wCrzur//wB5oMPi/wBIbJO3AP8ePGCF</BinData>
    </Pixels>
  </Image>
  <Image ID="Image:2" Name="6x6x1x8-swatch.tif-2">
    <AcquisitionDate>2010-02-23T12:51:30</AcquisitionDate>
    <Pixels DimensionOrder="XYCZT" ID="Pixels:2:0" PhysicalSizeX="10000.0"
                PhysicalSizeY="10000.0" Type="uint8" SizeC="1" SizeT="1" SizeX="6" SizeY="4" SizeZ="1">
      <Channel Color="-2147483648" ID="Channel:2"/>
      <BinData BigEndian="false" Length="32"
                   >/wCrzur//wB5oMPi/wBIbJO3AP8ePGCF</BinData>
    </Pixels>
  </Image>
  <Image ID="Image:3" Name="6x6x1x8-swatch.tif-3">
    <AcquisitionDate>2010-02-23T12:51:30</AcquisitionDate>
    <Pixels DimensionOrder="XYCZT" ID="Pixels:3:0" PhysicalSizeX="10000.0"
                PhysicalSizeY="10000.0" Type="uint8" SizeC="1" SizeT="1" SizeX="6" SizeY="4" SizeZ="1">
      <Channel Color="-2147483648" ID="Channel:3"/>
      <BinData BigEndian="false" Length="32"
                   >/wCrzur//wB5oMPi/wBIbJO3AP8ePGCF</BinData>
    </Pixels>
  </Image>
  <Image ID="Image:4" Name="6x6x1x8-swatch.tif-4">
    <AcquisitionDate>2010-02-23T12:51:30</AcquisitionDate>
    <Pixels DimensionOrder="XYCZT" ID="Pixels:4:0" PhysicalSizeX="10000.0"
                PhysicalSizeY="10000.0" Type="uint8" SizeC="1" SizeT="1" SizeX="6" SizeY="4" SizeZ="1">
      <Channel Color="-2147483648" ID="Channel:4"/>
      <BinData BigEndian="false" Length="32"
                   >/wCrzur//wB5oMPi/wBIbJO3AP8ePGCF</BinData>
    </Pixels>
  </Image>
  <Image ID="Image:5" Name="6x6x1x8-swatch.tif-5">
    <AcquisitionDate>2010-02-23T12:51:30</AcquisitionDate>
    <Pixels DimensionOrder="XYCZT" ID="Pixels:5:0" PhysicalSizeX="10000.0"
                PhysicalSizeY="10000.0" Type="uint8" SizeC="1" SizeT="1" SizeX="6" SizeY="4" SizeZ="1">
      <Channel Color="-2147483648" ID="Channel:5"/>
      <BinData BigEndian="false" Length="32"
                   >/wCrzur//wB5oMPi/wBIbJO3AP8ePGCF</BinData>
    </Pixels>
  </Image>
  <Image ID="Image:6" Name="6x6x1x8-swatch.tif-6">
    <AcquisitionDate>2010-02-23T12:51:30</AcquisitionDate>
    <Pixels DimensionOrder="XYCZT" ID="Pixels:6:0" PhysicalSizeX="10000.0"
                PhysicalSizeY="10000.0" Type="uint8" SizeC="1" SizeT="1" SizeX="6" SizeY="4" SizeZ="1">
      <Channel Color="-2147483648" ID="Channel:6"/>
      <BinData BigEndian="false" Length="32"
                   >/wCrzur//wB5oMPi/wBIbJO3AP8ePGCF</BinData>
    </Pixels>
  </Image>
  <Image ID="Image:7" Name="6x6x1x8-swatch.tif-7">
    <AcquisitionDate>2010-02-23T12:51:30</AcquisitionDate>
    <Pixels DimensionOrder="XYCZT" ID="Pixels:7:0" PhysicalSizeX="10000.0"
                PhysicalSizeY="10000.0" Type="uint8" SizeC="1" SizeT="1" SizeX="6" SizeY="4" SizeZ="1">
      <Channel Color="-2147483648" ID="Channel:7"/>
      <BinData BigEndian="false" Length="32"
                   >/wCrzur//wB5oMPi/wBIbJO3AP8ePGCF</BinData>
    </Pixels>
  </Image>
  <Image ID="Image:8" Name="6x6x1x8-swatch.tif-8">
    <AcquisitionDate>2010-02-23T12:51:30</AcquisitionDate>
    <Pixels DimensionOrder="XYCZT" ID="Pixels:8:0" PhysicalSizeX="10000.0"
                PhysicalSizeY="10000.0" Type="uint8" SizeC="1" SizeT="1" SizeX="6" SizeY="4" SizeZ="1">
      <Channel Color="-2147483648" ID="Channel:8"/>
      <BinData BigEndian="false" Length="32"
                   >/wCrzur//wB5oMPi/wBIbJO3AP8ePGCF</BinData>
    </Pixels>
  </Image>
  <Image ID="Image:9" Name="6x6x1x8-swatch.tif-9">
    <AcquisitionDate>2010-02-23T12:51:30</AcquisitionDate>
    <Pixels DimensionOrder="XYCZT" ID="Pixels:9:0" PhysicalSizeX="10000.0"
                PhysicalSizeY="10000.0" Type="uint8" SizeC="1" SizeT="1" SizeX="6" SizeY="4" SizeZ="1">
      <Channel Color="-2147483648" ID="Channel:9"/>
      <BinData BigEndian="false" Length="32"
                   >/wCrzur//wB5oMPi/wBIbJO3AP8ePGCF</BinData>
    </Pixels>
  </Image>
  <Image ID="Image:10" Name="6x6x1x8-swatch.tif-10">
    <AcquisitionDate>2010-02-23T12:51:30</AcquisitionDate>
    <Pixels DimensionOrder="XYCZT" ID="Pixels:10:0" PhysicalSizeX="10000.0"
                PhysicalSizeY="10000.0" Type="uint8" SizeC="1" SizeT="1" SizeX="6" SizeY="4" SizeZ="1">
      <Channel Color="-2147483648" ID="Channel:10"/>
      <BinData BigEndian="false" Length="32"
                   >/wCrzur//wB5oMPi/wBIbJO3AP8ePGCF</BinData>
    </Pixels>
  </Image>
</OME>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions