Search in sources :

Example 51 with ByteType

use of net.imglib2.type.numeric.integer.ByteType in project imagej-ops by imagej.

the class IntegralCursorTest method testIntegralCursorCopyConstructor.

@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void testIntegralCursorCopyConstructor() {
    Shape rectangleShape = new RectangleShape(1, false);
    IterableInterval<Neighborhood<ByteType>> ii = rectangleShape.neighborhoodsSafe(img);
    Cursor<Neighborhood<ByteType>> cursor = ii.cursor();
    // Manually select the neighborhood that is centered on the image
    cursor.fwd();
    cursor.fwd();
    cursor.fwd();
    cursor.fwd();
    cursor.fwd();
    IntegralCursor<ByteType> integralCursor = new IntegralCursor<>((RectangleNeighborhood) cursor.get());
    assertEquals(integralCursor.next(), new ByteType((byte) 1));
    assertEquals(integralCursor.next(), new ByteType((byte) 2));
    IntegralCursor<ByteType> integralCursor2 = new IntegralCursor<>(integralCursor);
    assertEquals(integralCursor2.next(), new ByteType((byte) 5));
    assertEquals(integralCursor2.next(), new ByteType((byte) 4));
    assertFalse(integralCursor2.hasNext());
}
Also used : Shape(net.imglib2.algorithm.neighborhood.Shape) RectangleShape(net.imglib2.algorithm.neighborhood.RectangleShape) RectangleShape(net.imglib2.algorithm.neighborhood.RectangleShape) ByteType(net.imglib2.type.numeric.integer.ByteType) Neighborhood(net.imglib2.algorithm.neighborhood.Neighborhood) RectangleNeighborhood(net.imglib2.algorithm.neighborhood.RectangleNeighborhood) Test(org.junit.Test)

Example 52 with ByteType

use of net.imglib2.type.numeric.integer.ByteType in project imagej-ops by imagej.

the class LocalThresholdTest method testLocalMinErrorThreshold.

/**
 * @see LocalMinErrorThreshold
 */
@Test
public void testLocalMinErrorThreshold() {
    ops.run(MinError.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 53 with ByteType

use of net.imglib2.type.numeric.integer.ByteType in project imagej-ops by imagej.

the class LocalThresholdTest method testLocalMedianThreshold.

/**
 * @see LocalMedianThreshold
 */
@Test
public void testLocalMedianThreshold() {
    ops.run(LocalMedianThreshold.class, out, in, new RectangleShape(3, 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 54 with ByteType

use of net.imglib2.type.numeric.integer.ByteType in project imagej-ops by imagej.

the class LocalThresholdTest method testLocalMidGreyThreshold.

/**
 * @see LocalMidGreyThreshold
 */
@Test
public void testLocalMidGreyThreshold() {
    ops.run(LocalMidGreyThreshold.class, out, in, new RectangleShape(3, 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 55 with ByteType

use of net.imglib2.type.numeric.integer.ByteType in project imagej-ops by imagej.

the class LocalThresholdTest method testLocalMaxLikelihoodThreshold.

/**
 * @see LocalMaxLikelihoodThreshold
 */
@Test
public void testLocalMaxLikelihoodThreshold() {
    // NB: Test fails for RectangleShapes of up to span==2
    ops.run(MaxLikelihood.class, out, in, new RectangleShape(3, 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)

Aggregations

ByteType (net.imglib2.type.numeric.integer.ByteType)83 Test (org.junit.Test)78 AbstractOpTest (net.imagej.ops.AbstractOpTest)76 RectangleShape (net.imglib2.algorithm.neighborhood.RectangleShape)55 Img (net.imglib2.img.Img)49 ArrayImg (net.imglib2.img.array.ArrayImg)33 Shape (net.imglib2.algorithm.neighborhood.Shape)18 DiamondShape (net.imglib2.algorithm.neighborhood.DiamondShape)17 HorizontalLineShape (net.imglib2.algorithm.neighborhood.HorizontalLineShape)16 ArrayList (java.util.ArrayList)9 Op (net.imagej.ops.Op)9 IterableInterval (net.imglib2.IterableInterval)9 BitType (net.imglib2.type.logic.BitType)6 UnsignedByteType (net.imglib2.type.numeric.integer.UnsignedByteType)6 AbstractUnaryComputerOp (net.imagej.ops.special.computer.AbstractUnaryComputerOp)5 Ops (net.imagej.ops.Ops)4 RandomAccessibleInterval (net.imglib2.RandomAccessibleInterval)4 IncompatibleTypeException (net.imglib2.exception.IncompatibleTypeException)4 CreateImgFromImg (net.imagej.ops.create.img.CreateImgFromImg)3 MapOp (net.imagej.ops.map.MapOp)3