-
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
Bug/fix annotation sorting #203
Conversation
annotation = shapely.geometry.MultiPoint(annotation_list) | ||
json_dict = _geometry_to_geojson(annotation, label=label) | ||
|
||
json_dict["id"] = str(idx) |
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.
there could be a placeholder for id in _geometry_to_geojson. Also is the key "id" in data ever used?
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.
We can do a placeholder, but we cannot set it as it denotes the order of the annotations and this is only available in this function. It’s also required by GeoJSON
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.
Okay as you prefer
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.
Changes in this PR:
- Split_by_label option removed in as_geojson() of WsiAnnotations.
- Consecutive annotations are grouped as long as they are of the same label to reduce the size of the output
- The proper order of annotations is retained in in as_geojson() of WsiAnnotations.
Tests:
A number of annotations for a slide are defined using ASAP format. The test checks whether the annotations are the same after being converted to geojson. The tests covers areas with annotations and an area of the slide where there are no annotations (and area is therefore None).
This PR fixes the way the annotations are sorted in the GeoJSON output. Previously, the output of
WsiAnnotations.as_geojson()
exported them in the order they were inserted without taking into account the sorting order selected while this is actually required to get the proper order of annotations. Also the tests are updated to reflect this.