ITK  5.0.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:
50  ITK_DISALLOW_COPY_AND_ASSIGN(SimplexMesh);
51 
53  using Self = SimplexMesh;
54 
57 
60 
63 
66 
68  using NeighborSetType = std::set< SizeValueType >;
69 
71  using NeighborSetIterator = typename NeighborSetType::iterator;
72 
74  using NeighborListType = std::vector< SizeValueType >;
75 
78 
80  using PointIdentifier = typename TMeshTraits::PointIdentifier;
81 
84 
87 
89  using CellType = typename Superclass::CellType;
90 
93 
96 
100 
103 
107 
109  itkNewMacro(Self);
110 
112  itkTypeMacro(SimplexMesh, Mesh);
113 
115  using MeshTraits = TMeshTraits;
116  using PixelType = typename MeshTraits::PixelType;
117  using PointsContainer = typename MeshTraits::PointsContainer;
118  using PointsContainerPointer = typename Superclass::PointsContainerPointer;
119  using PointsContainerIterator = typename Superclass::PointsContainer::Iterator;
120  using PointsContainerConstIterator = typename Superclass::PointsContainerConstIterator;
121  using CellsContainerPointer = typename Superclass::CellsContainerPointer;
122  using CellsContainerConstPointer = typename Superclass::CellsContainerConstPointer;
123  using CellsContainerIterator = typename Superclass::CellsContainerIterator;
124  using CellsContainerConstIterator = typename Superclass::CellsContainerConstIterator;
126 
128  itkSetMacro(GeometryData, GeometryMapPointer);
129 
131  itkGetConstReferenceMacro(GeometryData, GeometryMapPointer);
132 
134  itkSetMacro(LastCellId, CellIdentifier);
135 
137  itkGetConstMacro(LastCellId, CellIdentifier);
138 
143  void CopyInformation(const DataObject *data) override;
144 
151  CellIdentifier AddEdge(PointIdentifier startPointId, PointIdentifier endPointId);
152 
160  CellIdentifier AddFace(CellAutoPointer & cellPointer);
161 
166  CellIdentifier ReplaceFace(CellIdentifier replaceIndex, CellAutoPointer & cellPointer);
167 
171  IndexArray GetNeighbors(PointIdentifier pointId) const;
172 
176  NeighborListType * GetNeighbors(PointIdentifier pointId, unsigned int radius, NeighborListType *list = nullptr) const;
177 
183  void AddNeighbor(PointIdentifier pointId, PointIdentifier neighborId);
184 
188  void ReplaceNeighbor(PointIdentifier pointId, PointIdentifier oldNeighborId, PointIdentifier newNeighborIdx);
189 
193  void SwapNeighbors(PointIdentifier pointId, PointIdentifier firstNeighborId, PointIdentifier secondNeighborId);
194 
198  void SetGeometryData(PointIdentifier pointId, SimplexMeshGeometry *);
199 
203  void SetBarycentricCoordinates(PointIdentifier idx, PointType values);
204 
208  PointType GetBarycentricCoordinates(PointIdentifier idx) const;
209 
213  void SetReferenceMetrics(PointIdentifier idx, PointType values);
214 
218  PointType GetReferenceMetrics(PointIdentifier idx) const;
219 
223  void SetPhi(PointIdentifier idx, double values);
224 
228  double GetPhi(PointIdentifier idx) const;
229 
233  void SetMeanCurvature(PointIdentifier idx, double values);
234 
238  double GetMeanCurvature(PointIdentifier idx) const;
239 
243  void SetRadius(PointIdentifier idx, double values);
244 
248  double GetRadius(PointIdentifier idx) const;
249 
253  void SetDistance(PointIdentifier idx, double values);
254 
258  double GetDistance(PointIdentifier idx) const;
259 
261  CovariantVectorType ComputeNormal(PointIdentifier idx) const;
262 
263 protected:
265  SimplexMesh();
266  ~SimplexMesh() override;
267  void PrintSelf(std::ostream & os, Indent indent) const override;
269 
274 
282 }; // End Class: SimplexMesh
283 } // end namespace itk
284 
285 #ifndef ITK_MANUAL_INSTANTIATION
286 #include "itkSimplexMesh.hxx"
287 #endif
288 
289 #endif
std::set< SizeValueType > NeighborSetType
Represents a line segment for a Mesh.
Definition: itkLineCell.h:42
typename PointsContainer::Pointer PointsContainerPointer
Definition: itkPointSet.h:116
typename MeshTraits::PixelType PixelType
Definition: itkPointSet.h:103
typename CellsContainer::ConstIterator CellsContainerConstIterator
Definition: itkMesh.h:177
The class represents a 2-simplex mesh.
A wrapper of the STL &quot;map&quot; container.
SelfAutoPointer CellAutoPointer
std::vector< SizeValueType > NeighborListType
typename SimplexMeshGeometry::IndexArray IndexArray
typename PointsContainer::ConstIterator PointsContainerConstIterator
Definition: itkPointSet.h:122
itk::FixedArray< IdentifierType, 3 > IndexArray
Implements the N-dimensional mesh structure.
Definition: itkMesh.h:108
An abstract interface for cells.
TMeshTraits MeshTraits
Definition: itkPointSet.h:102
typename MeshTraits::PointType PointType
Definition: itkPointSet.h:108
typename PointType::VectorType VectorType
The non-const iterator type for the map.
typename MeshTraits::PointsContainer PointsContainer
Definition: itkPointSet.h:109
CellIdentifier m_LastCellId
The const iterator type for the map.
GeometryMapPointer m_GeometryData
typename CellType::CellAutoPointer CellAutoPointer
Definition: itkMesh.h:189
typename PointsContainer::Iterator PointsContainerIterator
Definition: itkPointSet.h:123
typename NeighborSetType::iterator NeighborSetIterator
typename CellsContainer::Pointer CellsContainerPointer
Definition: itkMesh.h:165
typename GeometryMapType::ConstIterator GeometryMapConstIterator
typename GeometryMapType::Iterator GeometryMapIterator
typename CellsContainer::ConstPointer CellsContainerConstPointer
Definition: itkMesh.h:166
handle geometric properties for vertices of a simplx mesh
typename MeshTraits::PointIdentifier PointIdentifier
Definition: itkPointSet.h:107
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename GeometryMapType::Pointer GeometryMapPointer
typename MeshTraits::CellIdentifier CellIdentifier
Definition: itkMesh.h:147
Base class for most ITK classes.
Definition: itkObject.h:60
A templated class holding a n-Dimensional covariant vector.
Base class for all data objects in ITK.
typename CellsContainer::Iterator CellsContainerIterator
Definition: itkMesh.h:178