Search in sources :

Example 16 with Op

use of net.imagej.ops.Op in project imagej-ops by imagej.

the class InvertTest method assertIntegerInvert.

private <T extends IntegerType<T>> void assertIntegerInvert(final Img<T> in, final Img<T> out) {
    final Op op = ops.op(Ops.Image.Invert.class, out, in);
    assertSame(InvertIIInteger.class, op.getClass());
    op.run();
    Cursor<T> inCursor = in.localizingCursor();
    Cursor<T> outCursor = out.localizingCursor();
    while (inCursor.hasNext()) {
        inCursor.fwd();
        outCursor.fwd();
    }
    integerCompare(in, out, null, null);
}
Also used : Op(net.imagej.ops.Op)

Example 17 with Op

use of net.imagej.ops.Op 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)

Example 18 with Op

use of net.imagej.ops.Op in project imagej-ops by imagej.

the class MapTest method testIterable.

@Test
public void testIterable() {
    final Img<ByteType> in = generateByteArrayTestImg(true, 10, 10);
    final Op nullary = Computers.nullary(ops, Ops.Math.Zero.class, ByteType.class);
    ops.run(MapNullaryIterable.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)

Aggregations

Op (net.imagej.ops.Op)18 AbstractOpTest (net.imagej.ops.AbstractOpTest)11 Test (org.junit.Test)11 ByteType (net.imglib2.type.numeric.integer.ByteType)9 AbstractUnaryComputerOp (net.imagej.ops.special.computer.AbstractUnaryComputerOp)6 UnaryComputerOp (net.imagej.ops.special.computer.UnaryComputerOp)4 Ops (net.imagej.ops.Ops)3 MapOp (net.imagej.ops.map.MapOp)3 AbstractUnaryInplaceOp (net.imagej.ops.special.inplace.AbstractUnaryInplaceOp)3 BinaryInplaceOp (net.imagej.ops.special.inplace.BinaryInplaceOp)3 UnaryInplaceOp (net.imagej.ops.special.inplace.UnaryInplaceOp)3 RectangleShape (net.imglib2.algorithm.neighborhood.RectangleShape)3 AbstractOp (net.imagej.ops.AbstractOp)2 UnaryFunctionOp (net.imagej.ops.special.function.UnaryFunctionOp)2 FloatType (net.imglib2.type.numeric.real.FloatType)2 Type (java.lang.reflect.Type)1 NumericTypeBinaryMath (net.imagej.ops.math.NumericTypeBinaryMath)1 BinaryFunctionOp (net.imagej.ops.special.function.BinaryFunctionOp)1 UnaryHybridCF (net.imagej.ops.special.hybrid.UnaryHybridCF)1 IncompatibleTypeException (net.imglib2.exception.IncompatibleTypeException)1