<div dir="ltr">Thanks for both!<br><br>Fixed it finally.<br><br>Jothy<br><br><div class="gmail_quote">On Tue, May 15, 2012 at 3:30 PM, Hal Canary <span dir="ltr"><<a href="mailto:hal@cs.unc.edu" target="_blank">hal@cs.unc.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 05/15/2012 10:19 AM, Jothybasu Selvaraj wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
Hi all,<br>
<br>
I have a pipeline like this, every time I call this function the memory<br>
increases ~10MB. How can I fix this?<br>
<br>
I have a imgData already instantiated like this<br>
<br>
vtkSmartPointer<vtkImageData><u></u>img=<br>
vtkSmartPointer<vtkImageData>:<u></u>:New();<br>
<br>
vtkSmartPointer<<u></u>vtkXMLImageReader>rd=<br>
vtkSmartPointer<<u></u>vtkXMLImageReader>::New();<br>
rd->SetFilename("filename");<br>
rd->Update();<br>
<br>
img=rd->GetOutput();<br>
<br>
<br>
//Now I repeat this function several times<br>
<br>
vtkSmartPointer<<u></u>vtkImageShiftScale>scaler=<br>
vtkSmartPointer<<u></u>vtkImageShiftScale>::New();<br></div>
scaler->SetInput(img);*//is this correct way of doing?*<div class="im"><br>
<br>
scaler->SetScale(0.5);//<u></u>Multiply<br>
scaler-><u></u>SetOutputScalarTypeToDouble();<br>
<br>
//scaler->ReleaseDataFlagOn();<u></u>//Tried with this too<br>
scaler->Update();<br>
<br></div>
img=scaler->GetOutput();*//is this correct way of doing?*<div class="im"><br>
<br>
I am beginner in C++, so I am expecting some silly mistakes.<br>
<br>
</div></blockquote>
<br>
Nine out of ten times , you want to do<br>
b->SetInputConnection(a-><u></u>GetOutputPort());<br>
instead of<br>
b->SetInput(a->GetOutput());<br>
<br>
See <a href="http://www.vtk.org/Wiki/VTK/FAQ" target="_blank">http://www.vtk.org/Wiki/VTK/<u></u>FAQ</a> .<br>
<br>
Is this what you want to do?<div class="im"><br>
<br>
vtkSmartPointer<<u></u>vtkXMLImageReader>rd=<br>
vtkSmartPointer<<u></u>vtkXMLImageReader>::New();<br>
rd->SetFilename("filename");<br>
rd->Update();<br></div>
vtkAlgorithmOutput * outputPort = rd->GetOutputPort();<div class="im"><br>
<br>
//Now I repeat this function several times<br>
{<br>
vtkSmartPointer<<u></u>vtkImageShiftScale>scaler=<br>
vtkSmartPointer<<u></u>vtkImageShiftScale>::New();<br></div>
scaler->SetInputConnection(<u></u>outputPort);<div class="im"><br>
scaler->SetScale(0.5);//<u></u>Multiply<br>
scaler-><u></u>SetOutputScalarTypeToDouble();<br></div>
scaler->Update();<br>
outputPort = scaler->GetOutputPort();<br>
}<br>
<br>
//then<br>
do_something_with(outputPort);<span class="HOEnZb"><font color="#888888"><br>
<br>
<br>
-- <br>
Hal Canary<br>
<a href="http://cs.unc.edu/%7Ehal/" target="_blank">http://cs.unc.edu/~hal/</a><br>
______________________________<u></u>_________________<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/<u></u>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_<u></u>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/<u></u>listinfo/vtkusers</a><br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr">Jothy<br></div><br>
</div>