Thanks for the quick response! I&#39;ve tried that and unfortunately it isn&#39;t working for me. I think the issue has to do with the fact that I&#39;m changing the pixel values manually, and the widgets don&#39;t realize the image has changed. <br>
<br>I thought it might have to do with the cachedImageDirty() signal, but I don&#39;t understand when to call markCachedImageDirty() (before qvtkWidget-&gt;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">&lt;<a href="mailto:a.h.prins@gmail.com">a.h.prins@gmail.com</a>&gt;</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&#39;s method of<br>
repainting the widget.<br>
See for example: <a 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></div><div class="h5"><br>
On Mon, Nov 23, 2009 at 2:04 PM, Garrett Larson &lt;<a href="mailto:garrett@unc.edu">garrett@unc.edu</a>&gt; wrote:<br>
&gt; I&#39;ve created an application that contains a QVTKWidget linked to a<br>
&gt; vtkImageViewer2. Alterations to the vtkImageData before initializing the<br>
&gt; vtkImageViewer2 are visible as soon as I call viewer-&gt;Render(), but any<br>
&gt; changes I make later do not appear until I click inside the widget. In fact,<br>
&gt; this happens even if I run the exact same sequence of methods to make a new<br>
&gt; vtkImageViewer2 (as below). Is this a result of the QVTKWidget caching the<br>
&gt; image data, and if so, how can I make it update? Thanks!<br>
&gt;<br>
&gt; ==================<br>
&gt;<br>
&gt;   gridData = vtkImageData::New();<br>
&gt;<br>
&gt; // etc.<br>
&gt;<br>
&gt;   gridData-&gt;<br>
&gt; SetScalarTypeToFloat();<br>
&gt;   gridData-&gt;AllocateScalars();<br>
&gt;   gridData-&gt;GetPointData()-&gt;GetScalars()-&gt;FillComponent(0,0);<br>
&gt;<br>
&gt;<br>
&gt; // The vtkImageData *gridData is modified via calls to SetScalarComponent...<br>
&gt;<br>
&gt;<br>
&gt; gridData-&gt;SetScalarComponentFromDouble((int)pos[0],(int)pos[1],0,0,intensity);<br>
&gt;<br>
&gt;   viewer = vtkImageViewer2::New();<br>
&gt;   viewer-&gt;SetInput(gridData);<br>
&gt;   viewer-&gt;SetupInteractor(this-&gt;ui-&gt;qvtkWidget-&gt;GetInteractor());<br>
&gt;   viewer-&gt;SetRenderWindow(this-&gt;ui-&gt;qvtkWidget-&gt;GetRenderWindow());<br>
&gt;   viewer-&gt;Render();<br>
&gt;<br>
&gt; // ... and the modified image is displayed correctly.<br>
&gt;<br>
&gt; // But if the vtkImageData *gridData is further modified via calls to<br>
&gt; SetScalarComponent...<br>
&gt;<br>
&gt;<br>
&gt; gridData-&gt;SetScalarComponentFromDouble((int)pos[0],(int)pos[1],0,0,intensity);<br>
&gt;<br>
&gt;   viewer = vtkImageViewer2::New();<br>
&gt;   viewer-&gt;SetInput(gridData);<br>
&gt;   viewer-&gt;SetupInteractor(this-&gt;ui-&gt;qvtkWidget-&gt;GetInteractor());<br>
&gt;   viewer-&gt;SetRenderWindow(this-&gt;ui-&gt;qvtkWidget-&gt;GetRenderWindow());<br>
&gt;   viewer-&gt;Render();<br>
&gt;<br>
&gt; // ...the new changes are still not visible until I click the image.<br>
&gt;<br>
&gt; ===================<br>
&gt;<br>
&gt; -Garrett Larson<br>
</div></div>&gt; _______________________________________________<br>
&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;<br>
&gt; Visit other Kitware open-source projects at<br>
&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;<br>
&gt; Please keep messages on-topic and check the VTK FAQ at:<br>
&gt; <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
&gt;<br>
&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
&gt;<br>
&gt;<br>
</blockquote></div><br>