Problem with rasterization of line and point ROIs
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 786
- Forks
- 267
- PR merge metrics
- No merged PRs in 30d
Description
When I used the point iterator on line and point ROIs I found that the obtained point coordinates are often wrong. In particular,
- the terminal points of lines are not rendered correctly,
- some consecutive line points have duplicates with identical positions,
- coordinates of points in single and multi-point ROIs are generally off by one pixel.
Test images (containing selected ROIs) can be found [here](https://github.com/imagingbook/imagej1/tree/wb-fixes/wilbur-test-images) (tried to attach a ZIP file but it was rejected).
In this course I also looked at the behavious of Line.getPixels() and found similar deficiencies. The end point of the line was never included and the resulting array of pixel values also contained duplicates from the same locations (which I believe is not intended). However, even when interpolation is ON, the getPixels() method missed the last point on the line.
The mapping from ``float`` or ``double`` to ``int`` coordinates is apparently flawed in several places. I suggest to use this version to calculate the right offset (which will also work for negative coordinates):
````
double x, y; // original position
int u = (int) Math.round(x - 0.5);
int v = (int) Math.round(y - 0.5);
````
Perhaps this should be packed into a single conversion method. There may be related problems in other places.
I have worked out a patch which can be found in [this repo](https://github.com/imagingbook/imagej1). Will send a pull request shortly. Hope this is useful, pls. let me know if anything's unclear.
--Wilhelm
PS: The announced pull request is [here](https://github.com/imagej/imagej1/pull/31).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked pull request #31 and the test images in wilbur-test-images. Inspect the point iterator and Line.getPixels() behavior described in the issue, including coordinate conversion for negative positions. Done means line endpoints are included, duplicate positions are removed, and point and line ROI coordinates match the expected pixels.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- computer-vision
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100