[ome-devel] OME-Tiff writing using LOCI calls from MATLAB, and ModuloAlongT annotation

Munro, Ian i.munro at imperial.ac.uk
Sun Oct 26 14:23:42 GMT 2014


Hi Gary

I've attached a Matlab routine that I wrote as an example of creating FLIM ome-tiffs.
The attached file generates an ome-tiff from a 5D matlab array.

Points to note:

The data is nonsense - it looks a bit decay-like but has no meaning.
The array’ delays' should contain the time points of your images in ps.
The background in FLIMfit is set by default to 200 for “Gated’ data. You can change this using the FLIMfit GUI.

To make the attached code work you will need to download bfmatlab.zip
& modify the path at the top of the attached file accordingly.

Then simply type:  save_as_OMEtiff_Synthetic_Gated(‘filename.ome.tiff’);

Hope this helps.

Ian



________________________________
From: ome-devel [ome-devel-bounces at lists.openmicroscopy.org.uk] on behalf of Yellen, Gary [gary_yellen at hms.harvard.edu]
Sent: Friday, October 24, 2014 8:37 PM
To: ome-devel at lists.openmicroscopy.org.uk
Subject: [ome-devel] OME-Tiff writing using LOCI calls from MATLAB, and ModuloAlongT annotation

I’m exporting microscope (2p FLIM) data from MATLAB to OME-Tiff format, using LOCI Java calls from MATLAB (in emulation of the Bio-Formats exporters).  The data are not collected from any of the commercial TCSPC devices, so there is no ‘native’ file format other than MATLAB.

I have two issues.

The first is speed:  export of 128x128 pixel uint16 planes is taking about 60 seconds per 512 planes (using LZW compression).  The native MATLAB saving speed for these same data (in matrix, not TIFF format) is 0.2 seconds.  I’d really like to export during acquisition, but this doesn’t seem practical with the available tools.  Is there an intermediate format that is readily converted to OME-TIFF, which I could write more quickly from MATLAB?  Or is there a way of making this more efficient, by writing the planes in a more consolidated way than calling writer.saveBytes for each image plane?

The second problem is generating a legal ModuloAlongT annotation (in hopes of trying the FLIMfit package).  I adapted some code that Melissa posted on a forum:

%% for the moduloAlongT annotation:
coreMetadata = loci.formats.CoreMetadata();
coreMetadata.moduloT.start = 0;
coreMetadata.moduloT.step = 0.05;
coreMetadata.moduloT.end = 12.75;
coreMetadata.moduloT.type = loci.formats.FormatTools.LIFETIME;
coreMetadata.moduloT.unit = 'ns';

… write the main part of the metadata to ‘metadata’, in the middle of which is …
OMEXMLService.addModuloAlong(metadata, coreMetadata, series);

If I stop and debug the code here, I get an apparently well-formed annotation (see below), but if I proceed to write data to the file and save it, the saved file’s metadata for the annotation looks strange (see further below).  Inside the annotation Value, it contains the full original metadata definition of the Experiment Type and Image (but no planes), plus an additional Structured Annotation object inside.  ImageJ2 can read the data by drag and drop, but if I use the verbose Bio-Formats Importer, it gives an error about the metadata:

java.lang.RuntimeException: org.xml.sax.SAXParseException: Element type "OME" must be followed by either attribute specifications, ">" or "/>".
Thanks for any advice anyone can provide on either of these subjects.

Gary

=================================

WELL-FORMED ANNOTATION during debug, retrieved using OMEXMLService.getOMEXML(metadata);

<StructuredAnnotations>
               <XMLAnnotation ID="Annotation:0" Namespace="openmicroscopy.org/omero/dimension/modulo">
               <Value>
               <Modulo namespace="http://www.openmicroscopy.org/Schemas/Additions/2011-09">
                              <ModuloAlongT End="12.75" Start="0.0" Step="0.05" Type="lifetime" TypeDescription="" Unit="ns"/>
               </Modulo>
               </Value>
               </XMLAnnotation>
</StructuredAnnotations>


STRANGE (recursive?) ANNOTATION retrieved from .ome.tif file:

<StructuredAnnotations>
<XMLAnnotation ID="Annotation:0" Namespace="openmicroscopy.org/omero/dimension/modulo">
<Value>
<OME xsi:schemaLocation="http://www.openmicroscopy.org/Schemas/OME/2013-06
http://www.openmicroscopy.org/Schemas/OME/2013-06/ome.xsd">

+ <Experiment Type="FluorescenceLifetime" ID="dFLIM_v2.1">  [[[[ this is collapsed for easy reading ]]]
+ <Image ID="Image:0">                                                                           [[[[ this is collapsed for easy reading ]]]
- <StructuredAnnotations>
<XMLAnnotation ID="Annotation:0" Namespace="openmicroscopy.org/omero/dimension/modulo">
<Value>
<Modulo namespace="http://www.openmicroscopy.org/Schemas/Additions/2011-09">
<ModuloAlongT Type="lifetime" Unit="ns" TypeDescription="" Step="0.05" Start="0.0" End="12.75"/>
</Modulo>
</Value>
</XMLAnnotation>
</StructuredAnnotations>
</OME>
</Value>
</XMLAnnotation>
</StructuredAnnotations>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-devel/attachments/20141026/79d5483b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: save_as_OMEtiff_Synthetic_Gated.m.zip
Type: application/zip
Size: 1542 bytes
Desc: save_as_OMEtiff_Synthetic_Gated.m.zip
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-devel/attachments/20141026/79d5483b/attachment.zip>


More information about the ome-devel mailing list