question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[RFI] Possible to apply mouse drag effect (pan, b/c) on one canvas onto other canvases ?

See original GitHub issue

Prerequisites

  • Are you running the latest version? => tools@2.3.1 and core@2.1.0
  • Are you reporting to the correct repository? => that is my understanding
  • Did you perform a cursory search? => yes, no luck tho

Description

My use cas is I have multiple canvas, or enabled element, on a page. Thanks to cornerstone-tools I can easily add a feature that lets the users drag its mouse on the canvas to change brightness / contrast values, like so :

                cornerstoneTools.mouseInput.enable(element);
                cornerstoneTools.mouseWheelInput.enable(element);
                cornerstoneTools.wwwc.activate(element, 1); 

As the user is dragging its mouse, the brightness / contrast changes. I would like to apply the same effect (b/c) to the other cornerstone canvas of the page.

So far I’ve tried this :


                element.addEventListener('cornerstoneimagerendered', (e) => {
                    console.log('[CornerstoneService] event cornerstoneimagerendered (where is the bc info?)')
                })

But the brightness / contrast values are nowhere to be found, at least in the e event payload.

I guess a pseudo code of what I would like to achieve is something like this :

  • on b/c change of canvas1 :
    • get the B/C value
    • apply it to the other canvases, and re-render them.

Is such a thing possible ? In the cornerstone philosophy, how should it be achieved ?

Also I have the same question for the pan feature, but 1/ it seems that these values are stored in the viewport of an element and 2/ I’d like the same solution for pan and b/c, so since I have no idea how to do that for b/c, I’m asking this 😺

Thanks

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
swederikcommented, May 21, 2018

Did you check the synchronizers?

https://rawgit.com/cornerstonejs/cornerstoneTools/master/examples/panZoomSynchronizer/index.html

See other examples here:

https://rawgit.com/cornerstonejs/cornerstoneTools/master/examples/index.html

Oh, and I guess you are talking about window width and window center when you say brightness / contrast.

0reactions
swederikcommented, May 29, 2018
const viewport = cornerstone.getViewport(element);
console.log(viewport.voi);

https://docs.cornerstonejs.org/concepts/viewports.html

You can also click View Source here: https://rawgit.com/cornerstonejs/cornerstone/master/example/windowlevel/index.html

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to drag and drop from one HTML5 canvas to another
When the user releases the mouse over the destination canvas, throw away (or hide) your tiny 'dragging' canvas, and re-draw the main canvas...
Read more >
Canvas Drag & Drop Objects Tutorial - YouTube
Canvas Drag & Drop Tutorial for cavas objects, like rects, rectangles and circles. Learn how to implement JavaScript and Canvas Drag and ...
Read more >
Untitled
Escuela escalada arnedillo, Strap orteils, Dynamite plum boilies, One other language spoken in spain, Soy separada en ingles, Dinamalar tirunelveli edition ...
Read more >
Untitled
Lume, Home depot kingshighway phone number, Mission possible rules science olympiad, Poly art animals, Centipede grass dormant, Curry tree osrs, ...
Read more >
Untitled
Sepedah drag bmx, Great bear pub menu, Ameropa kataloge online. #steroids Wikipedia 4000 bc, Carbon management courses sydney, California lottery ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found