-
Notifications
You must be signed in to change notification settings - Fork 7
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
Implement WsiAnnotations in C++ #252
Conversation
- Bump version to 0.7 - Rebuild setup toolchain to pyproject.toml - Remove CLI utilities and tests - Rename dlup.types to dlup._types - Reduce cyclic imports - Remove color transform from internal_handler='pil' (working towards v1.0) - Bugfixes
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #252 +/- ##
===========================================
- Coverage 98.63% 85.73% -12.90%
===========================================
Files 14 45 +31
Lines 1169 4985 +3816
Branches 0 1074 +1074
===========================================
+ Hits 1153 4274 +3121
- Misses 16 490 +474
- Partials 0 221 +221 ☔ View full report in Codecov by Sentry. |
…m:NKI-AI/dlup into feature/geometry
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.
LGTM. All geometry tests pass and the logic is clear.
This reverts commit a497eab.
- Add DLUP XML output - Rewrite setup to use meson-py --------- Co-authored-by: Bart de Rooij <[email protected]> Co-authored-by: Jonas Teuwen <[email protected]> Co-authored-by: JorenB <[email protected]>
The
WsiAnnotations
have been rewritten using boost.Polygon, replacing shapely. The current implementation with shapely has a few issues:The proposal is to keep
WsiAnnotations
around until v1.0.0, add deprecation warnings to the current calls that are not 1-1 compatible with the newSlideAnnotations
(available indlup.annotations_experimental
). In particular these features are implementeddlup.geometry.Polygon
: should be mostly compatible withshapely.geometry.Polygon
for our use casedlup.geometry.Point
: a point class, same as abovedlup.geometry.Box
: shapely doesn't support boxes but we do.The function
SlideAnnotations.read_region()
returns anAnnotationRegion
object rather than list of objects. You can access the polygons usingAnnotationRegion.polygons
, points usingAnnotationRegion.points
and boxes usingAnnotationRegion.boxes
. The first two behave as expected, but the boxes are not cropped to the read_region, so it is possible the (x, y) coordinate is negative (slightly outside of the read_region). In addition there is a callto_mask()
that generates the mask. The evaluation is lazy, so a call toread_region
does not execute the pipeline until you access the polygons, points, boxes or mask in the object.The
SlideAnnotations
has a few new calls:set_offset
: offsets all the annotations, useful in e.g. Halo annotationsscale
: scales all the annotations in place, useful if you have annotations at lower res and want to rescale to level 0as_dlup_xml
andfrom_dlup_xml
: this is our own defined schema which is able to serialiseSlideAnnotations
completely.reindex_polygons
: this sets an index for theto_mask()
in the polygons.relabel_polygons
: as expectedLazy evaluation
The library supports lazy evaluation, most operations are only performed when requesting masks or polygons.
WARNING: The operations might not all be thread-safe due to their in-place modification behaviour.
Something that might be nice to have
Please add more possible features.