Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use mousewheel change slice #1

Open
EnriqueBet opened this issue Jun 26, 2017 · 0 comments
Open

use mousewheel change slice #1

EnriqueBet opened this issue Jun 26, 2017 · 0 comments

Comments

@EnriqueBet
Copy link

Hi! I am trying to override the mouse wheel events of the QVTKRenderWindow and use it instead to navigate through my slices. Does anyone have any idea how to do that? I tried defining mouseUp and mouseSown functions to access to vtkImageReslice and vtkInteractorStyleImage and change the slice. But it just don't seem to work, maybe I am doing some rookie mistake. Here are my functitons:

 def MouseUp(obj,ev):
            if ev == "MouseWheelForwardEvent":
                    self.axialR.Update()
                    print("moving up")
                    matrix = self.axialR.GetResliceAxes()
                    slice = self.axialS.GetCurrentImageNumber()
                    slice += 1
                    self.axialS.SetCurrentImageNumber(slice)
                    self.axialR.Update()
                    self.axialW.GetRenderWindow().Render()

 def MouseDown(obj,ev):
            if ev == "MouseWheelForwardEvent":
                    self.axialR.Update()
                    print("moving up")
                    matrix = self.axialR.GetResliceAxes()
                    slice = self.axialS.GetCurrentImageNumber()
                    slice -= 1
                    self.axialS.SetCurrentImageNumber(slice)
                    self.axialR.Update()
                    self.axialW.GetRenderWindow().Render()

self.axialS.AddObserver('MouseWheelForwardEvent',MouseUp)
self.axialS.AddObserver('MouseWheelBackwardEvent',MouseDown)

where,

self.axialR = vtk.vtkImageReslice()
self.axialS = vtk.vtkInteractorImageStyle()

I will appreciate any help. Thanks in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant