/** * {@link Writer} provided. {@link ImgPlus} provided, or wrapped provided * {@link Img}. * * @param w * @param img * @throws ImgIOException * @throws IncompatibleTypeException */ public void saveImg(final Writer w, final SCIFIOImgPlus<?> img, final int imageIndex) throws ImgIOException, IncompatibleTypeException { saveImg(w, img, imageIndex, null); }
/** * {@link Writer} and {@link Img} provided * * @param w * @param img * @throws ImgIOException * @throws IncompatibleTypeException */ public void saveImg(final Writer w, final Img<?> img) throws ImgIOException, IncompatibleTypeException { saveImg(w, img, null); }
/** * String id provided. {@link ImgPlus} provided, or wrapped {@link Img} in * previous saveImg. * * @param id * @param img * @throws ImgIOException * @throws IncompatibleTypeException */ public Metadata saveImg(final String id, final SCIFIOImgPlus<?> img, final int imageIndex) throws ImgIOException, IncompatibleTypeException { return saveImg(id, img, imageIndex, null); }
/** * {@link Writer} and {@link Img} provided * * @param w * @param img * @throws ImgIOException * @throws IncompatibleTypeException */ public void saveImg(final Writer w, final Img<?> img) throws ImgIOException, IncompatibleTypeException { saveImg(w, img, null); }
/** * {@link Writer} provided. {@link ImgPlus} provided, or wrapped provided * {@link Img}. * * @param w * @param img * @throws ImgIOException * @throws IncompatibleTypeException */ public void saveImg(final Writer w, final SCIFIOImgPlus<?> img, final int imageIndex) throws ImgIOException, IncompatibleTypeException { saveImg(w, img, imageIndex, null); }
/** * String id provided. {@link ImgPlus} provided, or wrapped {@link Img} in * previous saveImg. * * @param id * @param img * @throws ImgIOException * @throws IncompatibleTypeException */ public Metadata saveImg(final String id, final SCIFIOImgPlus<?> img, final int imageIndex) throws ImgIOException, IncompatibleTypeException { return saveImg(id, img, imageIndex, null); }
/** * Entry point for saving an {@link ImgPlus}. The goal is to get to a * {@link Writer} and {@link ImgPlus} which are then passed to * {@link #writePlanes}. These saveImg signatures facilitate multiple pathways * to that goal. This method is called when a String id and {@link Img} are * provided. * * @param id * @param img * @throws ImgIOException * @throws IncompatibleTypeException */ public Metadata saveImg(final String id, final Img<?> img) throws ImgIOException, IncompatibleTypeException { return saveImg(id, img, null); }
/** * As {@link #saveImg(String, Img)} with configuration options. * * @param id * @param img * @param config Configuration information to use for this write. * @throws ImgIOException * @throws IncompatibleTypeException */ public Metadata saveImg(final String id, final Img<?> img, final SCIFIOConfig config) throws ImgIOException, IncompatibleTypeException { return saveImg(id, utils().makeSCIFIOImgPlus(img), 0, config); }
/** * As {@link #saveImg(Writer, Img)}, with configuration options. * * @param w * @param img * @param config Configuration information to use for this write. * @throws ImgIOException * @throws IncompatibleTypeException */ public void saveImg(final Writer w, final Img<?> img, final SCIFIOConfig config) throws ImgIOException, IncompatibleTypeException { saveImg(w, utils().makeSCIFIOImgPlus(img), 0, config); }
/** * As {@link #saveImg(Writer, Img)}, with configuration options. * * @param w * @param img * @param config Configuration information to use for this write. * @throws ImgIOException * @throws IncompatibleTypeException */ public void saveImg(final Writer w, final Img<?> img, final SCIFIOConfig config) throws ImgIOException, IncompatibleTypeException { saveImg(w, utils().makeSCIFIOImgPlus(img), 0, config); }
/** * As {@link #saveImg(String, Img)} with configuration options. * * @param id * @param img * @param config Configuration information to use for this write. * @throws ImgIOException * @throws IncompatibleTypeException */ public Metadata saveImg(final String id, final Img<?> img, final SCIFIOConfig config) throws ImgIOException, IncompatibleTypeException { return saveImg(id, utils().makeSCIFIOImgPlus(img), 0, config); }
/** * @see ImgSaver#saveImg(String, Img) */ public static void saveImg(final String dest, final Img<?> img) { try { new ImgSaver().saveImg(dest, img); } catch (final IncompatibleTypeException e) { saveError(dest, e); } catch (final ImgIOException e) { saveError(dest, e); } }
/** * @see ImgSaver#saveImg(String, SCIFIOImgPlus, int) */ public static void saveImg(final String dest, final SCIFIOImgPlus<?> imgPlus, final int imageIndex) { try { new ImgSaver().saveImg(dest, imgPlus, imageIndex); } catch (final IncompatibleTypeException e) { saveError(dest, e); } catch (final ImgIOException e) { saveError(dest, e); } }
/** * @see ImgSaver#saveImg(String, Img) */ public static void saveImg(final String dest, final Img<?> img) { try { new ImgSaver().saveImg(dest, img); } catch (final IncompatibleTypeException e) { saveError(dest, e); } catch (final ImgIOException e) { saveError(dest, e); } }
/** * @see ImgSaver#saveImg(String, SCIFIOImgPlus, int) */ public static void saveImg(final String dest, final SCIFIOImgPlus<?> imgPlus, final int imageIndex) { try { new ImgSaver().saveImg(dest, imgPlus, imageIndex); } catch (final IncompatibleTypeException e) { saveError(dest, e); } catch (final ImgIOException e) { saveError(dest, e); } }
/** * @see ImgSaver#saveImg(Writer, Img) */ public static void saveImg(final Writer writer, final Img<?> img) { try { new ImgSaver().saveImg(writer, img); } catch (final IncompatibleTypeException e) { saveError(writer.getMetadata().getDatasetName(), e); } catch (final ImgIOException e) { saveError(writer.getMetadata().getDatasetName(), e); } }
/** * @see ImgSaver#saveImg(Writer, Img) */ public static void saveImg(final Writer writer, final Img<?> img) { try { new ImgSaver().saveImg(writer, img); } catch (final IncompatibleTypeException e) { saveError(writer.getMetadata().getDatasetName(), e); } catch (final ImgIOException e) { saveError(writer.getMetadata().getDatasetName(), e); } }
private static void convertImg(final File file) throws Exception { final Context c = new Context(); final SCIFIOConfig config = new SCIFIOConfig().imgOpenerSetImgModes(ImgMode.ARRAY); final ImgPlus<?> img = new ImgOpener(c).openImgs(file.getAbsolutePath(), config).get(0); final String outPath = file.getParent() + File.separator + "out_" + img.getName(); new ImgSaver(c).saveImg(outPath, img); c.dispose(); }
/** * @see ImgSaver#saveImg(Writer, SCIFIOImgPlus, int) */ public static void saveImg(final Writer writer, final SCIFIOImgPlus<?> imgPlus, final int imageIndex) { try { new ImgSaver().saveImg(writer, imgPlus, imageIndex); } catch (final IncompatibleTypeException e) { saveError(writer.getMetadata().getDatasetName(), e); } catch (final ImgIOException e) { saveError(writer.getMetadata().getDatasetName(), e); } }
private void testPlaneSavingForConfig(final SCIFIOConfig config) throws ImgIOException, IncompatibleTypeException { final ImgOpener o = new ImgOpener(ctx); final ImgSaver s = new ImgSaver(ctx); // write the image final SCIFIOImgPlus<UnsignedByteType> before = o.openImgs(id, new UnsignedByteType(), config).get(0); s.saveImg(out, before); // re-read the written image and check for consistency final SCIFIOImgPlus<UnsignedByteType> after = o.openImgs(out, new UnsignedByteType()).get(0); assertImagesEqual(before, after); }