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);
}
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());
}
}
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);
}
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());
}
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());
}
Aggregations