about itkScalar and itkVector

Bill Hoffman bill.hoffman at kitware.com
Tue May 2 16:15:01 EDT 2000


Hi, 

The use of ::Pointer is required.  This is to avoid leaks and crashes.

For example:

itkFoo<bar>* i = itkFoo<bar>::New();
i->Print();

would crash because the value returned by New would be put
into a temporary ::Pointer then converted to a *, then the
temp would go away leaving i pointing to deleted memory.
I have just checked in a change that will give a syntax
error in the above code.

We are looking into the itkImage<int, 3> issue.  Will will get
back to you tomorrow.

-Bill
  

At 12:51 PM 5/2/00 -0400, Luis Ibanez wrote:
>Hi,
>
>in the code from
>
>.../Testing/Code/Common/itkBasicArchitectureTest.cxx
>
>itk images are created using:
>
>itkImage<  itkScalar< float > , 3 >::Pointer  myImage;
>
>we were naively using something like:
>
>itkImage<  float, 3 >  *myImage
>
>is the use of   "itkScalar" and "itkVector"
>something mandatory when creating images ?
>
>nd is the use of  the trait  "::Pointer"    a
>recomended methods as oposed to just an  "*"  ?
>
>
>Thanks
>
>
>Luis
>




More information about the Insight-developers mailing list