Search in sources :

Example 21 with RectangleShape

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

the class LocalThresholdTest method testLocalSauvolaIntegral.

/**
 * @see LocalSauvolaThresholdIntegral
 */
@Test
public void testLocalSauvolaIntegral() {
    ops.run(LocalSauvolaThresholdIntegral.class, out, in, new RectangleShape(2, false), new OutOfBoundsMirrorFactory<ByteType, Img<ByteType>>(Boundary.SINGLE), 0.5, 0.5);
    assertEquals(false, out.firstElement().get());
}
Also used : Img(net.imglib2.img.Img) ArrayImg(net.imglib2.img.array.ArrayImg) RectangleShape(net.imglib2.algorithm.neighborhood.RectangleShape) ByteType(net.imglib2.type.numeric.integer.ByteType) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 22 with RectangleShape

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

the class LocalThresholdTest method testLocalBernsenThreshold.

/**
 * @see LocalBernsenThreshold
 */
@Test
public void testLocalBernsenThreshold() {
    ops.run(LocalBernsenThreshold.class, out, in, new RectangleShape(3, false), new OutOfBoundsMirrorFactory<ByteType, Img<ByteType>>(Boundary.SINGLE), 1.0, Double.MAX_VALUE * 0.5);
    assertEquals(true, out.firstElement().get());
}
Also used : Img(net.imglib2.img.Img) ArrayImg(net.imglib2.img.array.ArrayImg) RectangleShape(net.imglib2.algorithm.neighborhood.RectangleShape) ByteType(net.imglib2.type.numeric.integer.ByteType) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 23 with RectangleShape

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

the class LocalThresholdTest method testLocalThresholdMean.

/**
 * @see LocalMeanThreshold
 */
@Test
public void testLocalThresholdMean() {
    ops.run(LocalMeanThreshold.class, out, in, new RectangleShape(1, false), new OutOfBoundsMirrorFactory<ByteType, Img<ByteType>>(Boundary.SINGLE), 0.0);
    assertEquals(true, out.firstElement().get());
}
Also used : Img(net.imglib2.img.Img) ArrayImg(net.imglib2.img.array.ArrayImg) RectangleShape(net.imglib2.algorithm.neighborhood.RectangleShape) ByteType(net.imglib2.type.numeric.integer.ByteType) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 24 with RectangleShape

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

the class LocalThresholdTest method testLocalRosinThreshold.

/**
 * @see LocalRosinThreshold
 */
@Test
public void testLocalRosinThreshold() {
    ops.run(Rosin.class, out, in, new RectangleShape(1, false), new OutOfBoundsMirrorFactory<ByteType, Img<ByteType>>(Boundary.SINGLE));
    assertEquals(false, out.firstElement().get());
}
Also used : Img(net.imglib2.img.Img) ArrayImg(net.imglib2.img.array.ArrayImg) RectangleShape(net.imglib2.algorithm.neighborhood.RectangleShape) ByteType(net.imglib2.type.numeric.integer.ByteType) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 25 with RectangleShape

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

Aggregations

RectangleShape (net.imglib2.algorithm.neighborhood.RectangleShape)53 ByteType (net.imglib2.type.numeric.integer.ByteType)47 Test (org.junit.Test)46 AbstractOpTest (net.imagej.ops.AbstractOpTest)44 Img (net.imglib2.img.Img)34 ArrayImg (net.imglib2.img.array.ArrayImg)33 Shape (net.imglib2.algorithm.neighborhood.Shape)12 ArrayList (java.util.ArrayList)11 DiamondShape (net.imglib2.algorithm.neighborhood.DiamondShape)11 IterableInterval (net.imglib2.IterableInterval)9 HorizontalLineShape (net.imglib2.algorithm.neighborhood.HorizontalLineShape)8 BitType (net.imglib2.type.logic.BitType)5 RandomAccessibleInterval (net.imglib2.RandomAccessibleInterval)4 Neighborhood (net.imglib2.algorithm.neighborhood.Neighborhood)4 IncompatibleTypeException (net.imglib2.exception.IncompatibleTypeException)4 Op (net.imagej.ops.Op)3 AbstractUnaryComputerOp (net.imagej.ops.special.computer.AbstractUnaryComputerOp)3 RandomAccess (net.imglib2.RandomAccess)2 RectangleNeighborhood (net.imglib2.algorithm.neighborhood.RectangleNeighborhood)2 LabelingType (net.imglib2.roi.labeling.LabelingType)2