Skip to content

Expose pixel and world coordinate conversions - #295

Closed
Henrik-KM wants to merge 1 commit into
BioVisionCenter:mainfrom
Henrik-KM:feat/public-pixel-world-conversions
Closed

Henrik-KM wants to merge 1 commit into
BioVisionCenter:mainfrom
Henrik-KM:feat/public-pixel-world-conversions

Conversation

@Henrik-KM

Copy link
Copy Markdown

Fixes #238.

Expose pixel_to_world and world_to_pixel from ngio.common. The converter's safe_to_world normalizes scalar starts and lengths using an axis's pixel size, so both functions can be used directly without constructing a Roi or Dimensions object. Downstream call site

The helpers use the same implementation as RoiSlice. The docstrings specify the strict 0.01-pixel snapping tolerance, behavior at and beyond the tolerance, and Python's ties-to-even rounding. Flooring the start and ceiling the exclusive stop still happen when forming array slices.

All 335 tests in the ROI, iterator, ROI pipeline, and Dask I/O test modules passed. I also ran the downstream safe_to_world function with the new imports for pixel and world inputs. Pre-commit hooks and the ngio.common type check passed.

A broader local Windows run stopped at test_the_reported_geometry_round_trips[whole-array]. That test passed in the focused run above and in isolation on unchanged upstream. Limited disk space prevented a full local run.

Implemented and tested with OpenAI Codex.

Checklist before merging

  • I added an appropriate entry to CHANGELOG.md

@lorenzocerrone

Copy link
Copy Markdown
Collaborator

Hi @Henrik-KM, thanks for the interest in ngio.

I'm closing this along with #293–#296, for the same reason: the linked issues don't have an agreed solution yet, and the new-API ones in particular need a design discussion before a PR can be reviewed.

If you'd like to contribute, please propose the approach on the issue first, and open a PR once there's agreement on the direction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Design: a public home for pixel_to_world / world_to_pixel

2 participants