Search in sources :

Example 51 with DependencyException

use of loci.common.services.DependencyException in project digilib by robcast.

the class BioFormatsDocuImage method loadImage.

@Override
public void loadImage(ImageInput ii) throws FileOpException {
    logger.debug("loadImage: " + ii);
    this.input = ii;
    reader = new ImageReader();
    try {
        // construct the object that stores OME-XML metadata
        ServiceFactory factory = new ServiceFactory();
        OMEXMLService service = factory.getInstance(OMEXMLService.class);
        meta = service.createOMEXMLMetadata();
        // set up the reader and associate it with the input file
        reader = new ImageReader();
        reader.setMetadataStore(meta);
        reader.setId(ii.getFile().getAbsolutePath());
        BufferedImageReader biReader = BufferedImageReader.makeBufferedImageReader(reader);
        img = biReader.openImage(0);
        logger.debug("image loaded: " + img);
    } catch (FormatException e) {
        throw new FileOpException("Unable to load image format: " + e);
    } catch (IOException e) {
        throw new FileOpException("Unable to load image file: " + e);
    } catch (ServiceException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (DependencyException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
Also used : ServiceException(loci.common.services.ServiceException) ServiceFactory(loci.common.services.ServiceFactory) FileOpException(digilib.io.FileOpException) BufferedImageReader(loci.formats.gui.BufferedImageReader) IOException(java.io.IOException) ImageReader(loci.formats.ImageReader) BufferedImageReader(loci.formats.gui.BufferedImageReader) DependencyException(loci.common.services.DependencyException) OMEXMLService(loci.formats.services.OMEXMLService) FormatException(loci.formats.FormatException)

Aggregations

DependencyException (loci.common.services.DependencyException)51 ServiceFactory (loci.common.services.ServiceFactory)49 FormatException (loci.formats.FormatException)39 ServiceException (loci.common.services.ServiceException)32 OMEXMLService (loci.formats.services.OMEXMLService)32 MissingLibraryException (loci.formats.MissingLibraryException)15 MetadataStore (loci.formats.meta.MetadataStore)14 CoreMetadata (loci.formats.CoreMetadata)13 IMetadata (loci.formats.meta.IMetadata)13 IOException (java.io.IOException)12 Location (loci.common.Location)10 ImageReader (loci.formats.ImageReader)10 Length (ome.units.quantity.Length)10 PositiveInteger (ome.xml.model.primitives.PositiveInteger)9 OMEXMLMetadata (loci.formats.ome.OMEXMLMetadata)8 ArrayList (java.util.ArrayList)7 MetadataRetrieve (loci.formats.meta.MetadataRetrieve)6 EnumerationException (ome.xml.model.enums.EnumerationException)6 File (java.io.File)5 IFormatWriter (loci.formats.IFormatWriter)5