[Insight-users] Problem in mesh visualization with itkQuadEdgeMesh.. still waiting for a response…please help!

alex gouaillard alexandre_gouaillard at hms.harvard.edu
Sun Mar 1 05:12:30 EST 2009


hi martine,

indeed in an itk:QuadEdgeMesh you have only Polygon cells, wether they  
represent triangles, quad or actual n-gons.

The code you are using is using the multivisitor patern, where you  
have to define yourself what kind of cells you are interested in. Here  
is some code, untested, that should put you in the right direction.

You first define the types:

   // typedef the itk cells we are interested in
   typedef itk::CellInterface<MeshType::PixelType,MeshType::CellTraits  
 >  CellInterfaceType;
   typedef itk::TriangleCell<CellInterfaceType>      floatTriangleCell;
   typedef itk::QuadrilateralCell<CellInterfaceType>  
floatQuadrilateralCell;

here you should add something like this

   typedef itk::PolygonCell< CellInterfaceType> floatPolygonCell;

then you should create a flavor of the Visit method that takes one  
object of this new type as argument in the VistVTKCellsClass

   void Visit(unsigned long, floatPolygonCell* t )
     {
     // you have to write it yourself.
     // you might just want to make a switch,
     // cast to the right triangle / quad type
     // and call the corresponding Visit method
     }

almost there,
add a visitor type like this

typedef itk::CellInterfaceVisitorImplementation<vtkFloatingPointType,  
MeshType::CellTraits,itk::PolygonCell<  
itk::CellInterface<MeshType::PixelType, MeshType::CellTraits > >,
   VistVTKCellsClass> PolygonVisitor;

finally, in the MeshToUnstructuredGrid function, add an object of the  
new visitor type, and register it to the multivisitor:

  PolygonVisitor::Pointer pv = PolygonVisitor::New();
  mv->AddVisitor(qv);

and you re done.

Computing curvature should then be straightforward with our classes.  
Note that this class was made for computation, and that influenced the  
design, most noticeably where we store curvature values.

Vizualizing will require you to transfer curvature values from  
pointype templates to vtk data-array. Brace yourself, and dig into the  
extended traits ;-)

alex.

On Feb 28, 2009, at 10:52 PM, Martine Lefevre wrote:

> Hi , could you give me more details ...how and where I add them ?
> Thanks
> Martine
>
>
> --- En date de : Sam 28.2.09, nadan zhu <nadan.zhu at gmail.com> a  
> écrit :
> De: nadan zhu <nadan.zhu at gmail.com>
> Objet: Re: [Insight-users] Problem in mesh visualization with  
> itkQuadEdgeMesh.. still waiting for a response…please help!
> À: "Martine Lefevre" <martine_lef at yahoo.fr>
> Cc: "Luis Ibanez" <luis.ibanez at kitware.com>, "insight itk" <insight-users at itk.org 
> >
> Date: Samedi 28 Février 2009, 5h14
>
> HI, Martine
>        Please add itk::PolygonCell type and PolygonVisitor. It works  
> for me.
>
>
> wanlin
>
>
>
>
>
> <ATT00001.txt>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090301/cc60845c/attachment.htm>


More information about the Insight-users mailing list