/** * Converts the given writer into a BufferedImageWriter, wrapping if needed. */ public static BufferedImageWriter makeBufferedImageWriter(IFormatWriter w) { if (w instanceof BufferedImageWriter) return (BufferedImageWriter) w; return new BufferedImageWriter(w); }
@Override public void run() { try { myWriter.close(); } catch (IOException exc) { LOGGER.info("", exc); } myWriter = BufferedImageWriter.makeBufferedImageWriter(w); save(id); } }.start();
/** * Saves the given BufferedImage to the current file. The BufferedImage * may represent a subsection of the full image to be saved. * * @param no the image index within the current file, starting from 0. * @param image the BufferedImage to save. * @param x the X coordinate of the upper-left corner of the image. * @param y the Y coordinate of the upper-left corner of the image. * @param w the width (in pixels) of the image. * @param h the height (in pixels) of the image. */ public void saveImage(int no, BufferedImage image, int x, int y, int w, int h) throws FormatException, IOException { Class dataType = getNativeDataType(); if (BufferedImage.class.isAssignableFrom(dataType)) { // native data type is compatible with BufferedImage savePlane(no, image, x, y, w, h); } else { // must convert BufferedImage to byte array byte[] buf = toBytes(image, this); saveBytes(no, buf, x, y, w, h); } }
omeMeta.setPixelsSizeT(new PositiveInteger(sizeT), 0); myWriter.setMetadataRetrieve(omexmlService.asRetrieve(omeMeta)); myWriter.setId(id); boolean stack = myWriter.canDoStacks(); ProgressMonitor progress = new ProgressMonitor(this, "Saving " + id, null, 0, stack ? images.length : 1); progress.setProgress(i); boolean canceled = progress.isCanceled(); myWriter.saveImage(i, images[i]); if (canceled) break; myWriter.savePlane(0, getImage()); progress.setProgress(1); myWriter.close();
/** * Saves the given BufferedImage to the current file. * * @param no the image index within the current file, starting from 0. * @param image the BufferedImage to save. */ public void saveImage(int no, BufferedImage image) throws FormatException, IOException { saveImage(no, image, 0, 0, image.getWidth(), image.getHeight()); }
@Override public void windowClosed(WindowEvent e) { try { myReader.close(); myWriter.close(); if (canCloseReader) { in.close(); } } catch (IOException io) { } }
biWriter.savePlane(filePlane, img); if (shutdown) break;
omeMeta.setPixelsSizeT(new PositiveInteger(sizeT), 0); myWriter.setMetadataRetrieve(omexmlService.asRetrieve(omeMeta)); myWriter.setId(id); boolean stack = myWriter.canDoStacks(); ProgressMonitor progress = new ProgressMonitor(this, "Saving " + id, null, 0, stack ? images.length : 1); progress.setProgress(i); boolean canceled = progress.isCanceled(); myWriter.saveImage(i, images[i]); if (canceled) break; myWriter.savePlane(0, getImage()); progress.setProgress(1); myWriter.close();
/** * Saves the given BufferedImage to the current file. * * @param no the image index within the current file, starting from 0. * @param image the BufferedImage to save. */ public void saveImage(int no, BufferedImage image) throws FormatException, IOException { saveImage(no, image, 0, 0, image.getWidth(), image.getHeight()); }
@Override public void windowClosed(WindowEvent e) { try { myReader.close(); myWriter.close(); if (canCloseReader) { in.close(); } } catch (IOException io) { } }
biWriter.savePlane(filePlane, img); if (shutdown) break;
/** * Saves the given BufferedImage to the current file. The BufferedImage * may represent a subsection of the full image to be saved. * * @param no the image index within the current file, starting from 0. * @param image the BufferedImage to save. * @param x the X coordinate of the upper-left corner of the image. * @param y the Y coordinate of the upper-left corner of the image. * @param w the width (in pixels) of the image. * @param h the height (in pixels) of the image. */ public void saveImage(int no, BufferedImage image, int x, int y, int w, int h) throws FormatException, IOException { Class dataType = getNativeDataType(); if (BufferedImage.class.isAssignableFrom(dataType)) { // native data type is compatible with BufferedImage savePlane(no, image, x, y, w, h); } else { // must convert BufferedImage to byte array byte[] buf = toBytes(image, this); saveBytes(no, buf, x, y, w, h); } }
@Override public void run() { try { myWriter.close(); } catch (IOException exc) { LOGGER.info("", exc); } myWriter = BufferedImageWriter.makeBufferedImageWriter(w); save(id); } }.start();
/** * Converts the given writer into a BufferedImageWriter, wrapping if needed. */ public static BufferedImageWriter makeBufferedImageWriter(IFormatWriter w) { if (w instanceof BufferedImageWriter) return (BufferedImageWriter) w; return new BufferedImageWriter(w); }
myReader = new BufferedImageReader(fileReader); fileWriter = new ImageWriter(); myWriter = new BufferedImageWriter(fileWriter);
myReader = new BufferedImageReader(fileReader); fileWriter = new ImageWriter(); myWriter = new BufferedImageWriter(fileWriter);