In the Reslice Cursor Widget example (vtk.js), I can see a vtkInteractorStyleImage in the code, but no ww / wl change happen if I drag on the slice. I modified the vtkInteractorStyleImage source code to avoid the check on targetIndex at line 228 (vtk-js/index.js at 009f66f34d63258c9aabcf676965c638f2bb0353 · Kitware/vtk-js · GitHub). Since I am pretty new at vtk.js, I wonder if I am missing something or this is really a sort of bug. Thanks to anyone will clear my doubt.
Without having gone through the code, I suppose the ResliceCursorWidget example didn’t invoke
InteractorStyleImage.setImageCurrentNumber(index) which is why it doesn’t change window/level.
Thank you! That’s correct, InteractorStyleImage.setImageCurrentNumber(index) is missing. I guess it does not make much sense though, since this is a reslice, so the notion of “image number” is a kind of not-applicable. Anyway, adding it fixed my problem.
AFAIK the “image number” actually refers to the
ith ImageMapper in the scene. For scenes with one image mapper, setting it to 0 is sufficient. Caveat: this is just from whatever I remember about the InteractorStyleImage, so I only have my memory to back me up here. But anyways, glad it worked for you!