<div dir="ltr">Thanks!<br><br>Do I need to add the below typdef declaration in .h and .cxx<br><br>typedef itk::DefaultStaticMeshTraits<<br> vtkFloatingPointType, PointDimension, MaxCellDimension, vtkFloatingPointType,vtkFloatingPointType >MeshTraits;<br>
<br> typedef itk::Mesh< vtkFloatingPointType,PointDimension,MeshTraits >MeshType;<br><br>Is there any example on how to declare and return itk objects in classes?<br><br>Thanks again<br><br>
Jothy<br><br><div class="gmail_quote">On Thu, Jun 7, 2012 at 1:56 PM, David Doria <span dir="ltr"><<a href="mailto:daviddoria@gmail.com" target="_blank">daviddoria@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">> Which one do you mean MeshType::pointer or MeshType?<br>
><br>
> Jothy<br>
<br>
</div>MeshType is not an object, it is just a type (defined with 'typedef').<br>
MeshType::Pointer is then a smartpointer to an object of type<br>
'MeshType'.<br>
<br>
David<br>
<div class="im"><br>
>> Hi,<br>
>> It is better to return smartpointers over regular pointers?<br>
>><br>
>> Regards<br>
<br>
</div>If you create the object as a:<br>
<br>
MeshType::Pointer myMesh = MeshType::New();<br>
<br>
in the function, you'll have to return a MeshType::Pointer, or the<br>
smart pointer will go out of scope and be destroyed. Actually, I think<br>
in ITK that is the only way to do it (I don't have any experience with<br>
itk::Mesh, but with itk::Image I don't think anything works correctly<br>
if you try to create a itk::Image<float, 2>* image = itk::Image<float,<br>
2>::New() ?)<br>
<span class="HOEnZb"><font color="#888888"><br>
David<br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr">Jothy<br></div><br>
</div>