<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
<br>
You may ignore the caching stuff in there. Its off by default, and is
only useful to prevent updates when there are no changes.<br>
<br>
Whenever you make changes to VTK's data objects it's your job to call
qvtkWidget->update() or viewer->Render() afterward so the new
changes get put onto the screen.<br>
<br>
Clint<br>
<br>
On 11/23/2009 07:27 AM, Garrett Larson wrote:
<blockquote
cite="mid:c78467350911230627v64259513y1dfca16eb8689d91@mail.gmail.com"
type="cite">Thanks for the quick response! I've tried that and
unfortunately it isn't working for me. I think the issue has to do with
the fact that I'm changing the pixel values manually, and the widgets
don't realize the image has changed. <br>
<br>
I thought it might have to do with the cachedImageDirty() signal, but I
don't understand when to call markCachedImageDirty() (before
qvtkWidget->update() ? after?) or how to check if the flag is being
set appropriately as the value is a protected member of QVTKWidget.<br>
<br>
-Garrett Larson<br>
<br>
<br>
<div class="gmail_quote">On Mon, Nov 23, 2009 at 8:53 AM, André Prins
<span dir="ltr"><<a moz-do-not-send="true"
href="mailto:a.h.prins@gmail.com">a.h.prins@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote"
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">You
could try calling QVTKWidget::update(), which is Qt's method of<br>
repainting the widget.<br>
See for example: <a moz-do-not-send="true"
href="http://doc.trolltech.com/4.5/qwidget.html#update" target="_blank">http://doc.trolltech.com/4.5/qwidget.html#update</a>.<br>
<br>
Regards,<br>
André<br>
<div>
<div class="h5"><br>
On Mon, Nov 23, 2009 at 2:04 PM, Garrett Larson <<a
moz-do-not-send="true" href="mailto:garrett@unc.edu">garrett@unc.edu</a>>
wrote:<br>
> I've created an application that contains a QVTKWidget linked to a<br>
> vtkImageViewer2. Alterations to the vtkImageData before
initializing the<br>
> vtkImageViewer2 are visible as soon as I call viewer->Render(),
but any<br>
> changes I make later do not appear until I click inside the
widget. In fact,<br>
> this happens even if I run the exact same sequence of methods to
make a new<br>
> vtkImageViewer2 (as below). Is this a result of the QVTKWidget
caching the<br>
> image data, and if so, how can I make it update? Thanks!<br>
><br>
> ==================<br>
><br>
> gridData = vtkImageData::New();<br>
><br>
> // etc.<br>
><br>
> gridData-><br>
> SetScalarTypeToFloat();<br>
> gridData->AllocateScalars();<br>
>
gridData->GetPointData()->GetScalars()->FillComponent(0,0);<br>
><br>
><br>
> // The vtkImageData *gridData is modified via calls to
SetScalarComponent...<br>
><br>
><br>
>
gridData->SetScalarComponentFromDouble((int)pos[0],(int)pos[1],0,0,intensity);<br>
><br>
> viewer = vtkImageViewer2::New();<br>
> viewer->SetInput(gridData);<br>
>
viewer->SetupInteractor(this->ui->qvtkWidget->GetInteractor());<br>
>
viewer->SetRenderWindow(this->ui->qvtkWidget->GetRenderWindow());<br>
> viewer->Render();<br>
><br>
> // ... and the modified image is displayed correctly.<br>
><br>
> // But if the vtkImageData *gridData is further modified via calls
to<br>
> SetScalarComponent...<br>
><br>
><br>
>
gridData->SetScalarComponentFromDouble((int)pos[0],(int)pos[1],0,0,intensity);<br>
><br>
> viewer = vtkImageViewer2::New();<br>
> viewer->SetInput(gridData);<br>
>
viewer->SetupInteractor(this->ui->qvtkWidget->GetInteractor());<br>
>
viewer->SetRenderWindow(this->ui->qvtkWidget->GetRenderWindow());<br>
> viewer->Render();<br>
><br>
> // ...the new changes are still not visible until I click the
image.<br>
><br>
> ===================<br>
><br>
> -Garrett Larson<br>
</div>
</div>
> _______________________________________________<br>
> Powered by <a moz-do-not-send="true" href="http://www.kitware.com"
target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a moz-do-not-send="true"
href="http://www.kitware.com/opensource/opensource.html"
target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the VTK FAQ at:<br>
> <a moz-do-not-send="true" href="http://www.vtk.org/Wiki/VTK_FAQ"
target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a moz-do-not-send="true"
href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
><br>
><br>
</blockquote>
</div>
<br>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>
Visit other Kitware open-source projects at <a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>
Please keep messages on-topic and check the VTK FAQ at: <a class="moz-txt-link-freetext" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a>
Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a>
</pre>
</blockquote>
<br>
</body>
</html>