Hi everyone,<br><br>I have a problem with vtkImageViewer2 when trying to use it with a QVTKWidget. The puzzling thing is that the same code when used with vtkImageViewer works fine.<br><br>I was wondering if someone has any ideas as to what I am doing wrong:
<br><br>Here is the code:<br><br>QApplication app(argc, argv);&nbsp;&nbsp;&nbsp; <br>&nbsp;MainWindow mainWin;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; <br>&nbsp;QTVTKWidget widget;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; #if QT_VERSION &lt; 0x040000<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; app.setMainWidget(&amp;mainWin);
<br>&nbsp;&nbsp;&nbsp; #endif<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // DICOM image reader<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; vtkDICOMImageReader *reader = vtkDICOMImageReader::New();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; reader-&gt;SetDirectoryName(&quot;/home/luca/data/dicom/11088&quot;);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; reader-&gt;Update();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; vtkImageViewer2 * view2 = vtkImageViewer2::New();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; view2-&gt;SetInput(reader-&gt;GetOutput());<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; double * range = reader-&gt;GetOutput()-&gt;GetScalarRange();
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; view2-&gt;SetColorLevel (0.5 * (range[1] + range[0]));<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; view2-&gt;SetColorWindow (range[1] - range[0]);<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // We will have out custom interactor later<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; view2-&gt;SetupInteractor(
widget.GetRenderWindow()-&gt;GetInteractor());<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; widget.SetRenderWindow(view2-&gt;GetRenderWindow());<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; QVBoxLayout * mainLayout = new QVBoxLayout;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; mainLayout-&gt;addWidget(&amp;widget);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; mainWin.addLayout(mainLayout);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; mainWin.Pack();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; mainWin.show();&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;  <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // Run our application loop.<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; app.exec();<br><br><br>Now, this only shows a blank black canvas with no image...and if I replace the ctkImageViewer2 with vtkImageViewer object, it works fine...
<br><br><br>I am not sure what I am doing wrong... any help would be appreciated...<br><br>Cheers,<br>Luca<br>