Viewers icon indicating copy to clipboard operation
Viewers copied to clipboard

Accesing current image in series

Open trung1704ptit opened this issue 6 years ago • 5 comments

Hi forks, We are making AI analytic for each image, but when I scroll mouse, I cannot find the way to handle what current image index is. we want to show the result for each image.

the current Image index is depend on currentImageIdIndex. I tried to check in OHIFCornerstoneViewport.js but sopInstanceUid always undefined.

Can you tell us the way to handle it.

trung1704ptit avatar Mar 04 '20 10:03 trung1704ptit

If you are referring to the series number displayed in the lower left, that value is displayed by the HTML element with the class name "bottom-left overlay-element". To access the element:

const bottom_left_overlay = window.document.getElementsByClassName("bottom-left overlay-element")[0];

You could get the first child element and figure out how the innerHTML is assigned or just cheat and read the innerHTML value.

mtm12 avatar Mar 05 '20 13:03 mtm12

Hi @mtm12, I mean when I scroll mouse on the content of viewer (the center of viewer) => the image will change, so we want to trigger this current image index to show the result. Because each image will have a result on platform/viewer

example in viewportSpecificData, we have an array of data, for each data, we want to get the currentImageIdIndex.

Please let us know how can we trigger this from cornerstone to viewer

trung1704ptit avatar Mar 09 '20 02:03 trung1704ptit

Hello trung1704ptit,

The function mouseWheelCallback(evt) is fired when the mouse wheel is scrolled. See the code around line 20549 in the StackScrollMouseWheelTool

Marc

On Sun, Mar 8, 2020 at 10:19 PM trung1704ptit [email protected] wrote:

Hi @mtm12 https://github.com/mtm12, I mean when I scroll mouse on the content of viewer (the center of viewer) => the image will change, so we want to trigger this current image index to show the result. Because each image will have a result on platform/viewer

example my series has 40 images. when we want to trigger the currentImage / 40

Please let us know how can we trigger this from cornerstone to viewer

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/OHIF/Viewers/issues/1480?email_source=notifications&email_token=AGWQ3UVNH6JJJTBCHQQYTSTRGRG4JA5CNFSM4LBB25YKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOFNRSQ#issuecomment-596302026, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGWQ3UWQRPVG42NSOGVSBHTRGRG4JANCNFSM4LBB25YA .

-- Marc McLean

mtm12 avatar Mar 09 '20 12:03 mtm12

cornerstone.js emits a cornerstonenewimage event when a new image is displayed:

https://github.com/cornerstonejs/cornerstone/blob/master/src/events.js#L2

The event includes the new image's cornerstone image id. You can then fetch the "stack" toolstate for the enabledElement that emitted the event. Then use the cornerstone image id from the event, and the list of cornerstoneImageIds in toolState, to determine the currentImageIdIndex (which may already be on the stack toolstate anyway)

dannyrb avatar Mar 09 '20 16:03 dannyrb

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Mar 30 '20 16:03 stale[bot]