ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkLaplacianDeformationQuadEdgeMeshFilter.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 itkLaplacianDeformationQuadEdgeMeshFilter_h
19 #define itkLaplacianDeformationQuadEdgeMeshFilter_h
20 
23 
24 #include "itkConceptChecking.h"
25 
26 #include "itksys/hash_map.hxx"
27 
28 namespace itk {
92 template< class TInputMesh, class TOutputMesh, class TSolverTraits >
93 class ITK_TEMPLATE_EXPORT LaplacianDeformationQuadEdgeMeshFilter:
94  public QuadEdgeMeshToQuadEdgeMeshFilter< TInputMesh, TOutputMesh >
95 {
96 public:
102 
104 
105 
106  typedef TInputMesh InputMeshType;
108 
109  itkStaticConstMacro(InputPointDimension, unsigned int, InputMeshType::PointDimension);
110 
112  typedef TOutputMesh OutputMeshType;
119 
120  itkStaticConstMacro(OutputPointDimension, unsigned int, OutputMeshType::PointDimension);
121 
122  typedef TSolverTraits SolverTraits;
123  typedef typename SolverTraits::ValueType ValueType;
124  typedef typename SolverTraits::MatrixType MatrixType;
125  typedef typename SolverTraits::VectorType VectorType;
126 
128 
130  void SetCoefficientsMethod(CoefficientsComputationType *iMethod)
131  {
132  this->m_CoefficientsMethod = iMethod;
133  this->Modified();
134  }
136 
138 
140  void SetConstrainedNode(OutputPointIdentifier vId, const OutputPointType & iP);
141 
143  void SetDisplacement(OutputPointIdentifier vId, const OutputVectorType &iV);
144 
148  bool GetDisplacement( OutputPointIdentifier vId, OutputVectorType& oV ) const;
149 
151  void ClearConstraints();
152 
154  itkSetMacro(Order, unsigned int);
155  itkGetMacro(Order, unsigned int);
157 
158  enum AreaType
159  {
161  NONE = 0,
162 
164  MIXEDAREA
165  };
166 
168  itkSetMacro(AreaComputationType, AreaType );
169  itkGetMacro(AreaComputationType, AreaType );
171 
172 #ifdef ITK_USE_CONCEPT_CHECKING
173  itkConceptMacro( SameDimensionCheck1,
175  itkConceptMacro( SameDimensionCheck2,
177 #endif
178 
179 protected:
180 
183  virtual ~LaplacianDeformationQuadEdgeMeshFilter() ITK_OVERRIDE {}
184 
185  typedef itksys::hash_map< OutputPointIdentifier, OutputPointIdentifier > OutputMapPointIdentifier;
186  typedef typename OutputMapPointIdentifier::iterator OutputMapPointIdentifierIterator;
187  typedef typename OutputMapPointIdentifier::const_iterator OutputMapPointIdentifierConstIterator;
188 
189  typedef itksys::hash_map< OutputPointIdentifier, OutputVectorType > ConstraintMapType;
190  typedef typename ConstraintMapType::const_iterator ConstraintMapConstIterator;
191 
193  {
194  size_t operator() ( OutputQEPrimal* qe ) const
195  {
196  return reinterpret_cast< size_t >( qe );
197  }
198  };
199 
200  typedef itksys::hash_map< OutputQEPrimal*, OutputCoordRepType, HashOutputQEPrimal > CoefficientMapType;
201  typedef typename CoefficientMapType::const_iterator CoefficientMapConstIterator;
202 
203  typedef itksys::hash_map< OutputPointIdentifier, OutputCoordRepType > AreaMapType;
204  typedef typename AreaMapType::const_iterator AreaMapConstIterator;
205 
206  typedef itksys::hash_map< OutputPointIdentifier, OutputCoordRepType > RowType;
207  typedef typename RowType::iterator RowIterator;
208  typedef typename RowType::const_iterator RowConstIterator;
209 
214 
216 
217  unsigned int m_Order;
219 
220  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
221 
222  OutputCoordRepType ComputeMixedAreaForGivenVertex(OutputPointIdentifier vId);
223  OutputCoordRepType ComputeMixedArea(OutputQEPrimal *iQE1, OutputQEPrimal *iQE2);
224 
225  virtual void ComputeVertexIdMapping();
226 
227  void ComputeLaplacianMatrix( MatrixType &ioL );
228 
229  void
230  FillMatrixRow(OutputPointIdentifier iId,
231  unsigned int iDegree,
232  OutputCoordRepType iWeight,
233  RowType & ioRow);
234 
239  void FillMatrix(MatrixType & iM, VectorType & iBx, VectorType & iBy, VectorType & iBz);
240 
253  void SolveLinearSystems(const MatrixType & iM,
254  const VectorType & iBx,
255  const VectorType & iBy,
256  const VectorType & iBz,
257  VectorType & oX,
258  VectorType & oY,
259  VectorType & oZ);
260 
261 
262 private:
263  ITK_DISALLOW_COPY_AND_ASSIGN(LaplacianDeformationQuadEdgeMeshFilter);
264 
265  struct Triple
266  {
267  Triple() {}
268  Triple(OutputPointIdentifier iV, OutputCoordRepType iWeight, unsigned int iDegree):
269  m_Id(iV), m_Weight(iWeight), m_Degree(iDegree) {}
270 
273  unsigned int m_Degree;
274  };
275 };
276 } // end namespace itk
277 
278 #include "itkLaplacianDeformationQuadEdgeMeshFilter.hxx"
279 
280 #endif
QuadEdgeMeshToQuadEdgeMeshFilter< TInputMesh, TOutputMesh > Superclass
Light weight base class for most itk classes.
TOutputMesh OutputMeshType
Definition: itkMeshSource.h:66
OutputMapPointIdentifier::const_iterator OutputMapPointIdentifierConstIterator
Triple(OutputPointIdentifier iV, OutputCoordRepType iWeight, unsigned int iDegree)
itksys::hash_map< OutputPointIdentifier, OutputCoordRepType > AreaMapType
itksys::hash_map< OutputPointIdentifier, OutputPointIdentifier > OutputMapPointIdentifier
itksys::hash_map< OutputPointIdentifier, OutputCoordRepType > RowType
itksys::hash_map< OutputPointIdentifier, OutputVectorType > ConstraintMapType
A convenience class for computation of various triangle elements in 2D or 3D.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itksys::hash_map< OutputQEPrimal *, OutputCoordRepType, HashOutputQEPrimal > CoefficientMapType
#define itkConceptMacro(name, concept)
(abstract) base class for laplacian surface mesh deformation.
Superclass for all the matrix coefficients computation classes.