You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a stack viewport to display frames of an OCT image. One of the controls I have on the viewer is a range slider which lets the user select the frame to view using viewport.setImageIdIndex(rangeSliderValue). I am also using the StackScrollTool on the viewport. There's some UX reasons why I have both the StackScrollTool as well as a range slider to set the selected frame. Either way if you set the selected frame with the range slider viewport.setImageIdIndex() then use the stack scroll tool (I have the tool binding set to Ctrl + MouseWheel) the selected frame jumps to the initial frame the StackViewport was set to with viewport.setStack(imageIds, initialIndex).
Potential Fix
After some digging I found out that the StackViewport has 2 separate properties:
currentImageIdIndex
targetImageIdIndex
The StackScrollTool references targetImageIdIndex, which is set when calling viewport.setStack() and viewport.scroll(). It appears that the StackScrollTool ends up calling viewport.scroll(). However, when calling viewport.setImageIdIndex() it appears that only currentImageIdIndex is updated. I believe this is the source of the problem. The setImageIdIndex()/_setImageIdIndex() method should also update targetImageIdIndex after successfully setting the new currentImageIdIndex. This way when using viewport.scroll() or StackScrollTool in combination with manual viewport.setImageIdIndex() the referenced image id index will stay in sync with each other.
Steps to Reproduce
Set the StackViewport selected index to something other than the index it was initialized with using viewport.setImageIdIndex()
Use the StackScrollTool to scroll to the next/previous image
The frame will jump to the initial viewport index state
Example
Set default stack index to 0
Call viewport.setImageIdIndex(60) or some other value that is not 0
Scroll using StackScrollTool
The selected viewport image will jump to 0 + delta instead of 60 + delta
The current behavior
The index that the StackScrollTool thinks the viewport is on is not the same as what the viewport is actually on.
The expected behavior
The selected index of the StackViewport should be the same as the index the StackScrollTool references.
OS
Windows 11
Node version
v20.18.0
Browser
Chromium 131.0.6778.205
The text was updated successfully, but these errors were encountered:
Describe the Bug
I have a stack viewport to display frames of an OCT image. One of the controls I have on the viewer is a range slider which lets the user select the frame to view using
viewport.setImageIdIndex(rangeSliderValue)
. I am also using theStackScrollTool
on the viewport. There's some UX reasons why I have both theStackScrollTool
as well as a range slider to set the selected frame. Either way if you set the selected frame with the range sliderviewport.setImageIdIndex()
then use the stack scroll tool (I have the tool binding set toCtrl
+MouseWheel
) the selected frame jumps to the initial frame theStackViewport
was set to withviewport.setStack(imageIds, initialIndex)
.Potential Fix
After some digging I found out that the
StackViewport
has 2 separate properties:currentImageIdIndex
targetImageIdIndex
The
StackScrollTool
referencestargetImageIdIndex
, which is set when callingviewport.setStack()
andviewport.scroll()
. It appears that theStackScrollTool
ends up callingviewport.scroll()
. However, when callingviewport.setImageIdIndex()
it appears that onlycurrentImageIdIndex
is updated. I believe this is the source of the problem. ThesetImageIdIndex()
/_setImageIdIndex()
method should also updatetargetImageIdIndex
after successfully setting the newcurrentImageIdIndex
. This way when usingviewport.scroll()
orStackScrollTool
in combination with manualviewport.setImageIdIndex()
the referenced image id index will stay in sync with each other.Steps to Reproduce
StackViewport
selected index to something other than the index it was initialized with usingviewport.setImageIdIndex()
StackScrollTool
to scroll to the next/previous imageExample
0
viewport.setImageIdIndex(60)
or some other value that is not0
StackScrollTool
0 + delta
instead of60 + delta
The current behavior
The index that the
StackScrollTool
thinks the viewport is on is not the same as what the viewport is actually on.The expected behavior
The selected index of the
StackViewport
should be the same as the index theStackScrollTool
references.OS
Windows 11
Node version
v20.18.0
Browser
Chromium 131.0.6778.205
The text was updated successfully, but these errors were encountered: