Search in sources :

Example 26 with OMEXMLMetadataRoot

use of ome.xml.meta.OMEXMLMetadataRoot in project bioformats by openmicroscopy.

the class OMETiffWriter method getBinaryOnlyOMEXML.

private String getBinaryOnlyOMEXML(String file, String companion, String companionUUID) throws FormatException, IOException, DependencyException, ServiceException {
    ServiceFactory factory = new ServiceFactory();
    OMEXMLService service = factory.getInstance(OMEXMLService.class);
    OMEXMLMetadata meta = service.createOMEXMLMetadata();
    String uuid = "urn:uuid:" + getUUID(new Location(file).getName());
    meta.setUUID(uuid);
    meta.setBinaryOnlyMetadataFile(new Location(companion).getName());
    meta.setBinaryOnlyUUID(companionUUID);
    OMEXMLMetadataRoot root = (OMEXMLMetadataRoot) meta.getRoot();
    root.setCreator(FormatTools.CREATOR);
    return service.getOMEXML(meta);
}
Also used : ServiceFactory(loci.common.services.ServiceFactory) OMEXMLMetadata(loci.formats.ome.OMEXMLMetadata) OMEXMLMetadataRoot(ome.xml.meta.OMEXMLMetadataRoot) OMEXMLService(loci.formats.services.OMEXMLService) Location(loci.common.Location)

Example 27 with OMEXMLMetadataRoot

use of ome.xml.meta.OMEXMLMetadataRoot in project bioformats by openmicroscopy.

the class OMETiffWriter method getOMEXML.

private String getOMEXML(String file) throws FormatException, IOException {
    // generate UUID and add to OME element
    String uuid = "urn:uuid:" + getUUID(new Location(file).getName());
    omeMeta.setUUID(uuid);
    OMEXMLMetadataRoot root = (OMEXMLMetadataRoot) omeMeta.getRoot();
    root.setCreator(FormatTools.CREATOR);
    String xml;
    try {
        xml = service.getOMEXML(omeMeta);
    } catch (ServiceException se) {
        throw new FormatException(se);
    }
    return xml;
}
Also used : ServiceException(loci.common.services.ServiceException) OMEXMLMetadataRoot(ome.xml.meta.OMEXMLMetadataRoot) FormatException(loci.formats.FormatException) Location(loci.common.Location)

Aggregations

OMEXMLMetadataRoot (ome.xml.meta.OMEXMLMetadataRoot)27 ServiceException (loci.common.services.ServiceException)11 Image (ome.xml.model.Image)11 IOException (java.io.IOException)8 FormatException (loci.formats.FormatException)8 OMEXMLMetadata (loci.formats.ome.OMEXMLMetadata)7 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)6 DependencyException (loci.common.services.DependencyException)6 ServiceFactory (loci.common.services.ServiceFactory)6 OMEXMLService (loci.formats.services.OMEXMLService)6 Pixels (ome.xml.model.Pixels)6 Location (loci.common.Location)5 OriginalMetadataAnnotation (loci.formats.meta.OriginalMetadataAnnotation)5 Document (org.w3c.dom.Document)5 Node (org.w3c.dom.Node)5 NodeList (org.w3c.dom.NodeList)5 SAXException (org.xml.sax.SAXException)5 StructuredAnnotations (ome.xml.model.StructuredAnnotations)4 XMLAnnotation (ome.xml.model.XMLAnnotation)4 PositiveInteger (ome.xml.model.primitives.PositiveInteger)4