[vtkusers] QVTK and vtkStreamingDemandDrivenPipeline (0487BC08) and Win32OpenGLWindow errors
Ashish Singh
mrasingh at gmail.com
Sun Mar 15 16:13:14 EDT 2009
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();
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090315/cdb173b7/attachment.htm>
More information about the vtkusers
mailing list