feat: add ndpa annotation support#268
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for Hamamatsu .ndpa XML annotation files by parsing NDPA viewstates and converting their nanometer-based coordinates into level-0 pixel geometries so they can be loaded through the existing Lazyslide annotation pipeline.
Changes:
- Implement
read_ndpa()(NDPA XML → GeoDataFrame) with coordinate transform based on slide metadata. - Update
load_annotations()to dispatch.ndpapaths to the NDPA reader and to retain non-area geometries (e.g., pins/lines) whenmin_areais set. - Add NDPA-focused tests plus NDPA fixture files, and adjust
.gitignoreto keep those fixtures tracked.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/lazyslide/io/_annotation.py |
Adds NDPA parsing/coordinate transform and updates load_annotations() behavior for .ndpa and non-area geometries. |
src/lazyslide/io/__init__.py |
Exposes read_ndpa as part of the public lazyslide.io API. |
tests/test_io_ndpa.py |
Adds unit tests covering NDPA parsing, dispatch, metadata requirements, and malformed XML handling. |
tests/data/annotations_mixed.ndpa |
Adds a mixed-geometry NDPA fixture for tests. |
tests/data/annotations_malformed.ndpa |
Adds a malformed NDPA fixture for parse-error testing. |
.gitignore |
Ensures tests/data/*.ndpa fixtures aren’t ignored by broad data/ ignores. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
.ndpaannotation file supportCloses #45
Type of changes