Search in sources :

Example 36 with ByteType

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

the class JoinTest method testJoin2Inplaces.

@Test
public void testJoin2Inplaces() {
    final Op op = ops.op(DefaultJoin2Inplaces.class, in, inplaceOp, inplaceOp);
    op.run();
    // test
    final Cursor<ByteType> c = in.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)

Example 37 with ByteType

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

the class ConditionalTest method testDefault.

@Test
public void testDefault() {
    final ByteType out = new ByteType((byte) 10);
    final ByteType defaultVal = new ByteType((byte) 100);
    assertEquals(10, ((ByteType) ops.run(Default.class, out, new BoolType(true), defaultVal)).get());
    assertEquals(100, ((ByteType) ops.run(Default.class, out, new BoolType(false), defaultVal)).get());
}
Also used : BoolType(net.imglib2.type.logic.BoolType) ByteType(net.imglib2.type.numeric.integer.ByteType) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 38 with ByteType

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

the class ConditionalTest method testIf.

@Test
public void testIf() {
    final ByteType ifTrueVal = new ByteType((byte) 10);
    final ByteType ifFalseVal = new ByteType((byte) 100);
    assertEquals(10, ((ByteType) ops.run(If.class, new BoolType(true), ifTrueVal, ifFalseVal)).get());
    assertEquals(100, ((ByteType) ops.run(If.class, new BoolType(false), ifTrueVal, ifFalseVal)).get());
}
Also used : BoolType(net.imglib2.type.logic.BoolType) ByteType(net.imglib2.type.numeric.integer.ByteType) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 39 with ByteType

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

the class MapTest method testII.

@Test
public void testII() {
    final Img<ByteType> in = generateByteArrayTestImg(true, 10, 10);
    final Op nullary = Computers.nullary(ops, Ops.Math.Zero.class, ByteType.class);
    ops.run(MapNullaryII.class, in, nullary);
    for (final ByteType ps : in) assertEquals(ps.get(), 0);
}
Also used : Op(net.imagej.ops.Op) BinaryInplaceOp(net.imagej.ops.special.inplace.BinaryInplaceOp) ByteType(net.imglib2.type.numeric.integer.ByteType) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 40 with ByteType

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

the class MapTest method testIIAndIIInplaceParallelCellImg.

@Test
public void testIIAndIIInplaceParallelCellImg() {
    final Img<ByteType> first = generateByteTestCellImg(true, 40, 20);
    final Img<ByteType> firstCopy = first.copy();
    final Img<ByteType> second = generateByteTestCellImg(false, 40, 20);
    for (final ByteType px : second) px.set((byte) 1);
    final Img<ByteType> secondCopy = second.copy();
    sub = Inplaces.binary(ops, Ops.Math.Subtract.class, ByteType.class);
    final BinaryInplaceOp<? super Img<ByteType>, Img<ByteType>> map = Inplaces.binary(ops, MapIIAndIIInplaceParallel.class, firstCopy, second, sub);
    map.run(firstCopy, second, firstCopy);
    map.run(first, secondCopy, secondCopy);
    assertImgSubEquals(first, second, firstCopy);
    assertImgSubEquals(first, second, secondCopy);
}
Also used : Img(net.imglib2.img.Img) Ops(net.imagej.ops.Ops) 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