IGSTK
|
00001 /*========================================================================= 00002 00003 Program: Image Guided Surgery Software Toolkit 00004 Module: $RCSfile: igstkMeshObject.h,v $ 00005 Language: C++ 00006 Date: $Date: 2008-02-11 01:41:50 $ 00007 Version: $Revision: 1.9 $ 00008 00009 Copyright (c) ISC Insight Software Consortium. All rights reserved. 00010 See IGSTKCopyright.txt or http://www.igstk.org/copyright.htm for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 #ifndef __igstkMeshObject_h 00019 #define __igstkMeshObject_h 00020 00021 #include "igstkSpatialObject.h" 00022 #include <itkMeshSpatialObject.h> 00023 #include <itkTetrahedronCell.h> 00024 #include <itkTriangleCell.h> 00025 #include <itkDefaultDynamicMeshTraits.h> 00026 00027 namespace igstk 00028 { 00029 00030 namespace Friends 00031 { 00032 class MeshReaderToMeshSpatialObject; 00033 } 00034 00047 class MeshObject 00048 : public SpatialObject 00049 { 00050 00051 public: 00052 00054 igstkStandardClassTraitsMacro( MeshObject, SpatialObject ) 00055 00056 00059 typedef itk::DefaultDynamicMeshTraits<float,3,3> MeshTrait; 00060 00065 typedef itk::Mesh<float,3,MeshTrait> MeshType; 00066 00068 typedef itk::MeshSpatialObject<MeshType> MeshSpatialObjectType; 00069 00071 typedef MeshType::PointType PointType; 00072 typedef MeshType::CellTraits CellTraits; 00073 typedef itk::CellInterface< float, CellTraits > CellInterfaceType; 00074 typedef itk::TetrahedronCell<CellInterfaceType> TetraCellType; 00075 typedef itk::TriangleCell<CellInterfaceType> TriangleCellType; 00076 typedef MeshType::CellType CellType; 00077 typedef CellType::CellAutoPointer CellAutoPointer; 00078 00080 typedef MeshType::PointsContainer PointsContainer; 00081 typedef MeshType::PointsContainerPointer PointsContainerPointer; 00082 typedef MeshType::CellsContainer CellsContainer; 00083 typedef MeshType::CellsContainerPointer CellsContainerPointer; 00084 00085 public: 00086 00088 bool AddPoint(unsigned int id,float x, float y,float z); 00089 00091 bool AddTetrahedronCell(unsigned int id, 00092 unsigned int vertex1,unsigned int vertex2, 00093 unsigned int vertex3,unsigned int vertex4); 00094 00096 bool AddTriangleCell(unsigned int id, 00097 unsigned int vertex1, 00098 unsigned int vertex2, 00099 unsigned int vertex3); 00100 00102 const PointsContainerPointer GetPoints() const; 00103 00105 const CellsContainerPointer GetCells() const; 00106 00109 igstkFriendClassMacro( igstk::Friends::MeshReaderToMeshSpatialObject ); 00110 00111 protected: 00112 00114 MeshObject( void ); 00115 00117 ~MeshObject( void ); 00118 00120 virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const; 00121 00122 private: 00123 00125 void SetMesh( MeshType * mesh ); 00126 00128 MeshSpatialObjectType::Pointer m_MeshSpatialObject; 00129 MeshType::Pointer m_Mesh; 00130 00131 }; 00132 00133 } // end namespace igstk 00134 00135 #endif // __igstkMeshObject_h