Java Code Examples for net.imglib2.view.IntervalView#cursor()
The following examples show how to use
net.imglib2.view.IntervalView#cursor() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PermuteViewTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 6 votes |
@Test public void permuteCoordinatesInverseOfDimensionTest() { Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[]{2, 2}, new DoubleType()); Cursor<DoubleType> c = img.cursor(); MersenneTwisterFast r = new MersenneTwisterFast(SEED); while (c.hasNext()) { c.next().set(r.nextDouble()); } IntervalView<DoubleType> out = Views.permuteCoordinatesInverse(img, new int[]{0, 1}, 1); Cursor<DoubleType> il2 = out.cursor(); RandomAccess<DoubleType> opr = ops.transform().permuteCoordinatesInverseView(img, new int[]{0, 1}, 1).randomAccess(); while (il2.hasNext()) { il2.next(); opr.setPosition(il2); assertEquals(il2.get().get(), opr.get().get(), 1e-10); } }
Example 2
Source File: PermuteViewTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 6 votes |
@Test public void testIntervalPermuteCoordinates() { Img<DoubleType> img = ArrayImgs.doubles(2, 2); Cursor<DoubleType> c = img.cursor(); MersenneTwisterFast r = new MersenneTwisterFast(SEED); while (c.hasNext()) { c.next().set(r.nextDouble()); } IntervalView<DoubleType> expected = Views.permuteCoordinates(img, new int[]{0, 1}); Cursor<DoubleType> e = expected.cursor(); RandomAccessibleInterval<DoubleType> actual = ops.transform().permuteCoordinatesView(img, new int[]{0, 1}); RandomAccess<DoubleType> actualRA = actual.randomAccess(); while (e.hasNext()) { e.next(); actualRA.setPosition(e); assertEquals(e.get().get(), actualRA.get().get(), 1e-10); } assertTrue(Intervals.equals(expected, actual)); }
Example 3
Source File: PermuteViewTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 6 votes |
@Test public void testIntervalPermuteDimensionCoordinates() { Img<DoubleType> img = ArrayImgs.doubles(2, 2); Cursor<DoubleType> c = img.cursor(); MersenneTwisterFast r = new MersenneTwisterFast(SEED); while (c.hasNext()) { c.next().set(r.nextDouble()); } IntervalView<DoubleType> expected = Views.permuteCoordinates(img, new int[]{0, 1}, 1); Cursor<DoubleType> e = expected.cursor(); RandomAccessibleInterval<DoubleType> actual = ops.transform().permuteCoordinatesView(img, new int[]{0, 1}, 1); RandomAccess<DoubleType> actualRA = actual.randomAccess(); while (e.hasNext()) { e.next(); actualRA.setPosition(e); assertEquals(e.get().get(), actualRA.get().get(), 1e-10); } assertTrue(Intervals.equals(expected, actual)); }
Example 4
Source File: PermuteViewTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 6 votes |
@Test public void testIntervalPermuteInverseCoordinates() { Img<DoubleType> img = ArrayImgs.doubles(2, 2); Cursor<DoubleType> c = img.cursor(); MersenneTwisterFast r = new MersenneTwisterFast(SEED); while (c.hasNext()) { c.next().set(r.nextDouble()); } IntervalView<DoubleType> expected = Views.permuteCoordinatesInverse(img, new int[]{0, 1}); Cursor<DoubleType> e = expected.cursor(); RandomAccessibleInterval<DoubleType> actual = ops.transform().permuteCoordinatesInverseView(img, new int[]{0, 1}); RandomAccess<DoubleType> actualRA = actual.randomAccess(); while (e.hasNext()) { e.next(); actualRA.setPosition(e); assertEquals(e.get().get(), actualRA.get().get(), 1e-10); } assertTrue(Intervals.equals(expected, actual)); }
Example 5
Source File: PermuteViewTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 6 votes |
@Test public void testIntervalPermuteInverseDimensionCoordinates() { Img<DoubleType> img = ArrayImgs.doubles(2, 2); Cursor<DoubleType> c = img.cursor(); MersenneTwisterFast r = new MersenneTwisterFast(SEED); while (c.hasNext()) { c.next().set(r.nextDouble()); } IntervalView<DoubleType> expected = Views.permuteCoordinatesInverse(img, new int[]{0, 1}, 1); Cursor<DoubleType> e = expected.cursor(); RandomAccessibleInterval<DoubleType> actual = ops.transform().permuteCoordinatesInverseView(img, new int[]{0, 1}, 1); RandomAccess<DoubleType> actualRA = actual.randomAccess(); while (e.hasNext()) { e.next(); actualRA.setPosition(e); assertEquals(e.get().get(), actualRA.get().get(), 1e-10); } assertTrue(Intervals.equals(expected, actual)); }