feat: added promise lifecycle to Viewport and hook for HangingProtocol #3352
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.
Context
It is useful to know when the data containers related to a hanging protocol change are loaded. This PR triggers a new HangingProtocolHook:
onLayoutViewportDataContainersLoaded
. This only fires once all viewportDataContainers related to running a hanging protocol are complete. The reason it is only a "DataContainer" load is because data is loaded progressively in OHIF. So while the metadata container exists (i.e. empty volume or empty stack)--the actual pixel data may not have been progressively loaded in yet. Future work may consider adding aonLayoutViewportDataLoaded
when all data related to a hanging protocol is fully downloaded.Changes & Results
CornerstoneViewportService previously had many async functions which returned void. Instead, they now return the actual promise these async functions intend to fire. This allows downstream functions to optionally call the .then() or ignore which should keep behaviour exactly the same.
Testing
This feature can be tested by simply using the
onLayoutViewportDataContainersLoaded
hook on hangingProtocol.Checklist
PR
semantic-release format and guidelines.
Code
etc.)
Public Documentation Updates
additions or removals.
Tested Environment