[Insight-users] return a smart pointer
Ivan Macia
imacia at vicomtech.org
Sat Jan 2 06:55:55 EST 2010
Hi Siqi,
Since the filter is going out of scope you should do
ImageType::Pointer img = filter->GetOutput();
filter->Update();
img->DisconnectPipeline();
return img;
Regards
Iván
2009/12/31 siqi chen <siqichensc at gmail.com>
> 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?
>
> void main()
> {
> ImageType::Pointer image = fun();
> }
>
> ImageType::Pointer fun()
> {
> FilterType::Pointer filter = FilterType::New();
> ...
> ImageType::Pointer img = filter->GetOutput();
> filter->Update();
> return img;
> }
>
> Thanks
> Siqi
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100102/7565debb/attachment.htm>
More information about the Insight-users
mailing list