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

fix(state synchronization): SEG and RT viewports should keep their before hydration voi #3560

Merged
merged 9 commits into from
Aug 9, 2023

Conversation

sedghi
Copy link
Member

@sedghi sedghi commented Jul 26, 2023

fixes #3410

Context

As described in the issue above, when having SEG or RT viewport, and the user clicks on the load/hydrate, the old
viewport VOI LUT is not preserved and is removed. The reason for this is that this action is an "update"
action, and we only storePresentation state on "set" actions (during disable element).

Changes & Results

  • refactored the storePresentation into a command so that we can call it from both set and update actions.
  • In addition the getPresentationIds should not increment the index at the end of the id if the action is an update (
    if in the same viewportIndex and displaySetInstanceUid we are requesting a new presentation id)

Testing

Checklist

PR

  • My Pull Request title is descriptive, accurate and follows the
    semantic-release format and guidelines.

Code

  • My code has been well-documented (function documentation, inline comments,
    etc.)

Public Documentation Updates

  • The documentation page has been updated as necessary for any public API
    additions or removals.

Tested Environment

  • [] OS:
  • [] Node version:
  • [] Browser:

sedghi added 3 commits July 24, 2023 16:07
feat(presentation update): Consolidate storePresentation state updates

This commit consolidates the storePresentation state updates for the OHIFCornerstoneRTViewport and OHIFCornerstoneSEGViewport components in the cornerston-dicom-rt and cornerstone-dicom-seg extensions, respectively. The storePresentation state is now updated at relevant points during the component lifecycle, ensuring that the state is stored correctly when necessary.

No special consideration has been made for the rest of the changes in the codebase.
@netlify
Copy link

netlify bot commented Jul 26, 2023

Deploy Preview for ohif-platform-docs canceled.

Name Link
🔨 Latest commit 2751b6a
🔍 Latest deploy log https://app.netlify.com/sites/ohif-platform-docs/deploys/64d2a5f8f62b980008136a46

@netlify
Copy link

netlify bot commented Jul 26, 2023

Deploy Preview for ohif-dev canceled.

Name Link
🔨 Latest commit 2751b6a
🔍 Latest deploy log https://app.netlify.com/sites/ohif-dev/deploys/64d2a5f87b936600080bdac9

@sedghi sedghi changed the title fix/temp temp temp fix(state syncronization): SEG and RT viewports should keep their old voi before hydratoin Jul 26, 2023
@sedghi sedghi changed the title fix(state syncronization): SEG and RT viewports should keep their old voi before hydratoin fix(state synchronization): SEG and RT viewports should keep their old voi before hydratoin Jul 26, 2023
@sedghi sedghi changed the title fix(state synchronization): SEG and RT viewports should keep their old voi before hydratoin fix(state synchronization): SEG and RT viewports should keep their old voi before hydration Jul 26, 2023
@codecov
Copy link

codecov bot commented Jul 26, 2023

Codecov Report

Merging #3560 (2751b6a) into master (156c1ba) will not change coverage.
Report is 2 commits behind head on master.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3560   +/-   ##
=======================================
  Coverage   42.81%   42.81%           
=======================================
  Files          80       80           
  Lines        1448     1448           
  Branches      340      340           
=======================================
  Hits          620      620           
  Misses        663      663           
  Partials      165      165           

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4f037ae...2751b6a. Read the comment docs.

@sedghi sedghi changed the title fix(state synchronization): SEG and RT viewports should keep their old voi before hydration fix(state synchronization): SEG and RT viewports should keep their before hydration voi Jul 26, 2023
@sedghi sedghi requested a review from wayfarer3130 July 26, 2023 16:44
@cypress
Copy link

cypress bot commented Jul 26, 2023

Passing run #3427 ↗︎

0 36 0 0 Flakiness 0

Details:

add review comments
Project: Viewers Commit: 2751b6ad31
Status: Passed Duration: 03:06 💡
Started: Aug 8, 2023 8:37 PM Ended: Aug 8, 2023 8:41 PM

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings.

@jbocce
Copy link
Collaborator

jbocce commented Aug 8, 2023

I started testing these changes with regards to the steps outlined in #3410. And the way I read that issue, there are TWO problems. The first problem in outlined in steps 1-4 and the second problem in steps 5-8. The second problem appears to be resolved with these changes. However, the first problem appears to remain. Namely...

  1. Open this study: https://deploy-preview-3560--ohif-dev.netlify.app/viewer?StudyInstanceUIDs=1.3.12.2.1107.5.2.32.35162.30000015050317233592200000046
  2. Note the auto W/L=95/35
  3. Drag the SEG into the viewport
  4. Previous W/L has been undone to become W/L=689/315

Or is this expected?

@@ -120,6 +121,7 @@ Here are a list of some options available:
if auth headers are used, a preflight request is required.
- `maxNumRequests`: The maximum number of requests to allow in parallel. It is an object with keys of `interaction`, `thumbnail`, and `prefetch`. You can specify a specific number for each type.
- `showLoadingIndicator`: (default to true), if set to false, the loading indicator will not be shown when navigating between studies.
- `supportsWildcard`: (default to false), if set to true, the datasource will support wildcard matching for patient name and patient id.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does it make sense to further specify that this is for study level (QIDO) search?

@sedghi
Copy link
Member Author

sedghi commented Aug 8, 2023

started testing these changes with regards to the steps outlined in #3410. And the way I read that issue, there are TWO problems. The first problem in outlined in steps 1-4 and the second problem in steps 5-8. The second problem appears to be resolved with these changes. However, the first problem appears to remain. Namely...

It is not a problem and it is by design. If you change the w/l it will keep it for SEG, if not it will reset it to volume which is intended

@@ -160,6 +168,8 @@ function OHIFCornerstoneSEGViewport(props) {
viewportIndex,
segDisplaySet,
}).then(isHydrated => {
storePresentationState();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we store the presentation after/once the SEG is hydrated? I would think that would be too late with respect to fixing issue #3410, but maybe this is for something else. This comment applies to other similar changes in this PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

I added comment, sorry it was not clear you are right

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry, but I am still a bit confused. The then callback is called AFTER the SEG is hydrated, correct? If so, then the first line of the comment you added seems a bit contradictory. But maybe I am missing something.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for your changes. However, considering the issue seemed fixed even before the most recent changes, I am not sure if the changes actually contribute to the fix. Just wanted to mention this.

@jbocce
Copy link
Collaborator

jbocce commented Aug 8, 2023

started testing these changes with regards to the steps outlined in #3410. And the way I read that issue, there are TWO problems. The first problem in outlined in steps 1-4 and the second problem in steps 5-8. The second problem appears to be resolved with these changes. However, the first problem appears to remain. Namely...

It is not a problem and it is by design. If you change the w/l it will keep it for SEG, if not it will reset it to volume which is intended

Ok. Thanks. I have verified that it keeps the changed w/l for the SEG.

@jbocce
Copy link
Collaborator

jbocce commented Aug 8, 2023

See my comments.

@jbocce
Copy link
Collaborator

jbocce commented Aug 8, 2023

Hmmm. Is this behaviour expected?

ScreenHunter.Aug.08.14.07.mp4

@sedghi
Copy link
Member Author

sedghi commented Aug 8, 2023

Yes it is correct, since you chose the second DS but the SEG is on the third DS.

Copy link
Collaborator

@jbocce jbocce left a comment

Choose a reason for hiding this comment

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

Approved.

@@ -256,7 +230,9 @@ const OHIFCornerstoneViewport = React.memo(props => {
setImageScrollBarHeight();

return () => {
storePresentation();
commandsManager.runCommand('storePresentation', {
viewportIndex,
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use viewportId throughout - we are trying to remove references to viewportIndex generally.

Copy link
Member Author

Choose a reason for hiding this comment

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

that is another big PR that I will care later

@@ -616,6 +617,35 @@ function commandsModule({
);
toolGroup.setToolEnabled(ReferenceLinesTool.toolName);
},
storePresentation: ({ viewportIndex }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is much cleaner to have in the commandsModule to allow re-use.

Copy link
Contributor

@wayfarer3130 wayfarer3130 left a comment

Choose a reason for hiding this comment

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

Generally good with the changes. Might change the viewportId, but will leave that up to you to decide.

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.

[Bug] SEG/RTSTRUCT changes W/L after loading
3 participants