/** * Check that having raw typed ImgOpener methods doesn't cause problems. This * test should just fail to compile if there's an issue. */ @Test public void testGenerics() throws IncompatibleTypeException, ImgIOException { doTestGenerics(new UnsignedByteType()); doTestGenerics(new FloatType()); doTestGenerics(new DoubleType()); }
/** * Test opening images with various ImgOptions set. */ @Test public void testImgOptions() throws IncompatibleTypeException, ImgIOException { final UnsignedByteType t = new UnsignedByteType(); testSubRegion(new ArrayImgFactory<>(t)); testSubRegion(new PlanarImgFactory<>(t)); testSubRegion(new SCIFIOCellImgFactory<>(t)); }
private <T extends RealType<T> & NativeType<T>> void testSubRegion( final ImgFactory<T> factory) throws ImgIOException { final SCIFIOConfig config = new SCIFIOConfig(); // should get an inner left left 128x128 square AxisType[] axes = new AxisType[] { Axes.X, Axes.Y }; String[] ranges = new String[] { "128-255", "128-255" }; config.imgOpenerSetRegion(new ImageRegion(axes, ranges)); doTestSubRegion(factory, config, 128 * 128 * 5); axes = new AxisType[] { Axes.TIME }; ranges = new String[] { "0,2-4:2" }; // should get the first, 3rd and 5th T slices config.imgOpenerSetRegion(new ImageRegion(axes, ranges)); doTestSubRegion(factory, config, 512 * 512 * 3); // should get the whole image config.imgOpenerSetRegion(null); doTestSubRegion(factory, config, 512 * 512 * 5); }