[Insight-users] [vtkusers] Return itkObjects

David Doria daviddoria at gmail.com
Thu Jun 7 09:31:42 EDT 2012


On Thu, Jun 7, 2012 at 9:05 AM, Jothybasu Selvaraj <jothybasu at gmail.com> wrote:
> Thanks!
>
> Do I need to add the below typdef declaration in .h and .cxx
>
>
> typedef itk::DefaultStaticMeshTraits<
> vtkFloatingPointType, PointDimension, MaxCellDimension,
> vtkFloatingPointType,vtkFloatingPointType >MeshTraits;
>
> typedef itk::Mesh< vtkFloatingPointType,PointDimension,MeshTraits >MeshType;

You just need the typedef to be in scope. So if you declare it in the
header, and you include the header in the implementation file, you
should be good to go. You'll get "type undefined" errors if it can't
find the typedef.

> Is there any example on how to declare  and return itk objects in classes?

I just added this:

http://www.itk.org/Wiki/ITK/Examples/Utilities/ReturnObjectFromFunction

If someone else familiar with this could look at case 4 of returning a
normal pointer and storing it in a smart pointer and give a better
explanation of why it doesn't work, that'd be great. You'll see that
case 1 is the only one that works.

David


More information about the Insight-users mailing list