Skip to content

Commit 28fcdd4

Browse files
authored
Merge pull request #266 from scijava/scijava-ops-image/improved-thresholding
Improved thresholding
2 parents b3ad0f6 + ad83c3a commit 28fcdd4

13 files changed

Lines changed: 274 additions & 245 deletions

File tree

scijava-ops-engine/src/main/java/org/scijava/ops/engine/adapt/lift/ComputerToIterables.java

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,17 @@
4545
* that operate on {@link Iterable}s of types. N.B. it is the user's
4646
* responsibility to pass {@link Iterable}s of the same length (otherwise the Op
4747
* will stop when one of the {@link Iterable}s runs out of {@link Object}s).
48-
*
48+
* <p>
49+
* Note the use of generic types for each of the {@link Iterable}s in the output
50+
* Ops. This is particularly useful for matching the Ops themselves, outside of
51+
* adaptation.
52+
* </p>
4953
* @author Gabriel Selzer
5054
*/
51-
public class ComputerToIterables<I, I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11, I12, I13, I14, I15, I16, O> implements OpCollection {
55+
public class ComputerToIterables<I, I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11, I12, I13, I14, I15, I16, O, II extends Iterable<I>, II1 extends Iterable<I1>, II2 extends Iterable<I2>, II3 extends Iterable<I3>, II4 extends Iterable<I4>, II5 extends Iterable<I5>, II6 extends Iterable<I6>, II7 extends Iterable<I7>, II8 extends Iterable<I8>, II9 extends Iterable<I9>, II10 extends Iterable<I10>, II11 extends Iterable<I11>, II12 extends Iterable<I12>, II13 extends Iterable<I13>, II14 extends Iterable<I14>, II15 extends Iterable<I15>, II16 extends Iterable<I16>, IO extends Iterable<O>> implements OpCollection {
5256

5357
@OpField(names = "engine.adapt")
54-
public final Function<Computers.Arity0<O>, Computers.Arity0<Iterable<O>>> liftComputer0 =
58+
public final Function<Computers.Arity0<O>, Computers.Arity0<IO>> liftComputer0 =
5559
(computer) -> {
5660
return (out) -> {
5761
var itrout = out.iterator();
@@ -62,7 +66,7 @@ public class ComputerToIterables<I, I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11
6266
};
6367

6468
@OpField(names = "engine.adapt")
65-
public final Function<Computers.Arity1<I, O>, Computers.Arity1<Iterable<I>, Iterable<O>>> liftComputer1 =
69+
public final Function<Computers.Arity1<I, O>, Computers.Arity1<II, IO>> liftComputer1 =
6670
(computer) -> {
6771
return (in, out) -> {
6872
var itrin = in.iterator();
@@ -74,7 +78,7 @@ public class ComputerToIterables<I, I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11
7478
};
7579

7680
@OpField(names = "engine.adapt")
77-
public final Function<Computers.Arity2<I1, I2, O>, Computers.Arity2<Iterable<I1>, Iterable<I2>, Iterable<O>>> liftComputer2 =
81+
public final Function<Computers.Arity2<I1, I2, O>, Computers.Arity2<II1, II2, IO>> liftComputer2 =
7882
(computer) -> {
7983
return (in1, in2, out) -> {
8084
var itrin1 = in1.iterator();
@@ -87,7 +91,7 @@ public class ComputerToIterables<I, I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11
8791
};
8892

8993
@OpField(names = "engine.adapt")
90-
public final Function<Computers.Arity3<I1, I2, I3, O>, Computers.Arity3<Iterable<I1>, Iterable<I2>, Iterable<I3>, Iterable<O>>> liftComputer3 =
94+
public final Function<Computers.Arity3<I1, I2, I3, O>, Computers.Arity3<II1, II2, II3, IO>> liftComputer3 =
9195
(computer) -> {
9296
return (in1, in2, in3, out) -> {
9397
var itrin1 = in1.iterator();
@@ -101,7 +105,7 @@ public class ComputerToIterables<I, I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11
101105
};
102106

103107
@OpField(names = "engine.adapt")
104-
public final Function<Computers.Arity4<I1, I2, I3, I4, O>, Computers.Arity4<Iterable<I1>, Iterable<I2>, Iterable<I3>, Iterable<I4>, Iterable<O>>> liftComputer4 =
108+
public final Function<Computers.Arity4<I1, I2, I3, I4, O>, Computers.Arity4<II1, II2, II3, II4, IO>> liftComputer4 =
105109
(computer) -> {
106110
return (in1, in2, in3, in4, out) -> {
107111
var itrin1 = in1.iterator();
@@ -116,7 +120,7 @@ public class ComputerToIterables<I, I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11
116120
};
117121

118122
@OpField(names = "engine.adapt")
119-
public final Function<Computers.Arity5<I1, I2, I3, I4, I5, O>, Computers.Arity5<Iterable<I1>, Iterable<I2>, Iterable<I3>, Iterable<I4>, Iterable<I5>, Iterable<O>>> liftComputer5 =
123+
public final Function<Computers.Arity5<I1, I2, I3, I4, I5, O>, Computers.Arity5<II1, II2, II3, II4, II5, IO>> liftComputer5 =
120124
(computer) -> {
121125
return (in1, in2, in3, in4, in5, out) -> {
122126
var itrin1 = in1.iterator();
@@ -132,7 +136,7 @@ public class ComputerToIterables<I, I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11
132136
};
133137

134138
@OpField(names = "engine.adapt")
135-
public final Function<Computers.Arity6<I1, I2, I3, I4, I5, I6, O>, Computers.Arity6<Iterable<I1>, Iterable<I2>, Iterable<I3>, Iterable<I4>, Iterable<I5>, Iterable<I6>, Iterable<O>>> liftComputer6 =
139+
public final Function<Computers.Arity6<I1, I2, I3, I4, I5, I6, O>, Computers.Arity6<II1, II2, II3, II4, II5, II6, IO>> liftComputer6 =
136140
(computer) -> {
137141
return (in1, in2, in3, in4, in5, in6, out) -> {
138142
var itrin1 = in1.iterator();
@@ -149,7 +153,7 @@ public class ComputerToIterables<I, I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11
149153
};
150154

151155
@OpField(names = "engine.adapt")
152-
public final Function<Computers.Arity7<I1, I2, I3, I4, I5, I6, I7, O>, Computers.Arity7<Iterable<I1>, Iterable<I2>, Iterable<I3>, Iterable<I4>, Iterable<I5>, Iterable<I6>, Iterable<I7>, Iterable<O>>> liftComputer7 =
156+
public final Function<Computers.Arity7<I1, I2, I3, I4, I5, I6, I7, O>, Computers.Arity7<II1, II2, II3, II4, II5, II6, II7, IO>> liftComputer7 =
153157
(computer) -> {
154158
return (in1, in2, in3, in4, in5, in6, in7, out) -> {
155159
var itrin1 = in1.iterator();
@@ -167,7 +171,7 @@ public class ComputerToIterables<I, I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11
167171
};
168172

169173
@OpField(names = "engine.adapt")
170-
public final Function<Computers.Arity8<I1, I2, I3, I4, I5, I6, I7, I8, O>, Computers.Arity8<Iterable<I1>, Iterable<I2>, Iterable<I3>, Iterable<I4>, Iterable<I5>, Iterable<I6>, Iterable<I7>, Iterable<I8>, Iterable<O>>> liftComputer8 =
174+
public final Function<Computers.Arity8<I1, I2, I3, I4, I5, I6, I7, I8, O>, Computers.Arity8<II1, II2, II3, II4, II5, II6, II7, II8, IO>> liftComputer8 =
171175
(computer) -> {
172176
return (in1, in2, in3, in4, in5, in6, in7, in8, out) -> {
173177
var itrin1 = in1.iterator();
@@ -186,7 +190,7 @@ public class ComputerToIterables<I, I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11
186190
};
187191

188192
@OpField(names = "engine.adapt")
189-
public final Function<Computers.Arity9<I1, I2, I3, I4, I5, I6, I7, I8, I9, O>, Computers.Arity9<Iterable<I1>, Iterable<I2>, Iterable<I3>, Iterable<I4>, Iterable<I5>, Iterable<I6>, Iterable<I7>, Iterable<I8>, Iterable<I9>, Iterable<O>>> liftComputer9 =
193+
public final Function<Computers.Arity9<I1, I2, I3, I4, I5, I6, I7, I8, I9, O>, Computers.Arity9<II1, II2, II3, II4, II5, II6, II7, II8, II9, IO>> liftComputer9 =
190194
(computer) -> {
191195
return (in1, in2, in3, in4, in5, in6, in7, in8, in9, out) -> {
192196
var itrin1 = in1.iterator();
@@ -206,7 +210,7 @@ public class ComputerToIterables<I, I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11
206210
};
207211

208212
@OpField(names = "engine.adapt")
209-
public final Function<Computers.Arity10<I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, O>, Computers.Arity10<Iterable<I1>, Iterable<I2>, Iterable<I3>, Iterable<I4>, Iterable<I5>, Iterable<I6>, Iterable<I7>, Iterable<I8>, Iterable<I9>, Iterable<I10>, Iterable<O>>> liftComputer10 =
213+
public final Function<Computers.Arity10<I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, O>, Computers.Arity10<II1, II2, II3, II4, II5, II6, II7, II8, II9, II10, IO>> liftComputer10 =
210214
(computer) -> {
211215
return (in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, out) -> {
212216
var itrin1 = in1.iterator();
@@ -227,7 +231,7 @@ public class ComputerToIterables<I, I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11
227231
};
228232

229233
@OpField(names = "engine.adapt")
230-
public final Function<Computers.Arity11<I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11, O>, Computers.Arity11<Iterable<I1>, Iterable<I2>, Iterable<I3>, Iterable<I4>, Iterable<I5>, Iterable<I6>, Iterable<I7>, Iterable<I8>, Iterable<I9>, Iterable<I10>, Iterable<I11>, Iterable<O>>> liftComputer11 =
234+
public final Function<Computers.Arity11<I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11, O>, Computers.Arity11<II1, II2, II3, II4, II5, II6, II7, II8, II9, II10, II11, IO>> liftComputer11 =
231235
(computer) -> {
232236
return (in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, out) -> {
233237
var itrin1 = in1.iterator();
@@ -249,7 +253,7 @@ public class ComputerToIterables<I, I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11
249253
};
250254

251255
@OpField(names = "engine.adapt")
252-
public final Function<Computers.Arity12<I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11, I12, O>, Computers.Arity12<Iterable<I1>, Iterable<I2>, Iterable<I3>, Iterable<I4>, Iterable<I5>, Iterable<I6>, Iterable<I7>, Iterable<I8>, Iterable<I9>, Iterable<I10>, Iterable<I11>, Iterable<I12>, Iterable<O>>> liftComputer12 =
256+
public final Function<Computers.Arity12<I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11, I12, O>, Computers.Arity12<II1, II2, II3, II4, II5, II6, II7, II8, II9, II10, II11, II12, IO>> liftComputer12 =
253257
(computer) -> {
254258
return (in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, out) -> {
255259
var itrin1 = in1.iterator();
@@ -272,7 +276,7 @@ public class ComputerToIterables<I, I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11
272276
};
273277

274278
@OpField(names = "engine.adapt")
275-
public final Function<Computers.Arity13<I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11, I12, I13, O>, Computers.Arity13<Iterable<I1>, Iterable<I2>, Iterable<I3>, Iterable<I4>, Iterable<I5>, Iterable<I6>, Iterable<I7>, Iterable<I8>, Iterable<I9>, Iterable<I10>, Iterable<I11>, Iterable<I12>, Iterable<I13>, Iterable<O>>> liftComputer13 =
279+
public final Function<Computers.Arity13<I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11, I12, I13, O>, Computers.Arity13<II1, II2, II3, II4, II5, II6, II7, II8, II9, II10, II11, II12, II13, IO>> liftComputer13 =
276280
(computer) -> {
277281
return (in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, out) -> {
278282
var itrin1 = in1.iterator();
@@ -296,7 +300,7 @@ public class ComputerToIterables<I, I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11
296300
};
297301

298302
@OpField(names = "engine.adapt")
299-
public final Function<Computers.Arity14<I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11, I12, I13, I14, O>, Computers.Arity14<Iterable<I1>, Iterable<I2>, Iterable<I3>, Iterable<I4>, Iterable<I5>, Iterable<I6>, Iterable<I7>, Iterable<I8>, Iterable<I9>, Iterable<I10>, Iterable<I11>, Iterable<I12>, Iterable<I13>, Iterable<I14>, Iterable<O>>> liftComputer14 =
303+
public final Function<Computers.Arity14<I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11, I12, I13, I14, O>, Computers.Arity14<II1, II2, II3, II4, II5, II6, II7, II8, II9, II10, II11, II12, II13, II14, IO>> liftComputer14 =
300304
(computer) -> {
301305
return (in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, out) -> {
302306
var itrin1 = in1.iterator();
@@ -321,7 +325,7 @@ public class ComputerToIterables<I, I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11
321325
};
322326

323327
@OpField(names = "engine.adapt")
324-
public final Function<Computers.Arity15<I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11, I12, I13, I14, I15, O>, Computers.Arity15<Iterable<I1>, Iterable<I2>, Iterable<I3>, Iterable<I4>, Iterable<I5>, Iterable<I6>, Iterable<I7>, Iterable<I8>, Iterable<I9>, Iterable<I10>, Iterable<I11>, Iterable<I12>, Iterable<I13>, Iterable<I14>, Iterable<I15>, Iterable<O>>> liftComputer15 =
328+
public final Function<Computers.Arity15<I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11, I12, I13, I14, I15, O>, Computers.Arity15<II1, II2, II3, II4, II5, II6, II7, II8, II9, II10, II11, II12, II13, II14, II15, IO>> liftComputer15 =
325329
(computer) -> {
326330
return (in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, out) -> {
327331
var itrin1 = in1.iterator();
@@ -347,7 +351,7 @@ public class ComputerToIterables<I, I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11
347351
};
348352

349353
@OpField(names = "engine.adapt")
350-
public final Function<Computers.Arity16<I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11, I12, I13, I14, I15, I16, O>, Computers.Arity16<Iterable<I1>, Iterable<I2>, Iterable<I3>, Iterable<I4>, Iterable<I5>, Iterable<I6>, Iterable<I7>, Iterable<I8>, Iterable<I9>, Iterable<I10>, Iterable<I11>, Iterable<I12>, Iterable<I13>, Iterable<I14>, Iterable<I15>, Iterable<I16>, Iterable<O>>> liftComputer16 =
354+
public final Function<Computers.Arity16<I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11, I12, I13, I14, I15, I16, O>, Computers.Arity16<II1, II2, II3, II4, II5, II6, II7, II8, II9, II10, II11, II12, II13, II14, II15, II16, IO>> liftComputer16 =
351355
(computer) -> {
352356
return (in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, out) -> {
353357
var itrin1 = in1.iterator();

0 commit comments

Comments
 (0)