Skip to content

Commit da29c66

Browse files
committed
Use LabelingMapping.setLabelSets() instead of deprecated SerializationAccess
1 parent 3aad06c commit da29c66

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ Jean-Yves Tinevez and Michael Zinsmaier.</license.copyrightOwners>
200200
<!-- NB: Deploy releases to the SciJava Maven repository. -->
201201
<releaseProfiles>deploy-to-scijava</releaseProfiles>
202202

203+
<imglib2-roi.version>0.9.0</imglib2-roi.version>
203204
</properties>
204205

205206
<repositories>

src/main/java/net/imglib2/algorithm/labeling/ConnectedComponents.java

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
import java.util.ArrayList;
3939
import java.util.Arrays;
40-
import java.util.HashSet;
40+
import java.util.Collections;
4141
import java.util.Iterator;
4242
import java.util.List;
4343
import java.util.Set;
@@ -53,7 +53,6 @@
5353
import net.imglib2.RandomAccessibleInterval;
5454
import net.imglib2.iterator.IntervalIterator;
5555
import net.imglib2.roi.labeling.ImgLabeling;
56-
import net.imglib2.roi.labeling.LabelingMapping;
5756
import net.imglib2.type.numeric.IntegerType;
5857
import net.imglib2.view.Views;
5958

@@ -147,20 +146,12 @@ public static < T extends IntegerType< T >, L, I extends IntegerType< I > > void
147146

148147
final int numLabels = labelAllConnectedComponents( input, output, se, service ) + 1;
149148

150-
final ArrayList< Set< L > > labelSets = new ArrayList< Set< L > >();
151-
labelSets.add( new HashSet< L >() );
149+
final ArrayList< Set< L > > labelSets = new ArrayList<>();
150+
labelSets.add( Collections.emptySet() );
152151
for ( int i = 1; i < numLabels; ++i )
153-
{
154-
final HashSet< L > set = new HashSet< L >();
155-
set.add( labelGenerator.next() );
156-
labelSets.add( set );
157-
}
158-
new LabelingMapping.SerialisationAccess< L >( labeling.getMapping() )
159-
{
160-
{
161-
super.setLabelSets( labelSets );
162-
}
163-
};
152+
labelSets.add( Collections.singleton( labelGenerator.next() ) );
153+
154+
labeling.getMapping().setLabelSets( labelSets );
164155
}
165156

166157
/**

0 commit comments

Comments
 (0)