Skip to content
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

Add additional behaviors to image overlays #761

Merged
merged 4 commits into from
Jan 24, 2022

Conversation

naglepuff
Copy link
Collaborator

This PR rounds out some functionality for image overlays that make them more reactive in applications like HistomicsUI.

Specifically, this PR introduces the following changes:

  • Image overlay layers now properly respond to the globalAnnotationOpacity of the image viewer. As a result, image overlays now change opacity based on the slider in HistomicsUI.
  • Image overlays now respect the currently highlighted annotation. Image overlay elements of non-highlighted annotations will reduce their opacity by 75% like other element types. This can be demonstrated in HUI by selecting "Interactive" in the annotations widget and hovering over different annotations in the list.
  • Schema for image overlays now allows for additional properties. This fixes an issue where editing an annotation (e.g. via HUI) would cause an error when trying to save, since the id property would be added to the overlay elements.
  • drawAnnotation has been updated to account for the case where an image overlay element was removed from the annotation between an initial call to drawAnnotation and a follow up call to drawAnnotation.

When rendering image overlay element annotations, use the global
opacity to help set the initial opactity. Also make image overlay
layers respond to changes in the global opacity.
This supports deleting individual elements from an annotation containing
overlay elements (e.g. from the HistomicsUI edit annotation widget.
If re-drawing an annotation with image overlay elements, compare the updated
results of `annotation.overlays()` to the overlays stored in `this._annotations`.
This captures changes to the `annotation._elements` collection between the
initial render of the annotation and the redraw.
@naglepuff naglepuff requested a review from manthey January 21, 2022 21:08
@@ -508,7 +508,7 @@ class AnnotationSchema:
'group': groupSchema,
},
'required': ['girderId', 'type'],
'additionalProperties': False,
'additionalProperties': True,
Copy link
Member

Choose a reason for hiding this comment

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

Probably the correct thing to do is to make the overlay annotation inherit from the baseShapeSchema, except that we don't want to get the line and lineWidth properties. We can do this in a separate PR -- baseShapeSchema would inherit from baseElementSchema which would exclude those properties and then the overlay annotation would inherit from that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Created #762

Copy link
Member

@manthey manthey left a comment

Choose a reason for hiding this comment

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

This looks right to me. We should make a new issue or PR to adjust the schema in a more intelligent manner.

@naglepuff naglepuff merged commit d71c256 into master Jan 24, 2022
@naglepuff naglepuff deleted the image-overlay-highlighting branch January 24, 2022 18:01
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.

2 participants