await setVolumesForViewports while converting viewport from stack to vol #1454
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
I suspect, that
setVolumesForViewports
is missing await in convertStackToVolumeViewport.tsSimilar step in convertVolumeToStack (i.e. setting stack images) has await,
Moreover, while using this function in my project, I observed, that when promise returned by convertStackToVolumeViewport.ts is resolved - it doesn't always contain volume (and actor) for an asset. (Unfortunatelly I can't share these assets, as this is a private medical information). However, upon waiting for couple of seconds, volume is added to viewport and actor becomes available.
Changes & Results
below is the console.log of
viewport.getActors()
after callingconvertStackToVolumeViewport
Testing
I couldn't reproduce it with assets shiped with cornerstone examples, and can't share mine unfortunatelly.
However, I find this change straightforward and unless there was a seriour reason to do so, I suspect this
await
was just forgotten.However, to verify that nothing got broken at least, this example could be used https://www.cornerstonejs.org/live-examples/stacktovolumewithannotations
Checklist
PR
semantic-release format and guidelines.
Code
My code has been well-documented (function documentation, inline comments,
etc.)
I have run the
yarn build:update-api
to update the API documentation, and havecommitted the changes to this PR. (Read more here https://www.cornerstonejs.org/docs/contribute/update-api)
Public Documentation Updates
additions or removals. (no changes in any public api)
Tested Environment