Search in sources :

Example 6 with Op

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

the class MapNeighborhoodTest method testMapNeighoodsWrongArgs.

@Test
@Ignore("There is no way to throw an error for invalid typed computers at the moment.")
public void testMapNeighoodsWrongArgs() {
    final Op mapOp = ops.op(DefaultMapNeighborhood.class, out, in, new RectangleShape(1, false), new Increment());
    // ClassCastException will be thrown
    mapOp.run();
}
Also used : AbstractUnaryComputerOp(net.imagej.ops.special.computer.AbstractUnaryComputerOp) Op(net.imagej.ops.Op) RectangleShape(net.imglib2.algorithm.neighborhood.RectangleShape) Ignore(org.junit.Ignore) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 7 with Op

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

the class MapNeighborhoodTest method testMapNeighborhoodsAccess.

/**
 * Test if every neighborhood pixel of the image was really accessed during
 * the map operation.
 *
 * @see DefaultMapNeighborhood
 */
@Test
public void testMapNeighborhoodsAccess() {
    final Op mapOp = ops.op(DefaultMapNeighborhood.class, out, in, new RectangleShape(1, false), new CountNeighbors());
    mapOp.run();
    for (final ByteType t : out) {
        assertEquals(9, t.get());
    }
}
Also used : AbstractUnaryComputerOp(net.imagej.ops.special.computer.AbstractUnaryComputerOp) Op(net.imagej.ops.Op) RectangleShape(net.imglib2.algorithm.neighborhood.RectangleShape) ByteType(net.imglib2.type.numeric.integer.ByteType) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 8 with Op

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

the class MapNeighborhoodTest method testMapNeighborhoodsWithCenterAccess.

/**
 * Test if every neighborhood pixel of the image was really accessed during
 * the map operation.
 *
 * @see MapNeighborhoodWithCenter
 */
@Test
public void testMapNeighborhoodsWithCenterAccess() {
    final Op mapOp = ops.op(MapNeighborhoodWithCenter.class, out, in, new RectangleShape(1, false), new CountNeighborsWithCenter());
    mapOp.run();
    for (final ByteType t : out) {
        assertEquals(9, t.get());
    }
    for (final ByteType t : in) {
        assertEquals(9, t.get());
    }
}
Also used : AbstractUnaryComputerOp(net.imagej.ops.special.computer.AbstractUnaryComputerOp) Op(net.imagej.ops.Op) RectangleShape(net.imglib2.algorithm.neighborhood.RectangleShape) ByteType(net.imglib2.type.numeric.integer.ByteType) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 9 with Op

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

the class JoinTest method testJoinInplaceAndComputer.

@Test
public void testJoinInplaceAndComputer() {
    final Op op = ops.op(DefaultJoinInplaceAndComputer.class, out, in, inplaceOp, computerOp);
    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 10 with Op

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

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