Skip to content

Default projection assumes projection dimension interval starts at 0 #292

Description

@andmccall

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.

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");
}
};
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions