00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkSimplexMesh_h
00018 #define __itkSimplexMesh_h
00019
00020 #if defined(_MSC_VER)
00021 #pragma warning ( disable : 4786 )
00022 #endif
00023
00024 #include "itkMesh.h"
00025 #include "itkSimplexMeshGeometry.h"
00026 #include "itkVertexCell.h"
00027 #include "itkTriangleCell.h"
00028 #include "itkCellInterface.h"
00029 #include "itkMapContainer.h"
00030 #include "itkFixedArray.h"
00031 #include "itkNumericTraits.h"
00032 #include <vector>
00033 #include <algorithm>
00034 #include <set>
00035
00036 namespace itk
00037 {
00050 template <typename TPixelType, unsigned int VDimension = 3,
00051 typename TMeshTraits = DefaultStaticMeshTraits< TPixelType , VDimension, VDimension, TPixelType , TPixelType , TPixelType >
00052 >
00053 class SimplexMesh : public Mesh<TPixelType, VDimension, TMeshTraits>
00054 {
00055 public:
00057 typedef SimplexMesh Self;
00058
00060 typedef Mesh<TPixelType, VDimension, TMeshTraits> Superclass;
00061
00063 typedef SmartPointer<Self> Pointer;
00064
00066 typedef SmartPointer<const Self> ConstPointer;
00067
00069 typedef typename SimplexMeshGeometry::IndexArray IndexArray;
00070
00072 typedef std::set<unsigned long> NeighborSetType;
00073
00075 typedef typename NeighborSetType::iterator NeighborSetIterator;
00076
00078 typedef std::vector<unsigned long> NeighborListType;
00079
00081 typedef typename TMeshTraits::PointType PointType;
00082
00084 typedef typename TMeshTraits::PointIdentifier PointIdentifier;
00085
00087 typedef typename PointType::VectorType VectorType;
00088
00090 typedef typename Superclass::CellType CellType;
00091
00093 typedef typename CellType::CellAutoPointer CellAutoPointer;
00094
00096 typedef itk::LineCell<CellType> LineType;
00097
00099 typedef itk::MapContainer<unsigned long, SimplexMeshGeometry *> GeometryMapType;
00100
00102 typedef typename GeometryMapType::Pointer GeometryMapPointer;
00103
00105 typedef typename GeometryMapType::Iterator GeometryMapIterator;
00106
00107
00109 itkNewMacro(Self);
00110
00112 itkTypeMacro(SimplexMesh, Mesh);
00113
00115 typedef TMeshTraits MeshTraits;
00116 typedef typename MeshTraits::PixelType PixelType;
00117 typedef typename MeshTraits::PointsContainer PointsContainer;
00118 typedef typename Superclass::PointsContainerPointer PointsContainerPointer;
00119 typedef typename Superclass::PointsContainer::Iterator PointsContainerIterator;
00120 typedef typename Superclass::PointsContainerConstIterator PointsContainerConstIterator;
00121 typedef typename Superclass::CellsContainerPointer CellsContainerPointer;
00122 typedef typename Superclass::CellsContainerIterator CellsContainerIterator;
00123
00125 itkSetMacro(GeometryData, GeometryMapPointer );
00126
00128 itkGetConstReferenceMacro(GeometryData, GeometryMapPointer );
00129
00131 itkSetMacro(LastCellId, unsigned long);
00132
00134 itkGetMacro(LastCellId, unsigned long);
00135
00140 virtual void CopyInformation(const DataObject *data);
00141
00142
00149 unsigned long AddEdge(unsigned long startPointId, unsigned long endPointId);
00150
00151
00159 unsigned long AddFace(CellAutoPointer &cellPointer);
00160
00165 unsigned long ReplaceFace(unsigned long replaceIndex, CellAutoPointer &cellPointer);
00166
00170 IndexArray GetNeighbors(unsigned long pointId) const;
00171
00175 NeighborListType* GetNeighbors(unsigned long pointId, unsigned int radius, NeighborListType* list = NULL) const;
00176
00182 void AddNeighbor(unsigned long pointId, unsigned long neighborId);
00183
00187 void ReplaceNeighbor(unsigned long pointId, unsigned long oldNeighborId,unsigned long newNeighborIdx);
00188
00192 void SwapNeighbors(unsigned long pointId, unsigned long firstNeighborId,unsigned long secondNeighborId);
00193
00197 void SetGeometryData(unsigned long pointId, SimplexMeshGeometry*);
00198
00202 void SetBarycentricCoordinates(unsigned long idx, PointType values);
00203
00207 PointType GetBarycentricCoordinates(unsigned long idx) const;
00208
00212 void SetReferenceMetrics(unsigned long idx, PointType values);
00213
00217 PointType GetReferenceMetrics(unsigned long idx) const;
00218
00222 void SetPhi(unsigned long idx, double values);
00223
00227 double GetPhi(unsigned long idx) const;
00228
00232 void SetMeanCurvature(unsigned long idx, double values);
00233
00237 double GetMeanCurvature(unsigned long idx) const;
00238
00242 void SetRadius(unsigned long idx, double values);
00243
00247 double GetRadius(unsigned long idx) const;
00248
00252 void SetDistance(unsigned long idx, double values);
00253
00257 double GetDistance(unsigned long idx) const;
00258
00260 PointType ComputeNormal(unsigned long idx ) const;
00261
00262 protected:
00264 SimplexMesh();
00265 virtual ~SimplexMesh();
00266 void PrintSelf(std::ostream& os, Indent indent) const;
00268
00272 GeometryMapPointer m_GeometryData;
00273
00274
00281 unsigned long m_LastCellId;
00282
00283
00284 private:
00285 SimplexMesh(const Self&);
00286
00287
00288
00289
00290 };
00291
00292 }
00293
00294 #ifndef ITK_MANUAL_INSTANTIATION
00295 #include "itkSimplexMesh.txx"
00296 #endif
00297
00298 #endif
00299