Repository navigation
Default projection assumes projection dimension interval starts at 0 #292
Description
Hi @gselzer,
The DimensionIterable class in DefaultProjectParallel (see below) does not project any data from negative coordinates in the projection dimension, basically assuming that the RAI has a zero valued origin. This causes the projection to be incomplete if the data spans into negative coordinates. In line 109, k is statically set to -1, when it should probably be set to the min value for that dimension. I think this would require another parameter (starting position?), and passing it a value of input.min(dim), then subtracting 1 from that. Luckily this is a nested class and this change doesn't seem like it should affect the Op call.
This issue also seems to be present in ImageJ ops, but I know we're not updating that any more.
Lines 91 to 129 in 82d58a2
| final class DimensionIterable implements Iterable<T> { | |
| private final long size; | |
| private final int dim; | |
| private final RandomAccess<T> access; | |
| public DimensionIterable(final long size, final int dim, | |
| final RandomAccess<T> access) | |
| { | |
| this.size = size; | |
| this.dim = dim; | |
| this.access = access; | |
| } | |
| @Override | |
| public Iterator<T> iterator() { | |
| return new Iterator<T>() { | |
| int k = -1; | |
| @Override | |
| public boolean hasNext() { | |
| return k < size - 1; | |
| } | |
| @Override | |
| public T next() { | |
| k++; | |
| access.setPosition(k, dim); | |
| return access.get(); | |
| } | |
| @Override | |
| public void remove() { | |
| throw new UnsupportedOperationException("Not supported"); | |
| } | |
| }; | |
| } | |
| } |
Activity
gselzer commentedon Aug 12, 2026
@andmccall great catch, yet another bug in these projection Ops 🙁
I think that fixing these projection Ops is quickly jumping to the top of my SciJava Ops priority list.
To be clear, bugfixes to ImageJ Ops are always welcome - I just don't want to add new Ops 😅