|
| 1 | +package net.imagej.ops.types; |
| 2 | + |
| 3 | +import net.imagej.ops.AbstractOpTest; |
| 4 | +import net.imglib2.Cursor; |
| 5 | +import net.imglib2.FinalDimensions; |
| 6 | +import net.imglib2.img.Img; |
| 7 | +import net.imglib2.type.numeric.RealType; |
| 8 | +import net.imglib2.type.numeric.real.DoubleType; |
| 9 | + |
| 10 | +import org.junit.Test; |
| 11 | +import org.scijava.ops.OpField; |
| 12 | +import org.scijava.ops.core.OpCollection; |
| 13 | +import org.scijava.ops.core.computer.Computer; |
| 14 | +import org.scijava.param.Parameter; |
| 15 | +import org.scijava.plugin.Plugin; |
| 16 | +import org.scijava.struct.ItemIO; |
| 17 | + |
| 18 | +@Plugin(type = OpCollection.class) |
| 19 | +public class LiftingTest <I extends RealType<I>, O extends RealType<O>> extends AbstractOpTest{ |
| 20 | + |
| 21 | + @OpField(names = "test.liftImg") |
| 22 | + @Parameter(key = "input") |
| 23 | + @Parameter(key = "output", type = ItemIO.BOTH) |
| 24 | + public final Computer<I, O> testOp = (in, out) -> out.setReal(10.); |
| 25 | + |
| 26 | + @Test |
| 27 | + public void testLiftToImg() { |
| 28 | + Img<DoubleType> input = (Img<DoubleType>) ops.run("create.img", new FinalDimensions(10, 10), new DoubleType()); |
| 29 | + Img<DoubleType> output = (Img<DoubleType>) ops.run("create.img", new FinalDimensions(10, 10), new DoubleType()); |
| 30 | + |
| 31 | + ops.run("test.liftImg", input, output); |
| 32 | + |
| 33 | + Cursor<DoubleType> cursor = output.cursor(); |
| 34 | + while(cursor.hasNext()) { |
| 35 | + assert(cursor.next().get() == 10.); |
| 36 | + } |
| 37 | + |
| 38 | + } |
| 39 | + |
| 40 | + |
| 41 | +} |
0 commit comments