Skip to content

Commit 97360f3

Browse files
committed
Update to ImgLib2 version 5.1.0
And make the necessary code changes for the revised API. As part of this update, the MorphologyUtils.createSuitableFactory method was removed in favor of the new Util.getSuitableImgFactory method.
1 parent 34db2fa commit 97360f3

37 files changed

+160
-240
lines changed

pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</parent>
1111

1212
<artifactId>imglib2-algorithm</artifactId>
13-
<version>0.8.3-SNAPSHOT</version>
13+
<version>0.9.0-SNAPSHOT</version>
1414

1515
<name>ImgLib2 Algorithms</name>
1616
<description>Useful image processing algorithms.</description>
@@ -200,6 +200,7 @@ Jean-Yves Tinevez and Michael Zinsmaier.</license.copyrightOwners>
200200
<!-- NB: Deploy releases to the ImageJ Maven repository. -->
201201
<releaseProfiles>deploy-to-imagej</releaseProfiles>
202202

203+
<imglib2.version>5.1.0</imglib2.version>
203204
<imglib2-realtransform.version>2.0.0-beta-39</imglib2-realtransform.version>
204205
<jitk-tps.version>3.0.0</jitk-tps.version>
205206
<ojalgo.version>43.0</ojalgo.version>

src/main/java/net/imglib2/algorithm/binary/Thresholder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public static final < T extends Type< T > & Comparable< T >> Img< BitType > thre
7777
try
7878
{
7979
final ImgFactory< BitType > bitFactory = factory.imgFactory( new BitType() );
80-
final Img< BitType > target = bitFactory.create( source, new BitType() );
80+
final Img< BitType > target = bitFactory.create( source );
8181

8282
final Converter< T, BitType > converter;
8383
if ( above )

src/main/java/net/imglib2/algorithm/componenttree/BuildComponentTree.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,8 @@ private BuildComponentTree( final RandomAccessibleInterval< T > input, final Par
342342
final long[] dimensions = new long[ input.numDimensions() ];
343343
input.dimensions( dimensions );
344344

345-
final ImgFactory< BitType > imgFactory = new ArrayImgFactory< BitType >();
346-
visited = imgFactory.create( dimensions, new BitType() );
345+
final ImgFactory< BitType > imgFactory = new ArrayImgFactory<>( new BitType() );
346+
visited = imgFactory.create( dimensions );
347347
visitedRandomAccess = visited.randomAccess();
348348

349349
neighborhood = new Neighborhood( dimensions );

src/main/java/net/imglib2/algorithm/componenttree/mser/MserPartialComponentGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public MserPartialComponentGenerator( final T maxValue, final RandomAccessibleIn
8787
this.maxValue = maxValue;
8888
dimensions = new long[ input.numDimensions() ];
8989
input.dimensions( dimensions );
90-
linkedList = imgFactory.create( dimensions, new LongType() );
90+
linkedList = imgFactory.create( dimensions );
9191
}
9292

9393
@Override

src/main/java/net/imglib2/algorithm/componenttree/pixellist/PixelListPartialComponentGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ final class PixelListPartialComponentGenerator< T extends Type< T > > implements
8686
this.maxValue = maxValue;
8787
dimensions = new long[ input.numDimensions() ];
8888
input.dimensions( dimensions );
89-
linkedList = imgFactory.create( dimensions, new LongType() );
89+
linkedList = imgFactory.create( dimensions );
9090
}
9191

9292
@Override

src/main/java/net/imglib2/algorithm/dog/DifferenceOfGaussian.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public static < I extends NumericType< I >, T extends NumericType< T > & NativeT
9191
final ExecutorService service )
9292
{
9393
final T type = Util.getTypeFromInterval( dog );
94-
final Img< T > g1 = Util.getArrayOrCellImgFactory( dog, type ).create( dog, type );
94+
final Img< T > g1 = Util.getArrayOrCellImgFactory( dog, type ).create( dog );
9595
final long[] translation = new long[ dog.numDimensions() ];
9696
dog.min( translation );
9797
DoG( sigmaSmaller, sigmaLarger, input, Views.translate( g1, translation ), dog, service );

src/main/java/net/imglib2/algorithm/dog/DogDetection.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ public ArrayList< Point > getPeaks()
344344
else
345345
service = executorService;
346346

347-
dogImg = Util.getArrayOrCellImgFactory( interval, type ).create( interval, type );
347+
dogImg = Util.getArrayOrCellImgFactory( interval, type ).create( interval );
348348
final long[] translation = new long[ interval.numDimensions() ];
349349
interval.min( translation );
350350
dogImg = Views.translate( dogImg, translation );

src/main/java/net/imglib2/algorithm/edge/SubpixelEdgelDetection.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public static < T extends RealType< T > > ArrayList< Edgel > getEdgels(
111111
for ( int d = 0; d < n; ++d )
112112
dim[ d ] = input.dimension( d );
113113
dim[ n ] = n;
114-
final Img< T > gradients = factory.create( dim, input.randomAccess().get() );
114+
final Img< T > gradients = factory.create( dim );
115115

116116
// Compute partial derivatives of input in all dimension. This requires
117117
// a border of 1 pixel with respect to the input image

src/main/java/net/imglib2/algorithm/floydsteinberg/FloydSteinbergDithering.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,12 @@ public String getErrorMessage()
182182

183183
public Img< FloatType > createErrorDiffusionKernel( final int numDimensions )
184184
{
185-
final ArrayImgFactory< FloatType > factory = new ArrayImgFactory< FloatType >();
185+
final ArrayImgFactory< FloatType > factory = new ArrayImgFactory<>( new FloatType() );
186186

187187
// for 2d we take the values from the literature
188188
if ( numDimensions == 2 )
189189
{
190-
final Img< FloatType > kernel = factory.create( new long[] { 3, 3 }, new FloatType() );
190+
final Img< FloatType > kernel = factory.create( 3, 3 );
191191

192192
final RandomAccess< FloatType > cursor = kernel.randomAccess();
193193

@@ -212,7 +212,7 @@ public Img< FloatType > createErrorDiffusionKernel( final int numDimensions )
212212

213213
return kernel;
214214
}
215-
final Img< FloatType > kernel = factory.create( Util.getArrayFromValue( 3L, numDimensions ), new FloatType() );
215+
final Img< FloatType > kernel = factory.create( Util.getArrayFromValue( 3L, numDimensions ) );
216216
final Cursor< FloatType > cursor = kernel.cursor();
217217

218218
final int numValues = ( int ) ( kernel.size() / 2 );

src/main/java/net/imglib2/algorithm/gauss/AbstractGauss.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,12 @@ public AbstractGauss( final double[] sigma, final RandomAccessible< T > input, f
107107
final Interval intervalTmp = getTemporaryImgSize();
108108

109109
if ( numDimensions > 1 )
110-
tmp1 = factory.create( intervalTmp, getProcessingType() );
110+
tmp1 = factory.create( intervalTmp );
111111
else
112112
tmp1 = null;
113113

114114
if ( numDimensions > 2 )
115-
tmp2 = factory.create( intervalTmp, getProcessingType() );
115+
tmp2 = factory.create( intervalTmp );
116116
else
117117
tmp2 = null;
118118
}

0 commit comments

Comments
 (0)