Search in sources :

Example 1 with HorizontalLineShape

use of net.imglib2.algorithm.neighborhood.HorizontalLineShape in project imagej-ops by imagej.

the class ClosingTest method testListClose.

@Test
public void testListClose() {
    final List<Shape> shapes = new ArrayList<>();
    shapes.add(new DiamondShape(1));
    shapes.add(new DiamondShape(1));
    shapes.add(new RectangleShape(1, false));
    shapes.add(new HorizontalLineShape(2, 1, false));
    @SuppressWarnings("unchecked") final IterableInterval<ByteType> out1 = (IterableInterval<ByteType>) ops.run(ListClose.class, IterableInterval.class, in, shapes);
    final Img<ByteType> out2 = Closing.close(in, shapes, 1);
    assertIterationsEqual(out2, out1);
}
Also used : DiamondShape(net.imglib2.algorithm.neighborhood.DiamondShape) Shape(net.imglib2.algorithm.neighborhood.Shape) RectangleShape(net.imglib2.algorithm.neighborhood.RectangleShape) HorizontalLineShape(net.imglib2.algorithm.neighborhood.HorizontalLineShape) RectangleShape(net.imglib2.algorithm.neighborhood.RectangleShape) DiamondShape(net.imglib2.algorithm.neighborhood.DiamondShape) ArrayList(java.util.ArrayList) IterableInterval(net.imglib2.IterableInterval) ByteType(net.imglib2.type.numeric.integer.ByteType) HorizontalLineShape(net.imglib2.algorithm.neighborhood.HorizontalLineShape) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 2 with HorizontalLineShape

use of net.imglib2.algorithm.neighborhood.HorizontalLineShape in project imagej-ops by imagej.

the class DilationTest method testListDilateFull.

@Test
public void testListDilateFull() {
    final List<Shape> shapes = new ArrayList<>();
    shapes.add(new DiamondShape(1));
    shapes.add(new DiamondShape(1));
    shapes.add(new RectangleShape(1, false));
    shapes.add(new HorizontalLineShape(2, 1, false));
    @SuppressWarnings("unchecked") final IterableInterval<ByteType> out1 = (IterableInterval<ByteType>) ops.run(ListDilate.class, IterableInterval.class, in, shapes, true);
    final Img<ByteType> out2 = Dilation.dilateFull(in, shapes, 1);
    final Cursor<ByteType> c1 = out1.cursor();
    final Cursor<ByteType> c2 = out2.cursor();
    while (c1.hasNext()) assertEquals(c1.next().get(), c2.next().get());
}
Also used : DiamondShape(net.imglib2.algorithm.neighborhood.DiamondShape) Shape(net.imglib2.algorithm.neighborhood.Shape) RectangleShape(net.imglib2.algorithm.neighborhood.RectangleShape) HorizontalLineShape(net.imglib2.algorithm.neighborhood.HorizontalLineShape) DiamondShape(net.imglib2.algorithm.neighborhood.DiamondShape) ArrayList(java.util.ArrayList) ByteType(net.imglib2.type.numeric.integer.ByteType) HorizontalLineShape(net.imglib2.algorithm.neighborhood.HorizontalLineShape) RectangleShape(net.imglib2.algorithm.neighborhood.RectangleShape) IterableInterval(net.imglib2.IterableInterval) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 3 with HorizontalLineShape

use of net.imglib2.algorithm.neighborhood.HorizontalLineShape in project imagej-ops by imagej.

the class ErosionTest method testListErodeFull.

@Test
public void testListErodeFull() {
    final List<Shape> shapes = new ArrayList<>();
    shapes.add(new DiamondShape(1));
    shapes.add(new DiamondShape(1));
    shapes.add(new RectangleShape(1, false));
    shapes.add(new HorizontalLineShape(2, 1, false));
    final Img<ByteType> out2 = Erosion.erodeFull(in, shapes, 1);
    @SuppressWarnings("unchecked") final IterableInterval<ByteType> out1 = (IterableInterval<ByteType>) ops.run(ListErode.class, IterableInterval.class, in, shapes, true);
    assertIterationsEqual(out1, out2);
}
Also used : DiamondShape(net.imglib2.algorithm.neighborhood.DiamondShape) Shape(net.imglib2.algorithm.neighborhood.Shape) RectangleShape(net.imglib2.algorithm.neighborhood.RectangleShape) HorizontalLineShape(net.imglib2.algorithm.neighborhood.HorizontalLineShape) RectangleShape(net.imglib2.algorithm.neighborhood.RectangleShape) DiamondShape(net.imglib2.algorithm.neighborhood.DiamondShape) ArrayList(java.util.ArrayList) IterableInterval(net.imglib2.IterableInterval) ByteType(net.imglib2.type.numeric.integer.ByteType) HorizontalLineShape(net.imglib2.algorithm.neighborhood.HorizontalLineShape) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 4 with HorizontalLineShape

use of net.imglib2.algorithm.neighborhood.HorizontalLineShape in project imagej-ops by imagej.

the class ErosionTest method testListErode.

// @Test
public void testListErode() {
    final List<Shape> shapes = new ArrayList<>();
    shapes.add(new DiamondShape(1));
    shapes.add(new DiamondShape(1));
    shapes.add(new RectangleShape(1, false));
    shapes.add(new HorizontalLineShape(2, 1, false));
    final Img<ByteType> out2 = in.copy();
    Erosion.erode(Views.extendValue(in, new ByteType((byte) -128)), out2, shapes, 1);
    @SuppressWarnings("unchecked") final IterableInterval<ByteType> out1 = (IterableInterval<ByteType>) ops.run(ListErode.class, IterableInterval.class, in, shapes, false);
    assertIterationsEqual(out1, out2);
}
Also used : DiamondShape(net.imglib2.algorithm.neighborhood.DiamondShape) Shape(net.imglib2.algorithm.neighborhood.Shape) RectangleShape(net.imglib2.algorithm.neighborhood.RectangleShape) HorizontalLineShape(net.imglib2.algorithm.neighborhood.HorizontalLineShape) RectangleShape(net.imglib2.algorithm.neighborhood.RectangleShape) DiamondShape(net.imglib2.algorithm.neighborhood.DiamondShape) ArrayList(java.util.ArrayList) IterableInterval(net.imglib2.IterableInterval) ByteType(net.imglib2.type.numeric.integer.ByteType) HorizontalLineShape(net.imglib2.algorithm.neighborhood.HorizontalLineShape)

Example 5 with HorizontalLineShape

use of net.imglib2.algorithm.neighborhood.HorizontalLineShape in project imagej-ops by imagej.

the class BlackTopHatTest method testListBlackTopHat.

@Test
public void testListBlackTopHat() {
    final List<Shape> shapes = new ArrayList<>();
    shapes.add(new DiamondShape(1));
    shapes.add(new DiamondShape(1));
    shapes.add(new RectangleShape(1, false));
    shapes.add(new HorizontalLineShape(2, 1, false));
    @SuppressWarnings("unchecked") final IterableInterval<ByteType> out1 = (IterableInterval<ByteType>) ops.run(ListBlackTopHat.class, IterableInterval.class, in, shapes);
    final Img<ByteType> out2 = BlackTopHat.blackTopHat(in, shapes, 1);
    assertIterationsEqual(out2, out1);
}
Also used : DiamondShape(net.imglib2.algorithm.neighborhood.DiamondShape) Shape(net.imglib2.algorithm.neighborhood.Shape) RectangleShape(net.imglib2.algorithm.neighborhood.RectangleShape) HorizontalLineShape(net.imglib2.algorithm.neighborhood.HorizontalLineShape) RectangleShape(net.imglib2.algorithm.neighborhood.RectangleShape) DiamondShape(net.imglib2.algorithm.neighborhood.DiamondShape) ArrayList(java.util.ArrayList) IterableInterval(net.imglib2.IterableInterval) ByteType(net.imglib2.type.numeric.integer.ByteType) HorizontalLineShape(net.imglib2.algorithm.neighborhood.HorizontalLineShape) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)8 IterableInterval (net.imglib2.IterableInterval)8 DiamondShape (net.imglib2.algorithm.neighborhood.DiamondShape)8 HorizontalLineShape (net.imglib2.algorithm.neighborhood.HorizontalLineShape)8 RectangleShape (net.imglib2.algorithm.neighborhood.RectangleShape)8 Shape (net.imglib2.algorithm.neighborhood.Shape)8 ByteType (net.imglib2.type.numeric.integer.ByteType)8 AbstractOpTest (net.imagej.ops.AbstractOpTest)7 Test (org.junit.Test)7