Skip to content

Commit a622121

Browse files
committed
WIP: rebase migrate-imagej-ops over adapt-ops work
1 parent cb127c2 commit a622121

4 files changed

Lines changed: 96 additions & 111 deletions

File tree

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,46 @@
1-
package net.imagej.ops.types.transform;
2-
3-
import net.imagej.ops.types.transform.util.Maps;
4-
import net.imglib2.RandomAccessibleInterval;
5-
6-
import org.scijava.ops.OpService;
7-
import org.scijava.ops.function.Computers;
8-
import org.scijava.ops.matcher.OpRef;
9-
import org.scijava.ops.transform.OpMapper;
10-
import org.scijava.ops.transform.OpRefTransformUtils;
11-
import org.scijava.ops.transform.OpTransformer;
12-
import org.scijava.plugin.Plugin;
13-
14-
/**
15-
* @author David Kolb
16-
*/
17-
@Plugin(type = OpTransformer.class)
18-
public class LiftComputer2ToRAITransformer<I1, I2, O> implements
19-
OpMapper<Computers.Arity2<I1, I2, O>, Computers.Arity2<RandomAccessibleInterval<I1>, RandomAccessibleInterval<I2>, RandomAccessibleInterval<O>>>
20-
{
21-
22-
@Override
23-
@SuppressWarnings({ "unchecked", "rawtypes" })
24-
public Class<Computers.Arity2<I1, I2, O>> srcClass() {
25-
return (Class) Computers.Arity2.class;
26-
}
27-
28-
@Override
29-
@SuppressWarnings({ "unchecked", "rawtypes" })
30-
public Class<Computers.Arity2<RandomAccessibleInterval<I1>, RandomAccessibleInterval<I2>, RandomAccessibleInterval<O>>> targetClass() {
31-
return (Class) Computers.Arity2.class;
32-
}
33-
34-
@Override
35-
public Computers.Arity2<RandomAccessibleInterval<I1>, RandomAccessibleInterval<I2>, RandomAccessibleInterval<O>> transformTypesafe(final OpService opService, final Computers.Arity2<I1, I2, O> src,
36-
final OpRef targetRef)
37-
{
38-
return Maps.ComputerMaps.RAIs.liftBoth(src);
39-
}
40-
41-
@Override
42-
public OpRef getRefTransformingTo(final OpRef targetRef) {
43-
return OpRefTransformUtils.unliftTransform(targetRef, Computers.Arity2.class, RandomAccessibleInterval.class, new Integer[] {0, 1, 2},
44-
new Integer[] { 0, 1, 2 }, new Integer[] { 0 });
45-
}
46-
}
1+
//package net.imagej.ops.types.transform;
2+
//
3+
//import net.imagej.ops.types.transform.util.Maps;
4+
//import net.imglib2.RandomAccessibleInterval;
5+
//
6+
//import org.scijava.ops.OpService;
7+
//import org.scijava.ops.function.Computers;
8+
//import org.scijava.ops.matcher.OpRef;
9+
//import org.scijava.ops.transform.OpMapper;
10+
//import org.scijava.ops.transform.OpRefTransformUtils;
11+
//import org.scijava.ops.transform.OpTransformer;
12+
//import org.scijava.plugin.Plugin;
13+
//
14+
///**
15+
// * @author David Kolb
16+
// */
17+
//@Plugin(type = OpTransformer.class)
18+
//public class LiftComputer2ToRAITransformer<I1, I2, O> implements
19+
// OpMapper<Computers.Arity2<I1, I2, O>, Computers.Arity2<RandomAccessibleInterval<I1>, RandomAccessibleInterval<I2>, RandomAccessibleInterval<O>>>
20+
//{
21+
//
22+
// @Override
23+
// @SuppressWarnings({ "unchecked", "rawtypes" })
24+
// public Class<Computers.Arity2<I1, I2, O>> srcClass() {
25+
// return (Class) Computers.Arity2.class;
26+
// }
27+
//
28+
// @Override
29+
// @SuppressWarnings({ "unchecked", "rawtypes" })
30+
// public Class<Computers.Arity2<RandomAccessibleInterval<I1>, RandomAccessibleInterval<I2>, RandomAccessibleInterval<O>>> targetClass() {
31+
// return (Class) Computers.Arity2.class;
32+
// }
33+
//
34+
// @Override
35+
// public Computers.Arity2<RandomAccessibleInterval<I1>, RandomAccessibleInterval<I2>, RandomAccessibleInterval<O>> transformTypesafe(final OpService opService, final Computers.Arity2<I1, I2, O> src,
36+
// final OpRef targetRef)
37+
// {
38+
// return Maps.ComputerMaps.RAIs.liftBoth(src);
39+
// }
40+
//
41+
// @Override
42+
// public OpRef getRefTransformingTo(final OpRef targetRef) {
43+
// return OpRefTransformUtils.unliftTransform(targetRef, Computers.Arity2.class, RandomAccessibleInterval.class, new Integer[] {0, 1, 2},
44+
// new Integer[] { 0, 1, 2 }, new Integer[] { 0 });
45+
// }
46+
//}
Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,46 @@
1-
package net.imagej.ops.types.transform;
2-
3-
import net.imagej.ops.types.transform.util.Maps;
4-
import net.imglib2.RandomAccessibleInterval;
5-
6-
import org.scijava.ops.OpService;
7-
import org.scijava.ops.function.Computers;
8-
import org.scijava.ops.matcher.OpRef;
9-
import org.scijava.ops.transform.OpMapper;
10-
import org.scijava.ops.transform.OpRefTransformUtils;
11-
import org.scijava.ops.transform.OpTransformer;
12-
import org.scijava.plugin.Plugin;
13-
14-
/**
15-
* @author David Kolb
16-
*/
17-
@Plugin(type = OpTransformer.class)
18-
public class LiftComputerToRAITransformer<I, O> implements
19-
OpMapper<Computers.Arity1<I, O>, Computers.Arity1<RandomAccessibleInterval<I>, RandomAccessibleInterval<O>>>
20-
{
21-
22-
@Override
23-
@SuppressWarnings({ "unchecked", "rawtypes" })
24-
public Class<Computers.Arity1<I, O>> srcClass() {
25-
return (Class) Computers.Arity1.class;
26-
}
27-
28-
@Override
29-
@SuppressWarnings({ "unchecked", "rawtypes" })
30-
public Class<Computers.Arity1<RandomAccessibleInterval<I>, RandomAccessibleInterval<O>>> targetClass() {
31-
return (Class) Computers.Arity1.class;
32-
}
33-
34-
@Override
35-
public Computers.Arity1<RandomAccessibleInterval<I>, RandomAccessibleInterval<O>> transformTypesafe(final OpService opService, final Computers.Arity1<I, O> src,
36-
final OpRef targetRef)
37-
{
38-
return Maps.ComputerMaps.RAIs.liftBoth(src);
39-
}
40-
41-
@Override
42-
public OpRef getRefTransformingTo(final OpRef targetRef) {
43-
return OpRefTransformUtils.unliftTransform(targetRef, Computers.Arity1.class, RandomAccessibleInterval.class, new Integer[] {0, 1},
44-
new Integer[] { 0, 1 }, new Integer[] { 0 });
45-
}
46-
}
1+
//package net.imagej.ops.types.transform;
2+
//
3+
//import net.imagej.ops.types.transform.util.Maps;
4+
//import net.imglib2.RandomAccessibleInterval;
5+
//
6+
//import org.scijava.ops.OpService;
7+
//import org.scijava.ops.function.Computers;
8+
//import org.scijava.ops.matcher.OpRef;
9+
//import org.scijava.ops.transform.OpMapper;
10+
//import org.scijava.ops.transform.OpRefTransformUtils;
11+
//import org.scijava.ops.transform.OpTransformer;
12+
//import org.scijava.plugin.Plugin;
13+
//
14+
///**
15+
// * @author David Kolb
16+
// */
17+
//@Plugin(type = OpTransformer.class)
18+
//public class LiftComputerToRAITransformer<I, O> implements
19+
// OpMapper<Computers.Arity1<I, O>, Computers.Arity1<RandomAccessibleInterval<I>, RandomAccessibleInterval<O>>>
20+
//{
21+
//
22+
// @Override
23+
// @SuppressWarnings({ "unchecked", "rawtypes" })
24+
// public Class<Computers.Arity1<I, O>> srcClass() {
25+
// return (Class) Computers.Arity1.class;
26+
// }
27+
//
28+
// @Override
29+
// @SuppressWarnings({ "unchecked", "rawtypes" })
30+
// public Class<Computers.Arity1<RandomAccessibleInterval<I>, RandomAccessibleInterval<O>>> targetClass() {
31+
// return (Class) Computers.Arity1.class;
32+
// }
33+
//
34+
// @Override
35+
// public Computers.Arity1<RandomAccessibleInterval<I>, RandomAccessibleInterval<O>> transformTypesafe(final OpService opService, final Computers.Arity1<I, O> src,
36+
// final OpRef targetRef)
37+
// {
38+
// return Maps.ComputerMaps.RAIs.liftBoth(src);
39+
// }
40+
//
41+
// @Override
42+
// public OpRef getRefTransformingTo(final OpRef targetRef) {
43+
// return OpRefTransformUtils.unliftTransform(targetRef, Computers.Arity1.class, RandomAccessibleInterval.class, new Integer[] {0, 1},
44+
// new Integer[] { 0, 1 }, new Integer[] { 0 });
45+
// }
46+
//}

src/test/java/net/imagej/ops/AbstractOpTest.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,10 @@
2929

3030
package net.imagej.ops;
3131

32-
import static org.junit.Assert.assertEquals;
33-
import static org.junit.Assert.assertFalse;
34-
import static org.junit.Assert.assertTrue;
35-
3632
import io.scif.img.IO;
3733

3834
import java.math.BigInteger;
3935
import java.net.URL;
40-
import java.util.Iterator;
4136
import java.util.Random;
4237
import java.util.stream.StreamSupport;
4338

@@ -463,18 +458,6 @@ public static Img<DoubleType> openDoubleImg(final Class<?> c,
463458
return IO.openDoubleImgs(url.getPath()).get(0).getImg();
464459
}
465460

466-
public <T> void assertIterationsEqual(final Iterable<T> expected,
467-
final Iterable<T> actual)
468-
{
469-
final Iterator<T> e = expected.iterator();
470-
final Iterator<T> a = actual.iterator();
471-
while (e.hasNext()) {
472-
assertTrue("Fewer elements than expected", a.hasNext());
473-
assertEquals(e.next(), a.next());
474-
}
475-
assertFalse("More elements than expected", a.hasNext());
476-
}
477-
478461
public static <T> RandomAccessible<T> deinterval(
479462
RandomAccessibleInterval<T> input)
480463
{

src/test/java/net/imagej/ops/copy/CopyRAITest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,10 @@ public void createData() {
116116
@Test
117117
public void copyRAINoOutputTest() {
118118
@SuppressWarnings("unchecked")
119-
final RandomAccessibleInterval<UnsignedByteType> output = (RandomAccessibleInterval<UnsignedByteType>) ops
120-
.run("copy.rai", input);
119+
final RandomAccessibleInterval<UnsignedByteType> output = op("copy.rai")
120+
.input(input).outType(
121+
new Nil<RandomAccessibleInterval<UnsignedByteType>>()
122+
{}).apply();
121123

122124
final Cursor<UnsignedByteType> inc = input.localizingCursor();
123125
final RandomAccess<UnsignedByteType> outRA = output.randomAccess();

0 commit comments

Comments
 (0)