Search in sources :

Example 71 with ByteType

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);
}
Also used : DiamondShape(net.imglib2.algorithm.neighborhood.DiamondShape) Shape(net.imglib2.algorithm.neighborhood.Shape) RectangleShape(net.imglib2.algorithm.neighborhood.RectangleShape) HorizontalLineShape(net.imglib2.algorithm.neighborhood.HorizontalLineShape) RectangleShape(net.imglib2.algorithm.neighborhood.RectangleShape) DiamondShape(net.imglib2.algorithm.neighborhood.DiamondShape) ArrayList(java.util.ArrayList) IterableInterval(net.imglib2.IterableInterval) ByteType(net.imglib2.type.numeric.integer.ByteType) HorizontalLineShape(net.imglib2.algorithm.neighborhood.HorizontalLineShape) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 72 with ByteType

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);
}
Also used : DiamondShape(net.imglib2.algorithm.neighborhood.DiamondShape) Shape(net.imglib2.algorithm.neighborhood.Shape) RectangleShape(net.imglib2.algorithm.neighborhood.RectangleShape) HorizontalLineShape(net.imglib2.algorithm.neighborhood.HorizontalLineShape) RectangleShape(net.imglib2.algorithm.neighborhood.RectangleShape) DiamondShape(net.imglib2.algorithm.neighborhood.DiamondShape) ArrayList(java.util.ArrayList) IterableInterval(net.imglib2.IterableInterval) ByteType(net.imglib2.type.numeric.integer.ByteType) HorizontalLineShape(net.imglib2.algorithm.neighborhood.HorizontalLineShape) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 73 with ByteType

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);
}
Also used : RandomAccessibleInterval(net.imglib2.RandomAccessibleInterval) FinalInterval(net.imglib2.FinalInterval) UnsignedByteType(net.imglib2.type.numeric.integer.UnsignedByteType) ByteType(net.imglib2.type.numeric.integer.ByteType) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 74 with ByteType

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));
    }
}
Also used : Context(org.scijava.Context) OpService(net.imagej.ops.OpService) UnsignedByteType(net.imglib2.type.numeric.integer.UnsignedByteType) ByteType(net.imglib2.type.numeric.integer.ByteType) Before(org.junit.Before)

Example 75 with ByteType

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());
    }
}
Also used : AbstractUnaryComputerOp(net.imagej.ops.special.computer.AbstractUnaryComputerOp) Op(net.imagej.ops.Op) MapOp(net.imagej.ops.map.MapOp) UnaryComputerOp(net.imagej.ops.special.computer.UnaryComputerOp) UnaryInplaceOp(net.imagej.ops.special.inplace.UnaryInplaceOp) AbstractUnaryInplaceOp(net.imagej.ops.special.inplace.AbstractUnaryInplaceOp) 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