Skip to content

Commit a79c888

Browse files
committed
WIP: fix copy tests
TODO this work needs to be merged in with the other work on the copy namespace. However some of the files were changed in a filter namespace commit, so that has to be sorted out.
1 parent c464cf9 commit a79c888

4 files changed

Lines changed: 18 additions & 64 deletions

File tree

src/main/java/net/imagej/ops/copy/CopyLabelingMapping.java

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,11 @@
3131

3232
import java.util.List;
3333
import java.util.Set;
34-
import java.util.function.Function;
3534

3635
import net.imglib2.roi.labeling.LabelingMapping;
3736
import net.imglib2.roi.labeling.LabelingMapping.SerialisationAccess;
3837

3938
import org.scijava.Priority;
40-
import org.scijava.ops.OpDependency;
4139
import org.scijava.ops.core.Op;
4240
import org.scijava.ops.core.computer.Computer;
4341
import org.scijava.param.Parameter;
@@ -64,23 +62,23 @@ public void compute(final LabelingMapping<L> input, final LabelingMapping<L> out
6462

6563
}
6664

67-
@Plugin(type = Op.class, name = "copy.labelingMapping", priority = Priority.VERY_HIGH)
68-
@Parameter(key = "input")
69-
@Parameter(key = "output", type = ItemIO.OUTPUT)
70-
class CopyLabelingMappingFunction<L> implements Function<LabelingMapping<L>, LabelingMapping<L>> {
71-
72-
@OpDependency(name = "copy.labelingMapping")
73-
Computer<LabelingMapping<L>, LabelingMapping<L>> copyOp;
74-
@OpDependency(name = "create.labelingMapping")
75-
private Function<Integer, LabelingMapping<L>> outputCreator;
76-
77-
@Override
78-
public LabelingMapping<L> apply(LabelingMapping<L> input) {
79-
LabelingMapping<L> output = outputCreator.apply(input.numSets());
80-
copyOp.compute(input, output);
81-
return output;
82-
}
83-
}
65+
//@Plugin(type = Op.class, name = "copy.labelingMapping", priority = Priority.VERY_HIGH)
66+
//@Parameter(key = "input")
67+
//@Parameter(key = "output", type = ItemIO.OUTPUT)
68+
//class CopyLabelingMappingFunction<L> implements Function<LabelingMapping<L>, LabelingMapping<L>> {
69+
//
70+
// @OpDependency(name = "copy.labelingMapping")
71+
// Computer<LabelingMapping<L>, LabelingMapping<L>> copyOp;
72+
// @OpDependency(name = "create.labelingMapping")
73+
// private Function<Integer, LabelingMapping<L>> outputCreator;
74+
//
75+
// @Override
76+
// public LabelingMapping<L> apply(LabelingMapping<L> input) {
77+
// LabelingMapping<L> output = outputCreator.apply(input.numSets());
78+
// copyOp.compute(input, output);
79+
// return output;
80+
// }
81+
//}
8482

8583
/*
8684
* Access to LabelingMapping

src/main/java/net/imagej/ops/copy/CopyRAI.java

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,8 @@
2929

3030
package net.imagej.ops.copy;
3131

32-
import java.util.function.BiFunction;
33-
import java.util.function.Function;
34-
35-
import net.imglib2.Dimensions;
3632
import net.imglib2.RandomAccessibleInterval;
3733
import net.imglib2.util.Intervals;
38-
import net.imglib2.util.Util;
3934
import net.imglib2.view.Views;
4035

4136
import org.scijava.ops.OpDependency;
@@ -67,22 +62,3 @@ public void compute(final RandomAccessibleInterval<T> input, final RandomAccessi
6762
mapComputer.compute(Views.flatIterable(input), Views.flatIterable(output));
6863
}
6964
}
70-
71-
@Plugin(type = Op.class, name = "copy.rai", priority = 1.0)
72-
@Parameter(key = "input")
73-
@Parameter(key = "copy", type = ItemIO.OUTPUT)
74-
class CopyRAIFunction<T> implements Function<RandomAccessibleInterval<T>, RandomAccessibleInterval<T>> {
75-
76-
@OpDependency(name = "create.img")
77-
private BiFunction<Dimensions, T, RandomAccessibleInterval<T>> createOp;
78-
@OpDependency(name = "copy.rai")
79-
private Computer<RandomAccessibleInterval<T>, RandomAccessibleInterval<T>> copyOp;
80-
81-
@Override
82-
public RandomAccessibleInterval<T> apply(RandomAccessibleInterval<T> input) {
83-
RandomAccessibleInterval<T> output = createOp.apply(input, Util.getTypeFromInterval(input));
84-
copyOp.compute(input, output);
85-
return output;
86-
}
87-
88-
}

src/main/java/net/imagej/ops/copy/CopyType.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,8 @@
2929

3030
package net.imagej.ops.copy;
3131

32-
import java.util.function.Function;
33-
3432
import net.imglib2.type.Type;
3533

36-
import org.scijava.ops.OpDependency;
3734
import org.scijava.ops.core.Op;
3835
import org.scijava.ops.core.computer.Computer;
3936
import org.scijava.param.Parameter;
@@ -57,20 +54,3 @@ public void compute(final T input, final T output) {
5754
}
5855

5956
}
60-
61-
@Plugin(type = Op.class, name = "copy.type")
62-
@Parameter(key = "input")
63-
@Parameter(key = "copy", type = ItemIO.OUTPUT)
64-
class CopyTypeFunction<T extends Type<T>> implements Function<T, T> {
65-
66-
@OpDependency(name = "copy.type")
67-
Computer<T, T> copyOp;
68-
69-
@Override
70-
public T apply(T input) {
71-
T output = input.createVariable();
72-
copyOp.compute(input, output);
73-
return output;
74-
}
75-
76-
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public void copyRAINoOutputTest() {
139139
public void copyRAIWithOutputTest() {
140140
final Img<UnsignedByteType> output = input.factory().create(input, input.firstElement());
141141

142-
ops.run("copy.rai", output, input);
142+
ops.run("copy.rai", input, output);
143143

144144
final Cursor<UnsignedByteType> inc = input.cursor();
145145
final Cursor<UnsignedByteType> outc = output.cursor();

0 commit comments

Comments
 (0)