<div>Hi, VTK guys,<br><br>Now I upgrade from Activiz for VTK 5.8 to 7.0. And I define the
vtkInteractorStyleImage::MouseWheelForwardEvt and MouseWheelBackwardEvt
for slice switch. With VTK 5.8, it works but now it doesn't work for
7.0. With VTK 7.0, these 2 event handlers keep the old behavior which
zooms in or out. It does not call the function I define to switch the
slice number. My code is as follow:<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>private void Display(vtkRenderWindow aRenderWindow, vtkAlgorithmOutput aData)</div><div> {</div><div> if (aData == null)</div><div> return;</div><div> m_imageViewer = vtkImageViewer2.New();</div><div> m_imageViewer.SetInputConnection(aData);</div><div> switch (m_sliceDirection)</div><div> {</div><div> case Direction.AXIAL:</div><div> m_imageViewer.SetSliceOrientationToXY();</div><div> break;</div><div> case Direction.CORONAL:</div><div> m_imageViewer.SetSliceOrientationToYZ();</div><div> break;</div><div> case Direction.SAGITTAL:</div><div> m_imageViewer.SetSliceOrientationToXZ();</div><div> break;</div><div> default:</div><div> break;</div><div> }</div><div><br></div><div> m_imageViewer.GetSliceRange(ref m_minSliceNumber, ref m_maxSliceNumber);</div><div><br></div><div> m_interactorStyle = vtkInteractorStyleImage.New();</div><div> m_moveforward = new vtkObject.vtkObjectEventHandler(interactor_MouseWheelForwardEvt);</div><div> m_movebackward = new vtkObject.vtkObjectEventHandler(interactor_MouseWheelBackwardEvt);</div><div> </div><div> m_interactorStyle.MouseWheelForwardEvt += m_moveforward;</div><div> m_interactorStyle.MouseWheelBackwardEvt += m_movebackward;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>vtkObject.vtkObjectEventHandler(interactor_MouseWheelBackwardEvt);</div><div> </div><div> aRenderWindow.GetRenderers().InitTraversal();</div><div><br></div><div> m_renderer = aRenderWindow.GetRenderers().GetFirstRenderer();</div><div> m_renderer.SetBackground(0.0, 0.0, 0.0);</div><div><br></div><div> m_imageViewer.SetRenderWindow(aRenderWindow);</div><div> vtkRenderWindowInteractor interactor = aRenderWindow.GetInteractor();</div><div> interactor.SetInteractorStyle(m_interactorStyle);</div><div> </div><div> m_imageViewer.SetupInteractor(interactor);</div><div><br></div><div> m_currentSlice = m_minSliceNumber + (m_maxSliceNumber - m_minSliceNumber) / 2;</div><div> m_imageViewer.SetSlice(m_currentSlice);</div><div><br></div><div> m_imageViewer.Render();</div><div> } <br><br>What's wrong with the code?<br><br></div><div>Thanks</div><div>Liu Peng</div><br><br></div><br><br><span title="neteasefooter"><p> </p></span>