use of loci.formats.gui.BufferedImageReader in project bioformats by openmicroscopy.
the class SumPlanes method main.
public static void main(String[] args) throws Exception {
String id = args[0];
BufferedImageReader r = new BufferedImageReader();
System.out.print("Reading " + id);
r.setId(id);
int imageCount = r.getImageCount();
BufferedImage[] images = new BufferedImage[imageCount];
for (int i = 0; i < imageCount; i++) {
System.out.print(".");
images[i] = r.openImage(i);
}
r.close();
System.out.println(" [done]");
String outId = id + ".tif";
BufferedImageWriter w = new BufferedImageWriter();
System.out.print("Writing " + outId);
w.setId(outId);
w.saveImage(0, sum(images));
w.close();
System.out.println(" [done]");
}
use of loci.formats.gui.BufferedImageReader 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();
}
}
Aggregations