use of loci.common.services.DependencyException in project bioformats by openmicroscopy.
the class PrintROIs method main.
public static void main(String[] args) throws Exception {
ImageReader reader = new ImageReader();
IMetadata omexml;
try {
ServiceFactory factory = new ServiceFactory();
OMEXMLService service = factory.getInstance(OMEXMLService.class);
omexml = service.createOMEXMLMetadata();
} catch (DependencyException exc) {
throw new FormatException("Could not create OME-XML store.", exc);
} catch (ServiceException exc) {
throw new FormatException("Could not create OME-XML store.", exc);
}
reader.setMetadataStore(omexml);
reader.setId(args[0]);
printAllROIs(omexml);
System.out.println();
for (int series = 0; series < reader.getSeriesCount(); series++) {
printSeriesROIs(omexml, series);
}
reader.close();
}
use of loci.common.services.DependencyException in project bioformats by openmicroscopy.
the class FV1000Reader method initPOIService.
private void initPOIService() throws FormatException, IOException {
try {
ServiceFactory factory = new ServiceFactory();
poi = factory.getInstance(POIService.class);
} catch (DependencyException de) {
throw new FormatException("POI library not found", de);
}
poi.initialize(Location.getMappedId(getCurrentFile()));
}
use of loci.common.services.DependencyException in project bioformats by openmicroscopy.
the class CellH5Reader method initializeJHDFService.
// -- Helper methods --
private void initializeJHDFService(String id) throws IOException, MissingLibraryException {
try {
ServiceFactory factory = new ServiceFactory();
jhdf = factory.getInstance(JHDFService.class);
jhdf.setFile(id);
} catch (DependencyException e) {
throw new MissingLibraryException(JHDFServiceImpl.NO_JHDF_MSG, e);
}
}
use of loci.common.services.DependencyException in project bioformats by openmicroscopy.
the class WriterUtilities method createMetadata.
public static IMetadata createMetadata(String pixelType, int rgbChannels, int seriesCount, boolean littleEndian, int sizeT) throws Exception {
IMetadata metadata;
try {
ServiceFactory factory = new ServiceFactory();
OMEXMLService service = factory.getInstance(OMEXMLService.class);
metadata = service.createOMEXMLMetadata();
} catch (DependencyException exc) {
throw new FormatException("Could not create OME-XML store.", exc);
} catch (ServiceException exc) {
throw new FormatException("Could not create OME-XML store.", exc);
}
for (int i = 0; i < seriesCount; i++) {
MetadataTools.populateMetadata(metadata, i, "image #" + i, littleEndian, "XYCZT", pixelType, 160, 160, 1, rgbChannels, sizeT, rgbChannels);
}
return metadata;
}
use of loci.common.services.DependencyException in project bioformats by openmicroscopy.
the class LosslessJPEG2000Test method setUp.
@BeforeMethod
public void setUp() throws Exception {
File temp8 = File.createTempFile("test", ".jp2");
File temp16 = File.createTempFile("test", ".jp2");
temp8.deleteOnExit();
temp16.deleteOnExit();
Location.mapId(FILE_8, temp8.getAbsolutePath());
Location.mapId(FILE_16, temp16.getAbsolutePath());
IMetadata metadata8;
try {
ServiceFactory factory = new ServiceFactory();
OMEXMLService service = factory.getInstance(OMEXMLService.class);
metadata8 = service.createOMEXMLMetadata();
} catch (DependencyException exc) {
throw new FormatException("Could not create OME-XML store.", exc);
} catch (ServiceException exc) {
throw new FormatException("Could not create OME-XML store.", exc);
}
MetadataTools.populateMetadata(metadata8, 0, "foo", false, "XYCZT", "uint8", 1, 1, 1, 1, 1, 1);
IFormatWriter writer8 = new JPEG2000Writer();
writer8.setMetadataRetrieve(metadata8);
writer8.setId(FILE_8);
writer8.saveBytes(0, PIXELS_8);
writer8.close();
IMetadata metadata16;
try {
ServiceFactory factory = new ServiceFactory();
OMEXMLService service = factory.getInstance(OMEXMLService.class);
metadata16 = service.createOMEXMLMetadata();
} catch (DependencyException exc) {
throw new FormatException("Could not create OME-XML store.", exc);
} catch (ServiceException exc) {
throw new FormatException("Could not create OME-XML store.", exc);
}
MetadataTools.populateMetadata(metadata16, 0, "foo", false, "XYCZT", "uint16", 1, 1, 1, 1, 1, 1);
IFormatWriter writer16 = new JPEG2000Writer();
writer16.setMetadataRetrieve(metadata16);
writer16.setId(FILE_16);
writer16.saveBytes(0, PIXELS_16);
writer16.close();
}
Aggregations