-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LabeledImageServer coordinate bug #26
Conversation
43b829f
to
35d5d21
Compare
I’ll try this out next week, but I think I agree this behavior sounds wrong. I’d expect that the coordinates for It is an awkward and fiddly issue, where I think we need to be consistent in both for now - while forming an opinion for how it should look if/when we reconsider the It was a nice idea originally to provide pixel access at any arbitrary resolution based on the full-resolution image coordinates, but I think it breaks down in the details - both due to rounding errors, and the need to relate regions across images that correspond but have different resolutions. So I think in the short term we’re stuck looking for a least bad approach. |
Tentatively suggesting1 that if we set the labeled server downsample in However making sense of this in my head for different combinations of downsample in each case and writing suitable tests is not happening after 5pm on a Friday for me. Will revisit next week. Footnotes |
78074e0
to
978d841
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK for the coordinates issue. For the downsampling, I added a comment on #25
Outline
Currently, LabeledImageServer has behaviour that is definitively broken with respect to coordinates, and some behaviour that is arguably unintuitive with respect to downsampling.
Coordinates
When querying a LabelledImageServer, we create a Pillow image and draw the geometries on it. This means that for any Region2D which does not begin at the origin, we are drawing geometries in a different coordinate space. To return a correct labelled image, we must first translate the geometries to remove the offset of the region request, such that (0,0) in the pillow image is the origin of the region request, rather than always being the origin of the full-sized labelled image as it currently is.
Relevant code:
qubalab/qubalab/images/labeled_server.py
Lines 94 to 125 in 2bc2027
Currently, this PR just addresses the offset issue with coordinates.