[vtkusers] Problem with vtkPNGReader.
张
18434364531 at 163.com
Sun Mar 11 04:18:40 EDT 2018
hello everyone!
I have a question about vtkPNGReader.
I want to show a 2D picture on a qvtkwidget.When I run the project, the vtkOutputWindow shows :
ERROR:In D:VTK-8.0.1\IO\Image\vtkPNGReader.cxx, line 117
vtkPNGReader (000001FB05C3F490): Unable to open file 1.png
Here it is my code:
QtGuiApplication3::QtGuiApplication3(QWidget *parent)
: QMainWindow(parent)
{
ui.setupUi(this);
vtkRenderWindow* renwin = vtkRenderWindow::New();
renwin->StereoCapableWindowOn();
ui.qvtk1->SetRenderWindow(renwin);
ren1 = vtkRenderer::New();
ui.qvtk1->GetRenderWindow()->AddRenderer(ren1);
ui.qvtk1->GetRenderWindow()->Render();
vtkPNGReader *reader = vtkPNGReader::New();
char *filename = "1.png";
reader->SetFileName(filename);
reader->Update();
vtkImageViewer* image_view = vtkImageViewer::New();
image_view->SetInputConnection(reader->GetOutputPort());
ui.qvtk1->SetRenderWindow(image_view->GetRenderWindow());
image_view->SetupInteractor(ui.qvtk1->GetRenderWindow()->GetInteractor());
image_view->Delete();
reader->Delete();
renwin->Delete();
}
Do you have any suggertion?
Thank a lot for the help!
Best,
Sheryl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20180311/7b407ec1/attachment.html>
More information about the vtkusers
mailing list