[Insight-users] Retrieving coordinates from BinaryMask3DMeshSource mesh

Andriy Fedorov fedorov at bwh.harvard.edu
Fri May 18 14:35:40 EDT 2007


>
> Do you have any suggestions as to what I may be missing?
>

Catherine,

The code I sent you is just for illustration purposes. Do NOT attempt
to compile it, because it's a method of a separate class which I have.
It will NOT compile.

You should be able to understand from that code how to extract the
information from ITK mesh and re-implement it within *your* class to
serve *your* purpose.

Andriy Fedorov



On 18 May 2007 13:25:56 -0500, Catherine Peloquin <cepeloquin at gmail.com> wrote:
> Andriy,
>
> Thank you for your assistance.  I am working to integrate your code snippet
> with my current program.  I included itkCommand.h, but am getting the error
> messages "expected primary-expression before "template"" and "expected `;'
> before "template"" at the line "template<class TInputMesh> void".
>
> I did not forget a ';' in the lines prior to the class creation.  I even
> tried re-creating the makefile with ccmake before attempting to compile the
> code, but get the same error messages.
>
> Do you have any suggestions as to what I may be missing?
>
> Thank you,
> Catherine Peloquin
>
>
>
> On 5/18/07, Andriy Fedorov <fedorov at bwh.harvard.edu> wrote:
> > Catherine,
> >
> > Below is a code snippet, which saves a mesh in RAW format (very
> > simple), given ITK surface mesh. Hope this helps you.
> >
> > Andriy Fedorov
> >
> >
> >
> > template<class TInputMesh> void
> > TriangularSurfaceMeshWriter<TInputMesh>::WriteRawMesh(){
> >       std::ofstream raw_mesh(m_FileName.c_str());
> >       raw_mesh << m_InputMesh->GetPoints()->Size() << " "
> >         << m_InputMesh->GetCells()->Size() << std::endl;
> >
> >       typename
> InputMeshType::PointsContainer::ConstIterator inPointsI;
> >       typename
> InputMeshType::CellsContainer::ConstIterator inCellsI;
> >       inPointsI = m_InputMesh->GetPoints()->Begin();
> >       while(inPointsI !=
> m_InputMesh->GetPoints()->End()){
> >         typename InputMeshType::PointType curPoint;
> >         curPoint = inPointsI.Value();
> >         raw_mesh << curPoint[0] << " " << curPoint[1] << " " <<
> > curPoint[2] << std::endl;
> >         inPointsI++;
> >       }
> >
> >       inCellsI = m_InputMesh->GetCells()->Begin();
> >       typedef itk::TriangleCell<typename InputMeshType::CellType>
> TriangleType;
> >       while(inCellsI != m_InputMesh->GetCells()->End()){
> >         TriangleType *curTri;
> >         typename TriangleType::PointIdIterator ptI;
> >         if(inCellsI.Value()->GetType() !=
> > InputMeshType::CellType::TRIANGLE_CELL)
> >           itkExceptionMacro(<<"Input surface mesh is not
> triangular");
> >         curTri = dynamic_cast<TriangleType*>(inCellsI.Value());
> >         ptI = curTri->PointIdsBegin();
> >         raw_mesh << *ptI++ << " " << *ptI++ << " " << *ptI++ << std::endl;
> >         inCellsI++;
> >       }
> >       raw_mesh.close();
> > }
> >
> >
> > > Message: 5
> > > Date: Fri, 18 May 2007 10:48:03 -0500
> > > From: "Catherine Peloquin" < cepeloquin at gmail.com>
> > > Subject: [Insight-users] Retrieving coordinates from
> > >         BinaryMask3DMeshSource  mesh
> > > To: insight-users at itk.org
> > > Message-ID:
> > >
> <3a72f1140705180848h35f387f2h6e418e3aa2a62ba3 at mail.gmail.com>
> > > Content-Type: text/plain; charset="iso-8859-1"
> > >
> > > I am using the BinaryMask3DMeshSource filter example in
> > > Insight/Examples/Filters/SurfaceExtraction.cxx to
> create an isosurface of a
> > > series of DICOM images.  I need to retrieve the coordinates of the
> output
> > > mesh's nodes (or the vertices of the triangles formed by the mesh) so I
> can
> > > then draw the surface in Coin3D.  I realize that I can also draw the
> surface
> > > in VTK, but I need to integrate the program into an application that
> uses
> > > Coin.
> > >
> > > In a previous post (located at
> > >
> http://public.kitware.com/pipermail/insight-users/2007-May/022211.html
> ) , I
> > > attempted to follow the methods of retrieving coordinates in the
> PointSet
> > > example in
> Insight/Examples/DataRepresentation/Mesh/PointSet2.cxx, but
> could
> > > not find a way to get the mesh points for the points container.
> > >
> > > How is it possible to get the x, y, and z coordinates of a mesh
> generated by
> > > the BinaryMask3DMeshSource filter?
> > >
> > > Thank you,
> > > Catherine Peloquin
> > > -------------- next part --------------
> > > An HTML attachment was scrubbed...
> > > URL:
> http://public.kitware.com/pipermail/insight-users/attachments/20070518/4bc94481/attachment-0001.htm
> > >
> >
>
>


More information about the Insight-users mailing list