Thanks Clint. I am resending this message because the previous message didn&#39;t get posted to the list.<br><br>vtkRenderWindow::Render() opens up the image in a
new window and not in QVTKWidget. QVTKWidget::update() from OnLoad()
works fine.<br><br>There is one more issue with the same code. Even
before I select the directory containing CT images, I get a
vtkOutputWindow with many errors as below.<br>
<br><div>

Do you know what may be the cause of these? How do I fix these errors?<br><br>Thanks,<br><font color="#888888">Ashish</font></div><br>------------<br>ERROR: In ..\..\vtk-5.2.1sources\Rendering\vtkImageActor.cxx, line 267<br>

vtkOpenGLImageActor (05E9B1C0): This filter requires unsigned char scalars as input<br><br>ERROR: In ..\..\vtk-5.2.1sources\Filtering\vtkDemandDrivenPipeline.cxx, line 725<br>vtkStreamingDemandDrivenPipeline (05E9C998): Input port 0 of algorithm vtkImageMapToWindowLevelColors(05E9B7F8) has 0 connections but is not optional.<br>

<br>ERROR: In ..\..\vtk-5.2.1sources\Filtering\vtkDemandDrivenPipeline.cxx, line 725<br>vtkStreamingDemandDrivenPipeline (05E9C998): Input port 0 of algorithm vtkImageMapToWindowLevelColors(05E9B7F8) has 0 connections but is not optional.<br>

<br>ERROR: In ..\..\vtk-5.2.1sources\Filtering\vtkDemandDrivenPipeline.cxx, line 725<br>vtkStreamingDemandDrivenPipeline (05E9C998): Input port 0 of algorithm vtkImageMapToWindowLevelColors(05E9B7F8) has 0 connections but is not optional.<br>

<br>ERROR: In ..\..\vtk-5.2.1sources\Filtering\vtkDemandDrivenPipeline.cxx, line 725<br>vtkStreamingDemandDrivenPipeline (05E9C998): Input port 0 of algorithm vtkImageMapToWindowLevelColors(05E9B7F8) has 0 connections but is not optional.<br>

<br>ERROR: In ..\..\vtk-5.2.1sources\Rendering\vtkImageActor.cxx, line 267<br>vtkOpenGLImageActor (05E9B1C0): This filter requires unsigned char scalars as input<br><br>ERROR: In ..\..\vtk-5.2.1sources\Filtering\vtkDemandDrivenPipeline.cxx, line 725<br>

vtkStreamingDemandDrivenPipeline (05E9C998): Input port 0 of algorithm vtkImageMapToWindowLevelColors(05E9B7F8) has 0 connections but is not optional.<br><br>ERROR: In ..\..\vtk-5.2.1sources\Filtering\vtkDemandDrivenPipeline.cxx, line 725<br>

vtkStreamingDemandDrivenPipeline (05E9C998): Input port 0 of algorithm vtkImageMapToWindowLevelColors(05E9B7F8) has 0 connections but is not optional.<br><br>ERROR: In ..\..\vtk-5.2.1sources\Filtering\vtkDemandDrivenPipeline.cxx, line 725<br>

vtkStreamingDemandDrivenPipeline (05E9C998): Input port 0 of algorithm vtkImageMapToWindowLevelColors(05E9B7F8) has 0 connections but is not optional.<br><br>ERROR: In ..\..\vtk-5.2.1sources\Filtering\vtkDemandDrivenPipeline.cxx, line 725<br>

vtkStreamingDemandDrivenPipeline (05E9C998): Input port 0 of algorithm vtkImageMapToWindowLevelColors(05E9B7F8) has 0 connections but is not optional.<br><br>ERROR: In ..\..\vtk-5.2.1sources\Rendering\vtkImageActor.cxx, line 267<br>

vtkOpenGLImageActor (05E9B1C0): This filter requires unsigned char scalars as input<br><br>ERROR: In ..\..\vtk-5.2.1sources\Filtering\vtkDemandDrivenPipeline.cxx, line 725<br>vtkStreamingDemandDrivenPipeline (05E9C998): Input port 0 of algorithm vtkImageMapToWindowLevelColors(05E9B7F8) has 0 connections but is not optional.<br>

------------------<br><br><div class="gmail_quote">On Fri, Mar 13, 2009 at 3:57 PM, Clinton Stimpson <span dir="ltr">&lt;<a href="mailto:clinton@elemtech.com" target="_blank">clinton@elemtech.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
You need to update the view when you change the data.<br>
You can add a call to  vtkRenderWindow::Render() or preferably a call to QVTKWidget::update() in your OnLoad().<br>
<br>
Clint<br>
<br>
Ashish Singh wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div>
Hi,<br>
<br>
I am trying to display each slice from a series of CT scans in a QVTKwidget. The QVTKWidget itself is in a QMainWindow with 2 other widgets to browse and load the data. I want to be able to display the data in QVTKwidget as soon as I hit the load button. I can read the data fine, but it doesn&#39;t display in QVTKwidget until I click or interact with QVTKwidget using mouse. Can anyone please tell me what am I missing here?<br>


<br>
I am working on a Windows system and using VTK version 5.2.1 with Visual Studio 2005 and Qt 4.5<br>
<br>
Thanks,<br>
Ashish<br>
<br>
Here&#39;s my code:<br>
------header file----<br>
#include &lt;QObject&gt;<br>
#include &lt;QPushButton&gt;<br>
#include &lt;QLabel&gt;<br>
#include &lt;QHBoxLayout&gt;<br>
#include &lt;QVBoxLayout&gt;<br>
#include &lt;QMainWindow&gt;<br>
#include &lt;QVTKWidget.h&gt;<br>
#include &lt;QWidget&gt;<br>
#include &lt;QString&gt;<br>
#include &lt;QFileDialog&gt;<br>
#include &lt;QDir&gt;<br>
#include &lt;qapplication.h&gt;<br>
#include &lt;qobject.h&gt;<br>
#include &lt;QtGui&gt;<br>
<br>
#include &lt;vtkDICOMImageReader.h&gt;<br>
#include &lt;vtkImageViewer2.h&gt;<br>
#include &lt;vtkRenderWindow.h&gt;<br>
#include &quot;vtkRenderer.h&quot;<br>
<br>
using namespace std;<br>
<br>
class test : public QObject<br>
{<br>
    Q_OBJECT<br>
<br>
public:<br>
    string dirname;<br>
    vtkDICOMImageReader *reader;<br>
    vtkImageViewer2 *imgview;<br>
<br>
    QMainWindow *mymainwindow;<br>
    QWidget *centralwidget;<br>
    QLabel *mylabel;<br>
    QPushButton *mypbutton;<br>
    QPushButton *myloadbutton;<br>
    QVTKWidget *vtkwidget;<br>
    QHBoxLayout *myhlayout;<br>
    QVBoxLayout *myvlayout;<br>
    test(QObject* parent = 0);<br>
    ~test();<br>
<br>
<br>
    public slots:<br>
        void OnLoad();<br>
        void OnBrowse();<br>
<br>
};<br>
------cpp file------<br>
#include &quot;test.h&quot;<br>
test::test(QObject * parent):QObject(parent)<br>
{<br>
    reader = vtkDICOMImageReader::New();<br>
    imgview = vtkImageViewer2::New();<br>
<br>
    mymainwindow = new QMainWindow();<br>
    centralwidget = new QWidget(mymainwindow);<br>
<br>
    mylabel = new QLabel(centralwidget);<br>
    mypbutton = new QPushButton(centralwidget);<br>
    myloadbutton = new QPushButton(centralwidget);<br>
<br>
    vtkwidget = new QVTKWidget(centralwidget);<br>
    vtkwidget-&gt;GetRenderWindow()-&gt;AddRenderer(imgview-&gt;GetRenderer());<br>
    vtkwidget-&gt;setFixedSize(512,512);<br>
<br>
    myhlayout = new QHBoxLayout();<br>
    myvlayout = new QVBoxLayout();<br>
<br>
    //setup UI<br>
    mylabel-&gt;setText(&quot;Select Dicom Dir&quot;);<br>
    mypbutton-&gt;setText(&quot;Browse&quot;);<br>
    this-&gt;connect(this-&gt;mypbutton,SIGNAL(clicked()),this, SLOT(OnBrowse()));<br>
<br>
    myloadbutton-&gt;setText(&quot;Load&quot;);<br>
    this-&gt;connect(this-&gt;mypbutton,SIGNAL(clicked()),this, SLOT(OnLoad()));<br>
<br>
    myhlayout-&gt;addWidget(mylabel);<br>
    myhlayout-&gt;addWidget(mypbutton);<br>
    myhlayout-&gt;addWidget(myloadbutton);<br>
<br>
    myvlayout-&gt;addLayout(myhlayout);<br>
    myvlayout-&gt;addWidget(vtkwidget);<br>
<br>
    centralwidget-&gt;setLayout(myvlayout);<br>
    mymainwindow-&gt;setCentralWidget(centralwidget);<br>
    mymainwindow-&gt;show();<br>
}<br>
<br>
test::~test()<br>
{<br>
    reader-&gt;Delete();<br>
    imgview-&gt;Delete();<br>
}<br>
<br>
void test::OnLoad()<br>
{<br>
    reader-&gt;SetDirectoryName(&quot;D:\\testimages\\dicomset\\test&quot;);<br>
    reader-&gt;Update();<br>
<br>
    imgview-&gt;SetInput(reader-&gt;GetOutput());<br>
    imgview-&gt;GetRenderer()-&gt;ResetCamera();<br>
<br>
}<br>
<br>
void test::OnBrowse()<br>
{<br>
    QString indirectory = QFileDialog::getExistingDirectory(this-&gt;centralwidget,tr(&quot;Select Input Directory&quot;), QDir::currentPath());<br>
    dirname = indirectory.toStdString();<br>
<br>
}<br>
------main.cpp---------<br>
#include &quot;test.h&quot;<br>
void main(int argc, char *argv[])<br>
{<br>
    QApplication app(argc, argv);<br>
    test *mywin = new test;<br>
    app.exec();<br>
<br>
}<br></div></div>
------------------------------------------------------------------------<br>
<br>
_______________________________________________<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>
<br>
</blockquote></div><br>