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