[Insight-users] from vtk to msh : Mising itk::Mesh with igstk::MeshObject

Luis Ibanez luis.ibanez at kitware.com
Thu Mar 12 11:22:12 EDT 2009


Hi Luca,

There is something inconsistent between the code snippets that you
posted and the error message.

 From the error message, it seems that you are attempting to store
the raw pointer of an itk::Mesh<> directly into the smart pointer
of an igstk::MeshObject.  Which is indeed an invalid operation.

Instead of

       m_Mesh= m_VtkPolyDataReader->GetOutput();

you should do

      m_Mesh->SetMesh( m_VtkPolyDataReader->GetOutput() );


---

What is misleading about your code snippet is that it shows the
declarations:

A) typedef igstk::MeshObject                  MeshObjectType;
    typedef MeshObjectType::MeshType           MeshType;
    typedef ::itk::VTKPolyDataReader< MeshType > VtkPolyDataReaderType;

and in another section:


B) MeshType::Pointer m_Mesh;


It seems that the typedef that defined the MeshType in (B) is not
the same that we see in (A).

 From the error message it looks like MeshType in (B) was declared
as

              "typedef igstk::MeshObject    MeshType;"



    Regards,


        Luis



--------------------
Luca Ramundo wrote:
> 
> 
> Hi everybody..
> i'm writing code to convert vtk file in msh file.. this is my snippet of 
> code:
> 
> #include <itkVTKPolyDataReader.h>
> 
> ...
> 
> typedef igstk::MeshObject                  MeshObjectType;
> typedef MeshObjectType::MeshType           MeshType;
> typedef ::itk::VTKPolyDataReader< MeshType > VtkPolyDataReaderType;
> 
> ...
> 
> VtkPolyDataReaderType::Pointer  m_VtkPolyDataReader;
> m_VtkPolyDataReader = VtkPolyDataReaderType::New();
> m_VtkPolyDataReader->SetFileName( fileName);
> m_VtkPolyDataReader->Update();
> 
> MeshType::Pointer m_Mesh;
> m_Mesh= m_VtkPolyDataReader->GetOutput();
> MeshObjectObserver::Pointer observer = MeshObjectObserver::New();
> m_Mesh->AddObserver( igstk::MeshReader::MeshModifiedEvent(), observer);
> 
> but id doesn't work.. i receive an error on this row:
> 
> m_Mesh= m_VtkPolyDataReader->GetOutput();
> 
> error C2679: binary '=' : no operator found which takes a right-hand 
> operand of type 'itk::Mesh *' (or there is no acceptable conversion)
> with
> [
> TPixelType=float,
>  VDimension=3,
> TMeshTraits=igstk::MeshObject::MeshTrait
> ]
> 
> c:\users\luca\documents\progettotesi\src\insighttoolkit\code\common\itkSmartPointer.h(112): 
> could be 'itk::SmartPointer &itk::SmartPointer::operator =(const 
> itk::SmartPointer &)' with
> [
> TObjectType=igstk::MeshObject::Self
> ]
> 
> c:\users\luca\documents\progettotesi\src\insighttoolkit\code\common\itkSmartPointer.h(116): 
> or 'itk::SmartPointer &itk::SmartPointer::operator =(igstk::MeshObject *)'
> with
>  [
> TObjectType=igstk::MeshObject::Self
> ]
> while trying to match the argument list '(igstk::MeshObject::Pointer, 
> itk::Mesh *)'
> with
>  [
> TPixelType=float,
> VDimension=3,
> TMeshTraits=igstk::MeshObject::MeshTrait
> ]
> 
> Who can help me, please?
> 
> ------------------------------------------------------------------------
> La tua immagine personale dinamica per Messenger? Creala gratis con 
> Avatar Studio! <http://clk.atdmt.com/GBL/go/136430519/direct/01/>
> ------------------------------------------------------------------------
> E' arrivato Messenger 2009. Provalo insieme ai nuovi servizi Windows 
> Live. <http://clk.atdmt.com/GBL/go/136430510/direct/01/>
> 
> 
> ------------------------------------------------------------------------
> 
> _____________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.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