Search in sources :

Example 6 with RectangleShape

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

the class LocalThresholdTest method testLocalShanbhagThreshold.

/**
 * @see LocalShanbhagThreshold
 */
@Test
public void testLocalShanbhagThreshold() {
    ops.run(Shanbhag.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 7 with RectangleShape

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

the class LocalThresholdTest method testLocalNiblackThresholdIntegral.

/**
 * @see LocalNiblackThresholdIntegral
 */
@Test
public void testLocalNiblackThresholdIntegral() {
    ops.run(LocalNiblackThresholdIntegral.class, out, in, new RectangleShape(3, false), new OutOfBoundsMirrorFactory<ByteType, Img<ByteType>>(Boundary.SINGLE), 0.2, 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 8 with RectangleShape

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

the class LocalThresholdTest method testLocalNiblackThreshold.

/**
 * @see LocalNiblackThreshold
 */
@Test
public void testLocalNiblackThreshold() {
    ops.run(LocalNiblackThreshold.class, out, in, new RectangleShape(1, false), new OutOfBoundsMirrorFactory<ByteType, Img<ByteType>>(Boundary.SINGLE), 0.2, 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 9 with RectangleShape

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

the class LocalThresholdTest method testLocalLiThreshold.

/**
 * @see LocalLiThreshold
 */
@Test
public void testLocalLiThreshold() {
    ops.run(Li.class, out, in, new RectangleShape(1, false), new OutOfBoundsMirrorFactory<ByteType, Img<ByteType>>(Boundary.SINGLE));
    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 10 with RectangleShape

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

the class LocalThresholdTest method testLocalMeanResultsConsistency.

/**
 * @see LocalMeanThresholdIntegral
 * @see LocalMeanThreshold
 */
@Test
public void testLocalMeanResultsConsistency() {
    Img<BitType> out2 = null;
    Img<BitType> out3 = null;
    try {
        out2 = in.factory().imgFactory(new BitType()).create(in, new BitType());
        out3 = in.factory().imgFactory(new BitType()).create(in, new BitType());
    } catch (IncompatibleTypeException exc) {
        exc.printStackTrace();
    }
    // Default implementation
    ops.run(LocalMeanThreshold.class, out2, in, new RectangleShape(2, false), new OutOfBoundsMirrorFactory<ByteType, Img<ByteType>>(Boundary.SINGLE), 0.0);
    // Integral image-based implementation
    ops.run(LocalMeanThresholdIntegral.class, out3, in, new RectangleShape(2, false), new OutOfBoundsMirrorFactory<ByteType, Img<ByteType>>(Boundary.SINGLE), 0.0);
    testIterableIntervalSimilarity(out2, out3);
}
Also used : Img(net.imglib2.img.Img) ArrayImg(net.imglib2.img.array.ArrayImg) RectangleShape(net.imglib2.algorithm.neighborhood.RectangleShape) BitType(net.imglib2.type.logic.BitType) IncompatibleTypeException(net.imglib2.exception.IncompatibleTypeException) ByteType(net.imglib2.type.numeric.integer.ByteType) 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