IGSTK
igstkMeshObject.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Image Guided Surgery Software Toolkit
4  Module: $RCSfile: igstkMeshObject.h,v $
5  Language: C++
6  Date: $Date: 2008-02-11 01:41:50 $
7  Version: $Revision: 1.9 $
8 
9  Copyright (c) ISC Insight Software Consortium. All rights reserved.
10  See IGSTKCopyright.txt or http://www.igstk.org/copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 
18 #ifndef __igstkMeshObject_h
19 #define __igstkMeshObject_h
20 
21 #include "igstkSpatialObject.h"
22 #include <itkMeshSpatialObject.h>
23 #include <itkTetrahedronCell.h>
24 #include <itkTriangleCell.h>
25 #include <itkDefaultDynamicMeshTraits.h>
26 
27 namespace igstk
28 {
29 
30 namespace Friends
31 {
32 class MeshReaderToMeshSpatialObject;
33 }
34 
47 class MeshObject
48 : public SpatialObject
49 {
50 
51 public:
52 
55 
56 
59  typedef itk::DefaultDynamicMeshTraits<float,3,3> MeshTrait;
60 
65  typedef itk::Mesh<float,3,MeshTrait> MeshType;
66 
68  typedef itk::MeshSpatialObject<MeshType> MeshSpatialObjectType;
69 
71  typedef MeshType::PointType PointType;
72  typedef MeshType::CellTraits CellTraits;
73  typedef itk::CellInterface< float, CellTraits > CellInterfaceType;
74  typedef itk::TetrahedronCell<CellInterfaceType> TetraCellType;
75  typedef itk::TriangleCell<CellInterfaceType> TriangleCellType;
76  typedef MeshType::CellType CellType;
77  typedef CellType::CellAutoPointer CellAutoPointer;
78 
80  typedef MeshType::PointsContainer PointsContainer;
82  typedef MeshType::CellsContainer CellsContainer;
84 
85 public:
86 
88  bool AddPoint(unsigned int id,float x, float y,float z);
89 
91  bool AddTetrahedronCell(unsigned int id,
92  unsigned int vertex1,unsigned int vertex2,
93  unsigned int vertex3,unsigned int vertex4);
94 
96  bool AddTriangleCell(unsigned int id,
97  unsigned int vertex1,
98  unsigned int vertex2,
99  unsigned int vertex3);
100 
102  const PointsContainerPointer GetPoints() const;
103 
105  const CellsContainerPointer GetCells() const;
106 
109  igstkFriendClassMacro( igstk::Friends::MeshReaderToMeshSpatialObject );
110 
111 protected:
112 
114  MeshObject( void );
115 
117  ~MeshObject( void );
118 
120  virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const;
121 
122 private:
123 
125  void SetMesh( MeshType * mesh );
126 
128  MeshSpatialObjectType::Pointer m_MeshSpatialObject;
129  MeshType::Pointer m_Mesh;
130 
131 };
132 
133 } // end namespace igstk
134 
135 #endif // __igstkMeshObject_h
Implements the 3-dimensional mesh structure.
MeshType::PointType PointType
Type of the point used to describe the mesh.
bool AddTetrahedronCell(unsigned int id, unsigned int vertex1, unsigned int vertex2, unsigned int vertex3, unsigned int vertex4)
Add a tetrahedron cell to the mesh.
#define igstkFriendClassMacro(type)
Create a Macro for friend class.
Definition: igstkMacros.h:137
const PointsContainerPointer GetPoints() const
Return the points.
Geometrical abstraction of physical objects present in the surgical scene.
MeshType::CellsContainerPointer CellsContainerPointer
bool AddTriangleCell(unsigned int id, unsigned int vertex1, unsigned int vertex2, unsigned int vertex3)
Add a triangle cell to the mesh.
MeshType::PointsContainerPointer PointsContainerPointer
itk::CellInterface< float, CellTraits > CellInterfaceType
itk::MeshSpatialObject< MeshType > MeshSpatialObjectType
Type of the internal MeshSpatialObject.
MeshType::CellTraits CellTraits
#define igstkStandardClassTraitsMacro(classname, superclassname)
Convenience macro for traits of a non-templated class.
Definition: igstkMacros.h:275
const CellsContainerPointer GetCells() const
Return the cells.
igstkStandardClassTraitsMacro(MeshObject, SpatialObject) typedef itk typedef itk::Mesh< float, 3, MeshTrait > MeshType
Macro with standard traits declarations.
bool AddPoint(unsigned int id, float x, float y, float z)
Add a point to the mesh.
MeshType::PointsContainer PointsContainer
Type of containers used to store the points and cells.
CellType::CellAutoPointer CellAutoPointer
::itk::SmartPointer< Self > Pointer
Definition: igstkObject.h:50
MeshType::CellsContainer CellsContainer
MeshType::CellType CellType
itk::TriangleCell< CellInterfaceType > TriangleCellType
itk::TetrahedronCell< CellInterfaceType > TetraCellType
virtual void PrintSelf(std::ostream &os, itk::Indent indent) const
Print object information.