Skip to content

Commit 5167dc7

Browse files
committed
Improve type vars of ila wrapper morphology ops
1 parent 0f54afc commit 5167dc7

File tree

6 files changed

+91
-70
lines changed

6 files changed

+91
-70
lines changed

src/main/java/net/imagej/ops/morphology/BlackTopHats.java

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,47 +14,57 @@
1414
import org.scijava.ops.OpField;
1515
import org.scijava.ops.core.OpCollection;
1616
import org.scijava.ops.function.Computers;
17-
import org.scijava.ops.function.Computers;
18-
import org.scijava.ops.function.Functions;
1917
import org.scijava.ops.function.Functions;
2018
import org.scijava.ops.function.Inplaces;
21-
import org.scijava.ops.function.Inplaces;
22-
import org.scijava.param.Parameter;
2319
import org.scijava.plugin.Plugin;
24-
import org.scijava.struct.ItemIO;
2520

21+
/**
22+
* Wrapper Ops for imglib2-algorithm's Black Top Hats algorithms TODO: Revert to
23+
* the nice lambda syntax with all of the List ops once imglib2-algorithm
24+
* reaches a new version.
25+
*
26+
* @author Gabriel Selzer
27+
* @param <T>
28+
* @param <R>
29+
*/
2630
@Plugin(type = OpCollection.class)
2731
public class BlackTopHats<T extends RealType<T> & Comparable<T>, R extends RealType<R>> {
2832

33+
@SuppressWarnings("unchecked")
2934
@OpField(names = "morphology.BlackTopHat", params = "source, strels, numThreads, result")
30-
public final Functions.Arity3<Img<R>, List<Shape>, Integer, Img<R>> BlackTopHatImgList = BlackTopHat::blackTopHat;
35+
public final Functions.Arity3<Img<R>, List<? extends Shape>, Integer, Img<R>> BlackTopHatImgList = (in1, in2, in3) -> BlackTopHat.blackTopHat(in1, (List<Shape>) in2, in3);
3136

3237
@OpField(names = "morphology.BlackTopHat", params = "source, strel, numThreads, result")
3338
public final Functions.Arity3<Img<R>, Shape, Integer, Img<R>> BlackTopHatImgSingle = BlackTopHat::blackTopHat;
3439

40+
@SuppressWarnings("unchecked")
3541
@OpField(names = "morphology.BlackTopHat", params = "source, strels, minValue, maxValue, numThreads, result")
36-
public final Functions.Arity5<Img<T>, List<Shape>, T, T, Integer, Img<T>> BlackTopHatImgListMinMax = BlackTopHat::blackTopHat;
42+
public final Functions.Arity5<Img<T>, List<? extends Shape>, T, T, Integer, Img<T>> BlackTopHatImgListMinMax = (in1, in2, in3, in4, in5) -> BlackTopHat.blackTopHat(in1, (List<Shape>) in2, in3, in4, in5);
3743

3844
@OpField(names = "morphology.BlackTopHat", params = "source, strel, minValue, maxValue, numThreads, result")
3945
public final Functions.Arity5<Img<T>, Shape, T, T, Integer, Img<T>> BlackTopHatImgSingleMinMax = BlackTopHat::blackTopHat;
4046

47+
@SuppressWarnings("unchecked")
4148
@OpField(names = "morphology.BlackTopHat", params = "source, strels, numThreads, target")
42-
public final Computers.Arity3<RandomAccessible<R>, List<Shape>, Integer, IterableInterval<R>> BlackTopHatImgListComputer = (in1, in2, in3, out) -> BlackTopHat.blackTopHat(in1, out, in2, in3);
49+
public final Computers.Arity3<RandomAccessible<R>, List<? extends Shape>, Integer, IterableInterval<R>> BlackTopHatImgListComputer = (in1, in2, in3, out) -> BlackTopHat.blackTopHat(in1, out, (List<Shape>) in2, in3);
4350

51+
@SuppressWarnings("unchecked")
4452
@OpField(names = "morphology.BlackTopHat", params = "source, strels, minVal, maxVal, numThreads, target")
45-
public final Computers.Arity5<RandomAccessible<T>, List<Shape>, T, T, Integer, IterableInterval<T>> BlackTopHatImgListMinMaxComputer = (in1, in2, in3, in4, in5, out) -> BlackTopHat.blackTopHat(in1, out, in2, in3, in4, in5);
53+
public final Computers.Arity5<RandomAccessible<T>, List<? extends Shape>, T, T, Integer, IterableInterval<T>> BlackTopHatImgListMinMaxComputer = (in1, in2, in3, in4, in5, out) -> BlackTopHat.blackTopHat(in1, out, (List<Shape>) in2, in3, in4, in5);
4654

4755
@OpField(names = "morphology.BlackTopHat", params = "source, strel, numThreads, target")
4856
public final Computers.Arity3<RandomAccessible<R>, Shape, Integer, IterableInterval<R>> BlackTopHatImgComputer = (in1, in2, in3, out) -> BlackTopHat.blackTopHat(in1, out, in2, in3);
4957

5058
@OpField(names = "morphology.BlackTopHat", params = "source, strel, minVal, maxVal, numThreads, target")
5159
public final Computers.Arity5<RandomAccessible<T>, Shape, T, T, Integer, IterableInterval<T>> BlackTopHatImgMinMaxComputer = (in1, in2, in3, in4, in5, out) -> BlackTopHat.blackTopHat(in1, out, in2, in3, in4, in5);
5260

61+
@SuppressWarnings("unchecked")
5362
@OpField(names = "morphology.BlackTopHat", params = "source, interval, strels, numThreads")
54-
public final Inplaces.Arity4_1<RandomAccessibleInterval<R>, Interval, List<Shape>, Integer> BlackTopHatImgListInPlace = BlackTopHat::blackTopHatInPlace;
63+
public final Inplaces.Arity4_1<RandomAccessibleInterval<R>, Interval, List<? extends Shape>, Integer> BlackTopHatImgListInPlace = (io, in2, in3, in4) -> BlackTopHat.blackTopHatInPlace(io, in2, (List<Shape>) in3, in4);
5564

65+
@SuppressWarnings("unchecked")
5666
@OpField(names = "morphology.BlackTopHat", params = "source, interval, strels, minVal, maxVal, numThreads")
57-
public final Inplaces.Arity6_1<RandomAccessibleInterval<T>, Interval, List<Shape>, T, T, Integer> BlackTopHatImgListMinMaxInplace = BlackTopHat::blackTopHatInPlace;
67+
public final Inplaces.Arity6_1<RandomAccessibleInterval<T>, Interval, List<? extends Shape>, T, T, Integer> BlackTopHatImgListMinMaxInplace = (io, in2, in3, in4, in5, in6) -> BlackTopHat.blackTopHatInPlace(io, in2, (List<Shape>) in3, in4, in5, in6);
5868

5969
@OpField(names = "morphology.BlackTopHat", params = "source, interval, strel, numThreads")
6070
public final Inplaces.Arity4_1<RandomAccessibleInterval<R>, Interval, Shape, Integer> BlackTopHatImgSingleInPlace = BlackTopHat::blackTopHatInPlace;

src/main/java/net/imagej/ops/morphology/Closes.java

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,47 +14,48 @@
1414
import org.scijava.ops.OpField;
1515
import org.scijava.ops.core.OpCollection;
1616
import org.scijava.ops.function.Computers;
17-
import org.scijava.ops.function.Computers;
18-
import org.scijava.ops.function.Functions;
1917
import org.scijava.ops.function.Functions;
2018
import org.scijava.ops.function.Inplaces;
21-
import org.scijava.ops.function.Inplaces;
22-
import org.scijava.param.Parameter;
2319
import org.scijava.plugin.Plugin;
24-
import org.scijava.struct.ItemIO;
2520

2621
@Plugin(type = OpCollection.class)
2722
public class Closes<T extends RealType<T> & Comparable<T>, R extends RealType<R>> {
2823

24+
@SuppressWarnings("unchecked")
2925
@OpField(names = "morphology.close", params = "source, strels, numThreads, result")
30-
public final Functions.Arity3<Img<R>, List<Shape>, Integer, Img<R>> closeImgList = Closing::close;
26+
public final Functions.Arity3<Img<R>, List<? extends Shape>, Integer, Img<R>> closeImgList = (in1, in2, in3) -> Closing.close(in1, (List<Shape>) in2, in3);
3127

3228
@OpField(names = "morphology.close", params = "source, strel, numThreads, result")
3329
public final Functions.Arity3<Img<R>, Shape, Integer, Img<R>> closeImgSingle = Closing::close;
3430

31+
@SuppressWarnings("unchecked")
3532
@OpField(names = "morphology.close", params = "source, strels, minValue, maxValue, numThreads, result")
36-
public final Functions.Arity5<Img<T>, List<Shape>, T, T, Integer, Img<T>> closeImgListMinMax = Closing::close;
33+
public final Functions.Arity5<Img<T>, List<? extends Shape>, T, T, Integer, Img<T>> closeImgListMinMax = (in1, in2, in3, in4, in5) -> Closing.close(in1, (List<Shape>) in2, in3, in4, in5);
3734

3835
@OpField(names = "morphology.close", params = "source, strel, minValue, maxValue, numThreads, result")
3936
public final Functions.Arity5<Img<T>, Shape, T, T, Integer, Img<T>> closeImgSingleMinMax = Closing::close;
4037

38+
@SuppressWarnings("unchecked")
4139
@OpField(names = "morphology.close", params = "source, strels, numThreads, target")
42-
public final Computers.Arity3<RandomAccessible<R>, List<Shape>, Integer, IterableInterval<R>> closeImgListComputer = (in1, in2, in3, out) -> Closing.close(in1, out, in2, in3);
40+
public final Computers.Arity3<RandomAccessible<R>, List<? extends Shape>, Integer, IterableInterval<R>> closeImgListComputer = (in1, in2, in3, out) -> Closing.close(in1, out, (List<Shape>) in2, in3);
4341

42+
@SuppressWarnings("unchecked")
4443
@OpField(names = "morphology.close", params = "source, strels, minVal, maxVal, numThreads, target")
45-
public final Computers.Arity5<RandomAccessible<T>, List<Shape>, T, T, Integer, IterableInterval<T>> closeImgListMinMaxComputer = (in1, in2, in3, in4, in5, out) -> Closing.close(in1, out, in2, in3, in4, in5);
44+
public final Computers.Arity5<RandomAccessible<T>, List<? extends Shape>, T, T, Integer, IterableInterval<T>> closeImgListMinMaxComputer = (in1, in2, in3, in4, in5, out) -> Closing.close(in1, out, (List<Shape>) in2, in3, in4, in5);
4645

4746
@OpField(names = "morphology.close", params = "source, strel, numThreads, target")
4847
public final Computers.Arity3<RandomAccessible<R>, Shape, Integer, IterableInterval<R>> closeImgComputer = (in1, in2, in3, out) -> Closing.close(in1, out, in2, in3);
4948

5049
@OpField(names = "morphology.close", params = "source, strel, minVal, maxVal, numThreads, target")
5150
public final Computers.Arity5<RandomAccessible<T>, Shape, T, T, Integer, IterableInterval<T>> closeImgMinMaxComputer = (in1, in2, in3, in4, in5, out) -> Closing.close(in1, out, in2, in3, in4, in5);
5251

52+
@SuppressWarnings("unchecked")
5353
@OpField(names = "morphology.close", params = "source, interval, strels, numThreads")
54-
public final Inplaces.Arity4_1<RandomAccessibleInterval<R>, Interval, List<Shape>, Integer> closeImgListInPlace = Closing::closeInPlace;
54+
public final Inplaces.Arity4_1<RandomAccessibleInterval<R>, Interval, List<? extends Shape>, Integer> closeImgListInPlace = (io, in2, in3, in4) -> Closing.closeInPlace(io, in2, (List<Shape>) in3, in4);
5555

56+
@SuppressWarnings("unchecked")
5657
@OpField(names = "morphology.close", params = "source, interval, strels, minVal, maxVal, numThreads")
57-
public final Inplaces.Arity6_1<RandomAccessibleInterval<T>, Interval, List<Shape>, T, T, Integer> closeImgListMinMaxInplace = Closing::closeInPlace;
58+
public final Inplaces.Arity6_1<RandomAccessibleInterval<T>, Interval, List<? extends Shape>, T, T, Integer> closeImgListMinMaxInplace = (io, in2, in3, in4, in5, in6) -> Closing.closeInPlace(io, in2, (List<Shape>) in3, in4, in5, in6);
5859

5960
@OpField(names = "morphology.close", params = "source, interval, strel, numThreads")
6061
public final Inplaces.Arity4_1<RandomAccessibleInterval<R>, Interval, Shape, Integer> closeImgSingleInPlace = Closing::closeInPlace;

src/main/java/net/imagej/ops/morphology/Dilations.java

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,35 +14,36 @@
1414
import org.scijava.ops.OpField;
1515
import org.scijava.ops.core.OpCollection;
1616
import org.scijava.ops.function.Computers;
17-
import org.scijava.ops.function.Computers;
18-
import org.scijava.ops.function.Functions;
1917
import org.scijava.ops.function.Functions;
2018
import org.scijava.ops.function.Inplaces;
21-
import org.scijava.ops.function.Inplaces;
2219
import org.scijava.plugin.Plugin;
2320

2421
@Plugin(type = OpCollection.class)
2522
public class Dilations<T extends RealType<T> & Comparable<T>, R extends RealType<R>> {
2623

24+
@SuppressWarnings("unchecked")
2725
@OpField(names = "morphology.dilate", params = "source, strels, numThreads, result")
28-
public final Functions.Arity3<Img<R>, List<Shape>, Integer, Img<R>> dilateImgList = Dilation::dilate;
26+
public final Functions.Arity3<Img<R>, List<? extends Shape>, Integer, Img<R>> dilateImgList = (in1, in2, in3) -> Dilation.dilate(in1, (List<Shape>) in2, in3);
2927

3028
@OpField(names = "morphology.dilate", params = "source, strel, numThreads, result")
3129
public final Functions.Arity3<Img<R>, Shape, Integer, Img<R>> dilateImgSingle = Dilation::dilate;
3230

31+
@SuppressWarnings("unchecked")
3332
@OpField(names = "morphology.dilate", params = "source, strels, minValue, numThreads, result")
34-
public final Functions.Arity4<Img<T>, List<Shape>, T, Integer, Img<T>> dilateImgListMinValue = Dilation::dilate;
33+
public final Functions.Arity4<Img<T>, List<? extends Shape>, T, Integer, Img<T>> dilateImgListMinValue = (in1, in2, in3, in4) -> Dilation.dilate(in1, (List<Shape>) in2, in3, in4);
3534

3635
@OpField(names = "morphology.dilate", params = "source, strel, minValue, numThreads, result")
3736
public final Functions.Arity4<Img<T>, Shape, T, Integer, Img<T>> dilateImgSingleMinValue = Dilation::dilate;
3837

38+
@SuppressWarnings("unchecked")
3939
@OpField(names = "morphology.dilate", params = "source, strels, numThreads, target")
40-
public final Computers.Arity3<RandomAccessible<R>, List<Shape>, Integer, IterableInterval<R>> dilateImgListComputer = (in1,
41-
in2, in3, out) -> Dilation.dilate(in1, out, in2, in3);
40+
public final Computers.Arity3<RandomAccessible<R>, List<? extends Shape>, Integer, IterableInterval<R>> dilateImgListComputer = (in1,
41+
in2, in3, out) -> Dilation.dilate(in1, out, (List<Shape>) in2, in3);
4242

43+
@SuppressWarnings("unchecked")
4344
@OpField(names = "morphology.dilate", params = "source, strels, minVal, numThreads, target")
44-
public final Computers.Arity4<RandomAccessible<T>, List<Shape>, T, Integer, IterableInterval<T>> dilateImgListMinValComputer = (
45-
in1, in2, in3, in4, out) -> Dilation.dilate(in1, out, in2, in3, in4);
45+
public final Computers.Arity4<RandomAccessible<T>, List<? extends Shape>, T, Integer, IterableInterval<T>> dilateImgListMinValComputer = (
46+
in1, in2, in3, in4, out) -> Dilation.dilate(in1, out, (List<Shape>) in2, in3, in4);
4647

4748
@OpField(names = "morphology.dilate", params = "source, strel, numThreads, target")
4849
public final Computers.Arity3<RandomAccessible<R>, Shape, Integer, IterableInterval<R>> dilateImgComputer = (in1, in2, in3,
@@ -52,23 +53,27 @@ public class Dilations<T extends RealType<T> & Comparable<T>, R extends RealType
5253
public final Computers.Arity4<RandomAccessible<T>, Shape, T, Integer, IterableInterval<T>> dilateImgMinValComputer = (in1,
5354
in2, in3, in4, out) -> Dilation.dilate(in1, out, in2, in3, in4);
5455

56+
@SuppressWarnings("unchecked")
5557
@OpField(names = "morphology.dilate", params = "source, strels, numThreads, result")
56-
public final Functions.Arity3<Img<R>, List<Shape>, Integer, Img<R>> dilateFullImgList = Dilation::dilateFull;
58+
public final Functions.Arity3<Img<R>, List<? extends Shape>, Integer, Img<R>> dilateFullImgList = (in1, in2, in3) -> Dilation.dilateFull(in1, (List<Shape>) in2, in3);
5759

5860
@OpField(names = "morphology.dilate", params = "source, strel, numThreads, result")
5961
public final Functions.Arity3<Img<R>, Shape, Integer, Img<R>> dilateFullImgSingle = Dilation::dilateFull;
6062

63+
@SuppressWarnings("unchecked")
6164
@OpField(names = "morphology.dilate", params = "source, strels, minValue, numThreads, result")
62-
public final Functions.Arity4<Img<T>, List<Shape>, T, Integer, Img<T>> dilateFullImgListMinValue = Dilation::dilateFull;
65+
public final Functions.Arity4<Img<T>, List<? extends Shape>, T, Integer, Img<T>> dilateFullImgListMinValue = (in1, in2, in3, in4) -> Dilation.dilateFull(in1, (List<Shape>) in2, in3, in4);
6366

6467
@OpField(names = "morphology.dilate", params = "source, strel, minValue, numThreads, result")
6568
public final Functions.Arity4<Img<T>, Shape, T, Integer, Img<T>> dilateFullImgSingleMinValue = Dilation::dilateFull;
6669

70+
@SuppressWarnings("unchecked")
6771
@OpField(names = "morphology.dilate", params = "source, interval, strels, numThreads")
68-
public final Inplaces.Arity4_1<RandomAccessibleInterval<R>, Interval, List<Shape>, Integer> dilateImgListInPlace = Dilation::dilateInPlace;
72+
public final Inplaces.Arity4_1<RandomAccessibleInterval<R>, Interval, List<? extends Shape>, Integer> dilateImgListInPlace = (io, in2, in3, in4) -> Dilation.dilateInPlace(io, in2, (List<Shape>) in3, in4);
6973

74+
@SuppressWarnings("unchecked")
7075
@OpField(names = "morphology.dilate", params = "source, interval, strels, minVal, numThreads")
71-
public final Inplaces.Arity5_1<RandomAccessibleInterval<T>, Interval, List<Shape>, T, Integer> dilateImgListMinValInplace = Dilation::dilateInPlace;
76+
public final Inplaces.Arity5_1<RandomAccessibleInterval<T>, Interval, List<? extends Shape>, T, Integer> dilateImgListMinValInplace = (io, in2, in3, in4, in5) -> Dilation.dilateInPlace(io, in2, (List<Shape>) in3, in4, in5);
7277

7378
@OpField(names = "morphology.dilate", params = "source, interval, strel, numThreads")
7479
public final Inplaces.Arity4_1<RandomAccessibleInterval<R>, Interval, Shape, Integer> dilateImgSingleInPlace = Dilation::dilateInPlace;

0 commit comments

Comments
 (0)