Hi Siqi,<br><br>Since the filter is going out of scope you should do<br><br>ImageType::Pointer img = filter-&gt;GetOutput();<br>
filter-&gt;Update();<br>img-&gt;DisconnectPipeline();<br>
return img;<br><br>Regards<br><br>Iván<br><br><div class="gmail_quote">2009/12/31 siqi chen <span dir="ltr">&lt;<a href="mailto:siqichensc@gmail.com">siqichensc@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I dig into my old code and find that I used something like this before. Is this correct? How do I check the reference count?<br>
<br>
void main()<br>
{<br>
ImageType::Pointer image = fun();<br>
}<br>
<br>
ImageType::Pointer fun()<br>
{<br>FilterType::Pointer filter = FilterType::New();<br>
...<br>
ImageType::Pointer img = filter-&gt;GetOutput();<br>
filter-&gt;Update();<br>
return img;<br>
}<br><br>Thanks<br><font color="#888888">Siqi<br>
</font><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<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br></blockquote></div><br>