Search in sources :

Example 11 with DiamondShape

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

the class TopHatTest method testSingleTopHat.

@Test
public void testSingleTopHat() {
    final Shape shape = new DiamondShape(1);
    final List<Shape> shapes = Arrays.asList(shape);
    @SuppressWarnings("unchecked") final Img<ByteType> out1 = (Img<ByteType>) ops.run(ListTopHat.class, Img.class, in, shapes);
    final Img<ByteType> out2 = TopHat.topHat(in, shape, 1);
    assertIterationsEqual(out2, out1);
}
Also used : Img(net.imglib2.img.Img) 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) ByteType(net.imglib2.type.numeric.integer.ByteType) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 12 with DiamondShape

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

the class MorphologyOpsTest method testFillHoles.

@Test
public void testFillHoles() {
    Img<BitType> result = ops.create().img(imgWithHoles);
    ops.morphology().fillHoles(result, imgWithHoles, new DiamondShape(1));
    Cursor<BitType> resultC = result.cursor();
    final BitType one = new BitType(true);
    while (resultC.hasNext()) {
        assertEquals(one, resultC.next());
    }
}
Also used : BitType(net.imglib2.type.logic.BitType) DiamondShape(net.imglib2.algorithm.neighborhood.DiamondShape) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 13 with DiamondShape

use of net.imglib2.algorithm.neighborhood.DiamondShape 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)

Example 14 with DiamondShape

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

the class DilationTest method testListDilate.

@Test
public void testListDilate() {
    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, false);
    final Img<ByteType> out2 = Dilation.dilate(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 15 with DiamondShape

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

the class DilationTest method testSingleDilateBitType.

@Test
public void testSingleDilateBitType() {
    final Shape shape = new DiamondShape(1);
    @SuppressWarnings("unchecked") final Img<BitType> out1 = (Img<BitType>) ops.run(DefaultDilate.class, Img.class, bitIn, shape, false);
    final Img<BitType> out2 = Dilation.dilate(bitIn, shape, 1);
    final Cursor<BitType> c1 = out1.cursor();
    final Cursor<BitType> c2 = out2.cursor();
    while (c1.hasNext()) assertEquals(c1.next().get(), c2.next().get());
}
Also used : Img(net.imglib2.img.Img) DiamondShape(net.imglib2.algorithm.neighborhood.DiamondShape) Shape(net.imglib2.algorithm.neighborhood.Shape) RectangleShape(net.imglib2.algorithm.neighborhood.RectangleShape) HorizontalLineShape(net.imglib2.algorithm.neighborhood.HorizontalLineShape) BitType(net.imglib2.type.logic.BitType) DiamondShape(net.imglib2.algorithm.neighborhood.DiamondShape) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Aggregations

DiamondShape (net.imglib2.algorithm.neighborhood.DiamondShape)23 RectangleShape (net.imglib2.algorithm.neighborhood.RectangleShape)21 AbstractOpTest (net.imagej.ops.AbstractOpTest)20 Shape (net.imglib2.algorithm.neighborhood.Shape)20 Test (org.junit.Test)20 HorizontalLineShape (net.imglib2.algorithm.neighborhood.HorizontalLineShape)18 ByteType (net.imglib2.type.numeric.integer.ByteType)17 ArrayList (java.util.ArrayList)10 Img (net.imglib2.img.Img)10 IterableInterval (net.imglib2.IterableInterval)9 BitType (net.imglib2.type.logic.BitType)5 RandomAccessibleInterval (net.imglib2.RandomAccessibleInterval)3 Neighborhood (net.imglib2.algorithm.neighborhood.Neighborhood)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