/** * 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); }
/** * @param reader - An initialized {@link Reader} to use for reading image * data. * @return - the {@link ImgPlus} or null * @throws ImgIOException if there is a problem reading the image data. */ public List<SCIFIOImgPlus<?>> openImgs(final Reader reader) throws ImgIOException { return openImgs(reader, null); }
/** @deprecated Use {@link io.scif.img.IO#openImg(String, ImgOptions)}. */ public static<T extends RealType<T> & NativeType<T>> Img<T> open(final String pathOrURL) throws ImgIOException, IncompatibleTypeException { return (Img<T>) new ImgOpener().openImg(pathOrURL); // Old: //return wrap(IJ.openImage(pathOrURL)); }
/** * @see ImgOpener#openImgs(String) */ public static List<SCIFIOImgPlus<?>> openImgs(final String source) { final ImgOpener opener = opener(); List<SCIFIOImgPlus<?>> imgPlus = null; try { imgPlus = opener.openImgs(source); register(imgPlus, opener); } catch (final ImgIOException e) { openError(source, e); } return imgPlus; }
/** * @return The first value in this range. */ public Long head() { return get(0); }
/** * Returns true if the provided {@link Range} contains the given index */ private boolean inRange(final Range range, final long value) { if (range == null) return true; return range.contains(value); }
@Override public <T> SCIFIOImgPlus<T> makeSCIFIOImgPlus(final Img<T> img) { if (img instanceof SCIFIOImgPlus) return (SCIFIOImgPlus<T>) img; if (img instanceof ImgPlus) { return new SCIFIOImgPlus<>((ImgPlus<T>) img); } return new SCIFIOImgPlus<>(img); }
@Override public Reference makeRef(final Object referent, final ReferenceQueue queue, final Object... params) { final Reference ref = new ImgPlusCtxCleaner(referent, queue, params); return ref; }
/** * 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); }
/** * Reads in an {@link ImgPlus} from the first image of the given source. * * @param source - the location of the dataset to open * @return - the {@link ImgPlus} or null * @throws ImgIOException if there is a problem reading the image data. */ public List<SCIFIOImgPlus<?>> openImgs(final String source) throws ImgIOException { return openImgs(source, (SCIFIOConfig) null); }
/** * @return The first value in this range. */ public Long head() { return get(0); }
/** * Returns true if the provided {@link Range} contains the given index */ private boolean inRange(final Range range, final long value) { if (range == null) return true; return range.contains(value); }
@Override public <T> SCIFIOImgPlus<T> makeSCIFIOImgPlus(final Img<T> img) { if (img instanceof SCIFIOImgPlus) return (SCIFIOImgPlus<T>) img; if (img instanceof ImgPlus) { return new SCIFIOImgPlus<>((ImgPlus<T>) img); } return new SCIFIOImgPlus<>(img); }
/** * 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); }
/** * @param reader - An initialized {@link Reader} to use for reading image * data. * @return - the {@link ImgPlus} or null * @throws ImgIOException if there is a problem reading the image data. */ public List<SCIFIOImgPlus<?>> openImgs(final Reader reader) throws ImgIOException { return openImgs(reader, 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); }