Skip to content

Commit 7c2c8f7

Browse files
gselzeraxtimwalde
authored andcommitted
Allow wider Shape lists in morphology ops
1 parent 3783106 commit 7c2c8f7

File tree

6 files changed

+40
-40
lines changed

6 files changed

+40
-40
lines changed

src/main/java/net/imglib2/algorithm/morphology/BlackTopHat.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public class BlackTopHat
8989
* sub-type of {@code T extends RealType}.
9090
* @return a new {@link Img}, of same dimensions than the source.
9191
*/
92-
public static < T extends RealType< T >> Img< T > blackTopHat( final Img< T > source, final List< Shape > strels, final int numThreads )
92+
public static < T extends RealType< T >> Img< T > blackTopHat( final Img< T > source, final List< ? extends Shape > strels, final int numThreads )
9393
{
9494
final Img< T > closed = Closing.close( source, strels, numThreads );
9595
MorphologyUtils.subAAB( closed, source, numThreads );
@@ -140,7 +140,7 @@ public static < T extends RealType< T >> Img< T > blackTopHat( final Img< T > so
140140
* subtract them.
141141
* @return a new {@link Img}, of same dimensions than the source.
142142
*/
143-
public static < T extends Type< T > & Comparable< T > & Sub< T > > Img< T > blackTopHat( final Img< T > source, final List< Shape > strels, final T minVal, final T maxVal, final int numThreads )
143+
public static < T extends Type< T > & Comparable< T > & Sub< T > > Img< T > blackTopHat( final Img< T > source, final List< ? extends Shape > strels, final T minVal, final T maxVal, final int numThreads )
144144
{
145145
final Img< T > closed = Closing.close( source, strels, minVal, maxVal, numThreads );
146146
MorphologyUtils.subAAB( closed, source, numThreads );
@@ -262,7 +262,7 @@ public static < T extends Type< T > & Comparable< T > & Sub< T > > Img< T > blac
262262
* the type of the source and the result. Must extends
263263
* {@link RealType}.
264264
*/
265-
public static < T extends RealType< T > > void blackTopHat( final RandomAccessible< T > source, final IterableInterval< T > target, final List< Shape > strels, final int numThreads )
265+
public static < T extends RealType< T > > void blackTopHat( final RandomAccessible< T > source, final IterableInterval< T > target, final List< ? extends Shape > strels, final int numThreads )
266266
{
267267
Closing.close( source, target, strels, numThreads );
268268
MorphologyUtils.subAAB2( target, source, numThreads );
@@ -321,7 +321,7 @@ public static < T extends RealType< T > > void blackTopHat( final RandomAccessib
321321
* want to be able to compare pixels between themselves and to
322322
* subtract them.
323323
*/
324-
public static < T extends Type< T > & Comparable< T > & Sub< T >> void blackTopHat( final RandomAccessible< T > source, final IterableInterval< T > target, final List< Shape > strels, final T minVal, final T maxVal, final int numThreads )
324+
public static < T extends Type< T > & Comparable< T > & Sub< T >> void blackTopHat( final RandomAccessible< T > source, final IterableInterval< T > target, final List< ? extends Shape > strels, final T minVal, final T maxVal, final int numThreads )
325325
{
326326
Closing.close( source, target, strels, minVal, maxVal, numThreads );
327327
MorphologyUtils.subAAB2( target, source, numThreads );
@@ -452,7 +452,7 @@ public static < T extends Type< T > & Comparable< T > & Sub< T >> void blackTopH
452452
* the type of the source image. Must be a sub-type of
453453
* {@code T extends RealType}.
454454
*/
455-
public static < T extends RealType< T >> void blackTopHatInPlace( final RandomAccessible< T > source, final Interval interval, final List< Shape > strels, final int numThreads )
455+
public static < T extends RealType< T >> void blackTopHatInPlace( final RandomAccessible< T > source, final Interval interval, final List< ? extends Shape > strels, final int numThreads )
456456
{
457457
// Prepare tmp holder
458458
final T minVal = MorphologyUtils.createVariable( source, interval );
@@ -514,7 +514,7 @@ public static < T extends RealType< T >> void blackTopHatInPlace( final RandomAc
514514
* want to be able to compare pixels between themselves and to
515515
* subtract them.
516516
*/
517-
public static < T extends Type< T > & Comparable< T > & Sub< T >> void blackTopHatInPlace( final RandomAccessible< T > source, final Interval interval, final List< Shape > strels, final T minVal, final T maxVal, final int numThreads )
517+
public static < T extends Type< T > & Comparable< T > & Sub< T >> void blackTopHatInPlace( final RandomAccessible< T > source, final Interval interval, final List< ? extends Shape> strels, final T minVal, final T maxVal, final int numThreads )
518518
{
519519
// Prepare tmp holder
520520
final ImgFactory< T > factory = Util.getSuitableImgFactory( interval, minVal );

src/main/java/net/imglib2/algorithm/morphology/Closing.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public class Closing
7777
* @return an {@link Img} of the same type and same dimensions that of the
7878
* source.
7979
*/
80-
public static final < T extends RealType< T >> Img< T > close( final Img< T > source, final List< Shape > strels, final int numThreads )
80+
public static final < T extends RealType< T >> Img< T > close( final Img< T > source, final List< ? extends Shape > strels, final int numThreads )
8181
{
8282
final Img< T > dilated = Dilation.dilate( source, strels, numThreads );
8383
final Img< T > eroded = Erosion.erode( dilated, strels, numThreads );
@@ -124,7 +124,7 @@ public static final < T extends RealType< T >> Img< T > close( final Img< T > so
124124
* @return an {@link Img} of the same type and same dimensions that of the
125125
* source.
126126
*/
127-
public static final < T extends Type< T > & Comparable< T > > Img< T > close( final Img< T > source, final List< Shape > strels, final T minVal, final T maxVal, final int numThreads )
127+
public static final < T extends Type< T > & Comparable< T > > Img< T > close( final Img< T > source, final List< ? extends Shape > strels, final T minVal, final T maxVal, final int numThreads )
128128
{
129129
final Img< T > dilated = Dilation.dilate( source, strels, minVal, numThreads );
130130
final Img< T > eroded = Erosion.erode( dilated, strels, maxVal, numThreads );
@@ -239,7 +239,7 @@ public static final < T extends Type< T > & Comparable< T > > Img< T > close( fi
239239
* the type of the source and the result. Must extends
240240
* {@link RealType}.
241241
*/
242-
public static < T extends RealType< T > > void close( final RandomAccessible< T > source, final IterableInterval< T > target, final List< Shape > strels, final int numThreads )
242+
public static < T extends RealType< T > > void close( final RandomAccessible< T > source, final IterableInterval< T > target, final List< ? extends Shape > strels, final int numThreads )
243243
{
244244
final T maxVal = MorphologyUtils.createVariable( source, target );
245245
maxVal.setReal( maxVal.getMaxValue() );
@@ -301,7 +301,7 @@ public static < T extends RealType< T > > void close( final RandomAccessible< T
301301
* the type of the source and the result. Must extends
302302
* {@code Compparable}.
303303
*/
304-
public static < T extends Type< T > & Comparable< T > > void close( final RandomAccessible< T > source, final IterableInterval< T > target, final List< Shape > strels, final T minVal, final T maxVal, final int numThreads )
304+
public static < T extends Type< T > & Comparable< T > > void close( final RandomAccessible< T > source, final IterableInterval< T > target, final List< ? extends Shape > strels, final T minVal, final T maxVal, final int numThreads )
305305
{
306306
// Create temp image
307307
final ImgFactory< T > factory = Util.getSuitableImgFactory( target, maxVal );
@@ -456,7 +456,7 @@ public static < T extends Type< T > & Comparable< T > > void close( final Random
456456
* the type of the source image. Must be a sub-type of
457457
* {@code T extends RealType}.
458458
*/
459-
public static < T extends RealType< T > > void closeInPlace( final RandomAccessibleInterval< T > source, final Interval interval, final List< Shape > strels, final int numThreads )
459+
public static < T extends RealType< T > > void closeInPlace( final RandomAccessibleInterval< T > source, final Interval interval, final List< ? extends Shape > strels, final int numThreads )
460460
{
461461
final T maxVal = MorphologyUtils.createVariable( source, interval );
462462
maxVal.setReal( maxVal.getMaxValue() );
@@ -514,7 +514,7 @@ public static < T extends RealType< T > > void closeInPlace( final RandomAccessi
514514
* the type of the source image. Must be a sub-type of
515515
* {@code T extends Comparable}.
516516
*/
517-
public static < T extends Type< T > & Comparable< T >> void closeInPlace( final RandomAccessibleInterval< T > source, final Interval interval, final List< Shape > strels, final T minVal, final T maxVal, final int numThreads )
517+
public static < T extends Type< T > & Comparable< T >> void closeInPlace( final RandomAccessibleInterval< T > source, final Interval interval, final List< ? extends Shape > strels, final T minVal, final T maxVal, final int numThreads )
518518
{
519519
for ( final Shape strel : strels )
520520
{

src/main/java/net/imglib2/algorithm/morphology/Dilation.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public class Dilation
8787
* a sub-type of {@code T extends RealType}.
8888
* @return a new {@link Img}, of same dimensions than the source.
8989
*/
90-
public static < T extends RealType< T > > Img< T > dilate( final Img< T > source, final List< Shape > strels, final int numThreads )
90+
public static < T extends RealType< T > > Img< T > dilate( final Img< T > source, final List< ? extends Shape > strels, final int numThreads )
9191
{
9292
Img< T > target = source;
9393
for ( final Shape strel : strels )
@@ -138,7 +138,7 @@ public static < T extends RealType< T > > Img< T > dilate( final Img< T > source
138138
* a sub-type of {@code T extends Comparable & Type}.
139139
* @return a new {@link Img}, of same dimensions than the source.
140140
*/
141-
public static < T extends Type< T > & Comparable< T > > Img< T > dilate( final Img< T > source, final List< Shape > strels, final T minVal, final int numThreads )
141+
public static < T extends Type< T > & Comparable< T > > Img< T > dilate( final Img< T > source, final List< ? extends Shape > strels, final T minVal, final int numThreads )
142142
{
143143
Img< T > target = source;
144144
for ( final Shape strel : strels )
@@ -260,7 +260,7 @@ public static < T extends Type< T > & Comparable< T > > Img< T > dilate( final I
260260
* @param numThreads
261261
* the number of threads to use for the calculation.
262262
*/
263-
public static < T extends RealType< T >> void dilate( final RandomAccessible< T > source, final IterableInterval< T > target, final List< Shape > strels, final int numThreads )
263+
public static < T extends RealType< T >> void dilate( final RandomAccessible< T > source, final IterableInterval< T > target, final List< ? extends Shape > strels, final int numThreads )
264264
{
265265
final T minVal = MorphologyUtils.createVariable( source, target );
266266
minVal.setReal( minVal.getMinValue() );
@@ -317,7 +317,7 @@ public static < T extends RealType< T >> void dilate( final RandomAccessible< T
317317
* the type of the source image and the dilation result. Must be
318318
* a sub-type of {@code T extends Comparable & Type}.
319319
*/
320-
public static < T extends Type< T > & Comparable< T > > void dilate( final RandomAccessible< T > source, final IterableInterval< T > target, final List< Shape > strels, final T minVal, final int numThreads )
320+
public static < T extends Type< T > & Comparable< T > > void dilate( final RandomAccessible< T > source, final IterableInterval< T > target, final List< ? extends Shape > strels, final T minVal, final int numThreads )
321321
{
322322
if ( strels.isEmpty() ) { return; }
323323
if ( strels.size() == 1 )
@@ -608,7 +608,7 @@ public void run()
608608
* a sub-type of {@code T extends RealType}.
609609
* @return a new {@link Img}, possibly of larger dimensions than the source.
610610
*/
611-
public static < T extends RealType< T > > Img< T > dilateFull( final Img< T > source, final List< Shape > strels, final int numThreads )
611+
public static < T extends RealType< T > > Img< T > dilateFull( final Img< T > source, final List< ? extends Shape > strels, final int numThreads )
612612
{
613613
Img< T > target = source;
614614
for ( final Shape strel : strels )
@@ -672,7 +672,7 @@ public static < T extends RealType< T > > Img< T > dilateFull( final Img< T > so
672672
* a sub-type of {@code T extends Comparable & Type}.
673673
* @return a new {@link Img}, possibly of larger dimensions than the source.
674674
*/
675-
public static < T extends Type< T > & Comparable< T > > Img< T > dilateFull( final Img< T > source, final List< Shape > strels, final T minVal, final int numThreads )
675+
public static < T extends Type< T > & Comparable< T > > Img< T > dilateFull( final Img< T > source, final List< ? extends Shape > strels, final T minVal, final int numThreads )
676676
{
677677
Img< T > target = source;
678678
for ( final Shape strel : strels )
@@ -833,7 +833,7 @@ public static < T extends Type< T > & Comparable< T > > Img< T > dilateFull( fin
833833
* the type of the source image. Must be a sub-type of
834834
* {@code T extends RealType}.
835835
*/
836-
public static < T extends RealType< T > > void dilateInPlace( final RandomAccessibleInterval< T > source, final Interval interval, final List< Shape > strels, final int numThreads )
836+
public static < T extends RealType< T > > void dilateInPlace( final RandomAccessibleInterval< T > source, final Interval interval, final List< ? extends Shape > strels, final int numThreads )
837837
{
838838
for ( final Shape strel : strels )
839839
{
@@ -887,7 +887,7 @@ public static < T extends RealType< T > > void dilateInPlace( final RandomAccess
887887
* the type of the source image. Must be a sub-type of
888888
* {@code T extends Comparable & Type}.
889889
*/
890-
public static < T extends Type< T > & Comparable< T > > void dilateInPlace( final RandomAccessibleInterval< T > source, final Interval interval, final List< Shape > strels, final T minVal, final int numThreads )
890+
public static < T extends Type< T > & Comparable< T > > void dilateInPlace( final RandomAccessibleInterval< T > source, final Interval interval, final List< ? extends Shape > strels, final T minVal, final int numThreads )
891891
{
892892
for ( final Shape strel : strels )
893893
{

src/main/java/net/imglib2/algorithm/morphology/Erosion.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public class Erosion
8787
* sub-type of {@code T extends RealType}.
8888
* @return a new {@link Img}, of same dimensions than the source.
8989
*/
90-
public static < T extends RealType< T > > Img< T > erode( final Img< T > source, final List< Shape > strels, final int numThreads )
90+
public static < T extends RealType< T > > Img< T > erode( final Img< T > source, final List< ? extends Shape > strels, final int numThreads )
9191
{
9292
Img< T > target = source;
9393
for ( final Shape strel : strels )
@@ -138,7 +138,7 @@ public static < T extends RealType< T > > Img< T > erode( final Img< T > source,
138138
* sub-type of {@code T extends Comparable & Type}.
139139
* @return a new {@link Img}, of same dimensions than the source.
140140
*/
141-
public static < T extends Type< T > & Comparable< T > > Img< T > erode( final Img< T > source, final List< Shape > strels, final T maxVal, final int numThreads )
141+
public static < T extends Type< T > & Comparable< T > > Img< T > erode( final Img< T > source, final List< ? extends Shape > strels, final T maxVal, final int numThreads )
142142
{
143143
Img< T > target = source;
144144
for ( final Shape strel : strels )
@@ -260,7 +260,7 @@ public static < T extends Type< T > & Comparable< T > > Img< T > erode( final Im
260260
* @param numThreads
261261
* the number of threads to use for the calculation.
262262
*/
263-
public static < T extends RealType< T >> void erode( final RandomAccessible< T > source, final IterableInterval< T > target, final List< Shape > strels, final int numThreads )
263+
public static < T extends RealType< T >> void erode( final RandomAccessible< T > source, final IterableInterval< T > target, final List< ? extends Shape > strels, final int numThreads )
264264
{
265265
final T maxVal = MorphologyUtils.createVariable( source, target );
266266
maxVal.setReal( maxVal.getMaxValue() );
@@ -317,7 +317,7 @@ public static < T extends RealType< T >> void erode( final RandomAccessible< T >
317317
* the type of the source image and the erosion result. Must be a
318318
* sub-type of {@code T extends Comparable & Type}.
319319
*/
320-
public static < T extends Type< T > & Comparable< T > > void erode( final RandomAccessible< T > source, final IterableInterval< T > target, final List< Shape > strels, final T maxVal, final int numThreads )
320+
public static < T extends Type< T > & Comparable< T > > void erode( final RandomAccessible< T > source, final IterableInterval< T > target, final List< ? extends Shape > strels, final T maxVal, final int numThreads )
321321
{
322322
if ( strels.isEmpty() ) { return; }
323323
if ( strels.size() == 1 )
@@ -608,7 +608,7 @@ public void run()
608608
* sub-type of {@code T extends RealType}.
609609
* @return a new {@link Img}, possibly of larger dimensions than the source.
610610
*/
611-
public static < T extends RealType< T > > Img< T > erodeFull( final Img< T > source, final List< Shape > strels, final int numThreads )
611+
public static < T extends RealType< T > > Img< T > erodeFull( final Img< T > source, final List< ? extends Shape > strels, final int numThreads )
612612
{
613613
Img< T > target = source;
614614
for ( final Shape strel : strels )
@@ -672,7 +672,7 @@ public static < T extends RealType< T > > Img< T > erodeFull( final Img< T > sou
672672
* sub-type of {@code T extends Comparable & Type}.
673673
* @return a new {@link Img}, possibly of larger dimensions than the source.
674674
*/
675-
public static < T extends Type< T > & Comparable< T > > Img< T > erodeFull( final Img< T > source, final List< Shape > strels, final T maxVal, final int numThreads )
675+
public static < T extends Type< T > & Comparable< T > > Img< T > erodeFull( final Img< T > source, final List< ? extends Shape > strels, final T maxVal, final int numThreads )
676676
{
677677
Img< T > target = source;
678678
for ( final Shape strel : strels )
@@ -833,7 +833,7 @@ public static < T extends Type< T > & Comparable< T > > Img< T > erodeFull( fina
833833
* the type of the source image. Must be a sub-type of
834834
* {@code T extends RealType}.
835835
*/
836-
public static < T extends RealType< T > > void erodeInPlace( final RandomAccessible< T > source, final Interval interval, final List< Shape > strels, final int numThreads )
836+
public static < T extends RealType< T > > void erodeInPlace( final RandomAccessible< T > source, final Interval interval, final List< ? extends Shape > strels, final int numThreads )
837837
{
838838
for ( final Shape strel : strels )
839839
{
@@ -887,7 +887,7 @@ public static < T extends RealType< T > > void erodeInPlace( final RandomAccessi
887887
* the type of the source image. Must be a sub-type of
888888
* {@code T extends Comparable & Type}.
889889
*/
890-
public static < T extends Type< T > & Comparable< T > > void erodeInPlace( final RandomAccessibleInterval< T > source, final Interval interval, final List< Shape > strels, final T maxVal, final int numThreads )
890+
public static < T extends Type< T > & Comparable< T > > void erodeInPlace( final RandomAccessibleInterval< T > source, final Interval interval, final List< ? extends Shape > strels, final T maxVal, final int numThreads )
891891
{
892892
for ( final Shape strel : strels )
893893
{

0 commit comments

Comments
 (0)