[vtkusers] QVTK and vtkStreamingDemandDrivenPipeline (0487BC08) and Win32OpenGLWindow errors

Ashish Singh mrasingh at gmail.com
Mon Mar 16 14:41:25 EDT 2009


Thanks Clint. I was able to fix these errors with these and some more
suggestions from Luis.

Thanks,
Ashish

On Mon, Mar 16, 2009 at 10:42 AM, Clinton Stimpson <clinton at elemtech.com> wrote:
>
> I don't see where you are calling either
> imgview->SetRenderWindow(vtkwidget->GetRenderWindow())
> or
> vtkwidget->SetRenderWindow(imgview->GetRenderWindow())
>
> They need to share the window, otherwise you'll get an extra pop-up window.
> Maybe that'll also fix your pipeline issues where you're doing a render with
> incomplete pipeline connections.
>
> Clint
>
> Ashish Singh wrote:
>>
>> Hi,
>>
>> 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 and a slider to view each slice. I want to be
>> able to display the data in QVTKwidget as soon as I hit the load button and
>> use a slider to display every slice from the series. I am facing two
>> problems with my application.
>>
>> (1) when I run the application I get a bunch of errors that open in a new
>> vtkOutputWindow. How do I eliminate these? The errors that I get are as
>> follows:
>> -----
>> ERROR: In ..\..\vtk-5.2.1\Filtering\vtkDemandDrivenPipeline.cxx, line 725
>> vtkStreamingDemandDrivenPipeline (0487BC08): Input port 0 of algorithm
>> vtkImageMapToWindowLevelColors(0487AA68) has 0 connections but is not
>> optional.
>>
>> ERROR: In ..\..\vtk-5.2.1\Filtering\vtkDemandDrivenPipeline.cxx, line 725
>> vtkStreamingDemandDrivenPipeline (0487BC08): Input port 0 of algorithm
>> vtkImageMapToWindowLevelColors(0487AA68) has 0 connections but is not
>> optional.
>>
>> ERROR: In ..\..\vtk-5.2.1\Filtering\vtkDemandDrivenPipeline.cxx, line 725
>> vtkStreamingDemandDrivenPipeline (0487BC08): Input port 0 of algorithm
>> vtkImageMapToWindowLevelColors(0487AA68) has 0 connections but is not
>> optional.
>>
>> ERROR: In ..\..\vtk-5.2.1\Filtering\vtkDemandDrivenPipeline.cxx, line 725
>> vtkStreamingDemandDrivenPipeline (0487BC08): Input port 0 of algorithm
>> vtkImageMapToWindowLevelColors(0487AA68) has 0 connections but is not
>> optional.
>>
>> ERROR: In ..\..\vtk-5.2.1\Rendering\vtkImageActor.cxx, line 267
>> vtkOpenGLImageActor (0487A430): This filter requires unsigned char scalars
>> as input
>>
>> ERROR: In ..\..\vtk-5.2.1\Filtering\vtkDemandDrivenPipeline.cxx, line 725
>> vtkStreamingDemandDrivenPipeline (0487BC08): Input port 0 of algorithm
>> vtkImageMapToWindowLevelColors(0487AA68) has 0 connections but is not
>> optional.
>>
>> ERROR: In ..\..\vtk-5.2.1\Filtering\vtkDemandDrivenPipeline.cxx, line 725
>> vtkStreamingDemandDrivenPipeline (0487BC08): Input port 0 of algorithm
>> vtkImageMapToWindowLevelColors(0487AA68) has 0 connections but is not
>> optional.
>>
>> ERROR: In ..\..\vtk-5.2.1\Filtering\vtkDemandDrivenPipeline.cxx, line 725
>> vtkStreamingDemandDrivenPipeline (0487BC08): Input port 0 of algorithm
>> vtkImageMapToWindowLevelColors(0487AA68) has 0 connections but is not
>> optional.
>>
>> ERROR: In ..\..\vtk-5.2.1\Filtering\vtkDemandDrivenPipeline.cxx, line 725
>> vtkStreamingDemandDrivenPipeline (0487BC08): Input port 0 of algorithm
>> vtkImageMapToWindowLevelColors(0487AA68) has 0 connections but is not
>> optional
>> ERROR: In ..\..\vtk-5.2.1\Rendering\vtkImageActor.cxx, line 267
>> vtkOpenGLImageActor (0487A430): This filter requires unsigned char scalars
>> as input
>>
>> ---------
>>
>> (2)My application windows also opens up and I can load the data fine. But
>> when I use the slider, it opens up a new Win32OpenGLWindow and displays each
>> slice in this window instead of my QVTKWidget window.
>>
>> Can anyone please guide me on solving these 2 errors? I will really
>> appreciate all assistance with this.
>>
>> Thanks,
>> Ashish
>>
>> Here's my code:
>> ------header file----
>> #include <QObject>
>> #include <QPushButton>
>> #include <QLabel>
>> #include <QHBoxLayout>
>> #include <QVBoxLayout>
>> #include <QMainWindow>
>> #include <QVTKWidget.h>
>> #include <QWidget>
>> #include <QString>
>> #include <QFileDialog>
>> #include <QDir>
>> #include <qapplication.h>
>> #include <qobject.h>
>> #include <QtGui>
>> #include <QSlider>
>>
>> #include <vtkDICOMImageReader.h>
>> #include <vtkImageViewer2.h>
>> #include <vtkRenderWindow.h>
>> #include "vtkRenderer.h"
>>
>> using namespace std;
>>
>> class test : public QObject
>> {
>>    Q_OBJECT
>>
>> public:
>>    string dirname;
>>    vtkDICOMImageReader *reader;
>>    vtkImageViewer2 *imgview;
>>
>>    QMainWindow *mymainwindow;
>>    QWidget *centralwidget;
>>    QLabel *mylabel;
>>    QPushButton *mypbutton;
>>    QPushButton *myloadbutton;
>>    QSlider *slider1;
>>    QVTKWidget *vtkwidget;
>>    QHBoxLayout *myhlayout;
>>    QVBoxLayout *myvlayout;
>>    test(QObject* parent = 0);
>>    ~test();
>>
>>
>>    public slots:
>>        void OnLoad();
>>        void OnBrowse();
>>        void OnSlide(int);
>>
>> };
>> ------cpp file------
>> #include "test.h"
>> test::test(QObject * parent):QObject(parent)
>> {
>>    reader = vtkDICOMImageReader::New();
>>    imgview = vtkImageViewer2::New();
>>
>>    mymainwindow = new QMainWindow();
>>    centralwidget = new QWidget(mymainwindow);
>>
>>    mylabel = new QLabel(centralwidget);
>>    mypbutton = new QPushButton(centralwidget);
>>    myloadbutton = new QPushButton(centralwidget);
>>    slider1 = new QSlider(Qt::Horizontal,centralwidget);
>>
>>    vtkwidget = new QVTKWidget(centralwidget);
>>    vtkwidget->GetRenderWindow()->AddRenderer(imgview->GetRenderer());
>>    vtkwidget->setFixedSize(512,512);
>>
>>    myhlayout = new QHBoxLayout();
>>    myvlayout = new QVBoxLayout();
>>
>>    //setup UI
>>    mylabel->setText("Select Dicom Dir");
>>    mypbutton->setText("Browse");
>>    this->connect(this->mypbutton,SIGNAL(clicked()),this,
>> SLOT(OnBrowse()));
>>
>>    myloadbutton->setText("Load");
>>    this->connect(this->mypbutton,SIGNAL(clicked()),this, SLOT(OnLoad()));
>>
>>
>> this->connect(this->slider1,SIGNAL(valueChanged(int)),this,SLOT(OnSlide(int)));
>>
>>    myhlayout->addWidget(mylabel);
>>    myhlayout->addWidget(mypbutton);
>>    myhlayout->addWidget(myloadbutton);
>>
>>    myvlayout->addLayout(myhlayout);
>>    myvlayout->addWidget(vtkwidget);
>>    myvlayout->addWidget(slider1);
>>
>>    centralwidget->setLayout(myvlayout);
>>    mymainwindow->setCentralWidget(centralwidget);
>>    mymainwindow->show();
>> }
>>
>> test::~test()
>> {
>>    reader->Delete();
>>    imgview->Delete();
>> }
>>
>> void test::OnLoad()
>> {
>>    reader->SetDirectoryName(dirname.c_str());
>>    reader->Update();
>>
>>    imgview->SetInput(reader->GetOutput());
>>    imgview->GetRenderer()->ResetCamera();
>>    vtkwidget->update();
>>
>> }
>>
>> void test::OnSlide(int value)
>> {
>>
>>  this->slider1->setRange(this->imgview->GetSliceMin(),this->imgview->GetSliceMax());
>>    imgview->SetSlice(value);
>>
>> }
>>
>> void test::OnBrowse()
>> {
>>    QString indirectory =
>> QFileDialog::getExistingDirectory(this->centralwidget,tr("Select Input
>> Directory"), QDir::currentPath());
>>    dirname = indirectory.toStdString();
>>
>> }
>> ------main.cpp---------
>> #include "test.h"
>> void main(int argc, char *argv[])
>> {
>>    QApplication app(argc, argv);
>>    test *mywin = new test;
>>    app.exec();
>>
>> }
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>
>



More information about the vtkusers mailing list