[ome-devel] Help with writing OME-TIFF

Sebastien Besson (Staff) s.besson at dundee.ac.uk
Thu Jul 28 22:43:52 BST 2016


Hi Stuart,

As Curtis nicely described, some of the elements in your OME-XML header
are invalid. Thus Bio-Formats will read your file as a regular multi-page TIFF
(using T as the dimension to concatenate all planes) instead of an OME-TIFF.

In general, the Bio-Formats command line tools [1] might provide utilities to
help you debugging and validating the content of your OME-XML. For instance,
you should be able to run the following on your generated OME-TIFF:

$ tiffcomment xyz-converted.ome.tiff | xmlvalid

to extract the OME-XML header and list all the validation errors.

Let us know if anything is unclear,
Sebastien

[1] http://www.openmicroscopy.org/site/support/bio-formats5.1/users/comlinetools/index.html

On 28 Jul 2016, at 22:32, Curtis Rueden <ctrueden at wisc.edu<mailto:ctrueden at wisc.edu>> wrote:

Hi Stuart,

> I'm attempting to add support for OME-TIFF export to my software
> (ilastik).

Wonderful! :-)

> - The original file has dimensions XYCZT, but 'C' and 'T' have size 1.
> In my version, I just omit those axes.  Is that permitted under the
> standard?

Nope. According to the OME-XML schema, the DimensionOrder attribute is an enumeration which must have a valid five-digit value; see:

https://www.openmicroscopy.org/Schemas/Documentation/Generated/OME-2016-06/ome_xsd.html#Pixels_DimensionOrder

Instead of writing "XYZ" try writing "XYZCT" (or "XYZTC"; doesn't really matter since you only have 1 C and 1 T position).

> - The original file has 'ROI' entries in the metadata.  I'm omitting
> that information.  Is that standards-compliant?

It is not required to include ROI information. See the "minimum specification" for a compliant file:

http://www.openmicroscopy.org/site/support/ome-model/specifications/minimum.html

Note that your XML is much more complex than necessary, because you are writing a single-file OME-TIFF. As long as your IFDs are in Z-ascending order, you can simply write:


<?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: http://www.openmicroscopy.org/site/support/ome-model/ome-tiff/. -->
<OME xmlns="http://www.openmicroscopy.org/Schemas/OME/2015-01" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openmicroscopy.org/Schemas/OME/2015-01 http://www.openmicroscopy.org/Schemas/OME/2015-01/ome.xsd">
  <Image ID="Image:0" Name="exported-data">
    <Pixels BigEndian="true" DimensionOrder="XYZCT" ID="Pixels:0" SizeX="400" SizeY="300" SizeZ="4" Type="uint8">
      <Channel ID="Channel0:0" SamplesPerPixel="1">
        <LightPath />
      </Channel>
      <TiffData />
    </Pixels>
  </Image>
</OME>

And the mapping from IFDs to ZCT coordinates will be inferred as desired.

Lastly, you saw the OME-TIFF specification page, right?
http://www.openmicroscopy.org/site/support/ome-model/ome-tiff/specification.html

Regards,
Curtis

--
Curtis Rueden
LOCI software architect - http://loci.wisc.edu/software
ImageJ2 lead, Fiji maintainer - http://imagej.net/User:Rueden
Did you know ImageJ has a forum? http://forum.imagej.net/


On Thu, Jul 28, 2016 at 4:02 PM, Berg, Stuart <bergs at janelia.hhmi.org<mailto:bergs at janelia.hhmi.org>> wrote:
Greetings,

I'm attempting to add support for OME-TIFF export to my software (ilastik).  Since writing the OME-TIFF header seems simple enough (for simple cases, anyway), I want to avoid using an external library like python-bioformats.

But apparently I'm doing something wrong, because the files I'm producing can't be read correctly by the Fiji BioFormats plugin.  I'd appreciate it if someone can tell me what I'm doing wrong.  I've attached two files.  One is a valid OME-TIFF file, and the other is my "converted" version of it (same data, but the XML header was written by my software).  The OME header from my version is pasted below.

When I use the BioFormats Importer to read my 'converted' file, the header seems to be ignored, and instead BioFormats guesses that the file is a T-stack, not a Z-stack as I intended.

Questions:
- The original file has dimensions XYCZT, but 'C' and 'T' have size 1.  In my version, I just omit those axes.  Is that permitted under the standard?
- The original file has 'ROI' entries in the metadata.  I'm omitting that information.  Is that standards-compliant?

Best regards,
Stuart

PS — The

Here's the header I'm writing.  If you spot any obvious errors, let me know.

<?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: http://www.openmicroscopy.org/site/support/ome-model/ome-tiff/. -->
<OME xmlns="http://www.openmicroscopy.org/Schemas/OME/2015-01" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" UUID="urn:uuid:5cb6938c-5503-11e6-ade4-a45e60e933fb" xsi:schemaLocation="http://www.openmicroscopy.org/Schemas/OME/2015-01 http://www.openmicroscopy.org/Schemas/OME/2015-01/ome.xsd">
  <Image ID="Image:0" Name="exported-data">
    <Pixels BigEndian="true" DimensionOrder="XYZ" ID="Pixels:0" SizeX="400" SizeY="300" SizeZ="4" Type="uint8">
      <Channel ID="Channel0:0" SamplesPerPixel="1">
        <LightPath />
      </Channel>
      <TiffData FirstZ="0" IFD="0" PlaneCount="1">
        <UUID FileName="xyz-converted.ome.tiff">urn:uuid:5cb6938c-5503-11e6-ade4-a45e60e933fb</UUID>
      </TiffData>
      <TiffData FirstZ="1" IFD="1" PlaneCount="1">
        <UUID FileName="xyz-converted.ome.tiff">urn:uuid:5cb6938c-5503-11e6-ade4-a45e60e933fb</UUID>
      </TiffData>
      <TiffData FirstZ="2" IFD="2" PlaneCount="1">
        <UUID FileName="xyz-converted.ome.tiff">urn:uuid:5cb6938c-5503-11e6-ade4-a45e60e933fb</UUID>
      </TiffData>
      <TiffData FirstZ="3" IFD="3" PlaneCount="1">
        <UUID FileName="xyz-converted.ome.tiff">urn:uuid:5cb6938c-5503-11e6-ade4-a45e60e933fb</UUID>
      </TiffData>
    </Pixels>
  </Image>
</OME>

_______________________________________________
ome-devel mailing list
ome-devel at lists.openmicroscopy.org.uk<mailto:ome-devel at lists.openmicroscopy.org.uk>
http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel


_______________________________________________
ome-devel mailing list
ome-devel at lists.openmicroscopy.org.uk<mailto:ome-devel at lists.openmicroscopy.org.uk>
http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel


The University of Dundee is a registered Scottish Charity, No: SC015096
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-devel/attachments/20160728/b54d93b7/attachment.html>


More information about the ome-devel mailing list