imagej / imagej/imagej-ops

Discrepancy in width/height of polygons and meshes

Open
#439 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

Hey guys,

I just figured out, that there is a discrepancy between how polygons and meshes are generated / interpreted. You can see the issue by comparing X/Y coordinates of vertices of polygons and meshes being retrieved from similar binary masks.

Just an example: imagine a binary mask with 4x4 pixels being positive. The x coordinate of the first positive pixel may be 2 and the last one is at position 5. We do the same with a 4x4x4 cube in 3D. Now we generate a polygon from the 2D mask and a mesh from the 3D mask using ops contour() and marchingCubes(), respectively. Then we look at the vertices:
- The minimum x-coordinate of the polygon is 2, the maximum is 5. Its width appears to be 5 - 2 = 3
- The minimum x-coordinate of the mesh is 1.5, the maximum is 5.5. Its width appears to be 5.5 - 1.5 = 4.

Both results appear to be right from some point of view and both appear wrong from another point of view. And furthermore, I could imagine, that the polygon ranges from 2 to 6, because it would then be indeed outlining the binary mask. The related question is as old as image processing itself: Is the position of a pixel on the pixels top left corner or in its center? Independent from the answer to this question: I hope we all agree that this issue should to be solved at least in a way that polygons and meshes are treated equally.

For those who are interested in details, there is an implementation for showing the issue available online:
https://github.com/haesleinhuepf/OpsPolygonTest/blob/master/src/test/java/de/mpicbg/scf/labelhandling/OpsBoundingIntervalsTest.java

Cheers,
Robert

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the linked OpsPolygonTest implementation, particularly src/test/java/de/mpicbg/scf/labelhandling/OpsBoundingIntervalsTest.java, and compare the coordinates produced by contour() and marchingCubes() for the described masks. Review how both operations define pixel positions and determine a consistent coordinate convention; done means the polygon and mesh dimensions follow the same documented interpretation.

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
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.