Search in sources :

Example 16 with MissingLibraryException

use of loci.formats.MissingLibraryException in project bioformats by openmicroscopy.

the class OMEXMLWriter method setId.

// -- FormatWriter API methods --
/* @see loci.formats.FormatWriter#setId(String) */
@Override
public void setId(String id) throws FormatException, IOException {
    if (id.equals(currentId)) {
        return;
    }
    super.setId(id);
    MetadataRetrieve retrieve = getMetadataRetrieve();
    String xml;
    try {
        ServiceFactory factory = new ServiceFactory();
        service = factory.getInstance(OMEXMLService.class);
        xml = service.getOMEXML(retrieve);
        OMEXMLMetadata noBin = service.createOMEXMLMetadata(xml);
        service.removeBinData(noBin);
        OMEXMLMetadataRoot root = (OMEXMLMetadataRoot) noBin.getRoot();
        root.setCreator(FormatTools.CREATOR);
        xml = service.getOMEXML(noBin);
    } catch (DependencyException de) {
        throw new MissingLibraryException(OMEXMLServiceImpl.NO_OME_XML_MSG, de);
    } catch (ServiceException se) {
        throw new FormatException(se);
    }
    xmlFragments = new ArrayList<String>();
    currentFragment = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
    XMLTools.parseXML(xml, new OMEHandler());
    xmlFragments.add(currentFragment);
}
Also used : ServiceException(loci.common.services.ServiceException) ServiceFactory(loci.common.services.ServiceFactory) OMEXMLMetadata(loci.formats.ome.OMEXMLMetadata) OMEXMLMetadataRoot(ome.xml.meta.OMEXMLMetadataRoot) MissingLibraryException(loci.formats.MissingLibraryException) DependencyException(loci.common.services.DependencyException) MetadataRetrieve(loci.formats.meta.MetadataRetrieve) OMEXMLService(loci.formats.services.OMEXMLService) FormatException(loci.formats.FormatException)

Example 17 with MissingLibraryException

use of loci.formats.MissingLibraryException in project bioformats by openmicroscopy.

the class IPWReader method initPOIService.

private void initPOIService() throws FormatException, IOException {
    try {
        ServiceFactory factory = new ServiceFactory();
        poi = factory.getInstance(POIService.class);
    } catch (DependencyException de) {
        throw new MissingLibraryException("POI library not found", de);
    }
    poi.initialize(Location.getMappedId(getCurrentFile()));
}
Also used : ServiceFactory(loci.common.services.ServiceFactory) POIService(loci.formats.services.POIService) MissingLibraryException(loci.formats.MissingLibraryException) DependencyException(loci.common.services.DependencyException)

Aggregations

MissingLibraryException (loci.formats.MissingLibraryException)17 DependencyException (loci.common.services.DependencyException)15 ServiceFactory (loci.common.services.ServiceFactory)15 FormatException (loci.formats.FormatException)10 MetadataStore (loci.formats.meta.MetadataStore)9 CoreMetadata (loci.formats.CoreMetadata)8 ServiceException (loci.common.services.ServiceException)7 OMEXMLService (loci.formats.services.OMEXMLService)7 Location (loci.common.Location)4 MetadataRetrieve (loci.formats.meta.MetadataRetrieve)4 Length (ome.units.quantity.Length)4 IOException (java.io.IOException)3 RandomAccessInputStream (loci.common.RandomAccessInputStream)3 ImageReader (loci.formats.ImageReader)3 OMEXMLMetadata (loci.formats.ome.OMEXMLMetadata)3 NetCDFService (loci.formats.services.NetCDFService)3 File (java.io.File)2 ArrayList (java.util.ArrayList)2 IRandomAccess (loci.common.IRandomAccess)2 ChannelFiller (loci.formats.ChannelFiller)2