Discussion:
smart pointer
chensiqi
2008-12-18 04:34:49 UTC
Permalink
Hi, ITKers,

I have a smart pointer problem.
Here is my code:
///////////////////////////////

#include ""

typedef itk::XXXX <> FilterType
FilterType filter = FilterType::New();

int main()
{
..........................
filter->Update();
funa();
..........................
}
void funa()
{
.................
filter->update();
..................
}
//////////////////////////////////////
The program will throw out an exception about filter garbage collection.
How to fix this exception without passing the filter as a parameter to funa?

Any input will be appreciated.
Siqi
_________________________________________________________________
MSN°²È«±£»€ÖÐÐÄ£¬Ãâ·ÑÐÞžŽÏµÍ³Â©¶Ž£¬±£»€MSN°²È«£¡
http://im.live.cn/safe/center/
Matthew McCormick (thewtex)
2008-12-18 04:55:40 UTC
Permalink
Post by chensiqi
I have a smart pointer problem.
///////////////////////////////
#include ""
typedef itk::XXXX <> FilterType
FilterType filter = FilterType::New();
maybe
FilterType::Pointer filter = FilterType::New();
instead
Post by chensiqi
//////////////////////////////////////
The program will throw out an exception about filter garbage collection.
How to fix this exception without passing the filter as a parameter to funa?
chensiqi
2008-12-18 05:01:09 UTC
Permalink
whoops, that's a typo. I mean FilterType::Pointer filter = FilterType::New();
Thanks for your intention



Date: Wed, 17 Dec 2008 22:55:40 -0600From: matt-***@public.gmane.org: pidanchen-PkbjNfxxIASW1act/XJmeMp/***@public.gmane.org: Re: [Insight-users] smart pointerCC: insight-***@itk.org


I have a smart pointer problem.Here is my code://///////////////////////////// #include "" typedef itk::XXXX <> FilterTypeFilterType filter = FilterType::New();
maybe FilterType::Pointer filter = FilterType::New();instead

//////////////////////////////////////The program will throw out an exception about filter garbage collection.How to fix this exception without passing the filter as a parameter to funa?
_________________________________________________________________
аæ¿Í·þÒ³ÃæÌṩ×îÐÂMSN¿Í·þ×ÊѶ£¬ÖúÄúÇáËÉœâŸöÎÊÌâ¡£
http://help.cn.msn.com/Cs.html
ritesh.mahajan
2018-09-25 05:35:54 UTC
Permalink
Hi i am also facing related issue.

typedef signed short PixelType;
typedef itk::Image< PixelType, 3>ImageType;
typedef itk::ImageSeriesReader< ImageType >ReaderType;
ReaderType:: Pointer reader= ReaderType::New();

void ImageRead()
{
// using pointer reader here.
// which is allocated memory at global level
}

The above code crashes in debug mode. Where as it works in release mode.



--
Sent from: http://itk-users.7.n7.nabble.com/
The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there!
________________________________
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.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
https://itk.org/mailman/listinfo/insight-users

Loading...