Page 1 of 2

OME-TIF generation and Omero Import

PostPosted: Sat Jan 15, 2011 7:30 pm
by helmerj
Until Omero does support metaXpress as a valid format, I would like to create a workaround. In order to get my metaXpress raw 16 bit tiff data imported into Omero I thought I would convert my tiff files into OME-TIFF modifying the Exif.Image.ImageDescription fields that hold the OME XML data accordingly and then import those files into Omero.

I have tried the following:

  • import a raw 16bit tif files straight out of metaXpress into Omero
  • exportted that file to OME-TIFF using the OmeroInsight export to OME-TIff function
  • take the Exif.Image.ImageDescription field and modify it
  • import back into Omero

Whatever I try, I cannot make it work. I have also tried to write the OME-XML data directly into the metaXpress files, I have used the imgcnv tool from http://www.bioimage.ucsb.edu/BioImage%20Convert to convert the files, and or write the OME header to the files.

The OME information is always ignored.

So clearly I am doing something wrong.

An example:

this is the original OME field after export from OmeroInsight which I assume will at least give a a valid OME-Tiff file with a valid minimum OME-XML field in Exif.Image.Image.Description:

Code: Select all
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- 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://ome-xml.org/wiki/OmeTiff. -->
<OME xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" UUID="urn:uuid:7066938f-2105-40a9-bb8b-34da53158d94" xsi:schemaLocation="http://www.openmicroscopy.org/Schemas/OME/2010-06 http://www.openmicroscopy.org/Schemas/OME/2010-06/ome.xsd" xmlns="http://www.openmicroscopy.org/Schemas/OME/2010-06">
    <Image ID="urn:lsid:export.openmicroscopy.org:Image:7a72efb0-60c5-4e84-97e7-e575c1bb31e1_520:1674" Name="/home/helmerj/rails/metaxpress/transfer-script/input/20100825_rbilly_A01_w1E3AF3878-C79B-4C1C-B5C7-E98DA18167AF.tif">
        <AcquiredDate>
            2010-08-25T04:42:53
        </AcquiredDate>
        <Description/>
        <Pixels DimensionOrder="XYZCT" ID="urn:lsid:export.openmicroscopy.org:Pixels:7a72efb0-60c5-4e84-97e7-e575c1bb31e1_520:1675" PhysicalSizeX="0.0" PhysicalSizeY="0.0" PhysicalSizeZ="0.0" SizeC="1" SizeT="1" SizeX="1000" SizeY="1000" SizeZ="1" Type="uint16">
            <Channel Color="-16776961" ID="urn:lsid:export.openmicroscopy.org:Channel:7a72efb0-60c5-4e84-97e7-e575c1bb31e1_520:1676" SamplesPerPixel="1">
                <LightPath/>
            </Channel>
            <TiffData FirstC="0" FirstT="0" FirstZ="0" IFD="0" PlaneCount="1">
                <UUID FileName="__omero_export__3094290677181521664.ome.tiff">
                    urn:uuid:7066938f-2105-40a9-bb8b-34da53158d94
                </UUID>
            </TiffData>
            <Plane DeltaT="0.0" ExposureTime="0.0" TheC="0" TheT="0" TheZ="0"/>
        </Pixels>
    </Image>
</OME>


I have used an XML formatter to clear things up here, since the original is a single line of code.

So all I have here is the image block which itself contains the information about the pixel data. From one of the example files from the Omero website (tubhiswt_C1.ome.tif) I have extracted the XMl data and used it as an example to get this xml data:

Code: Select all
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- 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://ome-xml.org/wiki/OmeTiff. -->
<OME xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" UUID="urn:uuid:7066938f-2105-40a9-bb8b-34da53158d94" xsi:schemaLocation="http://www.openmicroscopy.org/Schemas/OME/2010-06 http://www.openmicroscopy.org/Schemas/OME/2010-06/ome.xsd" xmlns="http://www.openmicroscopy.org/Schemas/OME/2010-06">
   
  <Instrument ID="urn:lsid:export.openmicroscopy.org:Instrument:OWS1">
        <Microscope Manufacturer="Nikon" Model="Eclipse TE300" SerialNumber="U629762" Type="Inverted"/>
        <LightSource ID="urn:lsid:export.openmicroscopy.org:LightSource:OWS1" Manufacturer="Spectral Physics" Model="Tsunami 5W" SerialNumber="2123">
            <Laser Type="SolidState" LaserMedium="TiSapphire"/>
        </LightSource>
        <Detector ID="urn:lsid:export.openmicroscopy.org:Detector:OWS1" Type="PMT" Manufacturer="Hamamatzu" Model="H7422"/>
        <Detector ID="urn:lsid:export.openmicroscopy.org:Detector:OWS2" Type="Photodiode" Manufacturer="Bio-Rad" Model="1024TLD"/>
        <Objective ID="urn:lsid:export.openmicroscopy.org:Objective:OWS2" Manufacturer="Nikon" Model="S Fluor" SerialNumber="044989">
            <Correction>
                PlanApo
            </Correction>
            <Immersion>
                Oil
            </Immersion>
            <LensNA>
                1.40
            </LensNA>
            <NominalMagnification>
                100
            </NominalMagnification>
            <CalibratedMagnification>
                100.0
            </CalibratedMagnification>
            <WorkingDistance>
                0.13
            </WorkingDistance>
        </Objective>
    </Instrument>

    <Image ID="urn:lsid:export.openmicroscopy.org:Image:7a72efb0-60c5-4e84-97e7-e575c1bb31e1_520:1674" Name="/home/helmerj/rails/metaxpress/transfer-script/input/20100825_rbilly_A01_w1E3AF3878-C79B-4C1C-B5C7-E98DA18167AF.tif">
        <AcquiredDate>
            2010-08-25T04:42:53
        </AcquiredDate>
        <Description/>

      <LogicalChannel ID="urn:lsid:export.openmicroscopy.org:LogicalChannel:OWS348-1">
            <LightSourceRef ID="urn:lsid:export.openmicroscopy.org:LightSource:OWS1"/>
            <DetectorRef ID="urn:lsid:export.openmicroscopy.org:Detector:OWS1"/>
            <ChannelComponent Pixels="urn:lsid:export.openmicroscopy.org:Pixels:OWS348" Index="1"/>
        </LogicalChannel>
        <LogicalChannel ID="urn:lsid:export.openmicroscopy.org:LogicalChannel:OWS348-2">
            <LightSourceRef ID="urn:lsid:export.openmicroscopy.org:LightSource:OWS1"/>
            <DetectorRef ID="urn:lsid:export.openmicroscopy.org:Detector:OWS2"/>
            <ChannelComponent Pixels="urn:lsid:export.openmicroscopy.org:Pixels:OWS348" Index="0"/>
        </LogicalChannel>

        <Pixels DimensionOrder="XYZCT" ID="urn:lsid:export.openmicroscopy.org:Pixels:7a72efb0-60c5-4e84-97e7-e575c1bb31e1_520:1675" PhysicalSizeX="0.0" PhysicalSizeY="0.0" PhysicalSizeZ="0.0" SizeC="1" SizeT="1" SizeX="1000" SizeY="1000" SizeZ="1" Type="uint16">
            <Channel Color="-16776961" ID="urn:lsid:export.openmicroscopy.org:Channel:7a72efb0-60c5-4e84-97e7-e575c1bb31e1_520:1676" SamplesPerPixel="1">
                <LightPath/>
            </Channel>
            <TiffData FirstC="0" FirstT="0" FirstZ="0" IFD="0" PlaneCount="1">
                <UUID FileName="__omero_export__3094290677181521664.ome.tiff">
                    urn:uuid:7066938f-2105-40a9-bb8b-34da53158d94
                </UUID>
            </TiffData>
            <Plane DeltaT="0.0" ExposureTime="0.0" TheC="0" TheT="0" TheZ="0"/>
        </Pixels>
    </Image>
</OME>



So I have the Instrument block that has its own ID and I connect that Instrument block inside of Image using the chosen IDs in two logical channels.

In the example file tubhiswt_C1.ome.tif these two logical channels show up and the meta-data is inside them.

My questions:

Why do the two channels not show up when I use this XML data in my OME-TIFF file?
What is the correct syntax?
What is correct syntax to directly write to the Omero fields under Acquisition where I would like to place my meta-data, or do I have to use Logical channels?

Any help would be greatly appreciated.

Cheers Juergen

Re: OME-TIF generation and Omero Import

PostPosted: Tue Jan 18, 2011 9:49 am
by helmerj
Looking further at the latest OME-TIFF schema (2010-06) I have step by step added more and more OME tags to the XML header validating them in the proceeding using xmlvalidate from the bftools package (stable version 4.2.2 beta). This is what I have:

Code: Select all
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- 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://ome-xml.org/wiki/OmeTiff. -->
<OME xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" UUID="urn:uuid:7066938f-2105-40a9-bb8b-34da53158d94" xsi:schemaLocation="http://www.openmicroscopy.org/Schemas/OME/2010-06 http://www.openmicroscopy.org/Schemas/OME/2010-06/ome.xsd" xmlns="http://www.openmicroscopy.org/Schemas/OME/2010-06">
    <Project ID="urn:lsid:export.openmicroscopy.org:Project:151" Name="test001"></Project>
    <Dataset ID="urn:lsid:export.openmicroscopy.org:Dataset:151" Name="test001"></Dataset>
   <Experiment ID="urn:lsid:export.openmicroscopy.org:Experiment:some002" Type="">
      <Description>Optimization of encapsulation mix XPO1, overlaid with ATCC Hela for 48 hours, 1 x confluent T25 around three million cells per array, standard fix and label methods</Description>
        <ExperimenterRef ID="urn:lsid:export.openmicroscopy.org:Experimenter:2"></ExperimenterRef>
   </Experiment>
    <Experimenter DisplayName="Juergen Helmers" Email="juergen.helmers@gmail.com" FirstName="Juergen" ID="urn:lsid:export.openmicroscopy.org:Experimenter:2" Institution="CSIR" LastName="Helmers" UserName="root"></Experimenter>
    <Instrument ID="urn:lsid:export.openmicroscopy.org:Instrument:Ultra">
        <Microscope Manufacturer="Molecular Devices" Model="ImageXpress Ultra Confocal HCS" SerialNumber="213123123" Type="Other"></Microscope>
        <LightSource ID="urn:lsid:export.openmicroscopy.org:LightSource:Ultra-ls-001" Manufacturer="MD" Model="ls001" Power="35.00" SerialNumber="123123">
            <Laser Type="Other" Wavelength="561"></Laser>
        </LightSource>
        <Detector Gain="350" ID="urn:lsid:export.openmicroscopy.org:Detector:PMT3" Manufacturer="Hamamatsu" Model="upper123" SerialNumber="123123213" Type="LifetimeImaging"></Detector>   
    </Instrument>
   
    <Image ID="urn:lsid:export.openmicroscopy.org:Image:7a72efb0-60c5-4e84-97e7-e575c1bb31e1_520:1674" Name="/home/helmerj/rails/metaxpress/transfer-script/input/20100825_rbilly_A01_w1E3AF3878-C79B-4C1C-B5C7-E98DA18167AF.tif">
        <AcquiredDate>
            2010-08-25T04:42:53
        </AcquiredDate>
      <ExperimenterRef ID="urn:lsid:export.openmicroscopy.org:Experimenter:2"></ExperimenterRef>
      <ExperimentRef ID="urn:lsid:export.openmicroscopy.org:Experiment:some002"></ExperimentRef>
      <InstrumentRef ID="urn:lsid:export.openmicroscopy.org:Instrument:Ultra"></InstrumentRef>
        <Pixels DimensionOrder="XYZCT" ID="urn:lsid:export.openmicroscopy.org:Pixels:7a72efb0-60c5-4e84-97e7-e575c1bb31e1_520:1675" PhysicalSizeX="0.0" PhysicalSizeY="0.0" PhysicalSizeZ="0.0" SizeC="1" SizeT="1" SizeX="1000" SizeY="1000" SizeZ="1" Type="uint16">
            <Channel Color="-16776961" ExcitationWavelength="561" ID="urn:lsid:export.openmicroscopy.org:Channel:7a72efb0-60c5-4e84-97e7-e575c1bb31e1_520:1676" Name="PMT3" PinholeSize="4.00" SamplesPerPixel="1">
           <LightSourceSettings ID="urn:lsid:export.openmicroscopy.org:LightSource:Ultra-ls-001" Wavelength="361"></LightSourceSettings>
           <DetectorSettings Binning="2x2" Gain="350" ID="urn:lsid:export.openmicroscopy.org:Detector:PMT3"></DetectorSettings>
         </Channel>
            <TiffData FirstC="0" FirstT="0" FirstZ="0" IFD="0" PlaneCount="1">
                <UUID FileName="__omero_export__3094290677181521664.ome.tiff">
                    urn:uuid:7066938f-2105-40a9-bb8b-34da53158d94
                </UUID>
            </TiffData>
            <Plane DeltaT="0.0" ExposureTime="0.0" TheC="0" TheT="0" TheZ="0"/>
        </Pixels>
    </Image>
</OME>
<!-- No validation errors found.

import into Omero NOT successful

-->


The code validates alright but when I add this XML data to an ome-tif file that has been imported into Omero and exported as ome-tiff:

Code: Select all
exiv2 -M'set Exif.Image.ImageDescription <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!-- 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://ome-xml.org/wiki/OmeTiff. --> <OME xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" UUID="urn:uuid:7066938f-2105-40a9-bb8b-34da53158d94" xsi:schemaLocation="http://www.openmicroscopy.org/Schemas/OME/2010-06 http://www.openmicroscopy.org/Schemas/OME/2010-06/ome.xsd" xmlns="http://www.openmicroscopy.org/Schemas/OME/2010-06">     <Project ID="urn:lsid:export.openmicroscopy.org:Project:151" Name="test001"></Project>     <Dataset ID="urn:lsid:export.openmicroscopy.org:Dataset:151" Name="test001"></Dataset>    <Experiment ID="urn:lsid:export.openmicroscopy.org:Experiment:some002" Type="">       <Description>Optimization of encapsulation mix XPO1, overlaid with ATCC Hela for 48 hours, 1 x confluent T25 around three million cells per array, standard fix and label methods</Description>         <ExperimenterRef ID="urn:lsid:export.openmicroscopy.org:Experimenter:2"></ExperimenterRef>    </Experiment>     <Experimenter DisplayName="Juergen Helmers" Email="juergen.helmers@gmail.com" FirstName="Juergen" ID="urn:lsid:export.openmicroscopy.org:Experimenter:2" Institution="CSIR" LastName="Helmers" UserName="root"></Experimenter>     <Instrument ID="urn:lsid:export.openmicroscopy.org:Instrument:Ultra">         <Microscope Manufacturer="Molecular Devices" Model="ImageXpress Ultra Confocal HCS" SerialNumber="213123123" Type="Other"></Microscope>         <LightSource ID="urn:lsid:export.openmicroscopy.org:LightSource:Ultra-ls-001" Manufacturer="MD" Model="ls001" Power="35.00" SerialNumber="123123">             <Laser Type="Other" Wavelength="561"></Laser>         </LightSource>         <Detector Gain="350" ID="urn:lsid:export.openmicroscopy.org:Detector:PMT3" Manufacturer="Hamamatsu" Model="upper123" SerialNumber="123123213" Type="LifetimeImaging"></Detector>         </Instrument>          <Image ID="urn:lsid:export.openmicroscopy.org:Image:7a72efb0-60c5-4e84-97e7-e575c1bb31e1_520:1674" Name="/home/helmerj/rails/metaxpress/transfer-script/input/20100825_rbilly_A01_w1E3AF3878-C79B-4C1C-B5C7-E98DA18167AF.tif">         <AcquiredDate>             2010-08-25T04:42:53         </AcquiredDate>       <ExperimenterRef ID="urn:lsid:export.openmicroscopy.org:Experimenter:2"></ExperimenterRef>       <ExperimentRef ID="urn:lsid:export.openmicroscopy.org:Experiment:some002"></ExperimentRef>       <InstrumentRef ID="urn:lsid:export.openmicroscopy.org:Instrument:Ultra"></InstrumentRef>         <Pixels DimensionOrder="XYZCT" ID="urn:lsid:export.openmicroscopy.org:Pixels:7a72efb0-60c5-4e84-97e7-e575c1bb31e1_520:1675" PhysicalSizeX="0.0" PhysicalSizeY="0.0" PhysicalSizeZ="0.0" SizeC="1" SizeT="1" SizeX="1000" SizeY="1000" SizeZ="1" Type="uint16">             <Channel Color="-16776961" ExcitationWavelength="561" ID="urn:lsid:export.openmicroscopy.org:Channel:7a72efb0-60c5-4e84-97e7-e575c1bb31e1_520:1676" Name="PMT3" PinholeSize="4.00" SamplesPerPixel="1">            <LightSourceSettings ID="urn:lsid:export.openmicroscopy.org:LightSource:Ultra-ls-001" Wavelength="361"></LightSourceSettings>            <DetectorSettings Binning="2x2" Gain="350" ID="urn:lsid:export.openmicroscopy.org:Detector:PMT3"></DetectorSettings>          </Channel>             <TiffData FirstC="0" FirstT="0" FirstZ="0" IFD="0" PlaneCount="1">                 <UUID FileName="__omero_export__3094290677181521664.ome.tiff">                     urn:uuid:7066938f-2105-40a9-bb8b-34da53158d94                 </UUID>             </TiffData>             <Plane DeltaT="0.0" ExposureTime="0.0" TheC="0" TheT="0" TheZ="0"/>         </Pixels>     </Image> </OME> <!-- No validation errors found. -->' import.ome.tif


none of that data is added to the system for that file.

Any help on this would still be greatly appreciated...

Cheers J.

Re: OME-TIF generation and Omero Import

PostPosted: Wed Jan 19, 2011 12:29 pm
by helmerj
I have gotten a bit further :D

I have used bfconvert to convert my metaXpress tif file into an ome-tif file. bfconvert nicely adds all the existing unstructured meta-data in proper ome-XML format to the ome-tiff header. Upon import into my Omero system some of the meta-data even makes it into this import and is available as a new "_Mg_NA_" channel.

So far so good.

Next thing I did try was to modify the OME-XML block write it back to my ome-tif file and reimport to hopefully see my modified meta-data.

:? Bummer. I have used the following:

Code: Select all
exiv2 -M'set Exif.Image.ImageDescription <xml ... </ome>' file.ome.tif


the meta-data is not imported

I have also tried this:

Code: Select all
imgcnv -loadomexml ome011.xml -i 20100825_rbilly_A01_w1E3AF3878-C79B-4C1C-B5C7-E98DA18167AF.ome.tif -o 20100825_rbilly_A01_w1E3AF3878-C79B-4C1C-B5C7-E98DA18167AF_mod_binning_single_line_imgcnv.ome.tif -t OME-TIFF


The meta-data is not imported using either of the two tools. I have used the XML data formated (indented) as well as in a single line as in the original bftools created ome-tif file.
So it seems that the header modification writing the modified OME-XML block to the ome-tif file renders the file embedded meta-data useless.

Which tool can I use that successfully is able to write a modified ImageDescription to an ome-tif file so that the OMERO.Importer is able to handle the meta-data?

Any help would be greatly appreciated.

Cheers Juergen

Re: OME-TIF generation and Omero Import

PostPosted: Wed Jan 19, 2011 1:53 pm
by ajpatterson
exiv2 is a tool for working with Exif and other photographic style metadata (like the info saved from a normal digital camera), it is not designed to work with a tiff comment field as used by the OME-TIFF format.

I have not used the BioImageConvertor so cannot advise you on it.

I use convert (part of ImageMagick) to inject hand edited XML into a tiff file on the command line and in scripts.

Code: Select all
convert -depth 8 -comment "@input-matadata.xml" input-image.tiff output-file.ome.tiff


Depending on the data format your source tiff files are in you may or may not need the '-depth 8'. Or you may need a different number!

Code: Select all
[andrew@Voile ~]$ convert -version
Version: ImageMagick 6.6.2-0 2010-07-08 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2010 ImageMagick Studio LLC
Features: OpenMP OpenCL
[andrew@Voile ~]$


Hope this helps,

Andrew

Re: OME-TIF generation and Omero Import

PostPosted: Wed Jan 19, 2011 2:48 pm
by wmoore
Hi Juergen,

I am not sure that your XML is valid against the schema that it references
http://www.openmicroscopy.org/Schemas/O ... 06/ome.xsd

For example, you have <LogicalChannel> element under <Image>. <LogicalChannel> was combined with <Channel> a while back. You'll see that LogicalChannel doesn't exist in the 2010-06 schema. So it looks like the example file you are using is out of date.

Have a look at these examples, which use the 2010-04 schema: http://ome-xml.org/wiki/CompliantSpecification

A quick way to check if the metadata is in the ome.tif file is to open it in ImageJ with the BioFormats plugin http://www.loci.wisc.edu/bio-formats/downloads .
Go Plugin > LOCI > Bio-Formats Importer
Make sure you check the box to "Display OME-XML metadata".

If you see your metadata there, then it should be imported into OMERO.

Hope that helps,

Will.

Re: OME-TIF generation and Omero Import

PostPosted: Wed Jan 19, 2011 2:50 pm
by ajpatterson
Hi Juergen,

Just another thought. Have you looked at the 2010-06 examples in:
http://www.ome-xml.org/browser/Documentation/Samples/OmeFiles/2010-06

These may be useful to you.

Ta,

Andrew

Re: OME-TIF generation and Omero Import

PostPosted: Wed Jan 19, 2011 3:15 pm
by helmerj
ajpatterson wrote:Hi Juergen,

Just another thought. Have you looked at the 2010-06 examples in:
http://www.ome-xml.org/browser/Documentation/Samples/OmeFiles/2010-06

These may be useful to you.

Ta,

Andrew


Hi Andrew,

thats a lot for the tip using convert. I should have thought of that... I have raw 16-bit tif data so I would be using the -depth 16 flag. Does the convert call modify the image data in any way?

I am finally able to import the meta data!

@will Thanks for the tip with the imageJ plugin. Works like a charm!

Cheers Juergen

Re: OME-TIF generation and Omero Import

PostPosted: Thu Jan 20, 2011 7:41 am
by helmerj
Hi

thanks to everybody who has contributed to the solution of my problem so far!

My current work-flow

- convert tif to ome-tif using bfconvert
- write a modified OME-XML block to the ome-tif files using convert
- import ome-tif with modified header to Omero

would require me to convert all my thousands of metaXpress images (we are talking literally thousands of images every day...!) to ome-tiff first using bfconvert.

Due to the fact that bfconvert is a script starting a Java application for every single image one after the other this process takes for ever. On my home machine this take between 4-5 seconds per image off which 3-4 seconds are overhead as the tool informs me in its output.

Do I have to convert to ome-tif in the first place? If I only write the OME-XML block to the initial metaXpress tif file, using:

Code: Select all
convert -depth 16 -comment "@myomexml.xml" metaXpress.tif omero.ome.tif


and attempt an omero import I get "loci.formats.FormatException: Unmatched UUID" upon import...
I have written a script, that replaces a placeholder with the filename and another placeholder with a generated UUID string in all three places, a UUID shows up when bfconvert converts a metaXpress file to ome-xml. Is the UUID a truly random string of 8-4-4-4-12 characters each or is it related to the image data?

So is there another faster way to convert tif images to ome-tif, like a secret batch mode for bfconvert or another tool programmed in C or something similar?

Cheers J

Re: OME-TIF generation and Omero Import

PostPosted: Sat Jan 22, 2011 3:24 pm
by mlinkert
Hi Juergen,

My current work-flow

- convert tif to ome-tif using bfconvert
- write a modified OME-XML block to the ome-tif files using convert
- import ome-tif with modified header to Omero

would require me to convert all my thousands of metaXpress images (we are talking literally thousands of images every day...!) to ome-tiff first using bfconvert.

Due to the fact that bfconvert is a script starting a Java application for every single image one after the other this process takes for ever. On my home machine this take between 4-5 seconds per image off which 3-4 seconds are overhead as the tool informs me in its output.

Do I have to convert to ome-tif in the first place?


Since you are overwriting the OME-XML block in the TIFF comment anyway, there is no real value added in first converting your TIFFs to OME-TIFF. You should be able to eliminate the first step in your workflow and just write the OME-XML block directly to the TIFF files, but note that you will then need to change the file extension from .tif(f) to .ome.tif(f).

If I only write the OME-XML block to the initial metaXpress tif file, using:

Code: Select all
    convert -depth 16 -comment "@myomexml.xml" metaXpress.tif omero.ome.tif


and attempt an omero import I get "loci.formats.FormatException: Unmatched UUID" upon import...


Every OME-TIFF file must have an OME-XML block. The blocks should be nearly identical; the only difference should be the "UUID" element under the "OME" element.

I have written a script, that replaces a placeholder with the filename and another placeholder with a generated UUID string in all three places, a UUID shows up when bfconvert converts a metaXpress file to ome-xml. Is the UUID a truly random string of 8-4-4-4-12 characters each or is it related to the image data?


The UUIDs are more or less random. When Bio-Formats writes OME-TIFF files, it generates the appropriate UUIDs using the 'randomUUID()' method in java.util.UUID.

Regards,
-Melissa

Re: OME-TIF generation and Omero Import

PostPosted: Mon Jan 24, 2011 6:02 pm
by helmerj
Hi Melissa,

thanks for your help on the OME-TIF import. I still have trouble getting all in all valid ome-tif files.

1. I convert a metaXpress file to ome-tif using bfconvert

=> imports fine using the cli and gui importer

2. I use a metaXpress file, use convert from imagemagick to write the OME Block to the header, import it using the GUI OMERO.Importer

=> file and meta-data get imported as expected

3. I take the ome-tif file from 1. import the file using the cli-importer

=> throws an error but import the file nevertheless:

Code: Select all
2011-01-24 18:50:11,547 11874      [      main] ERROR      ome.formats.OMEROMetadataStoreClient  - Can't modify the current group.


4. I use the ome-tiff file from 1., extract the OME-header blcok and rewrite the same unmodified block using convert from imagemagick, and attempt to import the file using the cli-importer:

=> same error as in 3. and no file gets imported:

Code: Select all
2011-01-24 18:52:40,666 11205      [      main] ERROR      ome.formats.OMEROMetadataStoreClient  - Can't modify the current group.


as well as

Code: Select all
No imports found


I get the same result if I use a metXpress tif file and use convert from imagemagick to write an OME-Block to the file.

I really need to get the importer-cli to work together with modified tif files. I can import 100k to 500k files with a GUI... :(

Is there any more and proper documentation about the differences between the GUI and CLI importer and about the requirements for an import of tif files?

Cheers Juergen

UPDATE:

The files, whichever ones, import fine after I did remove the UUID statement in the top OME tag.

So this:

Code: Select all
<OME xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" UUID="urn:uuid:bfcf2894-3cf3-4cf2-803a-70157b7e9faa" xsi:schemaLocation="http://www.openmicroscopy.org/Schemas/OME/2010-06 http://www.openmicroscopy.org/Schemas/OME/2010-06/ome.xsd" xmlns="http://www.openmicroscopy.org/Schemas/OME/2010-06">


became this:

Code: Select all
<OME xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:schemaLocation="http://www.openmicroscopy.org/Schemas/OME/2010-06 http://www.openmicroscopy.org/Schemas/OME/2010-06/ome.xsd" xmlns="http://www.openmicroscopy.org/Schemas/OME/2010-06">


and now the import works just fine.