[vtkusers] Error "The interactor must be set prior to enabling the widget" using vtkResliceImageViewer

Liu_tj tjlp at netease.com
Sun Mar 20 10:52:18 EDT 2016


Hi, VTK guys,


I am using Activiz VTK 7.0 for my C# application. I try to use vtkResliceImageViewer to display DICOM axial, coronal or saggital view. The vtkRenderWindow is defined in a WPF user control. When I run my application, I get this error reported:


ERROR: In ..\..\..\VTK-7.0\Interaction\Widgets\vtkAbstractWidget.cxx, line 118
vtkResliceCursorWidget (0000000025A638B0): The interactor must be set prior to enabling the widget


ERROR: In ..\..\..\VTK-7.0\Interaction\Widgets\vtkAbstractWidget.cxx, line 118
vtkResliceCursorWidget (0000000025A638B0): The interactor must be set prior to enabling the widget


Below is my code. Do I miss any step?


        private void Display2(vtkRenderWindow aRenderWindow, vtkImageData aData)
        {
            if (aData == null)
                return;


            m_imageViewer = vtkResliceImageViewer.New();
            m_imageViewer.SetInputData(aData);
            m_imageViewer.SliceScrollOnMouseWheelOn();
            m_imageViewer.SetResliceModeToOblique();
            switch (m_sliceDirection)
            {
                case Direction.AXIAL:
                    m_imageViewer.SetSliceOrientationToXY();
                    break;
                case Direction.CORONAL:
                    m_imageViewer.SetSliceOrientationToYZ();
                    break;
                case Direction.SAGITTAL:
                    m_imageViewer.SetSliceOrientationToXZ();
                    break;
                default:
                    break;
            }


            m_imageViewer.GetSliceRange(ref m_minSliceNumber, ref m_maxSliceNumber);
            vtkRenderWindowInteractor interactor = aRenderWindow.GetInteractor();


            m_renderer = aRenderWindow.GetRenderers().GetFirstRenderer();
            m_renderer.SetBackground(0.0, 0.0, 0.0);


            m_imageViewer.SetRenderWindow(aRenderWindow);


            //m_imageViewer.SetupInteractor(interactor);
            aRenderWindow.GetRenderers().InitTraversal();
            m_currentSlice = m_minSliceNumber + (m_maxSliceNumber - m_minSliceNumber) / 2;
            m_imageViewer.SetSlice(m_currentSlice);


            m_scalarrange = new double[2];
            m_scalarrange = m_imageViewer.GetInput().GetScalarRange();


            if (!m_initialized)
            {
                m_threshold = new Segament_Threshold();
                m_threshold.Min_Threshold = 0;
                m_threshold.Max_Threshold = m_scalarrange[1];
            }


            m_initialized = true;
        }


Thanks
Liu Peng
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160320/a8d1464b/attachment.html>


More information about the vtkusers mailing list