Skip to content

Get the right displayed area from cornerstone, to allow overlay display.#1432

Merged
igoroctaviano merged 5 commits intocornerstonejs:masterfrom
wayfarer3130:fix/overlay-not-working
Oct 22, 2021
Merged

Get the right displayed area from cornerstone, to allow overlay display.#1432
igoroctaviano merged 5 commits intocornerstonejs:masterfrom
wayfarer3130:fix/overlay-not-working

Conversation

@wayfarer3130
Copy link
Copy Markdown
Contributor

@wayfarer3130 wayfarer3130 commented Sep 29, 2021

This just fixes overlay display - it was previously set to be active by default, but was failing because the displayedArea isn't actually available by default, and the displayed area is actually wrong because it means the overlay setup is done incorrectly/gets cropped by the canvas updates, so just doing it on a complete canvas works better.

@igoroctaviano - can you take a look?

@codecov
Copy link
Copy Markdown

codecov bot commented Sep 29, 2021

Codecov Report

Merging #1432 (6f9887e) into master (e81f1b6) will decrease coverage by 0.00%.
The diff coverage is 5.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1432      +/-   ##
==========================================
- Coverage   19.87%   19.87%   -0.01%     
==========================================
  Files         285      285              
  Lines       10031    10040       +9     
  Branches     2042     2045       +3     
==========================================
+ Hits         1994     1995       +1     
- Misses       6841     6845       +4     
- Partials     1196     1200       +4     
Impacted Files Coverage Δ
src/tools/OverlayTool.js 1.75% <5.00%> (+1.75%) ⬆️

Continue to review full report at Codecov.

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

Copy link
Copy Markdown
Contributor

@igoroctaviano igoroctaviano left a comment

Choose a reason for hiding this comment

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

It works fine, just a few comments.

Screen Shot 2021-10-07 at 16 12 57

const imageHeight =
Math.abs(viewport.displayedArea.brhc.y - viewport.displayedArea.tlhc.y) *
viewportPixelSpacing.row;
if (viewport.overlay === undefined) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think we need to check for overlay inside the overlay tool. If active it should just execute everyhing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It was just a way to turn a single overlay on/off, rather than the entire overlay tool. Figured it would expand to allow specific overlays to be activated/deactivated, eg for GSPS overlays.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Set it up to avoid displaying if the overlayColor is false

Also added a toggle to allow turning the overlay on and off.
…ble scaling, causing the image to be cropped.
… value

The overlay colour was set to a purple value ina  previous change, but wasn't configurable, so this
change makes the colour configurable, to allow for a site customization to make it consistently
visible.
@wayfarer3130 wayfarer3130 force-pushed the fix/overlay-not-working branch 3 times, most recently from 1f308d7 to ff5ecc0 Compare October 22, 2021 15:26
…educe cognitive complexity rule

Reduce cognitive complexity by splitting code
@wayfarer3130 wayfarer3130 force-pushed the fix/overlay-not-working branch from 6e25e42 to 6f9887e Compare October 22, 2021 15:45
@igoroctaviano igoroctaviano merged commit 9d569ba into cornerstonejs:master Oct 22, 2021
@dannyrb
Copy link
Copy Markdown
Member

dannyrb commented Oct 22, 2021

🎉 This PR is included in version 6.0.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants