[Insight-users] Mesh

Andriy Fedorov fedorov at bwh.harvard.edu
Thu Apr 10 16:17:03 EDT 2008


Nicolas,

There may be other issues, but here's one problem you have for sure:
in the code you posted cell_counter is always 0.

If this doesn't help, you might want to post the complete compile-able
code, where you observe the problem.

Andriy


>  Date: Thu, 10 Apr 2008 12:07:20 -0400
>  From: "Nicolas Roussel" <nroussel at mbfbioscience.com>
>  Subject: [Insight-users] Mesh
>  To: <insight-users at itk.org>
>  Message-ID:
>         <BA7400E0EC9AFE4D92DEE4EBEB5D9045012A790C at exchange2.microbrightfield.com>
>
>  Content-Type: text/plain; charset="us-ascii"
>
>  I am quite new to this mailing list.
>
>  I do have a question regarding Mesh processing.
>
>
>
>  My general question is this:
>
>
>
>  >From a mesh structure obtained from BinaryMask3DMeshSource I am trying
>  to extract the points of the mesh and the facets as triplets od point
>  indexes.
>
>
>
>  I though that I managed to do that, I can access the points as follows:
>
>  for (int j=0;j<nbp;j++)
>
>  {
>
>  mesh->GetPoint(j,&p);
>
>  pShape[k].SetPoint(p,j); //I am getting the coordinates from p [0],
>  p[1], p[2]
>
>  }
>
>
>
>
>
>  Getting the cells was somewat more complex
>
>
>
>   typedef MeshType::CellsContainer::ConstIterator  CellIterator;
>
>                     CellIterator cellIterator =
>  mesh->GetCells()->Begin();
>
>                     CellIterator cellEnd      = mesh->GetCells()->End();
>
>                     //int nbc=(int)cellEnd-(int)cellIterator;
>
>                     pShape[k].AllocateTriangleSet(nbc);
>
>
>
>                     int cell_counter=0;
>
>                     while( cellIterator != cellEnd )
>
>                         {
>
>                         CellType * cell = cellIterator.Value();
>
>                         ++cellIterator;
>
>
>
>                         int n2=cell->GetNumberOfPoints();
>
>                         CellType::PointIdIterator pit =
>  cell->PointIdsBegin();
>
>
>
>                         pShape[k].SetTriangle(pit,cell_counter); //I am
>  getting the indexes from pit[0], pit[1], pit[2]
>
>                         }
>
>
>
>
>
>  The points are correct and appear evenly spread across the object
>  surface, but the facets I obtained are incorrect and do not match the
>  object's surface.
>
>
>
>  Thank you for your help
>
>
>
>
>
>  Nicolas


More information about the Insight-users mailing list