[vtkusers] Newbie question.

Junior Pilato junior.pilato at gmail.com
Tue Apr 17 14:25:30 EDT 2007


Dear vtkusers,

I have some problems with render scene.

I try to open some images, and store these images in a vtkImageData
object. After this I want to create three vtkImagePlaneWidget, for each
axis. In this project I use a extend QVTKWidget class.

First I try (to test it) open the images in constructor class. In this case
no problems occour. But when I try to call this in a different method
nothing
occour.


class vtkFrame : public QVTKWidget{
   (...)
   protected:

      vtkImageData *imageData;

     vtkRenderer *ren;

     vtkImagePlaneWidget *planeWidgetX;
     vtkImagePlaneWidget *planeWidgetY;
     vtkImagePlaneWidget *planeWidgetZ;

     void configImagePlanes();
}

void vtkFrame::configImagePlanes(){
    vtkPNGReader *reader = vtkPNGReader::New();
    reader->SetFilePrefix("/u/images/image");
    reader->SetDataExtent(0,255,0,255,0,255);
    reader->Update();

    imageData = reader->GetOutput();
    planeWidgetX->SetInput(imageData);
    planeWidgetY->SetInput(imageData);
    planeWidgetZ->SetInput(imageData);

    planeWidgetX->SetInteractor(this->GetInteractor());
    planeWidgetX->On();
    planeWidgetY->SetInteractor(this->GetInteractor());
    planeWidgetY->On();
    planeWidgetZ->SetInteractor(this->GetInteractor());
    planeWidgetZ->On();

    // Reset camera
    ren->ResetCamera();

    // Render scene
    ren->GetRenderWindow()->Render();

};


// Implements the main window by inheriting from Ui::MainWindow.
class MyMainWindow : public QMainWindow, public Ui::MainWindow {

    MyMainWindow();

protected:

    void openFiles();
};



MyMainWindow::MyMainWindow(){

   ren = vtkRenderer::New();
   vtkFrameWin->addRenderer(ren);

    // Reset camera
    vtkFrameWin->resetCamera();

    // Render scene
    vtkFrameWin->render();

     // First case, when I call here, ok!
    vtkFrameWin->configImagePlanes();
}


void MyMainWindow::openFiles(){

   //Second case: when I call here, the problem occour.  Nothing appears
(black background).
   vtkFrameWin->configImagePlanes();

}

I dont understant..... Somebody know why?


Thanks.


-- 
Pilato Jr.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070417/6ab65de8/attachment.htm>


More information about the vtkusers mailing list