ITK  5.4.0
Insight Toolkit
itkSimplexMesh.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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  * https://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,
44  unsigned int VDimension = 3,
45  typename TMeshTraits =
46  DefaultStaticMeshTraits<TPixelType, VDimension, VDimension, TPixelType, TPixelType, TPixelType>>
47 class ITK_TEMPLATE_EXPORT SimplexMesh : public Mesh<TPixelType, VDimension, TMeshTraits>
48 {
49 public:
50  ITK_DISALLOW_COPY_AND_MOVE(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 typename Superclass::CellType;
90 
93 
96 
100 
103 
107 
108  // Backward compatibility to expose enum from class.
110 
112  itkNewMacro(Self);
113 
115  itkOverrideGetNameOfClassMacro(SimplexMesh);
116 
118  using MeshTraits = TMeshTraits;
119  using PixelType = typename MeshTraits::PixelType;
120  using PointsContainer = typename MeshTraits::PointsContainer;
121  using typename Superclass::PointsContainerPointer;
122  using PointsContainerIterator = typename Superclass::PointsContainer::Iterator;
123  using typename Superclass::PointsContainerConstIterator;
124  using typename Superclass::CellsContainerPointer;
125  using typename Superclass::CellsContainerConstPointer;
126  using typename Superclass::CellsContainerIterator;
127  using typename Superclass::CellsContainerConstIterator;
128  using typename Superclass::CellIdentifier;
129 
131  itkSetMacro(GeometryData, GeometryMapPointer);
132 
134  itkGetConstReferenceMacro(GeometryData, GeometryMapPointer);
135 
137  itkSetMacro(LastCellId, CellIdentifier);
138 
140  itkGetConstMacro(LastCellId, CellIdentifier);
141 
146  void
147  CopyInformation(const DataObject * data) override;
148 
155  CellIdentifier
156  AddEdge(PointIdentifier startPointId, PointIdentifier endPointId);
157 
165  CellIdentifier
166  AddFace(CellAutoPointer & cellPointer);
167 
172  CellIdentifier
173  ReplaceFace(CellIdentifier replaceIndex, CellAutoPointer & cellPointer);
174 
178  IndexArray
179  GetNeighbors(PointIdentifier idx) const;
180 
185  GetNeighbors(PointIdentifier idx, unsigned int radius, NeighborListType * list = nullptr) const;
186 
192  void
193  AddNeighbor(PointIdentifier pointIdx, PointIdentifier neighborIdx);
194 
198  void
199  ReplaceNeighbor(PointIdentifier pointIdx, PointIdentifier oldIdx, PointIdentifier newIdx);
200 
204  void
205  SwapNeighbors(PointIdentifier pointIdx, PointIdentifier firstIdx, PointIdentifier secondIdx);
206 
210  void
211  SetGeometryData(PointIdentifier pointId, SimplexMeshGeometry *);
212 
216  void
217  SetBarycentricCoordinates(PointIdentifier idx, PointType value);
218 
222  PointType
223  GetBarycentricCoordinates(PointIdentifier idx) const;
224 
228  void
229  SetReferenceMetrics(PointIdentifier idx, PointType value);
230 
234  PointType
235  GetReferenceMetrics(PointIdentifier idx) const;
236 
240  void
241  SetPhi(PointIdentifier idx, double value);
242 
246  double
247  GetPhi(PointIdentifier idx) const;
248 
252  void
253  SetMeanCurvature(PointIdentifier idx, double value);
254 
258  double
259  GetMeanCurvature(PointIdentifier idx) const;
260 
264  void
265  SetRadius(PointIdentifier idx, double value);
266 
270  double
271  GetRadius(PointIdentifier idx) const;
272 
276  void
277  SetDistance(PointIdentifier idx, double value);
278 
282  double
283  GetDistance(PointIdentifier idx) const;
284 
287  ComputeNormal(PointIdentifier idx) const;
288 
289 protected:
291  SimplexMesh();
292  ~SimplexMesh() override;
293  void
294  PrintSelf(std::ostream & os, Indent indent) const override;
300  GeometryMapPointer m_GeometryData{};
301 
308  CellIdentifier m_LastCellId{};
309 }; // End Class: SimplexMesh
310 } // end namespace itk
311 
312 #ifndef ITK_MANUAL_INSTANTIATION
313 # include "itkSimplexMesh.hxx"
314 #endif
315 
316 #endif
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::SimplexMesh::GeometryMapConstIterator
typename GeometryMapType::ConstIterator GeometryMapConstIterator
Definition: itkSimplexMesh.h:106
itk::SimplexMesh::NeighborSetIterator
typename NeighborSetType::iterator NeighborSetIterator
Definition: itkSimplexMesh.h:71
itk::PointSet::PointsContainerIterator
typename PointsContainer::Iterator PointsContainerIterator
Definition: itkPointSet.h:125
itk::GTest::TypedefsAndConstructors::Dimension2::VectorType
ImageBaseType::SpacingType VectorType
Definition: itkGTestTypedefsAndConstructors.h:53
itk::GTest::TypedefsAndConstructors::Dimension2::PointType
ImageBaseType::PointType PointType
Definition: itkGTestTypedefsAndConstructors.h:51
itk::MapContainer::Iterator
The non-const iterator type for the map.
Definition: itkMapContainer.h:171
itk::MapContainer::ConstIterator
The const iterator type for the map.
Definition: itkMapContainer.h:253
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::SimplexMeshGeometry
handle geometric properties for vertices of a simplex mesh
Definition: itkSimplexMeshGeometry.h:44
itk::MapContainer
A wrapper of the STL "map" container.
Definition: itkMapContainer.h:45
itk::Mesh::CellAutoPointer
typename CellType::CellAutoPointer CellAutoPointer
Definition: itkMesh.h:229
itk::MeshEnums::MeshClassCellsAllocationMethod
MeshClassCellsAllocationMethod
Definition: itkCommonEnums.h:198
itk::SimplexMesh::GeometryMapIterator
typename GeometryMapType::Iterator GeometryMapIterator
Definition: itkSimplexMesh.h:105
itk::PointSet::PointIdentifier
typename MeshTraits::PointIdentifier PointIdentifier
Definition: itkPointSet.h:105
itk::PointSet::MeshTraits
TMeshTraits MeshTraits
Definition: itkPointSet.h:100
itkMesh.h
itk::CellInterface::CellAutoPointer
SelfAutoPointer CellAutoPointer
Definition: itkCellInterface.h:133
itk::PointSet::PixelType
typename MeshTraits::PixelType PixelType
Definition: itkPointSet.h:101
itkFixedArray.h
itk::SimplexMesh
The class represents a 2-simplex mesh.
Definition: itkSimplexMesh.h:47
itk::SimplexMesh::GeometryMapPointer
typename GeometryMapType::Pointer GeometryMapPointer
Definition: itkSimplexMesh.h:102
itk::SimplexMesh::NeighborListType
std::vector< SizeValueType > NeighborListType
Definition: itkSimplexMesh.h:74
itk::SimplexMesh::VectorType
typename PointType::VectorType VectorType
Definition: itkSimplexMesh.h:83
itk::LineCell
Represents a line segment for a Mesh.
Definition: itkLineCell.h:45
itk::CovariantVector
A templated class holding a n-Dimensional covariant vector.
Definition: itkCovariantVector.h:70
itkVertexCell.h
itk::PointSet::PointsContainer
typename MeshTraits::PointsContainer PointsContainer
Definition: itkPointSet.h:107
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::Mesh
Implements the N-dimensional mesh structure.
Definition: itkMesh.h:126
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:61
itk::SimplexMeshGeometry::IndexArray
itk::FixedArray< IdentifierType, 3 > IndexArray
Definition: itkSimplexMeshGeometry.h:50
itk::PointSet::PointType
typename MeshTraits::PointType PointType
Definition: itkPointSet.h:106
itk::SimplexMesh::IndexArray
typename SimplexMeshGeometry::IndexArray IndexArray
Definition: itkSimplexMesh.h:65
itkSimplexMeshGeometry.h
itkTriangleCell.h
itk::SimplexMesh::NeighborSetType
std::set< SizeValueType > NeighborSetType
Definition: itkSimplexMesh.h:68
itk::DataObject
Base class for all data objects in ITK.
Definition: itkDataObject.h:293