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(viewport-sync): Enable re-sync image slices in a different position when needed #3984

Merged

Conversation

mateusfreira
Copy link
Contributor

Context

Changes & Results

This is a specific change SyncGroupService.ts to clean up the previously registered spatialRegistrationMetadataProvider by cornerstone.js.

When creating the correlation matrix among the viewports cornerstone.js for performance reasons, it caches the matrix using the spatialRegistrationMetadataProvider, but when the tool is disabled, it does not clean it up. This makes it impossible to re-sync the viewports to a different point if the user wants to.

This is a common use case when radiologists are comparing 2 studies (one current and one prior) and by mistake, enable the sync on a non-optimal point and want to disable it, scrool one of the viewports to the correct point and then lock the scroll again.

Here Cornestone calculateViewportsSpatialRegistration and it never gets cleaned up.
noted

Testing

I Have demonstrated this Bug on a video available in youtube also show the fix

Screenshot 2024-03-09 at 11 14 04 AM

(Watch from 2:20:50 to 2:25:52 where I demo the Bug and the fix after my code change)

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:
    macOS apple M1
  • Node version:
  • v18.17.0
  • Browser:
  • Arc Chromium Engine Version 119.0.6045.199
  • Chrome Version 122.0.6261.112 (Official Build) (arm64)

Copy link

netlify bot commented Mar 9, 2024

Deploy Preview for ohif-dev canceled.

Name Link
🔨 Latest commit 273b9d1
🔍 Latest deploy log https://app.netlify.com/sites/ohif-dev/deploys/6626b13166110c00088518d0

Copy link

netlify bot commented Mar 9, 2024

Deploy Preview for ohif-platform-docs canceled.

Name Link
🔨 Latest commit 273b9d1
🔍 Latest deploy log https://app.netlify.com/sites/ohif-platform-docs/deploys/6626b1316d1641000892cc34

Copy link

codecov bot commented Mar 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 44.41%. Comparing base (8a335bd) to head (273b9d1).
Report is 343 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3984      +/-   ##
==========================================
- Coverage   46.23%   44.41%   -1.83%     
==========================================
  Files          78       80       +2     
  Lines        1276     1333      +57     
  Branches      312      327      +15     
==========================================
+ Hits          590      592       +2     
- Misses        548      588      +40     
- Partials      138      153      +15     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -152,6 +154,8 @@ export default class SyncGroupService {
return;
}

this.unRegisterSpatialRegistration(synchronizer);
Copy link
Member

@sedghi sedghi Mar 20, 2024

Choose a reason for hiding this comment

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

can we filter and only do this for image slice sync synchronizer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review, @sedghi; I sure can do it; Must does not seem to exists a way to differentiate the synchronizer other than the name.

Is checking the name of the sincronizer enough for this situation?

Copy link
Member

Choose a reason for hiding this comment

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

sure

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, @sedghi. I have updated the code, and it is working as expected now. Let me know if you think I should improve anything else.

@mateusfreira mateusfreira force-pushed the bug/unable-to-re-sync-image-slice-sync-tool branch 2 times, most recently from 4681557 to 592d7a6 Compare April 21, 2024 19:00
@mateusfreira mateusfreira force-pushed the bug/unable-to-re-sync-image-slice-sync-tool branch from 592d7a6 to 919602b Compare April 21, 2024 19:04
@IbrahimCSAE IbrahimCSAE self-requested a review April 21, 2024 20:16
Copy link
Collaborator

@IbrahimCSAE IbrahimCSAE left a comment

Choose a reason for hiding this comment

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

LGTM

@sedghi
Copy link
Member

sedghi commented Apr 22, 2024

I still need to test this, @mateusfreira can you provide reproducible steps to follow that shows the bug?

Copy link
Member

@sedghi sedghi left a comment

Choose a reason for hiding this comment

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

Tested it and worked great, Lovely fix, thanks a lot!

@sedghi sedghi merged commit 6ebd2cc into OHIF:master Apr 22, 2024
6 of 7 checks passed
WillianVarela pushed a commit to cfaz-net/dicomviewer that referenced this pull request Apr 30, 2024
thanh-nguyen-dang pushed a commit to uc-cdis/Viewers that referenced this pull request May 1, 2024
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.

None yet

3 participants