[Insight-users] Smart pointers as function argument

David Pastor david.pastor at die.upm.es
Mon Nov 16 12:12:20 EST 2009


HI,

I'm trying to have a library with some functions I use to process Images with ITK.

What I do is:

FilterApi f = new FilterApi();
InputType::Pointer filtered = InputType::New();
f->filtering(reader->getOutput(), filtered, arg1, arg2);

inside of filtering I have some filter and filtered = filter->GetOutput();

The function workst, and the filtered image is ok inside the function range. But in my main framework, the filtered image is null. In other words, the data is lost when you get out from the function and it is not persistent even though i created the pointer in my main.

I imagine this is something related to SmartPointers. Is there any way to do this? it's a bit tiring to write the same blocks of code in each main.

cheers
david


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20091116/24e09f68/attachment.htm>


More information about the Insight-users mailing list