Search in sources :

Example 31 with OutOfBoundsMirrorFactory

use of net.imglib2.outofbounds.OutOfBoundsMirrorFactory in project imagej-ops by imagej.

the class LocalThresholdTest method testLocalPhansalkarResultsConsistency.

/**
 * @see LocalPhansalkarThresholdIntegral
 * @see LocalPhansalkarThreshold
 */
@Test
public void testLocalPhansalkarResultsConsistency() {
    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(LocalPhansalkarThreshold.class, out2, normalizedIn, new RectangleShape(2, false), new OutOfBoundsMirrorFactory<ByteType, Img<ByteType>>(Boundary.SINGLE), 0.25, 0.5);
    // Integral image-based implementation
    ops.run(LocalPhansalkarThresholdIntegral.class, out3, normalizedIn, new RectangleShape(2, false), new OutOfBoundsMirrorFactory<ByteType, Img<ByteType>>(Boundary.SINGLE), 0.25, 0.5);
    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)

Example 32 with OutOfBoundsMirrorFactory

use of net.imglib2.outofbounds.OutOfBoundsMirrorFactory in project imagej-ops by imagej.

the class LocalThresholdTest method testLocalOtsuThreshold.

/**
 * @see LocalOtsuThreshold
 */
@Test
public void testLocalOtsuThreshold() {
    ops.run(Otsu.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 33 with OutOfBoundsMirrorFactory

use of net.imglib2.outofbounds.OutOfBoundsMirrorFactory in project imagej-ops by imagej.

the class LocalThresholdTest method testLocalRenyiEntropyThreshold.

/**
 * @see LocalRenyiEntropyThreshold
 */
@Test
public void testLocalRenyiEntropyThreshold() {
    ops.run(RenyiEntropy.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 34 with OutOfBoundsMirrorFactory

use of net.imglib2.outofbounds.OutOfBoundsMirrorFactory in project imagej-ops by imagej.

the class LocalThresholdTest method testLocalNiblackResultsConsistency.

/**
 * @see LocalNiblackThresholdIntegral
 * @see LocalNiblackThreshold
 */
@Test
public void testLocalNiblackResultsConsistency() {
    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(LocalNiblackThreshold.class, out2, normalizedIn, new RectangleShape(2, false), new OutOfBoundsMirrorFactory<ByteType, Img<ByteType>>(Boundary.SINGLE), 0.2, 1.0);
    // Integral image-based implementation
    ops.run(LocalNiblackThresholdIntegral.class, out3, normalizedIn, new RectangleShape(2, false), new OutOfBoundsMirrorFactory<ByteType, Img<ByteType>>(Boundary.SINGLE), 0.2, 1.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)

Example 35 with OutOfBoundsMirrorFactory

use of net.imglib2.outofbounds.OutOfBoundsMirrorFactory in project imagej-ops by imagej.

the class LocalThresholdTest method testLocalMaxEntropyThreshold.

/**
 * @see LocalMaxEntropyThreshold
 */
@Test
public void testLocalMaxEntropyThreshold() {
    ops.run(MaxEntropy.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)

Aggregations

RectangleShape (net.imglib2.algorithm.neighborhood.RectangleShape)35 ByteType (net.imglib2.type.numeric.integer.ByteType)35 AbstractOpTest (net.imagej.ops.AbstractOpTest)34 Img (net.imglib2.img.Img)34 Test (org.junit.Test)34 ArrayImg (net.imglib2.img.array.ArrayImg)33 IncompatibleTypeException (net.imglib2.exception.IncompatibleTypeException)4 BitType (net.imglib2.type.logic.BitType)4 RandomAccessibleInterval (net.imglib2.RandomAccessibleInterval)2 OutOfBoundsMirrorFactory (net.imglib2.outofbounds.OutOfBoundsMirrorFactory)2 EigenvalueDecomposition (Jama.EigenvalueDecomposition)1 Matrix (Jama.Matrix)1 ArrayList (java.util.ArrayList)1 FinalInterval (net.imglib2.FinalInterval)1 DiamondShape (net.imglib2.algorithm.neighborhood.DiamondShape)1