ITK  6.0.0
Insight Toolkit
itkLaplacianDeformationQuadEdgeMeshFilter.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 itkLaplacianDeformationQuadEdgeMeshFilter_h
19#define itkLaplacianDeformationQuadEdgeMeshFilter_h
20
23#include "ITKQuadEdgeMeshFilteringExport.h"
24
25#include "itkConceptChecking.h"
26
27#include <unordered_map>
28
29namespace itk
30{
36{
37public:
41 enum class Area : uint8_t
42 {
44 NONE = 0,
45
47 MIXEDAREA
48 };
49};
50// Define how to print enumeration
51extern ITKQuadEdgeMeshFiltering_EXPORT std::ostream &
53
115template <class TInputMesh, class TOutputMesh, class TSolverTraits>
117 : public QuadEdgeMeshToQuadEdgeMeshFilter<TInputMesh, TOutputMesh>
118{
119public:
120 ITK_DISALLOW_COPY_AND_MOVE(LaplacianDeformationQuadEdgeMeshFilter);
121
127
128 itkOverrideGetNameOfClassMacro(LaplacianDeformationQuadEdgeMeshFilter);
129
131 using InputMeshType = TInputMesh;
132 using typename Superclass::InputPointType;
133
134 static constexpr unsigned int InputPointDimension = InputMeshType::PointDimension;
135
137 using OutputMeshType = TOutputMesh;
138 using typename Superclass::OutputCoordRepType;
139 using typename Superclass::OutputPointType;
140 using typename Superclass::OutputPointIdentifier;
141 using typename Superclass::OutputQEPrimal;
142 using typename Superclass::OutputVectorType;
143 using typename Superclass::OutputQEIterator;
144
145 static constexpr unsigned int OutputPointDimension = OutputMeshType::PointDimension;
146
147 using SolverTraits = TSolverTraits;
148 using ValueType = typename SolverTraits::ValueType;
149 using MatrixType = typename SolverTraits::MatrixType;
151
153
155 void
157 {
158 this->m_CoefficientsMethod = iMethod;
159 this->Modified();
160 }
164
166 void
168
170 void
172
176 bool
178
180 void
182
184 itkSetMacro(Order, unsigned int);
185 itkGetMacro(Order, unsigned int);
189#if !defined(ITK_LEGACY_REMOVE)
191 static constexpr AreaEnum NONE = AreaEnum::NONE;
192 static constexpr AreaEnum MIXEDAREA = AreaEnum::MIXEDAREA;
193#endif
194
196 itkSetEnumMacro(AreaComputationType, AreaEnum);
197 itkGetMacro(AreaComputationType, AreaEnum);
200#ifdef ITK_USE_CONCEPT_CHECKING
203#endif
204
205protected:
211 using OutputMapPointIdentifier = std::unordered_map<OutputPointIdentifier, OutputPointIdentifier>;
212 using OutputMapPointIdentifierIterator = typename OutputMapPointIdentifier::iterator;
213 using OutputMapPointIdentifierConstIterator = typename OutputMapPointIdentifier::const_iterator;
214
215 using ConstraintMapType = std::unordered_map<OutputPointIdentifier, OutputVectorType>;
216 using ConstraintMapConstIterator = typename ConstraintMapType::const_iterator;
217
219 {
220 size_t
222 {
223 return reinterpret_cast<size_t>(qe);
224 }
225 };
226
227 using CoefficientMapType = std::unordered_map<OutputQEPrimal *, OutputCoordRepType, HashOutputQEPrimal>;
228 using CoefficientMapConstIterator = typename CoefficientMapType::const_iterator;
229
230 using AreaMapType = std::unordered_map<OutputPointIdentifier, OutputCoordRepType>;
231 using AreaMapConstIterator = typename AreaMapType::const_iterator;
232
233 using RowType = std::unordered_map<OutputPointIdentifier, OutputCoordRepType>;
234 using RowIterator = typename RowType::iterator;
235 using RowConstIterator = typename RowType::const_iterator;
236
238 ConstraintMapType m_Constraints{};
239 CoefficientMapType m_CoefficientMap{};
240 AreaMapType m_MixedAreaMap{};
241
242 CoefficientsComputationType * m_CoefficientsMethod{};
243
244 unsigned int m_Order{ 1 };
245 AreaEnum m_AreaComputationType{ AreaEnum::NONE };
246
247 void
248 PrintSelf(std::ostream & os, Indent indent) const override;
249
254
255 virtual void
257
258 void
260
261 void
262 FillMatrixRow(OutputPointIdentifier iId, unsigned int iDegree, OutputCoordRepType iWeight, RowType & ioRow);
263
268 void
270
283 void
285 const VectorType & iBx,
286 const VectorType & iBy,
287 const VectorType & iBz,
288 VectorType & oX,
289 VectorType & oY,
290 VectorType & oZ);
291
292
293private:
294 struct Triple
295 {
296 Triple() = default;
297 Triple(OutputPointIdentifier iV, OutputCoordRepType iWeight, unsigned int iDegree)
298 : m_Id(iV)
299 , m_Weight(iWeight)
300 , m_Degree(iDegree)
301 {}
302
305 unsigned int m_Degree;
306 };
307};
308} // end namespace itk
309
310#include "itkLaplacianDeformationQuadEdgeMeshFilter.hxx"
311
312#endif
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Contains all enum classes used by LaplacianDeformationQuadEdgeMeshFilter class.
(abstract) base class for laplacian surface mesh deformation.
void SetConstrainedNode(OutputPointIdentifier vId, const OutputPointType &iP)
bool GetDisplacement(OutputPointIdentifier vId, OutputVectorType &oV) const
std::unordered_map< OutputPointIdentifier, OutputPointIdentifier > OutputMapPointIdentifier
typename CoefficientMapType::const_iterator CoefficientMapConstIterator
void FillMatrix(MatrixType &iM, VectorType &iBx, VectorType &iBy, VectorType &iBz)
Fill matrix iM and vectors Bx, m_By and m_Bz depending on if one vertex is on the border or not.
std::unordered_map< OutputPointIdentifier, OutputCoordRepType > AreaMapType
void SetCoefficientsMethod(CoefficientsComputationType *iMethod)
typename ConstraintMapType::const_iterator ConstraintMapConstIterator
typename OutputMapPointIdentifier::const_iterator OutputMapPointIdentifierConstIterator
void FillMatrixRow(OutputPointIdentifier iId, unsigned int iDegree, OutputCoordRepType iWeight, RowType &ioRow)
void PrintSelf(std::ostream &os, Indent indent) const override
std::unordered_map< OutputPointIdentifier, OutputVectorType > ConstraintMapType
std::unordered_map< OutputPointIdentifier, OutputCoordRepType > RowType
std::unordered_map< OutputQEPrimal *, OutputCoordRepType, HashOutputQEPrimal > CoefficientMapType
void SolveLinearSystems(const MatrixType &iM, const VectorType &iBx, const VectorType &iBy, const VectorType &iBz, VectorType &oX, VectorType &oY, VectorType &oZ)
Solve linear systems : and and .
OutputCoordRepType ComputeMixedAreaForGivenVertex(OutputPointIdentifier iId)
OutputCoordRepType ComputeMixedArea(OutputQEPrimal *iQE1, OutputQEPrimal *iQE2)
typename OutputMapPointIdentifier::iterator OutputMapPointIdentifierIterator
~LaplacianDeformationQuadEdgeMeshFilter() override=default
void SetDisplacement(OutputPointIdentifier vId, const OutputVectorType &iV)
Light weight base class for most itk classes.
Superclass for all the matrix coefficients computation classes.
TOutputMesh OutputMeshType
Definition: itkMeshSource.h:68
typename OutputMeshType::PointIdentifier OutputPointIdentifier
typename OutputMeshType::VectorType OutputVectorType
typename OutputMeshType::CoordRepType OutputCoordRepType
A convenience class for computation of various triangle elements in 2D or 3D.
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
ITKCommon_EXPORT std::ostream & operator<<(std::ostream &out, typename AnatomicalOrientation::CoordinateEnum value)
Triple(OutputPointIdentifier iV, OutputCoordRepType iWeight, unsigned int iDegree)