Skip to content

Commit 05b74e7

Browse files
authored
Merge pull request #102 from scijava/scijava/scijava-ops-engine/parse-type-shortcuts
Closes #163
2 parents c205e7e + 8668da1 commit 05b74e7

11 files changed

Lines changed: 118 additions & 63 deletions

File tree

‎imagej/imagej-ops2/src/main/java/net/imagej/ops2/adapt/LiftFunctionsToRAI.java‎

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ private LiftFunctionsToRAI() {
6969

7070
/**
7171
* @implNote op names='adapt', priority='100.'
72-
* type='java.util.function.Function'
7372
*/
7473
public static <I1, O extends Type<O>, RAII1 extends RandomAccessibleInterval<I1>, RAIO extends RandomAccessibleInterval<O>> Function<RAII1, RAIO> lift11(
7574
@OpDependency(name = "create") BiFunction<Dimensions, O, RAIO> imgCreator, //
@@ -87,7 +86,6 @@ public static <I1, O extends Type<O>, RAII1 extends RandomAccessibleInterval<I1>
8786

8887
/**
8988
* @implNote op names='adapt', priority='100.'
90-
* type='java.util.function.Function'
9189
*/
9290
public static <I1, I2, O extends Type<O>, RAII1 extends RandomAccessibleInterval<I1>, RAIO extends RandomAccessibleInterval<O>> BiFunction<RAII1, I2, RAIO> lift21(
9391
@OpDependency(name = "create") BiFunction<Dimensions, O, RAIO> imgCreator, //
@@ -105,7 +103,6 @@ public static <I1, I2, O extends Type<O>, RAII1 extends RandomAccessibleInterval
105103

106104
/**
107105
* @implNote op names='adapt', priority='100.'
108-
* type='java.util.function.Function'
109106
*/
110107
public static <I1, I2, O extends Type<O>, RAII1 extends RandomAccessibleInterval<I1>, RAII2 extends RandomAccessibleInterval<I2>, RAIO extends RandomAccessibleInterval<O>> BiFunction<RAII1, RAII2, RAIO> lift22(
111108
@OpDependency(name = "create") BiFunction<Dimensions, O, RAIO> imgCreator, //
@@ -124,7 +121,6 @@ public static <I1, I2, O extends Type<O>, RAII1 extends RandomAccessibleInterval
124121

125122
/**
126123
* @implNote op names='adapt', priority='100.'
127-
* type='java.util.function.Function'
128124
*/
129125
public static <I1, I2, I3, O extends Type<O>, RAII1 extends RandomAccessibleInterval<I1>, RAIO extends RandomAccessibleInterval<O>> Functions.Arity3<RAII1, I2, I3, RAIO> lift31(
130126
@OpDependency(name = "create") BiFunction<Dimensions, O, RAIO> imgCreator, //
@@ -142,7 +138,6 @@ public static <I1, I2, I3, O extends Type<O>, RAII1 extends RandomAccessibleInte
142138

143139
/**
144140
* @implNote op names='adapt', priority='100.'
145-
* type='java.util.function.Function'
146141
*/
147142
public static <I1, I2, I3, O extends Type<O>, RAII1 extends RandomAccessibleInterval<I1>, RAII2 extends RandomAccessibleInterval<I2>, RAIO extends RandomAccessibleInterval<O>> Functions.Arity3<RAII1, RAII2, I3, RAIO> lift32(
148143
@OpDependency(name = "create") BiFunction<Dimensions, O, RAIO> imgCreator, //
@@ -161,7 +156,6 @@ public static <I1, I2, I3, O extends Type<O>, RAII1 extends RandomAccessibleInte
161156

162157
/**
163158
* @implNote op names='adapt', priority='100.'
164-
* type='java.util.function.Function'
165159
*/
166160
public static <I1, I2, I3, O extends Type<O>, RAII1 extends RandomAccessibleInterval<I1>, RAII2 extends RandomAccessibleInterval<I2>, RAII3 extends RandomAccessibleInterval<I3>, RAIO extends RandomAccessibleInterval<O>> Functions.Arity3<RAII1, RAII2, RAII3, RAIO> lift33(
167161
@OpDependency(name = "create") BiFunction<Dimensions, O, RAIO> imgCreator, //
@@ -181,7 +175,6 @@ public static <I1, I2, I3, O extends Type<O>, RAII1 extends RandomAccessibleInte
181175

182176
/**
183177
* @implNote op names='adapt', priority='100.'
184-
* type='java.util.function.Function'
185178
*/
186179
public static <I1, I2, I3, I4, O extends Type<O>, RAII1 extends RandomAccessibleInterval<I1>, RAIO extends RandomAccessibleInterval<O>> Functions.Arity4<RAII1, I2, I3, I4, RAIO> lift41(
187180
@OpDependency(name = "create") BiFunction<Dimensions, O, RAIO> imgCreator, //
@@ -199,7 +192,6 @@ public static <I1, I2, I3, I4, O extends Type<O>, RAII1 extends RandomAccessible
199192

200193
/**
201194
* @implNote op names='adapt', priority='100.'
202-
* type='java.util.function.Function'
203195
*/
204196
public static <I1, I2, I3, I4, O extends Type<O>, RAII1 extends RandomAccessibleInterval<I1>, RAII2 extends RandomAccessibleInterval<I2>, RAIO extends RandomAccessibleInterval<O>> Functions.Arity4<RAII1, RAII2, I3, I4, RAIO> lift42(
205197
@OpDependency(name = "create") BiFunction<Dimensions, O, RAIO> imgCreator, //
@@ -218,7 +210,6 @@ public static <I1, I2, I3, I4, O extends Type<O>, RAII1 extends RandomAccessible
218210

219211
/**
220212
* @implNote op names='adapt', priority='100.'
221-
* type='java.util.function.Function'
222213
*/
223214
public static <I1, I2, I3, I4, O extends Type<O>, RAII1 extends RandomAccessibleInterval<I1>, RAII2 extends RandomAccessibleInterval<I2>, RAII3 extends RandomAccessibleInterval<I3>, RAIO extends RandomAccessibleInterval<O>> Functions.Arity4<RAII1, RAII2, RAII3, I4, RAIO> lift43(
224215
@OpDependency(name = "create") BiFunction<Dimensions, O, RAIO> imgCreator, //
@@ -238,7 +229,6 @@ public static <I1, I2, I3, I4, O extends Type<O>, RAII1 extends RandomAccessible
238229

239230
/**
240231
* @implNote op names='adapt', priority='100.'
241-
* type='java.util.function.Function'
242232
*/
243233
public static <I1, I2, I3, I4, O extends Type<O>, RAII1 extends RandomAccessibleInterval<I1>, RAII2 extends RandomAccessibleInterval<I2>, RAII3 extends RandomAccessibleInterval<I3>, RAII4 extends RandomAccessibleInterval<I4>, RAIO extends RandomAccessibleInterval<O>> Functions.Arity4<RAII1, RAII2, RAII3, RAII4, RAIO> lift44(
244234
@OpDependency(name = "create") BiFunction<Dimensions, O, RAIO> imgCreator, //
@@ -259,7 +249,6 @@ public static <I1, I2, I3, I4, O extends Type<O>, RAII1 extends RandomAccessible
259249

260250
/**
261251
* @implNote op names='adapt', priority='100.'
262-
* type='java.util.function.Function'
263252
*/
264253
public static <I1, I2, I3, I4, I5, O extends Type<O>, RAII1 extends RandomAccessibleInterval<I1>, RAIO extends RandomAccessibleInterval<O>> Functions.Arity5<RAII1, I2, I3, I4, I5, RAIO> lift51(
265254
@OpDependency(name = "create") BiFunction<Dimensions, O, RAIO> imgCreator, //
@@ -277,7 +266,6 @@ public static <I1, I2, I3, I4, I5, O extends Type<O>, RAII1 extends RandomAccess
277266

278267
/**
279268
* @implNote op names='adapt', priority='100.'
280-
* type='java.util.function.Function'
281269
*/
282270
public static <I1, I2, I3, I4, I5, O extends Type<O>, RAII1 extends RandomAccessibleInterval<I1>, RAII2 extends RandomAccessibleInterval<I2>, RAIO extends RandomAccessibleInterval<O>> Functions.Arity5<RAII1, RAII2, I3, I4, I5, RAIO> lift52(
283271
@OpDependency(name = "create") BiFunction<Dimensions, O, RAIO> imgCreator, //
@@ -296,7 +284,6 @@ public static <I1, I2, I3, I4, I5, O extends Type<O>, RAII1 extends RandomAccess
296284

297285
/**
298286
* @implNote op names='adapt', priority='100.'
299-
* type='java.util.function.Function'
300287
*/
301288
public static <I1, I2, I3, I4, I5, O extends Type<O>, RAII1 extends RandomAccessibleInterval<I1>, RAII2 extends RandomAccessibleInterval<I2>, RAII3 extends RandomAccessibleInterval<I3>, RAIO extends RandomAccessibleInterval<O>> Functions.Arity5<RAII1, RAII2, RAII3, I4, I5, RAIO> lift53(
302289
@OpDependency(name = "create") BiFunction<Dimensions, O, RAIO> imgCreator, //
@@ -316,7 +303,6 @@ public static <I1, I2, I3, I4, I5, O extends Type<O>, RAII1 extends RandomAccess
316303

317304
/**
318305
* @implNote op names='adapt', priority='100.'
319-
* type='java.util.function.Function'
320306
*/
321307
public static <I1, I2, I3, I4, I5, O extends Type<O>, RAII1 extends RandomAccessibleInterval<I1>, RAII2 extends RandomAccessibleInterval<I2>, RAII3 extends RandomAccessibleInterval<I3>, RAII4 extends RandomAccessibleInterval<I4>, RAIO extends RandomAccessibleInterval<O>> Functions.Arity5<RAII1, RAII2, RAII3, RAII4, I5, RAIO> lift54(
322308
@OpDependency(name = "create") BiFunction<Dimensions, O, RAIO> imgCreator, //
@@ -337,7 +323,6 @@ public static <I1, I2, I3, I4, I5, O extends Type<O>, RAII1 extends RandomAccess
337323

338324
/**
339325
* @implNote op names='adapt', priority='100.'
340-
* type='java.util.function.Function'
341326
*/
342327
public static <I1, I2, I3, I4, I5, O extends Type<O>, RAII1 extends RandomAccessibleInterval<I1>, RAII2 extends RandomAccessibleInterval<I2>, RAII3 extends RandomAccessibleInterval<I3>, RAII4 extends RandomAccessibleInterval<I4>, RAII5 extends RandomAccessibleInterval<I5>, RAIO extends RandomAccessibleInterval<O>> Functions.Arity5<RAII1, RAII2, RAII3, RAII4, RAII5, RAIO> lift55(
343328
@OpDependency(name = "create") BiFunction<Dimensions, O, RAIO> imgCreator, //

‎imagej/imagej-ops2/src/main/java/net/imagej/ops2/copy/Copiers.java‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ private Copiers() {
6060
* @param <T> the {@link Type} of the objects involved
6161
* @param input the input {@link Type}
6262
* @param output the {@link Type} that will be filled with the value of {@code input}
63-
* @implNote op names='copy, copy.type'
63+
* @implNote op names='copy, copy.type', type=Computer
6464
*/
6565
public static <T extends Type<T>> void copyType(final T input, final T output) {
6666
output.set(input);
@@ -75,7 +75,7 @@ public static <T extends Type<T>> void copyType(final T input, final T output) {
7575
* @param input the {@link RandomAccessibleInterval} whose data will be copied
7676
* @param copy the {@link RandomAccessibleInterval} that will be filled with the contents of {@code input}
7777
* @author Christian Dietz (University of Konstanz)
78-
* @implNote op names='copy, copy.rai, copy.img', priority='10.0'
78+
* @implNote op names='copy, copy.rai, copy.img', priority='10.0', type=Computer
7979
*/
8080
public static <T> void copyRAI( //
8181
final @OpDependency(name = "copy") Computers.Arity1<T, T> copier, //
@@ -95,7 +95,7 @@ public static <T> void copyRAI( //
9595
* @param input the {@link ImgLabeling} to copy
9696
* @param output the destination container of the copy operation
9797
* @author Christian Dietz (University of Konstanz)
98-
* @implNote op names='copy, copy.imgLabeling'
98+
* @implNote op names='copy, copy.imgLabeling', type=Computer
9999
*/
100100
public static <T extends IntegerType<T> & NativeType<T>, L> void copyImgLabeling( //
101101
final @OpDependency(name = "copy") Computers.Arity1<RandomAccessibleInterval<T>, RandomAccessibleInterval<T>> raiCopier, //
@@ -118,7 +118,7 @@ public static <T extends IntegerType<T> & NativeType<T>, L> void copyImgLabeling
118118
* @param <L> the type of the {@link LabelingMapping} elements
119119
* @param input the {@link LabelingMapping} to copy
120120
* @param output the destination container of the copy operation
121-
* @implNote op names='copy, copy.labelingMapping', priority='10000.'
121+
* @implNote op names='copy, copy.labelingMapping', priority='10000.', type=Computer
122122
*/
123123
public static <L> void copyLabelingMapping(final LabelingMapping<L> input, final LabelingMapping<L> output) {
124124
output.setLabelSets(input.getLabelSets());
@@ -132,7 +132,7 @@ public static <L> void copyLabelingMapping(final LabelingMapping<L> input, final
132132
* @param <A> the type of the backing data storage for each image
133133
* @param input the {@link ArrayImg} to copy
134134
* @param output the destination container of the copy operation
135-
* @implNote op names='copy, copy.img', priority='10000.'
135+
* @implNote op names='copy, copy.img', priority='10000.', type=Computer
136136
*/
137137
public static <T extends NativeType<T>, A extends ArrayDataAccess<A>> void copyArrayImage( //
138138
final ArrayImg<T, A> input,
@@ -154,7 +154,7 @@ public static <T extends NativeType<T>, A extends ArrayDataAccess<A>> void copyA
154154
* @param copier an Op responsible for copying element types
155155
* @param input the {@link IterableInterval} to copy
156156
* @param output the destination container of the copy operation
157-
* @implNote op names='copy, copy.iterableInterval, copy.img', priority='1.0'
157+
* @implNote op names='copy, copy.iterableInterval, copy.img', priority='1.0', type=Computer
158158
*/
159159
public static <T> void copyIterableInterval( //
160160
@OpDependency(name = "copy.type") final Computers.Arity1<Iterable<T>, Iterable<T>> copier, //

‎imagej/imagej-ops2/src/main/java/net/imagej/ops2/filter/NeighborhoodFilters.java‎

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
package net.imagej.ops2.filter;
3131

3232
import net.imglib2.algorithm.neighborhood.Neighborhood;
33-
import net.imglib2.type.numeric.RealType;
34-
import net.imglib2.type.numeric.real.DoubleType;
3533
import org.scijava.function.Computers;
3634
import org.scijava.ops.spi.OpDependency;
3735

@@ -51,7 +49,7 @@ private NeighborhoodFilters() {
5149
* @param <T> the {@link java.lang.reflect.Type} of the elements of
5250
* {@code neighborhood}
5351
* @param <V> the {@link java.lang.reflect.Type} of the output container
54-
* @implNote op name='filter.max',type='org.scijava.function.Computers$Arity1'
52+
* @implNote op name='filter.max', type='Computer'
5553
*/
5654
public static <T, V> void defaultMax(@OpDependency(
5755
name = "stats.max") Computers.Arity1<Iterable<T>, V> op,
@@ -70,8 +68,7 @@ public static <T, V> void defaultMax(@OpDependency(
7068
* @param <T> the {@link java.lang.reflect.Type} of the elements of
7169
* {@code neighborhood}
7270
* @param <V> the {@link java.lang.reflect.Type} of the output container
73-
* @implNote op
74-
* name='filter.mean',type='org.scijava.function.Computers$Arity1'
71+
* @implNote op name='filter.mean',type='Computer'
7572
*/
7673
public static <T, V> void defaultMean(@OpDependency(
7774
name = "stats.mean") Computers.Arity1<Iterable<T>, V> op,
@@ -90,8 +87,7 @@ public static <T, V> void defaultMean(@OpDependency(
9087
* @param <T> the {@link java.lang.reflect.Type} of the elements of
9188
* {@code neighborhood}
9289
* @param <V> the {@link java.lang.reflect.Type} of the output container
93-
* @implNote op
94-
* name='filter.median',type='org.scijava.function.Computers$Arity1'
90+
* @implNote op name='filter.median', type='Computer'
9591
*/
9692
public static <T, V> void defaultMedian(@OpDependency(
9793
name = "stats.median") Computers.Arity1<Iterable<T>, V> op,
@@ -110,7 +106,7 @@ public static <T, V> void defaultMedian(@OpDependency(
110106
* @param <T> the {@link java.lang.reflect.Type} of the elements of
111107
* {@code neighborhood}
112108
* @param <V> the {@link java.lang.reflect.Type} of the output container
113-
* @implNote op name='filter.min',type='org.scijava.function.Computers$Arity1'
109+
* @implNote op name='filter.min', type='Computer'
114110
*/
115111
public static <T, V> void defaultMinimum(@OpDependency(
116112
name = "stats.min") Computers.Arity1<Iterable<T>, V> op,
@@ -129,8 +125,7 @@ public static <T, V> void defaultMinimum(@OpDependency(
129125
* @param <T> the {@link java.lang.reflect.Type} of the elements of
130126
* {@code neighborhood}
131127
* @param <V> the {@link java.lang.reflect.Type} of the output container
132-
* @implNote op
133-
* name='filter.variance',type='org.scijava.function.Computers$Arity1'
128+
* @implNote op name='filter.variance', type='Computer'
134129
*/
135130
public static <T, V> void defaultVariance(@OpDependency(
136131
name = "stats.variance") Computers.Arity1<Iterable<T>, V> op,

‎imagej/imagej-ops2/src/main/java/net/imagej/ops2/filter/gauss/Gaussians.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ private Gaussians() {
7070
* @param outOfBounds the {@link OutOfBoundsFactory} that defines how the
7171
* calculation is affected outside the input bounds.
7272
* @param output the output image
73-
* @implNote op names='filter.gauss'
73+
* @implNote op names='filter.gauss', type=Computer
7474
*/
7575
@SuppressWarnings({ "unchecked", "rawtypes" })
7676
public static <I extends NumericType<I>, O extends NumericType<O>> void
@@ -108,7 +108,7 @@ private Gaussians() {
108108
* @param outOfBounds the {@link OutOfBoundsFactory} that defines how the
109109
* calculation is affected outside the input bounds.
110110
* @param output the preallocated output image
111-
* @implNote op names='filter.gauss'
111+
* @implNote op names='filter.gauss', type=Computer
112112
*/
113113
public static <I extends NumericType<I>, O extends NumericType<O>> void
114114
gaussRAISingleSigma( //

‎imagej/imagej-ops2/src/main/java/net/imagej/ops2/math/BinaryNumericTypeMath.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public class BinaryNumericTypeMath <T extends NumericType<T>> {
6767
* @param input2
6868
* @param dbzVal
6969
* @param output
70-
* @implNote op names='math.div, math.divide', priority='100.'
70+
* @implNote op names='math.div, math.divide', priority='100.', type=Computer
7171
*/
7272
public static <N extends NumericType<N>> void divider(N input1, N input2,
7373
@Nullable N dbzVal, N output)

‎imagej/imagej-ops2/src/main/java/net/imagej/ops2/math/BinaryRealTypeMath.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public class BinaryRealTypeMath <I1 extends RealType<I1>, I2 extends RealType<I2
8282
* @param input2
8383
* @param dbzVal
8484
* @param output
85-
* @implNote op names='math.div, math.divide'
85+
* @implNote op names='math.div, math.divide', type=Computer
8686
*/
8787
public static <T1 extends RealType<T1>, T2 extends RealType<T2>, O extends RealType<O>> void divider(
8888
T1 input1, T2 input2, @Nullable Double dbzVal, O output)

‎imagej/imagej-ops2/templates/main/java/net/imagej/ops2/adapt/LiftFunctionsToRAI.vm‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ public final class LiftFunctionsToRAI {
7171

7272
/**
7373
* @implNote op names='adapt', priority='100.'
74-
* type='java.util.function.Function'
7574
*/
7675
public static <#foreach($a in [1..$arity])I$a, #{end}O extends Type<O>, #foreach($a in [1..$rais])RAII$a extends RandomAccessibleInterval<I$a>, #{end}RAIO extends RandomAccessibleInterval<O>> $functionNames.call($arity)<#foreach($a in [1..$arity])#if($a <= $rais)RAI#{end}I$a, #{end}RAIO> lift$arity$rais(
7776
@OpDependency(name = "create") BiFunction<Dimensions, O, RAIO> imgCreator, //

‎scijava/scijava-function/src/main/java/org/scijava/function/Inplaces.java‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,11 @@
3333

3434
package org.scijava.function;
3535

36-
import java.util.Collections;
37-
import java.util.LinkedHashMap;
36+
import java.util.HashMap;
3837
import java.util.List;
3938
import java.util.Map;
40-
import java.util.HashMap;
4139
import java.util.Map.Entry;
40+
import java.util.Objects;
4241
import java.util.function.BiConsumer;
4342
import java.util.function.Consumer;
4443
import java.util.stream.Collectors;
@@ -1844,5 +1843,17 @@ public int arity() {
18441843
public int mutablePosition() {
18451844
return mutablePosition;
18461845
}
1846+
1847+
@Override
1848+
public boolean equals(Object that) {
1849+
if (!(that instanceof InplaceInfo)) return false;
1850+
InplaceInfo other = (InplaceInfo) that;
1851+
return other.arity == arity && other.mutablePosition == mutablePosition;
1852+
}
1853+
1854+
@Override
1855+
public int hashCode() {
1856+
return Objects.hash(arity, mutablePosition);
1857+
}
18471858
}
18481859
}

0 commit comments

Comments
 (0)