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 <itkCovariantVector.h>
00033 #include <vector>
00034 #include <algorithm>
00035 #include <set>
00036
00037 namespace itk
00038 {
00049 template <typename TPixelType, unsigned int VDimension = 3,
00050 typename TMeshTraits = DefaultStaticMeshTraits< TPixelType , VDimension, VDimension, TPixelType , TPixelType , TPixelType >
00051 >
00052 class SimplexMesh : public Mesh<TPixelType, VDimension, TMeshTraits>
00053 {
00054 public:
00056 typedef SimplexMesh Self;
00057
00059 typedef Mesh<TPixelType, VDimension, TMeshTraits> Superclass;
00060
00062 typedef SmartPointer<Self> Pointer;
00063
00065 typedef SmartPointer<const Self> ConstPointer;
00066
00068 typedef typename SimplexMeshGeometry::IndexArray IndexArray;
00069
00071 typedef std::set<unsigned long> NeighborSetType;
00072
00074 typedef typename NeighborSetType::iterator NeighborSetIterator;
00075
00077 typedef std::vector<unsigned long> NeighborListType;
00078
00080 typedef typename TMeshTraits::PointType PointType;
00081
00083 typedef typename TMeshTraits::PointIdentifier PointIdentifier;
00084
00086 typedef typename PointType::VectorType VectorType;
00087
00089 typedef CovariantVector<typename VectorType::ValueType, 3> CovariantVectorType;
00090
00092 typedef typename Superclass::CellType CellType;
00093
00095 typedef typename CellType::CellAutoPointer CellAutoPointer;
00096
00098 typedef itk::LineCell<CellType> LineType;
00099
00102 typedef itk::MapContainer<unsigned long, SimplexMeshGeometry *> GeometryMapType;
00103
00105 typedef typename GeometryMapType::Pointer GeometryMapPointer;
00106
00108 typedef typename GeometryMapType::Iterator GeometryMapIterator;
00109
00111 itkNewMacro(Self);
00112
00114 itkTypeMacro(SimplexMesh, Mesh);
00115
00117 typedef TMeshTraits MeshTraits;
00118 typedef typename MeshTraits::PixelType PixelType;
00119 typedef typename MeshTraits::PointsContainer PointsContainer;
00120 typedef typename Superclass::PointsContainerPointer PointsContainerPointer;
00121 typedef typename Superclass::PointsContainer::Iterator PointsContainerIterator;
00122 typedef typename Superclass::PointsContainerConstIterator PointsContainerConstIterator;
00123 typedef typename Superclass::CellsContainerPointer CellsContainerPointer;
00124 typedef typename Superclass::CellsContainerIterator CellsContainerIterator;
00125
00127 itkSetMacro(GeometryData, GeometryMapPointer );
00128
00130 itkGetConstReferenceMacro(GeometryData, GeometryMapPointer );
00131
00133 itkSetMacro(LastCellId, unsigned long);
00134
00136 itkGetConstMacro(LastCellId, unsigned long);
00137
00142 virtual void CopyInformation(const DataObject *data);
00143
00144
00151 unsigned long AddEdge(unsigned long startPointId, unsigned long endPointId);
00152
00153
00161 unsigned long AddFace(CellAutoPointer &cellPointer);
00162
00167 unsigned long ReplaceFace(unsigned long replaceIndex, CellAutoPointer &cellPointer);
00168
00172 IndexArray GetNeighbors(unsigned long pointId) const;
00173
00177 NeighborListType* GetNeighbors(unsigned long pointId, unsigned int radius, NeighborListType* list = NULL) const;
00178
00184 void AddNeighbor(unsigned long pointId, unsigned long neighborId);
00185
00189 void ReplaceNeighbor(unsigned long pointId, unsigned long oldNeighborId,unsigned long newNeighborIdx);
00190
00194 void SwapNeighbors(unsigned long pointId, unsigned long firstNeighborId,unsigned long secondNeighborId);
00195
00199 void SetGeometryData(unsigned long pointId, SimplexMeshGeometry*);
00200
00204 void SetBarycentricCoordinates(unsigned long idx, PointType values);
00205
00209 PointType GetBarycentricCoordinates(unsigned long idx) const;
00210
00214 void SetReferenceMetrics(unsigned long idx, PointType values);
00215
00219 PointType GetReferenceMetrics(unsigned long idx) const;
00220
00224 void SetPhi(unsigned long idx, double values);
00225
00229 double GetPhi(unsigned long idx) const;
00230
00234 void SetMeanCurvature(unsigned long idx, double values);
00235
00239 double GetMeanCurvature(unsigned long idx) const;
00240
00244 void SetRadius(unsigned long idx, double values);
00245
00249 double GetRadius(unsigned long idx) const;
00250
00254 void SetDistance(unsigned long idx, double values);
00255
00259 double GetDistance(unsigned long idx) const;
00260
00262 CovariantVectorType ComputeNormal(unsigned long idx ) const;
00263
00264 protected:
00266 SimplexMesh();
00267 virtual ~SimplexMesh();
00268 void PrintSelf(std::ostream& os, Indent indent) const;
00270
00274 GeometryMapPointer m_GeometryData;
00275
00282 unsigned long m_LastCellId;
00283
00284 private:
00285 SimplexMesh(const Self&);
00286
00287 };
00288
00289 }
00290
00291 #ifndef ITK_MANUAL_INSTANTIATION
00292 #include "itkSimplexMesh.txx"
00293 #endif
00294
00295 #endif
00296