Skip to content

Commit 52c11f4

Browse files
committed
Use Ops for slicing
1 parent 1e5c4e3 commit 52c11f4

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎scijava-ops-image/src/main/java/org/scijava/ops/image/transform/project/project/ProjectParallelComputer.java‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838

3939
import net.imglib2.view.Views;
4040
import org.scijava.function.Computers;
41+
import org.scijava.function.Functions;
42+
import org.scijava.ops.spi.OpDependency;
4143

4244
/**
4345
* <b>Projection</b> is the act of creating 1-dimensional slices of an n-dimensional image,
@@ -52,6 +54,9 @@ public class ProjectParallelComputer<T, V> implements
5254
Computers.Arity3<RandomAccessibleInterval<T>, Computers.Arity1<? super RandomAccessibleInterval<T>, V>, Integer, RandomAccessibleInterval<V>>
5355
{
5456

57+
@OpDependency(name="transform.hyperSliceView")
58+
Functions.Arity3<RandomAccessibleInterval<T>, Integer, Long, RandomAccessibleInterval<T>> slicer;
59+
5560
/**
5661
* Projects {@code op} along 1-dimensional slices (along dimension {@code dim}) of {@code input}
5762
*
@@ -76,7 +81,7 @@ public void compute(final RandomAccessibleInterval<T> input,
7681
.forEachPixel((pixel, position) -> {
7782
var ra = input;
7883
for (var d = 0; d < position.numDimensions(); d++) {
79-
ra = Views.hyperSlice(ra, d < dim ? 0 : 1, position.getIntPosition(d));
84+
ra = slicer.apply(ra, d < dim ? 0 : 1, position.getLongPosition(d));
8085
}
8186
op.compute(ra, pixel);
8287
});

0 commit comments

Comments
 (0)