[vtkusers] Flickering with QVTKWidget

Luis Roberto P. Paula luisrpp at gmail.com
Sat Oct 25 11:00:25 EDT 2008


Hi Michael,

Thank's for pointing this out, but it does not solve the flicker problem.

Does anybody knows how to do it?

On Sat, Oct 25, 2008 at 10:28 AM, Michael Jackson <
mike.jackson at bluequartz.net> wrote:

> Not sure about the flickering but if that is truly your code then it has a
> memory leak.
>
> vtkImageViewer* image_view = vtkImageViewer::New();
>
> Creates a pointer but the pointer is never destroyed. You need a line like:
>
> image_view->Delete();
>
> or use a vtkSmartPointer to instantiate the vtkImageViewer and you don't
> need to call the Delete() method:
>
> vtkSmartPointer<vtkImageViewer> image_view =
> vtkSmartPointer<vtkImageViewer>::New();
>
>
> _________________________________________________________
> Mike Jackson                  mike.jackson at bluequartz.net
> BlueQuartz Software                    www.bluequartz.net
> Principal Software Engineer                  Dayton, Ohio
>
>
>
>
> On Oct 24, 2008, at 11:08 PM, Luis Roberto P. Paula wrote:
>
>  Hi All,
>>
>> I have developed a GUI with Qt and I am using the QVTKWidget to display a
>> 2D image.
>>
>> This 2D image cames from a 3D image. I have a slider to control what is
>> the slice to be displayed.
>>
>> The problem is that I am getting a flickering effect every time the image
>> is changed.
>>
>> Here is a piece of code of what I am doing:
>>
>> void MyGui::moveBar() {
>>   ImageType2D::Pointer img =
>> myImage->getImage2DFrom3D(horizontalScrollBar->value());
>>
>>   vtkImageViewer* image_view = vtkImageViewer::New();
>>   image_view->SetInput(myImage->convertITKtoVTK(img));
>>
>>   vtkWidget->SetRenderWindow(image_view->GetRenderWindow());
>>
>>   image_view->SetColorLevel(138.5);
>>   image_view->SetColorWindow(233);
>>
>>   vtkWidget->show();
>> }
>>
>> This method is called every time the slider is moved.
>>
>> Does anybody knows how to get rid of this flickering effect?
>>
>> I'm using VTK 5.2.0 and Qt4.
>>
>> I have already tried to use the QTVTKWidget (a subclass of the QVTKWidget)
>> as suggested here (
>> http://www.vtk.org/pipermail/vtkusers/2006-November/088194.html), but it
>> didn't work.
>>
>> Is this really a "double buffering" problem?
>>
>> Is Qt a good framework to create GUIs for VTK applications?
>>
>> Thanks in advance,
>> Luis
>> _______________________________________________
>> This is the private VTK discussion list.
>> Please keep messages on-topic. Check the FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20081025/82ff1724/attachment.htm>


More information about the vtkusers mailing list