imagej / imagej/imagej-ops

ops behaviour for RAI with non-zero interval offset

Open
#584 9 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
94
Forks
44
PR merge metrics
No merged PRs in 30d

Description

@imagejan @ctrueden

related to: https://forum.image.sc/t/measure-surface-perimeter-in-imglib2/21213

```
final RandomAccessibleInterval outputOutline = opService.morphology().outline( mask, true );
```

Above code crashes if `Intervals.minAsLongArray( mask )` is non-zero, i.e. the interval has a non-zero offset.

I feel it is a strategic decision what to do here. My vote would be for all ops to respect non-zero offsets and "pass them on", i.e. the `outputOutline` should have the same interval offset as the input image.

Whatever the decision is, it is important to be consistent here, because this can lead to nasty hidden bugs if there is inconsistent behavior.

If we say that the offset must be zero, i.e., the inputs must actually be`Img` and not only `RAI` I would think there should be a crash with a message: `Detected Non-Zero Offset: not allowed`. Or something like this.

Applying `Views.zeroMin( input )` implicitly at the beginning of each `op` would avoid such crashes, but I don't think it would be good, because it is not clear what's going on.

Happy to discuss this more!

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at opService().morphology().outline(mask, true) and reproduce the crash with a mask whose Intervals.minAsLongArray value is non-zero. Read the related discussion and trace how the outline operation handles interval offsets. Done requires a project-wide decision and consistent behavior for non-zero offsets, including a clear failure mode if offsets are unsupported.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
computer-vision
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.