[vtkusers] QVTKWidget + vtkRectilinearWipeWidget

florian florian at tricksoft.de
Sun Jun 19 13:46:55 EDT 2011


Thanks for the info, i tried that but still cant get it working.

I used this example:
http://www.itk.org/Wiki/VTK/Examples/Cxx/Widgets/RectilinearWipeWidget
and wrote a minimal implementation using a qvtkwidget that causes the 
problem.

http://pastebin.com/LDYvRBPR

I hope anybody has an idea what causes this problem, because im 
completly stuck here :/

I would have uploaded the files, so they could be directly compiled, but 
I didn't know what methods are admissible.


On 18/06/11 22:14, clinton at elemtech.com wrote:
> You should use the Qt based vtkRenderWindowInteractor, QVTKInteractor. 
>  QVTKWidget makes one for you already, or you can specify one yourself.
>
> Clint
>
> ----- Reply message -----
> From: "florian" <florian at tricksoft.de>
> Date: Thu, Jun 16, 2011 5:39 am
> Subject: [vtkusers] QVTKWidget + vtkRectilinearWipeWidget
> To: <vtkusers at vtk.org>
>
> 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();
> _______________________________________________
> 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