Search in sources :

Example 6 with IncompatibleTypeException

use of net.imglib2.exception.IncompatibleTypeException 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 7 with IncompatibleTypeException

use of net.imglib2.exception.IncompatibleTypeException 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)

Aggregations

IncompatibleTypeException (net.imglib2.exception.IncompatibleTypeException)6 BitType (net.imglib2.type.logic.BitType)5 Test (org.junit.Test)5 AbstractOpTest (net.imagej.ops.AbstractOpTest)4 RectangleShape (net.imglib2.algorithm.neighborhood.RectangleShape)4 Img (net.imglib2.img.Img)4 ArrayImg (net.imglib2.img.array.ArrayImg)4 ByteType (net.imglib2.type.numeric.integer.ByteType)4 ExecutionException (java.util.concurrent.ExecutionException)1 ExecutorService (java.util.concurrent.ExecutorService)1 Op (net.imagej.ops.Op)1 Ops (net.imagej.ops.Ops)1 UnaryComputerOp (net.imagej.ops.special.computer.UnaryComputerOp)1 AbstractThresholdTest (net.imagej.ops.threshold.AbstractThresholdTest)1 Dimensions (net.imglib2.Dimensions)1 FinalDimensions (net.imglib2.FinalDimensions)1 UnsignedShortType (net.imglib2.type.numeric.integer.UnsignedShortType)1 DoubleType (net.imglib2.type.numeric.real.DoubleType)1 FloatType (net.imglib2.type.numeric.real.FloatType)1 ItemIO (org.scijava.ItemIO)1