[vtkusers] Flickering with QVTKWidget
Luis Roberto P. Paula
luisrpp at gmail.com
Sat Oct 25 11:47:57 EDT 2008
Problem solved!!
It was missing to call the Render method of the vtkRenderWindow class.
On Sat, Oct 25, 2008 at 1:23 PM, Luis Roberto P. Paula <luisrpp at gmail.com>wrote:
> Hi Clint,
>
> I tried this, but if a just call the SetInput method, the image doesn't
> change in the display when the slider moves.
>
> How can I update the image using the same vtkRenderWindow?
>
>
> On Sat, Oct 25, 2008 at 1:01 PM, Clinton Stimpson <clinton at elemtech.com>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?
>>>
>>
>> The flicker comes from re-creating the vtkRenderWindow each time you have
>> an image.
>> Can't you use the same vtkImageViewer instance at all times, and just call
>> SetInput when you change the image?
>> And don't bother calling vtkWidget->SetRenderWindow() and
>> vtkWidget->show() each time the slider moves.
>>
>> Clint
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20081025/50b97f13/attachment.htm>
More information about the vtkusers
mailing list