Set activeViewport

57 Aufrufe
Direkt zur ersten ungelesenen Nachricht

Benjamin Akrong

ungelesen,
06.01.2022, 10:15:1606.01.22
an cornerstone platform
Hi guys, is there a way one can manually change the active viewport to manipulate its data?

Claire Streb

ungelesen,
09.01.2022, 01:42:1509.01.22
an cornerstone platform
I just replied by mistake. Now this is a reply all that captures what Akron is describing.

So this is what I did (I'm no expert by any stretch of the imagination):
  • Went to Viewer: Script-Tag - CodeSandbox and clicked on a study. Now I see the Layout button Akron referred to.
  • Clicked on it and selected to view as many layouts at once that are possible (9 of them).
  • Opened the browser's Dev Tools, and inspected the various viewports. Each one is shown below, so you could access it that way.
<div class="viewport-element" data-viewport-index="N" ... 
where N is 0, 1, 2, ... 8
  • I also looked at https://github.com/cornerstonejs/cornerstone/blob/master/example/scrollzoompanwl/index.html which shows 

    // updates the image display

    function updateTheImage(imageIndex) {

    return cornerstone.loadAndCacheImage(imageIds[imageIndex]).then(function(image) {

    currentImageIndex = imageIndex;

    const viewport = cornerstone.getViewport(element);

    cornerstone.displayImage(element, image, viewport);

    });

    }


    // image enable the element

    const element = document.getElementById('dicomImage');

    cornerstone.enable(element); ... const imagePromise = updateTheImage(0); 
 
HTH,
Claire

---------- Forwarded message ---------
From: Benjamin Akrong
Date: Sat, Jan 8, 2022 at 2:10 PM
Subject: Re: Private message regarding: Set activeViewport
To: Claire Streb


So there layers button on the ohif viewer allows users to change and have more layouts which means more viewports but the activeViewportIndex remains that of the first viewport. So I wanted to know if I can change the activeViewportIndex so that I can set the active viewport to another instead of just the first one in the layouts

On Sat, 8 Jan 2022, 15:10 Claire Streb, wrote:
Maybe it's me, but I do not understand your question. The title says "set" but your question says "manually change".
Here is an example that sets the active viewport and lets the user change WW/WC, zoom, etc by using the mouse. Is that similar to what you are looking for?
If not, I suggest asking your question in a different way.


On Thursday, January 6, 2022 at 10:15:16 AM UTC-5 akron... wrote:
Hi guys, is there a way one can manually change the active viewport to manipulate its data?
Allen antworten
Antwort an Autor
Weiterleiten
0 neue Nachrichten