The OME consortium currently provides two major tools capable of working with OME-XML:
In addition to the above packages, this page outlines several useful tools, some of which we have developed ourselves, for working with documents in the OME-XML and OME-TIFF formats.
If you install the Bio-Formats command line tools, you can produce a nicely formatted OME-XML string from an OME-TIFF file with:
Alternately, if you have ImageMagick installed, one easy way to extract the OME-XML embedded in the TIFF headers is to use it from the command line:
If you are working in C/C++, we recommend the open source LibTIFF library, or Bio-Formats via either IKVM.NET or our JVMlink library.
If you are looking for a solution in Java, there are several options. Bio-Formats can read OME-TIFF files, as well as convert from many third-party formats into OME-TIFF format—see the example source code page for specific examples. Alternately, the open source ImageJ application reads multi-page TIFF files, storing the TIFF comment into the associated FileInfo object's "description" field.
If the XML was stored without line breaks it can still be difficult to read after being extracted. There are several solutions to this problem, such as using an XML viewer or editor (web browsers work well), or processing the XML with a SAX or DOM library.
On most Linux distributions, you can install the libxml package and use the xmllint program:
Here is a perl script that uses XML::LibXML to "pretty print" an XML document with appropriate whitespace:
Unfortunately, both xmllint and the above perl script can be somewhat fragile; if there are any errors or abnormalities in the XML, they generally fail to produce any indentation. Thus, we have also written some Java code to do the same thing; just download the Bio-Formats command line tools and run:
Another option is to feed the XML into our OME-Java library, which provides methods for querying and manipulating the OME-XML (using DOM and SAX). This library is what Bio-Formats uses to work with OME-XML.
We have created a command line tool in Java for validating OME-XML, and included it as part of the Bio-Formats command line tools. The command is:
Also available is a web-based OME-XML validator for checking files in OME-XML or OME-TIFF formats, including:
Alternately, you can use the more general online W3C XML validator to validate your OME-XML blocks. For best results, be sure to check the "keep going" option.
Another option is to use a commercial XML application such as Turbo XML to work with and validate your OME-XML documents.