Skip to content

feat: add ndpa annotation support#268

Merged
Mr-Milk merged 2 commits into
mainfrom
feat/ndpa-annotation
Jun 19, 2026
Merged

feat: add ndpa annotation support#268
Mr-Milk merged 2 commits into
mainfrom
feat/ndpa-annotation

Conversation

@Mr-Milk

@Mr-Milk Mr-Milk commented Jun 19, 2026

Copy link
Copy Markdown
Member

Add .ndpa annotation file support

Closes #45

Type of changes

  • ✨ New Feature (changes that introduce new functionality)

Copilot AI review requested due to automatic review settings June 19, 2026 14:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 .ndpa paths to the NDPA reader and to retain non-area geometries (e.g., pins/lines) when min_area is set.
  • Add NDPA-focused tests plus NDPA fixture files, and adjust .gitignore to 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.

Comment thread src/lazyslide/io/_annotation.py Outdated
Comment thread src/lazyslide/io/_annotation.py
@Mr-Milk Mr-Milk merged commit 6faca48 into main Jun 19, 2026
21 checks passed
@Mr-Milk Mr-Milk deleted the feat/ndpa-annotation branch June 19, 2026 19:48
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.

[IO] Support ndpa annotation file

2 participants