Dear Fabian,<br><br>As you suggested, I think you have to split your code in at least two functions. The first one will initialize you data, while the second will modify only the object &#39;PointCloudColors&#39;. You don&#39;t need to save the configuration of the camera as you won&#39;t reset any part of the rendering pipeline. You will modify only the input. So by calling for example &#39;PointCloudRenderWindow-&gt;Render();&#39; in the second function, VTK will check for you if something changed and then will update the rendering. <br>
<br>Moreover, I don&#39;t see any Qt objects in your code. With Qt and a QVTKWidget, you won&#39;t have to use the last three lines (at least, I never used them). You have some example on the wiki to use VTK with Qt: <a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx#Qt">http://www.vtk.org/Wiki/VTK/Examples/Cxx#Qt</a><br>
<br>Arnaud<br><br><div class="gmail_quote">On Mon, Oct 29, 2012 at 2:29 PM, Fabian <span dir="ltr">&lt;<a href="mailto:fabian-richter@gmx.de" target="_blank">fabian-richter@gmx.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello Arnaud BARRE,<br>
<br>
thanks for Your answer.<br>
<br>
My code looks like this (my pointcloud is a list already processed in the<br>
vector called &#39;Data&#39;):<br>
<br>
My Code wrote<br>
&gt; void PCV_VTKOps::PCV_Visualize(std::vector<br>
&gt; &lt;STRUCT_7Values&gt;<br>
&gt;  Data)<br>
&gt; {<br>
&gt;       int i;<br>
&gt;       PickedPoints.clear();<br>
&gt;<br>
&gt;       //general vtk declarations<br>
&gt;       vtkSmartPointer<br>
&gt; &lt;vtkRenderer&gt;<br>
&gt;                               PointCloudRenderer                                      = vtkSmartPointer<br>
&gt; &lt;vtkRenderer&gt;<br>
&gt; ::New();<br>
&gt;       vtkSmartPointer<br>
&gt; &lt;vtkRenderWindow&gt;<br>
&gt;                       PointCloudRenderWindow                          = vtkSmartPointer<br>
&gt; &lt;vtkRenderWindow&gt;<br>
&gt; ::New();<br>
&gt;       vtkSmartPointer<br>
&gt; &lt;vtkRenderWindowInteractor&gt;<br>
&gt;       PointCloudrenderWindowInteractor        = vtkSmartPointer<br>
&gt; &lt;vtkRenderWindowInteractor&gt;<br>
&gt; ::New();<br>
&gt;       vtkSmartPointer<br>
&gt; &lt;PCV_VTKPickPoints&gt;<br>
&gt;                       style                                                           = vtkSmartPointer<br>
&gt; &lt;PCV_VTKPickPoints&gt;<br>
&gt; ::New();<br>
&gt;       vtkSmartPointer<br>
&gt; &lt;vtkBMPReader&gt;<br>
&gt;                               BackgroundTextureReader                         = vtkSmartPointer<br>
&gt; &lt;vtkBMPReader&gt;<br>
&gt; ::New();<br>
&gt;       vtkSmartPointer<br>
&gt; &lt;vtkTexture&gt;<br>
&gt;                                       BackgroundTexture                                       = vtkSmartPointer<br>
&gt; &lt;vtkTexture&gt;<br>
&gt; ::New();<br>
&gt;       vtkSmartPointer<br>
&gt; &lt;vtkInteractorStyleTrackballCamera&gt;<br>
&gt;  style2                                               = vtkSmartPointer<br>
&gt; &lt;vtkInteractorStyleTrackballCamera&gt;<br>
&gt; ::New();<br>
&gt;       vtkSmartPointer<br>
&gt; &lt;vtkWindowToImageFilter&gt;<br>
&gt;               PointCloudToImageFilter                         = vtkSmartPointer<br>
&gt; &lt;vtkWindowToImageFilter&gt;<br>
&gt; ::New();<br>
&gt;       vtkSmartPointer<br>
&gt; &lt;vtkBMPWriter&gt;<br>
&gt;                               PointCloudToImageWriter                         = vtkSmartPointer<br>
&gt; &lt;vtkBMPWriter&gt;<br>
&gt; ::New();<br>
&gt;<br>
&gt;       vtkCamera                                                                       *PointCloudRendererCamera;<br>
&gt;<br>
&gt;       //vtkDeclarations PointCloud<br>
&gt;       vtkSmartPointer<br>
&gt; &lt;vtkUnsignedCharArray&gt;<br>
&gt;               PointCloudColors                                        = vtkSmartPointer<br>
&gt; &lt;vtkUnsignedCharArray&gt;<br>
&gt; ::New();<br>
&gt;       vtkSmartPointer<br>
&gt; &lt;vtkPoints&gt;<br>
&gt;                                       PointCloudPoints                                        = vtkSmartPointer<br>
&gt; &lt;vtkPoints&gt;<br>
&gt; ::New();<br>
&gt;       vtkSmartPointer<br>
&gt; &lt;vtkPolyData&gt;<br>
&gt;                               PointsPolydata                                          = vtkSmartPointer<br>
&gt; &lt;vtkPolyData&gt;<br>
&gt; ::New();<br>
&gt;       vtkSmartPointer<br>
&gt; &lt;vtkPolyData&gt;<br>
&gt;                               PointCloudPolyData                                      = vtkSmartPointer<br>
&gt; &lt;vtkPolyData&gt;<br>
&gt; ::New();<br>
&gt;       vtkSmartPointer<br>
&gt; &lt;vtkVertexGlyphFilter&gt;<br>
&gt;               PointCloudVertexFilter                          = vtkSmartPointer<br>
&gt; &lt;vtkVertexGlyphFilter&gt;<br>
&gt; ::New();<br>
&gt;       vtkSmartPointer<br>
&gt; &lt;vtkPolyDataMapper&gt;<br>
&gt;                       PointCloudMapper                                        = vtkSmartPointer<br>
&gt; &lt;vtkPolyDataMapper&gt;<br>
&gt; ::New();<br>
&gt;       vtkSmartPointer<br>
&gt; &lt;vtkActor&gt;<br>
&gt;                                       PointCloudActor                                         = vtkSmartPointer<br>
&gt; &lt;vtkActor&gt;<br>
&gt; ::New();<br>
&gt;<br>
&gt;       PointCloudColors                                        -&gt; SetNumberOfComponents(3);<br>
&gt;       unsigned char Color[3] = {0, 0, 0};<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;               for (i = 0; i &lt; (int) Data.size(); i++)<br>
&gt;               {<br>
&gt;                       if(VTKPARMS.ColorMode == 1)<br>
&gt;                       {<br>
&gt;                               Color[0] = Data[i].R;<br>
&gt;                               Color[1] = Data[i].G;<br>
&gt;                               Color[2] = Data[i].B;<br>
&gt;                       }<br>
&gt;                       PointCloudColors                                -&gt; InsertNextTupleValue(Color);<br>
&gt;                       PointCloudPoints                                -&gt; InsertNextPoint(Data[i].x,Data[i].y,Data[i].z);<br>
&gt;               }<br>
&gt;<br>
&gt;       PointsPolydata                                                  -&gt; SetPoints(PointCloudPoints);<br>
&gt;       PointCloudVertexFilter                                  -&gt;<br>
&gt; SetInputConnection(PointsPolydata-&gt;GetProducerPort());<br>
&gt;       PointCloudVertexFilter                                  -&gt; Update();<br>
&gt;       PointCloudPolyData                                              -&gt;<br>
&gt; ShallowCopy(PointCloudVertexFilter-&gt;GetOutput());<br>
&gt;       PointCloudPolyData                                              -&gt; GetPointData()-&gt;SetScalars(PointCloudColors);<br>
&gt;<br>
&gt;        //Visualization<br>
&gt;       PointCloudMapper                                                -&gt;<br>
&gt; SetInputConnection(PointCloudPolyData-&gt;GetProducerPort());<br>
&gt;       PointCloudActor                                                 -&gt; SetMapper(PointCloudMapper);<br>
&gt;       PointCloudActor                                                 -&gt; GetProperty()-&gt;SetPointSize(VTKPARMS.PointSize);<br>
&gt;<br>
&gt;       PointCloudRenderer                                              -&gt; AddActor(PointCloudActor);<br>
&gt;<br>
&gt;       BackgroundTextureReader                                 -&gt; SetFileName<br>
&gt; (&quot;C:\\PunktWolkenTest\\VTKBACKGROUND.bmp&quot;);<br>
&gt;       BackgroundTexture                                               -&gt;<br>
&gt; SetInputConnection(BackgroundTextureReader-&gt;GetOutputPort());<br>
&gt;<br>
&gt;       PointCloudRenderer-&gt;SetBackgroundTexture(BackgroundTexture);<br>
&gt;       PointCloudRenderer-&gt;TexturedBackgroundOn();<br>
&gt;<br>
&gt;       PointCloudRenderWindow                                  -&gt; AddRenderer(PointCloudRenderer);<br>
&gt;<br>
&gt;<br>
&gt;       PointCloudrenderWindowInteractor                        -&gt;<br>
&gt; SetRenderWindow(PointCloudRenderWindow);<br>
&gt;<br>
&gt; VTKPARMS.QTRenderer = PointCloudRenderer;<br>
&gt; VTKPARMS.QTRenderWindow = PointCloudRenderWindow;<br>
&gt;<br>
&gt;<br>
&gt;       PointCloudRenderWindow                                  -&gt; Render();<br>
&gt;       PointCloudrenderWindowInteractor                        -&gt; Start();<br>
&gt;       PointCloudRenderWindow                                  -&gt; Finalize();<br>
&gt;<br>
&gt; }<br>
<br>
But I am not sure if my question is more about structure. What this function<br>
does is basically take the points, process the pipeline and put the Renderer<br>
and RenderWindow somewhere where I can put it into a QVTKWidget.<br>
<br>
Now I am afraid, that &#39;sorting points out&#39; (because they have a special<br>
color value) would mean that I need to walk through the whole pipeline<br>
again. I know how to connect the QTSlider, but I dont know, if my function<br>
allows to interact with it after it run through.<br>
<br>
I thought about reorganising the function in case it needs to be called<br>
every time when the slider is moved. In that case I would save the VTKcamera<br>
somehow, filter the pointcloud before it gets visualized and swap the<br>
RenderWindows in the QVTKWidget (if possible).<br>
<br>
Would You think this to be better?<br>
<br>
THANKS ALOT,<br>
Fabian<br>
<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/Change-Objects-in-active-vtkRenderWindow-using-QT-tp5716830p5716869.html" target="_blank">http://vtk.1045678.n5.nabble.com/Change-Objects-in-active-vtkRenderWindow-using-QT-tp5716830p5716869.html</a><br>

<div class="HOEnZb"><div class="h5">Sent from the VTK - Users mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a 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: <a 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 href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</div></div></blockquote></div><br>