Skip to content

Commit 39c0fe7

Browse files
committed
Update code to ImgLib2 7.x
And fix backwards incompatibilities due to the new getType() method.
1 parent cb3aed8 commit 39c0fe7

File tree

8 files changed

+18
-8
lines changed

8 files changed

+18
-8
lines changed

scijava-ops-image/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,11 @@
264264

265265
<license.licenseName>bsd_2</license.licenseName>
266266
<license.copyrightOwners>SciJava developers.</license.copyrightOwners>
267+
268+
<imglib2.version>7.0.1</imglib2.version>
269+
<imglib2-roi.version>0.15.0</imglib2-roi.version>
270+
<imglib2-algorithm.version>0.15.1</imglib2-algorithm.version>
271+
<imglib2-realtransform.version>4.0.3</imglib2-realtransform.version>
267272
</properties>
268273

269274
<repositories>

scijava-ops-image/src/main/java/org/scijava/ops/image/coloc/ShuffledView.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,11 @@ public void shuffleBlocks(long seed) {
125125
shuffleBlocks();
126126
}
127127

128+
@Override
129+
public T getType() {
130+
return image.getType();
131+
}
132+
128133
@Override
129134
public RandomAccess<T> randomAccess() {
130135
return new ShuffledRandomAccess();

scijava-ops-image/src/main/java/org/scijava/ops/image/geom/geom3d/DefaultInertiaTensor3D.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public RealMatrix apply(final IterableRegion<B> input) {
6868
"Only three-dimensional inputs allowed!");
6969

7070
final BlockRealMatrix output = new BlockRealMatrix(3, 3);
71-
Cursor<Void> c = input.localizingCursor();
71+
Cursor<Void> c = input.inside().localizingCursor();
7272
double[] pos = new double[3];
7373
double[] computedCentroid = new double[3];
7474
centroid.apply(input).localize(computedCentroid);
@@ -95,7 +95,7 @@ public RealMatrix apply(final IterableRegion<B> input) {
9595
output.setEntry(2, 1, output.getEntry(1, 2));
9696
}
9797

98-
final double size = input.size();
98+
final double size = input.inside().size();
9999
output.setEntry(0, 0, output.getEntry(0, 0) / size);
100100
output.setEntry(0, 1, output.getEntry(0, 1) / size);
101101
output.setEntry(0, 2, output.getEntry(0, 2) / size);

scijava-ops-image/src/main/java/org/scijava/ops/image/image/watershed/Watershed.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public void compute(final RandomAccessibleInterval<T> in, //
138138
final List<Long> imiList = new ArrayList<>();
139139

140140
if (mask != null) {
141-
final Cursor<Void> c = Regions.iterable(mask).localizingCursor();
141+
final Cursor<Void> c = Regions.iterable(mask).inside().localizingCursor();
142142
while (c.hasNext()) {
143143
c.next();
144144
imiList.add(IntervalIndexer.positionToIndex(c, in));

scijava-ops-image/src/main/java/org/scijava/ops/image/image/watershed/WatershedSeeded.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ public void compute( //
207207
// Only iterate seeds that are not excluded by the mask
208208
final IterableRegion<B> maskRegions = Regions.iterable(mask);
209209
final IterableInterval<LabelingType<Integer>> seedsMasked = Regions.sample(
210-
(IterableInterval<Void>) maskRegions, seeds);
210+
maskRegions.inside(), seeds);
211211
final Cursor<LabelingType<Integer>> cursorSeeds = seedsMasked
212212
.localizingCursor();
213213

scijava-ops-image/src/main/java/org/scijava/ops/image/labeling/MergeLabeling.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ public ImgLabeling<L, I> apply( //
8787
.iterable(input1.getSource()).firstElement());
8888
if (mask != null) {
8989
final IterableRegion iterable = Regions.iterable(mask);
90-
final IterableInterval<LabelingType<L>> sample = Regions.sample(
91-
(IterableInterval<Void>) iterable, output);
90+
final IterableInterval<LabelingType<L>> sample = //
91+
Regions.sample(iterable.inside(), output);
9292
final RandomAccess<LabelingType<L>> randomAccess = input1.randomAccess();
9393
final RandomAccess<LabelingType<L>> randomAccess2 = input2.randomAccess();
9494
final Cursor<LabelingType<L>> cursor = sample.cursor();

scijava-ops-image/src/test/java/org/scijava/ops/image/image/watershed/WatershedSeededTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ private void assertResults(final RandomAccessibleInterval<FloatType> in,
219219
// count labels
220220
Set<Integer> labelSet = new HashSet<>();
221221
for (LabelingType<Integer> pixel : Regions.sample(
222-
(IterableInterval<Void>) regions, out))
222+
regions.inside(), out))
223223
{
224224
labelSet.addAll(pixel);
225225
}

scijava-ops-image/src/test/java/org/scijava/ops/image/image/watershed/WatershedTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ private void assertResults(final RandomAccessibleInterval<FloatType> in,
220220
// count labels
221221
Set<Integer> labelSet = new HashSet<>();
222222
for (LabelingType<Integer> pixel : Regions.sample(
223-
(IterableInterval<Void>) regions, out))
223+
regions.inside(), out))
224224
{
225225
labelSet.addAll(pixel);
226226
}

0 commit comments

Comments
 (0)