Search in sources :

Example 1 with OutOfBounds

use of net.imglib2.outofbounds.OutOfBounds in project imagej-ops by imagej.

the class ExtendRandomViewTest method extendRandomTest.

@Test
public void extendRandomTest() {
    Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10 }, new DoubleType());
    OutOfBounds<DoubleType> il2 = Views.extendRandom(img, 0, 0).randomAccess();
    OutOfBounds<DoubleType> opr = ops.transform().extendRandomView(img, 0, 0).randomAccess();
    il2.setPosition(new int[] { -1, -1 });
    opr.setPosition(new int[] { -1, -1 });
    assertEquals(il2.get().get(), opr.get().get(), 1e-10);
    il2.setPosition(new int[] { 11, 11 });
    opr.setPosition(new int[] { 11, 11 });
    assertEquals(il2.get().get(), opr.get().get(), 1e-10);
}
Also used : DoubleType(net.imglib2.type.numeric.real.DoubleType) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 2 with OutOfBounds

use of net.imglib2.outofbounds.OutOfBounds in project imagej-ops by imagej.

the class ExtendValueViewTest method extendValueTest.

@Test
public void extendValueTest() {
    Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10 }, new DoubleType());
    OutOfBounds<DoubleType> il2 = Views.extendValue(img, new DoubleType(0)).randomAccess();
    OutOfBounds<DoubleType> opr = ops.transform().extendValueView(img, new DoubleType(0)).randomAccess();
    il2.setPosition(new int[] { -1, -1 });
    opr.setPosition(new int[] { -1, -1 });
    assertEquals(il2.get().get(), opr.get().get(), 1e-10);
    il2.setPosition(new int[] { 11, 11 });
    opr.setPosition(new int[] { 11, 11 });
    assertEquals(il2.get().get(), opr.get().get(), 1e-10);
}
Also used : DoubleType(net.imglib2.type.numeric.real.DoubleType) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 3 with OutOfBounds

use of net.imglib2.outofbounds.OutOfBounds in project imagej-ops by imagej.

the class ExtendBorderViewTest method extendBorderTest.

@Test
public void extendBorderTest() {
    Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10 }, new DoubleType());
    OutOfBounds<DoubleType> il2 = Views.extendBorder(img).randomAccess();
    OutOfBounds<DoubleType> opr = ops.transform().extendBorderView(img).randomAccess();
    il2.setPosition(new int[] { -1, -1 });
    opr.setPosition(new int[] { -1, -1 });
    assertEquals(il2.get().get(), opr.get().get(), 1e-10);
    il2.setPosition(new int[] { 11, 11 });
    opr.setPosition(new int[] { 11, 11 });
    assertEquals(il2.get().get(), opr.get().get(), 1e-10);
}
Also used : DoubleType(net.imglib2.type.numeric.real.DoubleType) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 4 with OutOfBounds

use of net.imglib2.outofbounds.OutOfBounds in project imagej-ops by imagej.

the class ExtendMirrorDoubleViewTest method extendMirrorDoubleTest.

@Test
public void extendMirrorDoubleTest() {
    Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10 }, new DoubleType());
    OutOfBounds<DoubleType> il2 = Views.extendMirrorDouble(img).randomAccess();
    OutOfBounds<DoubleType> opr = ops.transform().extendMirrorDoubleView(img).randomAccess();
    il2.setPosition(new int[] { -1, -1 });
    opr.setPosition(new int[] { -1, -1 });
    assertEquals(il2.get().get(), opr.get().get(), 1e-10);
    il2.setPosition(new int[] { 11, 11 });
    opr.setPosition(new int[] { 11, 11 });
    assertEquals(il2.get().get(), opr.get().get(), 1e-10);
}
Also used : DoubleType(net.imglib2.type.numeric.real.DoubleType) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 5 with OutOfBounds

use of net.imglib2.outofbounds.OutOfBounds in project imagej-ops by imagej.

the class ExtendMirrorSingleViewTest method extendMirrorSingleTest.

@Test
public void extendMirrorSingleTest() {
    Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10 }, new DoubleType());
    OutOfBounds<DoubleType> il2 = Views.extendMirrorSingle(img).randomAccess();
    OutOfBounds<DoubleType> opr = ops.transform().extendMirrorSingleView(img).randomAccess();
    il2.setPosition(new int[] { -1, -1 });
    opr.setPosition(new int[] { -1, -1 });
    assertEquals(il2.get().get(), opr.get().get(), 1e-10);
    il2.setPosition(new int[] { 11, 11 });
    opr.setPosition(new int[] { 11, 11 });
    assertEquals(il2.get().get(), opr.get().get(), 1e-10);
}
Also used : DoubleType(net.imglib2.type.numeric.real.DoubleType) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Aggregations

AbstractOpTest (net.imagej.ops.AbstractOpTest)8 DoubleType (net.imglib2.type.numeric.real.DoubleType)8 Test (org.junit.Test)8 ArrayList (java.util.ArrayList)2 RandomAccessibleInterval (net.imglib2.RandomAccessibleInterval)2 DiamondShape (net.imglib2.algorithm.neighborhood.DiamondShape)2 Neighborhood (net.imglib2.algorithm.neighborhood.Neighborhood)2 RectangleShape (net.imglib2.algorithm.neighborhood.RectangleShape)2 Shape (net.imglib2.algorithm.neighborhood.Shape)2 LabelingType (net.imglib2.roi.labeling.LabelingType)2 IntType (net.imglib2.type.numeric.integer.IntType)2 ExtendedRandomAccessibleInterval (net.imglib2.view.ExtendedRandomAccessibleInterval)2 Collections (java.util.Collections)1 Comparator (java.util.Comparator)1 List (java.util.List)1 Map (java.util.Map)1 PriorityQueue (java.util.PriorityQueue)1 Set (java.util.Set)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 Collectors (java.util.stream.Collectors)1