Java Code Examples for net.imglib2.view.Views#subsample()
The following examples show how to use
net.imglib2.view.Views#subsample() .
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: SubsampleViewTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 6 votes |
@Test public void defaultSubsampleTest() { Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10 }, new DoubleType()); MersenneTwisterFast r = new MersenneTwisterFast(SEED); for (DoubleType d : img) { d.set(r.nextDouble()); } SubsampleView<DoubleType> il2 = Views.subsample((RandomAccessible<DoubleType>) img, 2); SubsampleView<DoubleType> opr = ops.transform().subsampleView(img, 2); Cursor<DoubleType> il2C = Views.interval(il2, new long[] { 0, 0 }, new long[] { 4, 4 }).localizingCursor(); RandomAccess<DoubleType> oprRA = opr.randomAccess(); while (il2C.hasNext()) { il2C.next(); oprRA.setPosition(il2C); assertEquals(il2C.get().get(), oprRA.get().get(), 1e-10); } }
Example 2
Source File: SubsampleViewTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 6 votes |
@Test public void defaultSubsampleStepsTest() { Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10 }, new DoubleType()); MersenneTwisterFast r = new MersenneTwisterFast(SEED); for (DoubleType d : img) { d.set(r.nextDouble()); } SubsampleView<DoubleType> il2 = Views.subsample((RandomAccessible<DoubleType>) img, 2, 1); SubsampleView<DoubleType> opr = ops.transform().subsampleView(img, 2, 1); Cursor<DoubleType> il2C = Views.interval(il2, new long[] { 0, 0 }, new long[] { 4, 9 }).localizingCursor(); RandomAccess<DoubleType> oprRA = opr.randomAccess(); while (il2C.hasNext()) { il2C.next(); oprRA.setPosition(il2C); assertEquals(il2C.get().get(), oprRA.get().get(), 1e-10); } }
Example 3
Source File: SubsampleViewTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 6 votes |
@Test public void testIntervalSubsample() { Img<DoubleType> img = ArrayImgs.doubles(10, 10); MersenneTwisterFast r = new MersenneTwisterFast(SEED); for (DoubleType d : img) { d.set(r.nextDouble()); } SubsampleIntervalView<DoubleType> expected = Views.subsample((RandomAccessibleInterval<DoubleType>) img, 2); SubsampleIntervalView<DoubleType> actual = (SubsampleIntervalView<DoubleType>) ops.transform().subsampleView((RandomAccessibleInterval<DoubleType>)img, 2); Cursor<DoubleType> il2C = Views.interval(expected, new long[] { 0, 0 }, new long[] { 4, 4 }).localizingCursor(); RandomAccess<DoubleType> oprRA = actual.randomAccess(); while (il2C.hasNext()) { il2C.next(); oprRA.setPosition(il2C); assertEquals(il2C.get().get(), oprRA.get().get(), 1e-10); } assertTrue(Intervals.equals(expected, actual)); }
Example 4
Source File: SubsampleViewTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 6 votes |
@Test public void testIntervalSubsampleSteps() { Img<DoubleType> img = ArrayImgs.doubles(10,10); MersenneTwisterFast r = new MersenneTwisterFast(SEED); for (DoubleType d : img) { d.set(r.nextDouble()); } SubsampleIntervalView<DoubleType> expected = Views.subsample((RandomAccessibleInterval<DoubleType>) img, 2, 1); SubsampleIntervalView<DoubleType> actual = (SubsampleIntervalView<DoubleType>) ops.transform().subsampleView((RandomAccessibleInterval<DoubleType>)img, 2, 1); Cursor<DoubleType> il2C = Views.interval(expected, new long[] { 0, 0 }, new long[] { 4, 9 }).localizingCursor(); RandomAccess<DoubleType> oprRA = actual.randomAccess(); while (il2C.hasNext()) { il2C.next(); oprRA.setPosition(il2C); assertEquals(il2C.get().get(), oprRA.get().get(), 1e-10); } assertTrue(Intervals.equals(expected, actual)); }
Example 5
Source File: SubsampleIntervalViewStepsForDims.java From imagej-ops with BSD 2-Clause "Simplified" License | 4 votes |
@Override public SubsampleIntervalView<T> calculate(final RandomAccessibleInterval<T> input) { return Views.subsample(input, steps); }
Example 6
Source File: IntervalSubsampleView.java From imagej-ops with BSD 2-Clause "Simplified" License | 4 votes |
@Override public SubsampleIntervalView<T> calculate(final RandomAccessibleInterval<T> input) { return Views.subsample(input, step); }
Example 7
Source File: SubsampleViewStepsForDims.java From imagej-ops with BSD 2-Clause "Simplified" License | 4 votes |
@Override public SubsampleView<T> calculate(RandomAccessible<T> input) { return Views.subsample(input, steps); }
Example 8
Source File: DefaultSubsampleView.java From imagej-ops with BSD 2-Clause "Simplified" License | 4 votes |
@Override public SubsampleView<T> calculate(RandomAccessible<T> input) { return Views.subsample(input, step); }