ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkSimplexMesh.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkSimplexMesh_h
19 #define itkSimplexMesh_h
20 
21 #include "itkMesh.h"
22 #include "itkSimplexMeshGeometry.h"
23 #include "itkVertexCell.h"
24 #include "itkTriangleCell.h"
25 #include "itkFixedArray.h"
26 #include <vector>
27 #include <algorithm>
28 #include <set>
29 
30 namespace itk
31 {
43 template< typename TPixelType, unsigned int VDimension = 3,
44  typename TMeshTraits =
45  DefaultStaticMeshTraits< TPixelType, VDimension, VDimension, TPixelType, TPixelType, TPixelType >
46  >
47 class ITK_TEMPLATE_EXPORT SimplexMesh:public Mesh< TPixelType, VDimension, TMeshTraits >
48 {
49 public:
51  typedef SimplexMesh Self;
52 
55 
58 
61 
64 
66  typedef std::set< SizeValueType > NeighborSetType;
67 
69  typedef typename NeighborSetType::iterator NeighborSetIterator;
70 
72  typedef std::vector< SizeValueType > NeighborListType;
73 
76 
78  typedef typename TMeshTraits::PointIdentifier PointIdentifier;
79 
82 
85 
87  typedef typename Superclass::CellType CellType;
88 
91 
94 
98 
101 
105 
107  itkNewMacro(Self);
108 
110  itkTypeMacro(SimplexMesh, Mesh);
111 
113  typedef TMeshTraits MeshTraits;
114  typedef typename MeshTraits::PixelType PixelType;
115  typedef typename MeshTraits::PointsContainer PointsContainer;
116  typedef typename Superclass::PointsContainerPointer PointsContainerPointer;
117  typedef typename Superclass::PointsContainer::Iterator PointsContainerIterator;
118  typedef typename Superclass::PointsContainerConstIterator PointsContainerConstIterator;
119  typedef typename Superclass::CellsContainerPointer CellsContainerPointer;
120  typedef typename Superclass::CellsContainerConstPointer CellsContainerConstPointer;
121  typedef typename Superclass::CellsContainerIterator CellsContainerIterator;
122  typedef typename Superclass::CellsContainerConstIterator CellsContainerConstIterator;
124 
126  itkSetMacro(GeometryData, GeometryMapPointer);
127 
129  itkGetConstReferenceMacro(GeometryData, GeometryMapPointer);
130 
132  itkSetMacro(LastCellId, CellIdentifier);
133 
135  itkGetConstMacro(LastCellId, CellIdentifier);
136 
141  virtual void CopyInformation(const DataObject *data) ITK_OVERRIDE;
142 
149  CellIdentifier AddEdge(PointIdentifier startPointId, PointIdentifier endPointId);
150 
158  CellIdentifier AddFace(CellAutoPointer & cellPointer);
159 
164  CellIdentifier ReplaceFace(CellIdentifier replaceIndex, CellAutoPointer & cellPointer);
165 
169  IndexArray GetNeighbors(PointIdentifier pointId) const;
170 
174  NeighborListType * GetNeighbors(PointIdentifier pointId, unsigned int radius, NeighborListType *list = ITK_NULLPTR) const;
175 
181  void AddNeighbor(PointIdentifier pointId, PointIdentifier neighborId);
182 
186  void ReplaceNeighbor(PointIdentifier pointId, PointIdentifier oldNeighborId, PointIdentifier newNeighborIdx);
187 
191  void SwapNeighbors(PointIdentifier pointId, PointIdentifier firstNeighborId, PointIdentifier secondNeighborId);
192 
196  void SetGeometryData(PointIdentifier pointId, SimplexMeshGeometry *);
197 
201  void SetBarycentricCoordinates(PointIdentifier idx, PointType values);
202 
206  PointType GetBarycentricCoordinates(PointIdentifier idx) const;
207 
211  void SetReferenceMetrics(PointIdentifier idx, PointType values);
212 
216  PointType GetReferenceMetrics(PointIdentifier idx) const;
217 
221  void SetPhi(PointIdentifier idx, double values);
222 
226  double GetPhi(PointIdentifier idx) const;
227 
231  void SetMeanCurvature(PointIdentifier idx, double values);
232 
236  double GetMeanCurvature(PointIdentifier idx) const;
237 
241  void SetRadius(PointIdentifier idx, double values);
242 
246  double GetRadius(PointIdentifier idx) const;
247 
251  void SetDistance(PointIdentifier idx, double values);
252 
256  double GetDistance(PointIdentifier idx) const;
257 
259  CovariantVectorType ComputeNormal(PointIdentifier idx) const;
260 
261 protected:
263  SimplexMesh();
264  virtual ~SimplexMesh() ITK_OVERRIDE;
265  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
267 
271  GeometryMapPointer m_GeometryData;
272 
279  CellIdentifier m_LastCellId;
280 
281 private:
282  ITK_DISALLOW_COPY_AND_ASSIGN(SimplexMesh);
283 }; // End Class: SimplexMesh
284 } // end namespace itk
285 
286 #ifndef ITK_MANUAL_INSTANTIATION
287 #include "itkSimplexMesh.hxx"
288 #endif
289 
290 #endif
GeometryMapType::Pointer GeometryMapPointer
PointType::VectorType VectorType
SmartPointer< Self > Pointer
Represents a line segment for a Mesh.
Definition: itkLineCell.h:42
SelfAutoPointer CellAutoPointer
MeshTraits::PointsContainer PointsContainer
GeometryMapType::Iterator GeometryMapIterator
Mesh< TPixelType, VDimension, TMeshTraits > Superclass
TMeshTraits::PointIdentifier PointIdentifier
CovariantVector< typename VectorType::ValueType, 3 > CovariantVectorType
MeshTraits::PointIdentifier PointIdentifier
Definition: itkPointSet.h:105
std::set< SizeValueType > NeighborSetType
Superclass::CellsContainerConstIterator CellsContainerConstIterator
The class represents a 2-simplex mesh.
A wrapper of the STL &quot;map&quot; container.
Superclass::CellIdentifier CellIdentifier
Superclass::CellsContainerIterator CellsContainerIterator
Superclass::PointsContainer::Iterator PointsContainerIterator
MeshTraits::CellIdentifier CellIdentifier
Definition: itkMesh.h:148
GeometryMapType::ConstIterator GeometryMapConstIterator
NeighborSetType::iterator NeighborSetIterator
TMeshTraits::PointType PointType
Superclass::CellsContainerPointer CellsContainerPointer
Implements the N-dimensional mesh structure.
Definition: itkMesh.h:108
std::vector< SizeValueType > NeighborListType
CellType::CellAutoPointer CellAutoPointer
The non-const iterator type for the map.
Superclass::CellType CellType
The const iterator type for the map.
CellType::CellAutoPointer CellAutoPointer
Definition: itkMesh.h:190
SimplexMeshGeometry::IndexArray IndexArray
MeshTraits::PointType PointType
Definition: itkPointSet.h:106
SmartPointer< const Self > ConstPointer
SimplexMesh Self
handle geometric properties for vertices of a simplx mesh
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Superclass::CellsContainerConstPointer CellsContainerConstPointer
TMeshTraits MeshTraits
itk::LineCell< CellType > LineType
MeshTraits::PixelType PixelType
Superclass::PointsContainerConstIterator PointsContainerConstIterator
A templated class holding a n-Dimensional covariant vector.
Base class for all data objects in ITK.
Superclass::PointsContainerPointer PointsContainerPointer
itk::MapContainer< SizeValueType, SimplexMeshGeometry * > GeometryMapType