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

perf(segmentation): make segmentation read 3x faster #3577

Merged
merged 7 commits into from
Aug 8, 2023

Conversation

sedghi
Copy link
Member

@sedghi sedghi commented Aug 2, 2023

fixes #3420 and #3523

Context

Move the SEG read into cornerstone3D adapters which was recently merged which has metadata call optimizations for performance

The goal was working with the old implementation of SEG read so that #3420 is fixed. As a result of switching back I also profile the read and saw repetitive metadata call in the PerFrameSequence for loop so precaching two repetitive calls. One here
and another here made the read faster

Changes & Results

remove lots of SEG read code

Testing

everything should behave the same but faster than before

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:

@netlify
Copy link

netlify bot commented Aug 2, 2023

Deploy Preview for ohif-dev ready!

Name Link
🔨 Latest commit e0382aa
🔍 Latest deploy log https://app.netlify.com/sites/ohif-dev/deploys/64d286b8af4292000970dc1c
😎 Deploy Preview https://deploy-preview-3577--ohif-dev.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@netlify
Copy link

netlify bot commented Aug 2, 2023

Deploy Preview for ohif-platform-docs ready!

Name Link
🔨 Latest commit e0382aa
🔍 Latest deploy log https://app.netlify.com/sites/ohif-platform-docs/deploys/64d286b8fd10a90008ce9702
😎 Deploy Preview https://deploy-preview-3577--ohif-platform-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@sedghi sedghi changed the title feat/segmentation mode initial perf(segmentation): make segmentation read 3x faster Aug 2, 2023
@sedghi sedghi requested a review from wayfarer3130 August 2, 2023 19:26
@codecov
Copy link

codecov bot commented Aug 2, 2023

Codecov Report

Merging #3577 (e0382aa) into master (0493a0d) will decrease coverage by 0.06%.
Report is 2 commits behind head on master.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3577      +/-   ##
==========================================
- Coverage   42.87%   42.81%   -0.06%     
==========================================
  Files          80       80              
  Lines        1446     1448       +2     
  Branches      339      340       +1     
==========================================
  Hits          620      620              
- Misses        662      663       +1     
- Partials      164      165       +1     
Files Changed Coverage Δ
platform/core/src/classes/MetadataProvider.js 4.02% <0.00%> (-0.06%) ⬇️

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 ec76ea2...e0382aa. Read the comment docs.

@cypress
Copy link

cypress bot commented Aug 2, 2023

Passing run #3421 ↗︎

0 36 0 0 Flakiness 0

Details:

Merge branch 'master' of github.com:OHIF/Viewers into feat/segmentation-mode-ini...
Project: Viewers Commit: e0382aadcf
Status: Passed Duration: 03:03 💡
Started: Aug 8, 2023 6:24 PM Ended: Aug 8, 2023 6:27 PM

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

@fedorov
Copy link
Member

fedorov commented Aug 2, 2023

remove lots of SEG read code

@sedghi can you maybe give a sentence summary of what was done to make performance 3x faster?

To be clear, was it the goal to make it 3x faster, or it just became 3x faster as a result of optimizations of the implementation? Are there any known implementation issues that can be resolved with some effort to make it even more faster?

@sedghi
Copy link
Member Author

sedghi commented Aug 2, 2023

@fedorov updated

@sedghi sedghi requested a review from jbocce August 8, 2023 12:22

let firstPosition = perFrame[0].PlanePositionSequence.ImagePositionPatient.map(
Number
const results = await adaptersSEG.Cornerstone3D.Segmentation.generateToolState(
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 and easier to understand.

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.

Couple of smallish changes. Definitely easier to read already.

@jbocce
Copy link
Collaborator

jbocce commented Aug 8, 2023

Looks good. Looks like there are conflicts to resolve prior to merge.

I confirmed that #3420 is fixed and that segmentation read is now faster.

@sedghi sedghi requested a review from wayfarer3130 August 8, 2023 18:15
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

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] v3: Segmentation flipped
4 participants