<div dir="ltr">Hello,<div><br></div><div>I am essentially trying to build on the FourPaneViewer example which you can find from here:</div><div><a href="https://github.com/Kitware/VTK/tree/master/Examples/GUI/Qt/FourPaneViewer">https://github.com/Kitware/VTK/tree/master/Examples/GUI/Qt/FourPaneViewer</a></div>
<div><br></div><div>The major changes compared to the original code is the inclusion in <span style="font-family:arial,sans-serif">QtVTKRenderWindows.cxx</span> of the subclass <span style="font-size:13px;font-family:arial,sans-serif">KeyPressInteractorStyle and the 3 lines of code where I apply the new style to view1. Both of these changes were included in my first post.</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">Below I have including the code I am using which consists of 3 files: </span><font face="arial, sans-serif">QtVTKRenderWindows.cxx, QtVTKRenderWindows.h and QtVTKRenderWindowsApp.cxx</font></div>
<div><font face="arial, sans-serif"><br></font></div><div>You can download the .ui file from the above link. <font face="arial, sans-serif"><br></font></div><div><br></div><div><font face="arial, sans-serif">Note: you may want to change the path to the Dicom files at </font><span style="font-family:arial,sans-serif">reader-&gt;SetDirectoryName(...)</span></div>
<div><span style="font-family:arial,sans-serif"><br></span></div><div><span style="font-family:arial,sans-serif">Thanks for your help.</span></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">==================</font></div>
<div><span style="font-family:arial,sans-serif">QtVTKRenderWindows.h</span><font face="arial, sans-serif"><br></font></div><div><span style="font-family:arial,sans-serif">==================</span></div><div><span style="font-family:arial,sans-serif"><br>
</span></div><div><div><font face="arial, sans-serif">#ifndef QtVTKRenderWindows_H</font></div><div><font face="arial, sans-serif">#define QtVTKRenderWindows_H</font></div><div><font face="arial, sans-serif"><br></font></div>
<div><font face="arial, sans-serif">#include &quot;vtkSmartPointer.h&quot;</font></div><div><font face="arial, sans-serif">#include &quot;vtkResliceImageViewer.h&quot;</font></div><div><font face="arial, sans-serif">#include &quot;vtkImagePlaneWidget.h&quot;</font></div>
<div><font face="arial, sans-serif">#include &quot;vtkDistanceWidget.h&quot;</font></div><div><font face="arial, sans-serif">#include &quot;vtkResliceImageViewerMeasurements.h&quot;</font></div><div><font face="arial, sans-serif">#include &lt;QMainWindow&gt;</font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">// Forward Qt class declarations</font></div><div><font face="arial, sans-serif">class Ui_QtVTKRenderWindows;</font></div><div><font face="arial, sans-serif"><br>
</font></div><div><font face="arial, sans-serif">class QtVTKRenderWindows : public QMainWindow</font></div><div><font face="arial, sans-serif">{</font></div><div><font face="arial, sans-serif">  Q_OBJECT</font></div><div>
<font face="arial, sans-serif">public:</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">  // Constructor/Destructor</font></div><div><font face="arial, sans-serif">  QtVTKRenderWindows(int argc, char *argv[]);</font></div>
<div><font face="arial, sans-serif">  ~QtVTKRenderWindows() {};</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">public slots:</font></div><div><font face="arial, sans-serif">  virtual void resliceMode(int);</font></div>
<div><font face="arial, sans-serif">  virtual void Render();</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">protected:</font></div><div><font face="arial, sans-serif">  vtkSmartPointer&lt; vtkResliceImageViewer &gt; riw[3];</font></div>
<div><font face="arial, sans-serif">  vtkSmartPointer&lt; vtkImagePlaneWidget &gt; planeWidget[3];</font></div><div><font face="arial, sans-serif">  vtkSmartPointer&lt; vtkDistanceWidget &gt; DistanceWidget[3];</font></div>
<div><font face="arial, sans-serif">  vtkSmartPointer&lt; vtkResliceImageViewerMeasurements &gt; ResliceMeasurements;</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">private:</font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">  // Designer form</font></div><div><font face="arial, sans-serif">  Ui_QtVTKRenderWindows *ui;</font></div><div><font face="arial, sans-serif">};</font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">#endif // QtVTKRenderWindows_H</font></div><div style="font-family:arial,sans-serif"><br></div></div><div style="font-family:arial,sans-serif">
====================</div><div style="font-family:arial,sans-serif">QtVTKRenderWindows.cxx<br></div><div style="font-family:arial,sans-serif">====================</div><div><span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div><div><div><font face="arial, sans-serif">#include &quot;ui_QtVTKRenderWindows.h&quot;</font></div><div><font face="arial, sans-serif">#include &quot;QtVTKRenderWindows.h&quot;</font></div><div><font face="arial, sans-serif"><br>
</font></div><div><font face="arial, sans-serif">#include &lt;vtkRenderer.h&gt;</font></div><div><font face="arial, sans-serif">#include &lt;vtkRenderWindow.h&gt;</font></div><div><font face="arial, sans-serif">#include &quot;vtkResliceImageViewer.h&quot;</font></div>
<div><font face="arial, sans-serif">#include &quot;vtkResliceCursorLineRepresentation.h&quot;</font></div><div><font face="arial, sans-serif">#include &quot;vtkResliceCursorThickLineRepresentation.h&quot;</font></div><div>
<font face="arial, sans-serif">#include &quot;vtkResliceCursorWidget.h&quot;</font></div><div><font face="arial, sans-serif">#include &quot;vtkResliceCursorActor.h&quot;</font></div><div><font face="arial, sans-serif">#include &quot;vtkResliceCursorPolyDataAlgorithm.h&quot;</font></div>
<div><font face="arial, sans-serif">#include &quot;vtkResliceCursor.h&quot;</font></div><div><font face="arial, sans-serif">#include &quot;vtkDICOMImageReader.h&quot;</font></div><div><font face="arial, sans-serif">#include &quot;vtkCellPicker.h&quot;</font></div>
<div><font face="arial, sans-serif">#include &quot;vtkProperty.h&quot;</font></div><div><font face="arial, sans-serif">#include &quot;vtkPlane.h&quot;</font></div><div><font face="arial, sans-serif">#include &quot;vtkImageData.h&quot;</font></div>
<div><font face="arial, sans-serif">#include &quot;vtkCommand.h&quot;</font></div><div><font face="arial, sans-serif">#include &quot;vtkPlaneSource.h&quot;</font></div><div><font face="arial, sans-serif">#include &quot;vtkLookupTable.h&quot;</font></div>
<div><font face="arial, sans-serif">#include &quot;vtkImageMapToWindowLevelColors.h&quot;</font></div><div><font face="arial, sans-serif">#include &quot;vtkInteractorStyleImage.h&quot;</font></div><div><font face="arial, sans-serif">#include &quot;vtkImageSlabReslice.h&quot;</font></div>
<div><font face="arial, sans-serif">#include &quot;vtkBoundedPlanePointPlacer.h&quot;</font></div><div><font face="arial, sans-serif">#include &quot;vtkDistanceWidget.h&quot;</font></div><div><font face="arial, sans-serif">#include &quot;vtkDistanceRepresentation.h&quot;</font></div>
<div><font face="arial, sans-serif">#include &quot;vtkHandleRepresentation.h&quot;</font></div><div><font face="arial, sans-serif">#include &quot;vtkResliceImageViewerMeasurements.h&quot;</font></div><div><font face="arial, sans-serif">#include &quot;vtkDistanceRepresentation2D.h&quot;</font></div>
<div><font face="arial, sans-serif">#include &quot;vtkPointHandleRepresentation3D.h&quot;</font></div><div><font face="arial, sans-serif">#include &quot;vtkPointHandleRepresentation2D.h&quot;</font></div><div><font face="arial, sans-serif">#include &lt;qdebug.h&gt;</font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">#include &lt;vtkPolyDataMapper.h&gt;</font></div><div><font face="arial, sans-serif">#include &lt;vtkObjectFactory.h&gt;</font></div>
<div><font face="arial, sans-serif">#include &lt;vtkActor.h&gt;</font></div><div><font face="arial, sans-serif">#include &lt;vtkSmartPointer.h&gt;</font></div><div><font face="arial, sans-serif">#include &lt;vtkRenderWindow.h&gt;</font></div>
<div><font face="arial, sans-serif">#include &lt;vtkRenderer.h&gt;</font></div><div><font face="arial, sans-serif">#include &lt;vtkRenderWindowInteractor.h&gt;</font></div><div><font face="arial, sans-serif">#include &lt;vtkPolyData.h&gt;</font></div>
<div><font face="arial, sans-serif">#include &lt;vtkSphereSource.h&gt;</font></div><div><font face="arial, sans-serif">#include &lt;vtkInteractorStyleTrackballCamera.h&gt;</font></div><div><font face="arial, sans-serif">#include &quot;QVTKWidget.h&quot;</font></div>
<div><font face="arial, sans-serif">#include &lt;QKeyEvent&gt;</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">// Define interaction style</font></div><div><font face="arial, sans-serif">class KeyPressInteractorStyle : public vtkInteractorStyle</font></div>
<div><font face="arial, sans-serif">{</font></div><div><font face="arial, sans-serif">public:</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>static KeyPressInteractorStyle* New();</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>vtkTypeMacro(KeyPressInteractorStyle, vtkInteractorStyle);</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>virtual void OnKeyPress() </font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>{</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>// Get the keypress</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>vtkRenderWindowInteractor *rwi = this-&gt;Interactor;</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>std::string key = rwi-&gt;GetKeySym();</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>// Output the key that was pressed</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>std::cout &lt;&lt; &quot;Pressed &quot; &lt;&lt; key &lt;&lt; std::endl;</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>qDebug()&lt;&lt; &quot;Pressed &quot; &lt;&lt; rwi-&gt;GetKeySym();</font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>// Forward events</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>vtkInteractorStyle::OnKeyPress();</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>}</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>virtual void OnChar()</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>{</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>qDebug()&lt;&lt;&quot;keeeey&quot;;</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>}</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">};</font></div><div><font face="arial, sans-serif">vtkStandardNewMacro(KeyPressInteractorStyle);</font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">//----------------------------------------------------------------------------</font></div>
<div><font face="arial, sans-serif">class vtkResliceCursorCallback : public vtkCommand</font></div><div><font face="arial, sans-serif">{</font></div><div><font face="arial, sans-serif">public:</font></div><div><font face="arial, sans-serif"><br>
</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>static vtkResliceCursorCallback *New()</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>{ </font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>return new vtkResliceCursorCallback; }</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>void Execute( vtkObject *caller, unsigned long ev,</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>void *callData )</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>{</font></div><div><font face="arial, sans-serif"><br>
</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>if (ev == vtkCommand::KeyPressEvent)</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>{</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>QKeyEvent* keyPressed = static_cast&lt;QKeyEvent*&gt;(callData);</font></div><div><span class="" style="white-space:pre"><font face="arial, sans-serif">                        </font></span></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>qDebug()&lt;&lt;&quot;key pressed: &quot;&lt;&lt;keyPressed-&gt;text();</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>}</font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>if (ev == vtkResliceCursorWidget::WindowLevelEvent ||</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>ev == vtkCommand::WindowLevelEvent ||</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>ev == vtkResliceCursorWidget::ResliceThicknessChangedEvent||</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>ev == vtkResliceCursorWidget::ResliceAxesChangedEvent||</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>ev == vtkResliceCursorWidget::ResetCursorEvent)</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>{</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>//do nothing</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>}</font></div><div><font face="arial, sans-serif"><br>
</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>vtkImagePlaneWidget* ipw =</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>dynamic_cast&lt; vtkImagePlaneWidget* &gt;( caller );</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>if (ipw)</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>{</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>double* wl = static_cast&lt;double*&gt;( callData );</font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>if ( ipw == this-&gt;IPW[0] )</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>{</font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                                </span>this-&gt;IPW[1]-&gt;SetWindowLevel(wl[0],wl[1],1);</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                                </span>this-&gt;IPW[2]-&gt;SetWindowLevel(wl[0],wl[1],1);</font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>}</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>else if( ipw == this-&gt;IPW[1] )</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>{</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                                </span>this-&gt;IPW[0]-&gt;SetWindowLevel(wl[0],wl[1],1);</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                                </span>this-&gt;IPW[2]-&gt;SetWindowLevel(wl[0],wl[1],1);</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>}</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>else if (ipw == this-&gt;IPW[2])</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>{</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                                </span>this-&gt;IPW[0]-&gt;SetWindowLevel(wl[0],wl[1],1);</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                                </span>this-&gt;IPW[1]-&gt;SetWindowLevel(wl[0],wl[1],1);</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>}</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>}</font></div><div><font face="arial, sans-serif"><br>
</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>vtkResliceCursorWidget *rcw = dynamic_cast&lt;</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>vtkResliceCursorWidget * &gt;(caller);</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>if (rcw)</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>{</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>vtkResliceCursorLineRepresentation *rep = dynamic_cast&lt;</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                                </span>vtkResliceCursorLineRepresentation * &gt;(rcw-&gt;GetRepresentation());</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>// Although the return value is not used, we keep the get calls</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>// in case they had side-effects</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>rep-&gt;GetResliceCursorActor()-&gt;GetCursorAlgorithm()-&gt;GetResliceCursor();</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>for (int i = 0; i &lt; 3; i++)</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>{</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                                </span>vtkPlaneSource *ps = static_cast&lt; vtkPlaneSource * &gt;(</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                                        </span>this-&gt;IPW[i]-&gt;GetPolyDataAlgorithm());</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                                </span>ps-&gt;SetOrigin(this-&gt;RCW[i]-&gt;GetResliceCursorRepresentation()-&gt;</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                                        </span>GetPlaneSource()-&gt;GetOrigin());</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                                </span>ps-&gt;SetPoint1(this-&gt;RCW[i]-&gt;GetResliceCursorRepresentation()-&gt;</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                                        </span>GetPlaneSource()-&gt;GetPoint1());</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                                </span>ps-&gt;SetPoint2(this-&gt;RCW[i]-&gt;GetResliceCursorRepresentation()-&gt;</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                                        </span>GetPlaneSource()-&gt;GetPoint2());</font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                                </span>// If the reslice plane has modified, update it on the 3D widget</font></div><div>
<font face="arial, sans-serif"><span class="" style="white-space:pre">                                </span>this-&gt;IPW[i]-&gt;UpdatePlacement();</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>}</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>}</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>if(ev == vtkResliceImageViewer::SliceChangedEvent)</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>{</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>for (int i = 0; i &lt; 3; i++)</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>{</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                                </span>vtkPlaneSource *ps = static_cast&lt; vtkPlaneSource * &gt;(</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                                        </span>this-&gt;IPW[i]-&gt;GetPolyDataAlgorithm());</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                                </span>ps-&gt;SetOrigin(this-&gt;RCW[i]-&gt;GetResliceCursorRepresentation()-&gt;</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                                        </span>GetPlaneSource()-&gt;GetOrigin());</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                                </span>ps-&gt;SetPoint1(this-&gt;RCW[i]-&gt;GetResliceCursorRepresentation()-&gt;</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                                        </span>GetPlaneSource()-&gt;GetPoint1());</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                                </span>ps-&gt;SetPoint2(this-&gt;RCW[i]-&gt;GetResliceCursorRepresentation()-&gt;</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                                        </span>GetPlaneSource()-&gt;GetPoint2());</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                                </span>// If the reslice plane has modified, update it on the 3D widget</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                                </span>this-&gt;IPW[i]-&gt;UpdatePlacement();</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>}</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>}</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>// Render everything</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>for (int i = 0; i &lt; 3; i++)</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>{</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>this-&gt;RCW[i]-&gt;Render();</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>}</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>this-&gt;IPW[0]-&gt;GetInteractor()-&gt;GetRenderWindow()-&gt;Render();</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>}</font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>vtkResliceCursorCallback() {}</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>vtkImagePlaneWidget* IPW[3];</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>vtkResliceCursorWidget *RCW[3];</font></div><div><font face="arial, sans-serif">};</font></div><div><font face="arial, sans-serif"><br></font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">QtVTKRenderWindows::QtVTKRenderWindows( int vtkNotUsed(argc), char *argv[])</font></div><div><font face="arial, sans-serif">{</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>this-&gt;ui = new Ui_QtVTKRenderWindows;</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>this-&gt;ui-&gt;setupUi(this);</font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>vtkSmartPointer&lt; vtkDICOMImageReader &gt; reader =</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>vtkSmartPointer&lt; vtkDICOMImageReader &gt;::New();</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>//reader-&gt;SetDirectoryName(argv[1]);</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>reader-&gt;SetDirectoryName(&quot;C:/Users/Panayiotis/DentalCEsse/qt_interface/build/Release/temp_dental/2/dicom&quot;);</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>reader-&gt;Update();</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>int imageDims[3];</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>reader-&gt;GetOutput()-&gt;GetDimensions(imageDims);</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><br>
</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>for (int i = 0; i &lt; 3; i++)</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>{</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>riw[i] = vtkSmartPointer&lt; vtkResliceImageViewer &gt;::New();</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>}</font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>vtkSmartPointer&lt;KeyPressInteractorStyle&gt; style = vtkSmartPointer&lt;KeyPressInteractorStyle&gt;::New();</font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>this-&gt;ui-&gt;view1-&gt;GetInteractor()-&gt;SetInteractorStyle(style);</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>//this-&gt;ui-&gt;view1-&gt;GetRenderWindow()-&gt;GetInteractor()-&gt;SetInteractorStyle(style);</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>//this-&gt;ui-&gt;view1-&gt;GetRenderWindow()-&gt;AddRenderer(riw[0]-&gt;GetRenderer());</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>style-&gt;SetCurrentRenderer(riw[0]-&gt;GetRenderer());</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>this-&gt;ui-&gt;view1-&gt;SetRenderWindow(riw[0]-&gt;GetRenderWindow());</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>riw[0]-&gt;SetupInteractor(</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>this-&gt;ui-&gt;view1-&gt;GetRenderWindow()-&gt;GetInteractor());</font></div>
<div><span class="" style="white-space:pre"><font face="arial, sans-serif">        </font></span></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>this-&gt;ui-&gt;view2-&gt;SetRenderWindow(riw[1]-&gt;GetRenderWindow());</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>riw[1]-&gt;SetupInteractor(</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>this-&gt;ui-&gt;view2-&gt;GetRenderWindow()-&gt;GetInteractor());</font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>this-&gt;ui-&gt;view3-&gt;SetRenderWindow(riw[2]-&gt;GetRenderWindow());</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>riw[2]-&gt;SetupInteractor(</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>this-&gt;ui-&gt;view3-&gt;GetRenderWindow()-&gt;GetInteractor());</font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>for (int i = 0; i &lt; 3; i++)</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>{</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>// make them all share the same reslice cursor object.</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>vtkResliceCursorLineRepresentation *rep =</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>vtkResliceCursorLineRepresentation::SafeDownCast(</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>riw[i]-&gt;GetResliceCursorWidget()-&gt;GetRepresentation());</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>riw[i]-&gt;SetResliceCursor(riw[0]-&gt;GetResliceCursor());</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>rep-&gt;GetResliceCursorActor()-&gt;</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>GetCursorAlgorithm()-&gt;SetReslicePlaneNormal(i);</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>riw[i]-&gt;SetInput(reader-&gt;GetOutput());</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>riw[i]-&gt;SetSliceOrientation(i);</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>riw[i]-&gt;SetResliceModeToAxisAligned();</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>}</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>vtkSmartPointer&lt;vtkCellPicker&gt; picker =</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>vtkSmartPointer&lt;vtkCellPicker&gt;::New();</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>picker-&gt;SetTolerance(0.005);</font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>vtkSmartPointer&lt;vtkProperty&gt; ipwProp =</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>vtkSmartPointer&lt;vtkProperty&gt;::New();</font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>vtkSmartPointer&lt; vtkRenderer &gt; ren =</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>vtkSmartPointer&lt; vtkRenderer &gt;::New();</font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>this-&gt;ui-&gt;view4-&gt;GetRenderWindow()-&gt;AddRenderer(ren);</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>vtkRenderWindowInteractor *iren = this-&gt;ui-&gt;view4-&gt;GetInteractor();</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>//commenting out the following code succesfully applies the </font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>//&#39;style&#39; to view4</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>//iren-&gt;SetInteractorStyle(style);</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>//style-&gt;SetCurrentRenderer(ren);</font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>for (int i = 0; i &lt; 3; i++)</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>{</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>planeWidget[i] = vtkSmartPointer&lt;vtkImagePlaneWidget&gt;::New();</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>planeWidget[i]-&gt;SetInteractor( iren );</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>planeWidget[i]-&gt;SetPicker(picker);</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>planeWidget[i]-&gt;RestrictPlaneToVolumeOn();</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>double color[3] = {0, 0, 0};</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>color[i] = 1;</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>planeWidget[i]-&gt;GetPlaneProperty()-&gt;SetColor(color);</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>color[i] = 0.25;</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>riw[i]-&gt;GetRenderer()-&gt;SetBackground( color );</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>planeWidget[i]-&gt;SetTexturePlaneProperty(ipwProp);</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>planeWidget[i]-&gt;TextureInterpolateOff();</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>planeWidget[i]-&gt;SetResliceInterpolateToCubic();</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>planeWidget[i]-&gt;SetInput(reader-&gt;GetOutput());</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>planeWidget[i]-&gt;SetPlaneOrientation(i);</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>planeWidget[i]-&gt;SetSliceIndex(imageDims[i]/2);</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>planeWidget[i]-&gt;DisplayTextOn();</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>planeWidget[i]-&gt;SetDefaultRenderer(ren);</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>planeWidget[i]-&gt;On();</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>planeWidget[i]-&gt;InteractionOn();</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>planeWidget[i]-&gt;SetTextureVisibility(0);</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>}</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>vtkSmartPointer&lt;vtkResliceCursorCallback&gt; cbk =</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>vtkSmartPointer&lt;vtkResliceCursorCallback&gt;::New();</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>for (int i = 0; i &lt; 3; i++)</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>{</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>cbk-&gt;IPW[i] = planeWidget[i];</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>cbk-&gt;RCW[i] = riw[i]-&gt;GetResliceCursorWidget();</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>riw[i]-&gt;GetResliceCursorWidget()-&gt;AddObserver(</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>vtkResliceCursorWidget::ResliceAxesChangedEvent, cbk );</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>riw[i]-&gt;GetResliceCursorWidget()-&gt;AddObserver(</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>vtkResliceCursorWidget::WindowLevelEvent, cbk );</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>riw[i]-&gt;GetResliceCursorWidget()-&gt;AddObserver(</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>vtkResliceCursorWidget::ResliceThicknessChangedEvent, cbk );</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>riw[i]-&gt;GetResliceCursorWidget()-&gt;AddObserver(</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>vtkResliceCursorWidget::ResetCursorEvent, cbk );</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>riw[i]-&gt;GetInteractorStyle()-&gt;AddObserver(</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                        </span>vtkCommand::WindowLevelEvent, cbk );</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>riw[i]-&gt;AddObserver(vtkResliceImageViewer::SliceChangedEvent,cbk);</font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>// Make them all share the same color map.</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>riw[i]-&gt;SetLookupTable(riw[0]-&gt;GetLookupTable());</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>planeWidget[i]-&gt;GetColorMap()-&gt;SetLookupTable(riw[0]-&gt;GetLookupTable());</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>planeWidget[i]-&gt;SetColorMap(riw[i]-&gt;GetResliceCursorWidget()-&gt;GetResliceCursorRepresentation()-&gt;GetColorMap());</font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>}</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>//riw[0]-&gt;GetRenderWindow()-&gt;GetInteractor()-&gt;AddObserver(vtkCommand::KeyPressEvent,cbk);</font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>resliceMode(1);</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>this-&gt;ui-&gt;resliceModeCheckBox-&gt;setChecked(true);</font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>this-&gt;ui-&gt;view1-&gt;show();</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>this-&gt;ui-&gt;view2-&gt;show();</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>this-&gt;ui-&gt;view3-&gt;show();</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>// Set up action signals and slots</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>this-&gt;ui-&gt;thickModeCheckBox-&gt;setEnabled(0);</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>this-&gt;ui-&gt;resliceModeCheckBox-&gt;setEnabled(0);</font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>this-&gt;ui-&gt;blendModeGroupBox-&gt;setEnabled(0);</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>this-&gt;ui-&gt;resetButton-&gt;setEnabled(0);</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>this-&gt;ui-&gt;AddDistance1Button-&gt;setEnabled(0);</font></div><div><font face="arial, sans-serif">};</font></div><div><font face="arial, sans-serif"><br>
</font></div><div><font face="arial, sans-serif">void QtVTKRenderWindows::resliceMode(int mode)</font></div><div><font face="arial, sans-serif">{</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>for (int i = 0; i &lt; 3; i++)</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>{</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>riw[i]-&gt;SetResliceMode(mode ? 1 : 0);</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>riw[i]-&gt;GetRenderer()-&gt;ResetCamera();</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>riw[i]-&gt;Render();</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>}</font></div><div><font face="arial, sans-serif">}</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">void QtVTKRenderWindows::Render()</font></div>
<div><font face="arial, sans-serif">{</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>for (int i = 0; i &lt; 3; i++)</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>{</font></div>
<div><font face="arial, sans-serif"><span class="" style="white-space:pre">                </span>riw[i]-&gt;Render();</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>}</font></div><div><font face="arial, sans-serif"><span class="" style="white-space:pre">        </span>this-&gt;ui-&gt;view3-&gt;GetRenderWindow()-&gt;Render();</font></div>
<div><font face="arial, sans-serif">}</font></div></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">=======================</font></div><div><font face="arial, sans-serif">QtVTKRenderWindowsApp.cxx<br>
</font></div><div><font face="arial, sans-serif">=======================</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><div>#include &lt;QApplication&gt;</div><div>#include &quot;QtVTKRenderWindows.h&quot;</div>
<div> </div><div>int main( int argc, char** argv )</div><div>{</div><div>  // QT Stuff</div><div>  QApplication app( argc, argv );</div><div> </div><div>  QtVTKRenderWindows myQtVTKRenderWindows(argc, argv);</div><div>  myQtVTKRenderWindows.show();</div>
<div> </div><div>  return app.exec();</div><div>}</div><div><br></div></font></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Sep 10, 2013 at 8:14 PM, Alex Malyushytskyy <span dir="ltr">&lt;<a href="mailto:alexmalvtk@gmail.com" target="_blank">alexmalvtk@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>It might be time to attach compilable code.<span class="HOEnZb"><font color="#888888"><br><br></font></span></div>
<span class="HOEnZb"><font color="#888888">Alex<br></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Sep 9, 2013 at 4:53 PM, Panayiotis Georgiou <span dir="ltr">&lt;<a href="mailto:ps.georgiou@gmail.com" target="_blank">ps.georgiou@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks for your reply Alex.<div><br></div><div>I have tried what you have suggested but it sill doesn&#39;t work. I believe the problem is on how I apply the new style on the three views. As I have noted in my original post, when I apply the customised style on the 4th view it works. The way I did that for the 4th view is:</div>


<div><br></div><div><div><span style="white-space:pre-wrap">        </span>vtkSmartPointer&lt; vtkRenderer &gt; ren =<span style="white-space:pre-wrap">        </span>vtkSmartPointer&lt; vtkRenderer &gt;::New();</div><div><br></div>
<div><span style="white-space:pre-wrap">        </span>this-&gt;ui-&gt;view4-&gt;GetRenderWindow()-&gt;AddRenderer(ren);</div><div><span style="white-space:pre-wrap">        </span>vtkRenderWindowInteractor *iren = this-&gt;ui-&gt;view4-&gt;GetInteractor();</div>


<div><span style="white-space:pre-wrap">        </span>iren-&gt;SetInteractorStyle(style);</div><div><span style="white-space:pre-wrap">        </span>style-&gt;SetCurrentRenderer(ren);</div></div><div><br></div><div>Any other suggestions?</div>


<div><br></div><div>Thanks.</div></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Sep 9, 2013 at 9:25 PM, Alex Malyushytskyy <span dir="ltr">&lt;<a href="mailto:alexmalvtk@gmail.com" target="_blank">alexmalvtk@gmail.com</a>&gt;</span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><table><tbody><tr><td>Override  vtkInteractorStyle::OnChar </td>
          <td>(</td>
          <td>)</td><td><br><br></td></tr></tbody></table>Make it do nothing. <br><br></div>Alex<br><div><div><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>On Mon, Sep 9, 2013 at 9:37 AM, Panayiotis Georgiou <span dir="ltr">&lt;<a href="mailto:ps.georgiou@gmail.com" target="_blank">ps.georgiou@gmail.com</a>&gt;</span> wrote:<br>



</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr">Dear vtk users,<div><br></div><div><div>I am trying to customize the FourPaneViewer example from the provided VTK examples. The full code of the example can be found in VTK_DIR/Examples/GUI/Qt/FourPaneViewer. </div>




<div><br></div><div>The example embeds in Qt 4 QVTKWidget views and performs reslicing. One of the views renders (3) vtkImagePlaneWidgets and each of the other 3 views renders a vtkResliceImageViewer.</div><div><br></div>




<div>What I am trying to achieve is disable in the 3 vtkResliceImageViewers any events triggered by pressing keys on the keyboard, i.e. I want to restrict the user and allow him to interact with these widgets using only the mouse. </div>




<div><br></div><div>The way I have tried to do this is by subclassing the vtkInteractorStyle class as follows:</div><div><br></div><div>    // Define interaction style</div><div>    class KeyPressInteractorStyle : public vtkInteractorStyle</div>




<div>    {</div><div>    public:</div><div>    <span style="white-space:pre-wrap">        </span>static KeyPressInteractorStyle* New();</div><div>    <span style="white-space:pre-wrap">        </span>vtkTypeMacro(KeyPressInteractorStyle, vtkInteractorStyle);</div>




<div>    </div><div>    <span style="white-space:pre-wrap">        </span>virtual void OnKeyPress() </div><div>    <span style="white-space:pre-wrap">        </span>{</div><div>    <span style="white-space:pre-wrap">                </span>// Get the keypress</div>




<div>    <span style="white-space:pre-wrap">                </span>vtkRenderWindowInteractor *rwi = this-&gt;Interactor;</div><div>    <span style="white-space:pre-wrap">                </span>std::string key = rwi-&gt;GetKeySym();</div><div>
    </div><div>    <span style="white-space:pre-wrap">                </span>// Output the key that was pressed</div><div>    <span style="white-space:pre-wrap">                </span>std::cout &lt;&lt; &quot;Pressed &quot; &lt;&lt; key &lt;&lt; std::endl;</div>




<div>    <span style="white-space:pre-wrap">                </span>qDebug()&lt;&lt; &quot;Pressed &quot; &lt;&lt; rwi-&gt;GetKeySym();</div><div>    </div><div>    <span style="white-space:pre-wrap">                </span>// Forward events</div>
<div>    <span style="white-space:pre-wrap">                </span>vtkInteractorStyle::OnKeyPress();</div><div>    <span style="white-space:pre-wrap">        </span>}</div><div>    </div><div>    };</div><div>    vtkStandardNewMacro(KeyPressInteractorStyle);</div>




<div><br></div><div>and then for each of the 3 views, the customised interaction style is applied as follows:</div><div><br></div><div>        vtkSmartPointer&lt;KeyPressInteractorStyle&gt; style = </div><div>    vtkSmartPointer&lt;KeyPressInteractorStyle&gt;::New();</div>




<div>        </div><div>        this-&gt;ui-&gt;view1-&gt;GetRenderWindow()-&gt;GetInteractor()-&gt;SetInteractorStyle(style);</div><div>        style-&gt;SetCurrentRenderer(riw[0]-&gt;GetRenderer());</div><div>        </div>




<div>        this-&gt;ui-&gt;view1-&gt;SetRenderWindow(riw[0]-&gt;GetRenderWindow());</div><div>        riw[0]-&gt;SetupInteractor(this-&gt;ui-&gt;view1-&gt;GetRenderWindow()-&gt;GetInteractor());</div><div><br></div><div>




where view1 is of type QVTKWidget  and riw[i] of type vtkResliceImageViewer.</div><div><br></div><div>Unfortunately the approach I am using has no effect. The keyboard events are not captured at all by the interaction style. Nothing is printed in the console. It should be noted that if I apply the customised style on the 4th view for vtkImagePlaneWidgets, then it works.</div>




<div><br></div><div>Can someone help me to fix this? I am new to VTK and any help will be much appreciated. </div><div><br></div><div>Thanks for your help,</div></div></div>
<br></div></div>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>