<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<div id="geary-body">
<div>Thanks Oleksandr for the great answer.</div>
<div><br>
</div>
<div>OK, i see, so when i use ShallowCopy, i copy the underlying structure of the vtk object e.g. attributes like the pointers the vtk object consists of without copying the content which the pointers point to.</div>
<div><br>
</div>
<div>So for example by using a ShallowCopy on a vtkPolydata object i copy all the underlying pointers to things like vtkPointSet, vtkDataSet, Cells, Lines, Vertices, Points etc. which a vtkPolydata object is composed of but unlike using a DeepCopy not the actual
content (vertices and stuff arrays) which these pointers point to.</div>
<div><br>
</div>
<div>By using the vtkSmartPointer i get a reference counted pointer to the vtkObject without transfering the ownership of this object. It only increments the lease count by one and if the lease count becomes zero the destructor of the object is called. </div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>Just one question: </div>
<div><br>
</div>
<div>Does every vtk filter copies the data it is given to?</div>
<div><br>
</div>
<div>e.g.</div>
<div><br>
</div>
<div>When using </div>
<div><br>
</div>
<div>
<pre><!--StartFragment--><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">vtkNew</span><<span style=" color:#800080;">vtkTransformPolyDataFilter</span>><span style=" color:#c0c0c0;"> </span><span style=" color:#092e64;">transformFilter</span>;</pre>
<pre><span style=" color:#c0c0c0;"> </span><span style=" color:#092e64;">transformFilter</span>-><span style=" color:#00677c;">SetInputData</span>(<span style=" color:#092e64;">polyData</span>);</pre>
<pre><span style=" color:#c0c0c0;"> </span><span style=" color:#092e64;">transformFilter</span>-><span style=" font-style:italic; color:#00677c;">SetTransform</span>(<span style=" color:#092e64;">transformation</span>);</pre>
<pre><span style=" color:#c0c0c0;"> </span><span style=" color:#092e64;">transformFilter</span>-><span style=" font-style:italic; color:#00677c;">Update</span>();<!--EndFragment--></pre>
<pre><br></pre>
<pre><br></pre>
<pre><font face="sans">does the polyData exists twice in memory (the original polyData and the filter keeps its own transformed copy of the polyData)?</font></pre>
<pre><br></pre>
<pre><font face="sans"><br></font></pre>
<pre><font face="sans">Thanks and regards,</font></pre>
<pre><font face="sans"><br></font></pre>
<pre><font face="sans">Berti</font></pre>
<pre><br></pre>
</div>
</div>
<div id="geary-quote"><br>
Am Do, 25. Okt, 2018 um 2:15 VORMITTAGS schrieb Oleksandr Malyushytsky <omalyushytskyvtkuser@gmail.com>:<br>
<blockquote type="cite">
<div dir="ltr">
<div><span style="background-color:rgb(249,249,249)"><font face="sans">vtkSmartPointer has nothing to do with neither deep or shallow copy.<br>
</font></span></div>
<div><br>
</div>
<div><font face="sans">if you assign vtk object to smartpointer the reference count of vtk object is incremented,</font></div>
<div><font face="sans">there is only one vtkObject in the memory. Once smartpointer is released (going out of scope for example) vtk object reference count it was pointing is decremented.</font></div>
<div><font face="sans">In another words <span style="background-color:rgb(249,249,249)">
<font face="sans">vtkSmartPointer is like a normal pointer, which adds does reference couning.</font></span></font></div>
<div><font face="sans"><span style="background-color:rgb(249,249,249)"><font face="sans"><br>
</font></span></font></div>
<div><font face="sans"><span style="background-color:rgb(249,249,249)"><font face="sans">Operations with smartpointer DO NOT copy any data related to the object they point to.</font></span></font></div>
<div><font face="sans"><span style="background-color:rgb(249,249,249)"><font face="sans"><br>
</font></span></font></div>
<div><font face="sans"><span style="background-color:rgb(249,249,249)"><font face="sans"><br>
</font></span></font></div>
<div><font face="sans"><span style="background-color:rgb(249,249,249)"><font face="sans">While deep and shalow copy are always performed with 2 different objects.<br>
</font></span></font></div>
<div><font face="sans"><span style="background-color:rgb(249,249,249)"><font face="sans"><br>
</font></span></font></div>
<div><font face="sans"><span style="background-color:rgb(249,249,249)"><font face="sans"><br>
</font></span></font></div>
<div><font face="sans"><br>
</font></div>
<div><font face="sans"></font><br>
</div>
<div><span style="background-color:rgb(249,249,249)"></span></div>
<div><span style="background-color:rgb(249,249,249)"></span></div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr">On Wed, Oct 24, 2018 at 3:19 PM Berti Krüger <<a href="mailto:berti_krueger@hotmail.com">berti_krueger@hotmail.com</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div id="m_8970809788956831463geary-body">
<div>Hello.</div>
<div><br>
</div>
<div>I (hopefully) already understand the difference between the ShallowCopy and the DeepCopy method (e.g. copying only the pointer vs. copying the pointer and the content pointed to).</div>
<div><br>
</div>
<div>But what i don't understand yet is, what is the difference between using the overloaded assignment operator of vtkSmartPointer and the ShallowCopy method, e.g. what is the difference between</div>
<div><br>
</div>
<div><br>
</div>
<div><font face="monospace"><font color="#204a87">vtkSmartPointer<vtkPolydata></font>
<font color="#a40000">myStrangePolydata</font> = <font color="#204a87">vtkSmartPointer<vtkPolydata></font>::<font color="#4e9a06">New()</font>;</font></div>
<div><font face="monospace"><br>
</font></div>
<div><font face="monospace"><br>
</font></div>
<div><font face="monospace"><font color="#a40000">myStrangePolydata</font> = <font color="#204a87">
vtkTransmogrifyFilter</font>-><font color="#204a87">GetOutput</font>();</font></div>
<div><font face="monospace"><br>
</font></div>
<div><br>
</div>
<div><font face="sans">and</font></div>
<div><font face="monospace"><br>
</font></div>
<div><font face="monospace"><br>
</font></div>
<div><span style="background-color:rgb(249,249,249)"><font face="monospace"><font color="#a40000">myStangePolydata</font>-><font color="#204a87">ShallowCopy</font>(<font color="#204a87">vtkTransmogrifyFilter</font>-><font color="#204a87">GetOutput</font>();</font></span></div>
<div><font face="monospace, monospace"><span style="background-color:rgb(249,249,249)"><br>
</span></font></div>
<div><font face="monospace, monospace"><span style="background-color:rgb(249,249,249)"><br>
</span></font></div>
<div><font face="monospace, monospace"><span style="background-color:rgb(249,249,249)"><br>
</span></font></div>
<div><span style="background-color:rgb(249,249,249)"><font face="sans">Does it make a difference to the reference count of the vtkSmartPointer?</font></span></div>
<div><span style="background-color:rgb(249,249,249)"><font face="sans"><br>
</font></span></div>
<div><span style="background-color:rgb(249,249,249)"><font face="sans"><br>
</font></span></div>
<div><span style="background-color:rgb(249,249,249)"><font face="sans">Thank you very much in advance.</font></span></div>
<div><span style="background-color:rgb(249,249,249)"><font face="sans"><br>
</font></span></div>
<div><span style="background-color:rgb(249,249,249)"><font face="sans"><br>
</font></span></div>
<div><span style="background-color:rgb(249,249,249)"><font face="sans">Cheers,</font></span></div>
<div><span style="background-color:rgb(249,249,249)"><font face="sans">Berti</font></span></div>
</div>
</div>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" 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" rel="noreferrer" target="_blank">
http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">
http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">https://public.kitware.com/mailman/listinfo/vtkusers</a><br>
</blockquote>
</div>
</blockquote>
</div>
</body>
</html>