use of net.imglib2.type.numeric.integer.ByteType in project imagej-ops by imagej.
the class OpeningTest method testListOpen.
@Test
public void testListOpen() {
final List<Shape> shapes = new ArrayList<>();
shapes.add(new DiamondShape(1));
shapes.add(new DiamondShape(1));
shapes.add(new RectangleShape(1, false));
shapes.add(new HorizontalLineShape(2, 1, false));
@SuppressWarnings("unchecked") final IterableInterval<ByteType> out1 = (IterableInterval<ByteType>) ops.run(ListOpen.class, IterableInterval.class, in, shapes);
final Img<ByteType> out2 = Opening.open(in, shapes, 1);
assertIterationsEqual(out2, out1);
}
use of net.imglib2.type.numeric.integer.ByteType in project imagej-ops by imagej.
the class TopHatTest method testListTopHat.
@Test
public void testListTopHat() {
final List<Shape> shapes = new ArrayList<>();
shapes.add(new DiamondShape(1));
shapes.add(new DiamondShape(1));
shapes.add(new RectangleShape(1, false));
shapes.add(new HorizontalLineShape(2, 1, false));
@SuppressWarnings("unchecked") final IterableInterval<ByteType> out1 = (IterableInterval<ByteType>) ops.run(ListTopHat.class, IterableInterval.class, in, shapes);
final Img<ByteType> out2 = TopHat.topHat(in, shapes, 1);
assertIterationsEqual(out2, out1);
}
use of net.imglib2.type.numeric.integer.ByteType in project imagej-ops by imagej.
the class SliceTest method testNonZeroMinimumInterval.
@Test
public void testNonZeroMinimumInterval() {
Img<ByteType> img3D = ArrayImgs.bytes(50, 50, 3);
IntervalView<ByteType> interval2D = Views.interval(img3D, new FinalInterval(new long[] { 25, 25, 2 }, new long[] { 35, 35, 2 }));
final int[] xyAxis = new int[] { 0, 1 };
// iterate through every slice, should return a single
// RandomAccessibleInterval<?> from 25, 25, 2 to 35, 35, 2
final SlicesII<ByteType> hyperSlices = new SlicesII<>(interval2D, xyAxis, true);
final Cursor<RandomAccessibleInterval<ByteType>> c = hyperSlices.cursor();
int i = 0;
while (c.hasNext()) {
c.next();
i++;
}
assertEquals(1, i);
}
use of net.imglib2.type.numeric.integer.ByteType in project imagej-ops by imagej.
the class SliceTest method setUp.
@Override
@Before
public void setUp() {
context = new Context(OpService.class);
ops = context.service(OpService.class);
in = ArrayImgs.bytes(20, 20, 21);
out = ArrayImgs.bytes(20, 20, 21);
for (final Cursor<ByteType> cur = in.cursor(); cur.hasNext(); ) {
cur.fwd();
cur.get().set((byte) cur.getIntPosition(2));
}
}
use of net.imglib2.type.numeric.integer.ByteType in project imagej-ops by imagej.
the class JoinTest method testJoinComputerAndInplace.
@Test
public void testJoinComputerAndInplace() {
final Op op = ops.op(DefaultJoinComputerAndInplace.class, out, in, computerOp, inplaceOp);
op.run();
// test
final Cursor<ByteType> c = out.cursor();
while (c.hasNext()) {
assertEquals(2, c.next().get());
}
}
Aggregations