Java Code Examples for net.imagej.ops.Op#run()
The following examples show how to use
net.imagej.ops.Op#run() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InvertTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 6 votes |
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); }
Example 2
Source File: AddNumericTypeBinaryMathAddTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@Test public void testAdd() { final ARGBDoubleType a = new ARGBDoubleType(255, 128, 128, 128); final ARGBDoubleType b = new ARGBDoubleType(255, 75, 35, 45); final Op op = ops.op(Ops.Math.Add.class, a, a, b); assertSame(NumericTypeBinaryMath.Add.class, op.getClass()); op.run(); assertEquals(203.0, a.getR(), DELTA); assertEquals(163.0, a.getG(), DELTA); assertEquals(173.0, a.getB(), DELTA); }
Example 3
Source File: MapNeighborhoodTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
/** * 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()); } }
Example 4
Source File: MapNeighborhoodTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@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(); }
Example 5
Source File: JoinTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@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()); } }
Example 6
Source File: JoinTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@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()); } }
Example 7
Source File: JoinTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
@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()); } }
Example 8
Source File: InvertTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
private <T extends RealType<T>> void assertDefaultInvert(final Img<T> in, final Img<T> out) { final T type = in.firstElement(); final T min = type.copy(); min.setReal(type.getMinValue()); final T max = type.copy(); max.setReal(type.getMaxValue()); final Op op = ops.op(Ops.Image.Invert.class, out, in); assertSame(InvertII.class, op.getClass()); op.run(); defaultCompare(in, out, min, max); }
Example 9
Source File: InvertTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
private <T extends RealType<T>> void assertDefaultInvertMinMaxProvided(final Img<T> in, final Img<T> out, final T min, final T max) { final Op op = ops.op(Ops.Image.Invert.class, out, in, (min), (max)); assertSame(InvertII.class, op.getClass()); op.run(); defaultCompare(in, out, min, max); }
Example 10
Source File: InvertTest.java From imagej-ops with BSD 2-Clause "Simplified" License | 5 votes |
private <T extends IntegerType<T>> void assertIntegerInvertMinMaxProvided(final Img<T> in, final Img<T> out, final T min, final T max) { // unsigned type test final Op op = ops.op(Ops.Image.Invert.class, out, in, min, max); assertSame(InvertIIInteger.class, op.getClass()); op.run(); integerCompare(in, out, min, max); }