[Insight-users] Using non-smart pointers

Navneeth Subramanian navneeth.s at gmail.com
Fri Dec 2 10:52:21 EST 2011


Try this instead:
void Test(input, outputImage.GetPointer() );

On Fri, Dec 2, 2011 at 9:12 PM, David Doria <daviddoria at gmail.com> wrote:
> If I have a function like this:
>
> void Test(const ImageType* input, ImageType* output)
>
> and I create 'output' like this:
>
> ImageType::Pointer outputImage = ImageType::New();
> void Test(input, outputImage);
>
> all is well. However, if I do this:
>
> ImageType* outputImage = ImageType::New();
> void Test(input, outputImage);
>
> it segfaults when I try to use 'output'. Here is a demonstration of
> the problem: http://www.itk.org/Wiki/ITK/Examples/Broken/Utilities/NonSmartPointers
>
> Can anyone explain what is wrong with this?
>
> Thanks,
>
> David
> _____________________________________
> 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


More information about the Insight-users mailing list