[vtkusers] QVTKWidget + vtkRectilinearWipeWidget

florian florian at tricksoft.de
Thu Jun 16 07:39:55 EDT 2011


Hallo,

Im trying to use a vtkRectilinearWipeWidget in my Qt Application.

When I create a new vtkRenderWindowInteractor everything works fine and 
i get a completely working widget in a seperate window. But I want the 
widget to be within my Application, where i created a qvtkwidget.

The problem is, when i run my application the vtkRectilinearWipe 
appears, but all the widget features are missing (like the sliders to 
move the split).

Instead i'm able to rotate the 2D Image with the mouse.


Below I pasted my code (Pastebin alternatively)
I would be really thankful if somebody could take a look at it and maybe 
figure out what I'm doing wrong.

http://pastebin.com/ufaiyPzv


             vtkWidgetFixed1 = new QVTKWidget();

             m_pMainWindow->setCentralWidget(vtkWidgetFixed1);

                         vtkImageConstantPad* pad1 = 
vtkImageConstantPad::New();
             pad1->SetInput(volume1->getData());
             pad1->SetConstant(0.0);
             pad1->SetOutputWholeExtent(0, 511, 0, 511, 0, 0);

             vtkImageConstantPad* pad2 = vtkImageConstantPad::New();
             pad2->SetInput(volume2->getData());
             pad2->SetConstant(0.0);
             pad2->SetOutputWholeExtent(0, 511, 0, 511, 0, 0);

             wipe = vtkSmartPointer<vtkImageRectilinearWipe>::New();
             wipe->SetInput(0,pad1->GetOutput());
             wipe->SetInput(1,pad2->GetOutput());
             wipe->SetPosition(10,256);
             wipe->SetWipe(0);

             vtkSmartPointer<vtkRenderer> ren1 = 
vtkSmartPointer<vtkRenderer>::New();
             vtkSmartPointer<vtkRenderWindow> renWin = 
vtkWidgetFixed1->GetRenderWindow();
             vtkSmartPointer<vtkRenderWindowInteractor> iren = 
vtkWidgetFixed1->GetInteractor();
             renWin->AddRenderer(ren1);
             renWin->SetInteractor(iren);

             vtkImageMapToWindowLevelColors *m_WLFilter = 
vtkImageMapToWindowLevelColors::New();
             m_WLFilter->SetOutputFormatToLuminance();
             m_WLFilter->SetInput( wipe->GetOutput() );
             m_WLFilter->SetWindow(1000.0);
             m_WLFilter->SetWindow(400.0);
             m_WLFilter->UpdateWholeExtent();

             vtkSmartPointer<vtkImageActor> wipeActor = 
vtkSmartPointer<vtkImageActor>::New();
             wipeActor->SetInput(m_WLFilter->GetOutput());

             vtkSmartPointer<vtkRectilinearWipeWidget> wipeWidget = 
vtkSmartPointer<vtkRectilinearWipeWidget>::New();
             wipeWidget->SetInteractor(iren);

             vtkRectilinearWipeRepresentation *wipeWidgetRep= 
static_cast<vtkRectilinearWipeRepresentation 
*>(wipeWidget->GetRepresentation());

             wipeWidgetRep->SetImageActor(wipeActor);
             wipeWidgetRep->SetRectilinearWipe(wipe);
             wipeWidgetRep->GetProperty()->SetLineWidth(2.0);
             wipeWidgetRep->GetProperty()->SetOpacity(0.75);

             ren1->AddActor(wipeActor);
             ren1->SetBackground(0.1, 0.2, 0.4);

             iren->Initialize();
             renWin->Render();
             wipeWidget->On();



More information about the vtkusers mailing list