<div dir="ltr">You are welcome.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, May 1, 2014 at 3:53 PM, Maarten Beek <span dir="ltr"><<a href="mailto:beekmaarten@yahoo.com" target="_blank">beekmaarten@yahoo.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="color:#000;background-color:#fff;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:12pt">
Using SetInputData(input); and not implementing ReportReferences seems to work.<br><br>Thanks Berk!<div><div class="h5"><br><div><span><br></span></div><div style="display:block"> <div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:12pt">
<div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:12pt"> <div dir="ltr"> <font face="Arial"> On Wednesday, April 30, 2014 4:47:05 PM, Maarten Beek <<a href="mailto:beekmaarten@yahoo.com" target="_blank">beekmaarten@yahoo.com</a>> wrote:<br>
</font> </div> <div><div><div><div style="color:#000;background-color:#fff;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:12pt">When I was using the code I commented out in ReportReferences, this->ImageConvolve wasn't deleted in the destructor because its value was set to NULL.<br clear="none">
So that didn't work either...<br clear="none"><br clear="none">Maarten<br clear="none"><div><span><br clear="none"></span></div><div><div style="display:block"> <div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:12pt">
<div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:12pt"> <div dir="ltr"> <font face="Arial"> On Wednesday, April 30, 2014 4:03:42 PM, Berk Geveci <<a href="mailto:berk.geveci@kitware.com" target="_blank">berk.geveci@kitware.com</a>> wrote:<br clear="none">
</font> </div> <div><div><div><div dir="ltr">Don't use this:<div><br clear="none"></div><div>this->ImageConvolve->SetInputConnection(this->GetInputConnection(0, 0));<br clear="none"></div><div><br clear="none">
</div><div>Use this instead:</div><div><br clear="none"></div><div>this->ImageConvolve->SetInputData(input); <br clear="none">
</div><div><br clear="none"></div><div>This needs to be done in RequestData every time it executes btw. Input can change. I didn't check if there are other filters that need to do this. Overall, internal filters should not share the input connection of the outer filter unless you are fairly knowledgeable in how pipelines deal with references.</div>
<div><br clear="none"></div><div>PS: By using SetInputConnection(), you are creating a reference loop that would require that right reporting in ReportReferences. I'd think that the code that you commented out would work but I would have to dig to be sure. This reference loop is most probably the cause of the leak you are seeing.</div>
<div><br clear="none"></div><div>-berk</div></div><div><div><br clear="none"><br clear="none"><div>On Wed, Apr 30, 2014 at 2:20 PM, Maarten Beek <span dir="ltr"><<a rel="nofollow" shape="rect" href="mailto:beekmaarten@yahoo.com" target="_blank">beekmaarten@yahoo.com</a>></span> wrote:<br clear="none">
<blockquote style="margin:0 0 0 .8ex"><div><div style="font-size:12pt;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif">I believe that that is what I am doing; I have attached the cpp file for you to have a look at.<br clear="none">
<br clear="none">Thank you for your help - Maarten<div><div><br clear="none"><div><span><br clear="none"></span></div><div style="display:block"> <div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:12pt">
<div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:12pt"> <div dir="ltr"> <font face="Arial"> On Wednesday, April 30, 2014 1:05:15 PM, Berk Geveci <<a rel="nofollow" shape="rect" href="mailto:berk.geveci@kitware.com" target="_blank">berk.geveci@kitware.com</a>> wrote:<br clear="none">
</font> </div> <div><div><div><div dir="ltr">vtkImageOpenClose3D may be too complicated for what you are trying to achieve. Can you describe your algorithm a bit?
In most cases, you can simply instantiate bunch of algorithms in RequestData(), set the input using the input data to the outer filter and using SetInputData() and then shallow copying the output of the last filter to the output of the outer filter.</div>
<div><div><br clear="none"><br clear="none"><div>On Wed, Apr 30, 2014 at 12:00 PM, Maarten Beek <span dir="ltr"><<a rel="nofollow" shape="rect" href="mailto:beekmaarten@yahoo.com" target="_blank">beekmaarten@yahoo.com</a>></span> wrote:<br clear="none">
<blockquote style="margin:0 0 0 .8ex"><div><div style="font-size:12pt;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><div>
<span>I replaced my </span><span><span><span><span>ProcessorClass by vtkImageThreshold and the strange behaviour disappeared.</span></span></span></span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif">
<br clear="none"><span><span><span><span></span></span></span></span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif">
<span><span><span><span>I guess my </span></span></span></span><span></span><span><span><span><span>ProcessorClass is wrong.... :-(</span></span></span></span></div>
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><span><span><span><span>So my question now is: how to correctly write a vtkImageAlgorithm that has an internal pipeline?</span></span></span></span></div>
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><br clear="none"><span><span><span><span></span></span></span></span></div>
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif">
<span><span><span><span>I have looked at vtkImageOpenClose3D, but (apparently!) don't really understand SetSharedInputInformation(), SetSharedOutputInformation(), and ReportReferences().</span></span></span></span></div>
<span><font color="#888888"></font></span><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><br clear="none"><span><span><span><span></span></span></span></span></div>
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><span><span><span><span>Maarten<br clear="none"></span></span></span></span></div>
<div><div><div style="display:block"> <div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:12pt"> <div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:12pt">
<div dir="ltr"> <font face="Arial"> On Wednesday, April 30, 2014 11:37:23 AM, Berk Geveci <<a rel="nofollow" shape="rect" href="mailto:berk.geveci@kitware.com" target="_blank">berk.geveci@kitware.com</a>> wrote:<br clear="none">
</font> </div> <div><div>
<div><div dir="ltr"><div>Confusing.</div><div><br clear="none"></div><div>Can you compile VTK with VTK_DEBUG_LEAKS set to ON (it is an advanced CMake flag) and see if you get reports of any objects leaking at exit?</div>
<div>
<br clear="none"></div></div>
<div><div><br clear="none"><br clear="none"><div>On Tue, Apr 29, 2014 at 4:40 PM, Maarten Beek <span dir="ltr"><<a rel="nofollow" shape="rect" href="mailto:beekmaarten@yahoo.com" target="_blank">beekmaarten@yahoo.com</a>></span> wrote:<br clear="none">
<blockquote style="margin:0 0 0 .8ex"><div><div style="font-size:12pt;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><div>
<span>Some additional info I found:</span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><br clear="none">
<span></span></div>
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><span>When I use SetInputConnection(), I see only one object being destructed as well (like with using SetInputData w/o RemoveAllInputs()).</span></div>
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><span>However the memory usage with SetInputConnection() is 378Mb as opposed to 430Mb with SetInputData(): the difference is about 50Mb (the size of the tiff image).</span></div>
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><br clear="none"><span></span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif">
<span>As I said in the earlier email I sent today, I am loading 2 images into 2 different </span><span><span><span><span>ProcessorClass
objects, or at least that's what I think. The images are similar and come from the same file, but the reader (which is destroyed by vtkSmartPointer when it gets out of scope?) cannot be that smart to realize it can tell the </span></span></span></span><span><span><span><span>ProcessorClass objects to share the image, can it?</span></span></span></span></div>
<span><font color="#888888"></font></span><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><br clear="none"><span><span><span><span></span></span></span></span></div>
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><span><span><span><span>Maarten<br clear="none"></span></span></span></span></div>
<div><div><div style="display:block"> <div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:12pt"> <div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:12pt">
<div dir="ltr"> <font face="Arial"> On , Maarten Beek <<a rel="nofollow" shape="rect" href="mailto:beekmaarten@yahoo.com" target="_blank">beekmaarten@yahoo.com</a>> wrote:<br clear="none"> </font> </div> <div><div>
<div><div style="font-size:12pt;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif">
I see (only reporting lines with reference to ReferenceCount):<br clear="none"><br clear="none">-> activate()<br clear="none">vtkImageData (00000000070808D0):UnRegistered by vtkInformation(...), ReferenceCount = 3<br clear="none">
<br clear="none">vtkImageData (00000000070ADA70):UnRegistered by vtkInformation(...), ReferenceCount = 3<br clear="none"><br clear="none">->deactivate() (without RemoveAllInputs() call)<br clear="none">vtkImageData (00000000070ADA70):UnRegistered by vtkTrivialProducer (...), ReferenceCount = 2<br clear="none">
<br clear="none">vtkImageData (00000000070ADA70):UnRegistered by vtkInformation (...), ReferenceCount = 1<br clear="none"><br clear="none">vtkImageData (00000000070ADA70):Registered by
vtkTrivialProducer (...), ReferenceCount = 2<br clear="none"><br clear="none">vtkImageData (00000000070ADA70):UnRegistered by vtkGarbageCollectorImpl (...), ReferenceCount = 0<br clear="none"><div><br clear="none"><span></span></div>
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif">vtkObject (00000000070ADA70): Destructing!</div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif">
<br clear="none"></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><br clear="none"></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif">
-> activate()<br clear="none">vtkImageData (0000000006FA15D0):UnRegistered by vtkInformation(...), ReferenceCount = 3<br clear="none"><br clear="none">vtkImageData (0000000006FB0180):UnRegistered by vtkInformation(...), ReferenceCount = 3</div>
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><br clear="none"></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif">
->deactivate() (with RemoveAllInputs() call)<br clear="none">vtkImageData (0000000006FA15D0):UnRegistered by vtkTrivialProducer (...), ReferenceCount = 2<br clear="none"><br clear="none">vtkImageData (0000000006FA15D0):UnRegistered by vtkInformation (...), ReferenceCount = 1<br clear="none">
<br clear="none">vtkImageData (0000000006FA15D0):Registered by vtkGarbageCollectorImpl (...), ReferenceCount = 2</div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif">
<br clear="none"></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif">vtkImageData (0000000006FA15D0):UnRegistered by vtkGarbageCollectorImpl (...), ReferenceCount = 0</div>
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><br clear="none"></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif">
vtkObject (0000000006FA15D0): Destructing!</div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><br clear="none">
</div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif">vtkImageData (0000000006FB0180):UnRegistered by vtkTrivialProducer (...), ReferenceCount = 2<br clear="none">
<br clear="none">vtkImageData
(0000000006FB0180):UnRegistered by vtkInformation (...), ReferenceCount = 1<br clear="none"><br clear="none">vtkImageData (0000000006FB0180):Registered by vtkGarbageCollectorImpl (...), ReferenceCount = 2</div><div><br clear="none">
</div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif">vtkImageData (0000000006FB0180):UnRegistered by vtkGarbageCollectorImpl (...), ReferenceCount = 0</div>
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><br clear="none"></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif">
vtkObject (0000000006FB0180): Destructing!</div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><br clear="none">
<span></span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><br clear="none"></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif">
It makes sense in my code that I create 2 copies of vtkImageData, loaded into different <span><span><span><span>ProcessorClass objects, but I don't understand
why the first copy doesn't get destructed when I am not using </span></span></span></span><br clear="none">RemoveAllInputs()</div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif">
<br clear="none"></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif">Maarten<br clear="none"></div><div><div style="display:block">
<div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:12pt"> <div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:12pt">
<div dir="ltr"> <font face="Arial"> On Tuesday, April 29, 2014
10:39:24 AM, Berk Geveci <<a rel="nofollow" shape="rect" href="mailto:berk.geveci@kitware.com" target="_blank">berk.geveci@kitware.com</a>> wrote:<br clear="none"> </font> </div> <div><div><div><div dir="ltr">Hmmm. This is fishy. I wonder if there is a leak somewhere in the new code. Can you try something for me? Add a reader->GetOutput()->DebugOn() right after SetInputData() and re-run. Do you see the object reference count go to 0 in deactivate?<div>
<br clear="none"></div><div>-berk</div></div><div><br clear="none"><br clear="none"><div>On Mon, Apr 28, 2014 at 11:53 AM, Maarten Beek <span dir="ltr"><<a rel="nofollow" shape="rect" href="mailto:beekmaarten@yahoo.com" target="_blank">beekmaarten@yahoo.com</a>></span> wrote:<br clear="none">
<blockquote style="margin:0 0 0 .8ex"><div><div><div style="font-size:12pt;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><div>
Hi all,</div><div><br clear="none"></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif">I bumped into something I don't really understand:<br clear="none">
</div><div><br clear="none"></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif">void MyClass::activate()</div>
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif">
{</div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><span> vtkSmartPointer<vtkTIFFReader> reader = vtkSmartPointer<vtkTIFFReader>::New();</span></div>
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><span><span> <...></span></span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif">
<span><span><span>
reader->Update();</span></span></span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><span><span><span><br clear="none">
</span></span></span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><span> m_Processor->SetInputData(reader->GetOutput());</span><br clear="none">
}</div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><br clear="none"></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif">
void MyClass::deactivate()</div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif">{</div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif">
<span> if( 0 != m_Processor )</span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><span><span> {</span></span></div>
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><span><span><span> <span> m_Processor->RemoveAllInputs();</span></span></span></span></div>
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><span><span><span><span><span> <span> m_Processor->Delete();</span></span></span></span></span></span></div>
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><span><span><span><span><span><span><span> <span> m_Processor = 0;<br clear="none">
</span></span></span></span></span></span></span></span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><span><span><span> }</span></span></span><br clear="none">
}</div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><br clear="none"></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif">
In the deactivate() function I do need the RemoveAllInputs() call to avoid a 50MB memory leak (100 slice 512x512 tiff). I don't need RemoveAllInputs() when I use SetInputConnection(reader->GetOutputPort()) in the activate() function.</div>
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><br clear="none"></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif">
Why is the difference between SetInputData() and SetInputConnection() with regards to memory management?</div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif">
<br clear="none"></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><span><span><span><span>m_Processor is derived from vtkImageAlgorithm and has an internal pipeline inside the RequestData(), processing the image data with vtkImageConvolve, vtkImageSobel2D, vtkImageThreshold and a few more.</span></span></span></span></div>
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><br clear="none"><span><span><span><span></span></span></span></span></div>
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif">
<span><span><span><span>int ProcessorClass::RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector* outputVector)</span></span></span></span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif">
<span><span><span><span>{</span></span></span></span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><span><span><span><span><span> vtkInformation* outInfo = outputVector->GetInformationObject(0);</span></span></span></span></span></div>
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><span><span><span><span><span><span> vtkImageData* output = vtkImageData::SafeDownCast(outInfo->Get(vtkdataObject::DATA_OBJECT()));</span></span></span></span></span></span></div>
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><span><span><span><span><span><span><br clear="none"></span></span></span></span></span></span></div>
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><span><span><span><span><span> if( this->GetMTime() > this->BuildTime )</span></span></span></span></span></div>
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><span><span><span><span><span><span>
</span>{</span></span></span></span></span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><span><span><span><span><span><span><span> <span> this->buildPipeline();</span></span></span></span></span></span></span></span></div>
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><span><span><span><span><span><span><span> </span></span>}</span></span></span></span></span></div>
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><br clear="none"><span><span><span><span><span></span></span></span></span></span></div>
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><span><span><span><span><span><span> if( 0 != this->GetNumberOfInputConnections(0) )</span></span></span></span></span></span></div>
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><span><span><span><span><span><span><span> {</span></span></span></span></span></span></span></div>
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><span><span><span><span><span><span><span><span> <span> this->MergeFilter->Update();</span></span></span></span></span></span></span></span></span></div>
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><span><span><span><span><span><span><span><span><span><span> <span> output->ShallowCopy(this->MergeFilter->GetOutput());</span></span></span></span></span></span></span></span></span></span></span></div>
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><span><span><span><span><span><span><span><span><span><span><span><span>
}</span></span></span></span></span></span></span></span></span></span></span></span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif">
<br clear="none"><span><span><span><span><span><span><span><span><span><span><span><span></span></span></span></span></span></span></span></span></span></span></span></span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif">
<span><span><span><span><span><span><span><span><span><span><span><span><span> return 1;</span></span></span></span></span></span></span></span></span></span></span></span></span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif">
<span><span><span><span><span><span><span><span><span><span><span><span><span>}<span><font color="#888888"><br clear="none"></font></span></span></span></span></span></span></span></span></span></span></span></span></span></span></div>
<span><font color="#888888"></font></span><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><span><span><span><span><br clear="none">
</span></span></span></span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><span><span><span><span><br clear="none">
</span></span></span></span></div>
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif">Maarten<br clear="none"></div></div></div></div><br clear="none">
_______________________________________________<br clear="none">
Powered by <a rel="nofollow" shape="rect" href="http://www.kitware.com/" target="_blank">www.kitware.com</a><br clear="none">
<br clear="none">
Visit other Kitware open-source projects at <a rel="nofollow" shape="rect" href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br clear="none">
<br clear="none">
Please keep messages on-topic and check the VTK FAQ at: <a rel="nofollow" shape="rect" href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br clear="none">
<br clear="none">
Follow this link to subscribe/unsubscribe:<br clear="none">
<a rel="nofollow" shape="rect" href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br clear="none">
<br clear="none"></blockquote></div><br clear="none"></div></div></div><br clear="none"><br clear="none"></div> </div> </div> </div></div> </div></div></div><br clear="none"><br clear="none"></div> </div> </div> </div>
</div></div></div></div>
</blockquote></div><br clear="none"></div></div></div></div><br clear="none"><br clear="none"></div> </div> </div> </div> </div></div></div></div></blockquote></div><br clear="none"></div></div></div></div><br clear="none">
<br clear="none"></div>
</div> </div> </div> </div></div></div></div></blockquote></div><br clear="none"></div></div></div></div><br clear="none"><br clear="none"></div> </div> </div> </div></div> </div></div></div><br><br></div> </div> </div>
</div> </div></div></div></div></blockquote></div><br></div>