ITK  4.8.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 >
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 
141 
144 
149 
151  void ClearConstraints();
152 
154  itkSetMacro(Order, unsigned int);
155  itkGetMacro(Order, unsigned int);
157 
158  enum AreaType
159  {
161  NONE = 0,
162 
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 
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 
224 
225  virtual void ComputeVertexIdMapping();
226 
227  void ComputeLaplacianMatrix( MatrixType &ioL );
228 
229  void
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  LaplacianDeformationQuadEdgeMeshFilter(const Self &); // purposely not implemented
264  void operator=(const Self &); // purposely not implemented
265 
266  struct Triple
267  {
268  Triple() {}
269  Triple(OutputPointIdentifier iV, OutputCoordRepType iWeight, unsigned int iDegree):
270  m_Id(iV), m_Weight(iWeight), m_Degree(iDegree) {}
271 
274  unsigned int m_Degree;
275  };
276 };
277 } // end namespace itk
278 
279 #include "itkLaplacianDeformationQuadEdgeMeshFilter.hxx"
280 
281 #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)
void SetConstrainedNode(OutputPointIdentifier vId, const OutputPointType &iP)
void SetCoefficientsMethod(CoefficientsComputationType *iMethod)
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.
OutputCoordRepType ComputeMixedAreaForGivenVertex(OutputPointIdentifier vId)
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...
virtual void Modified() const
void FillMatrixRow(OutputPointIdentifier iId, unsigned int iDegree, OutputCoordRepType iWeight, RowType &ioRow)
void PrintSelf(std::ostream &os, Indent indent) const override
Control indentation during Print() invocation.
Definition: itkIndent.h:49
OutputCoordRepType ComputeMixedArea(OutputQEPrimal *iQE1, OutputQEPrimal *iQE2)
bool GetDisplacement(OutputPointIdentifier vId, OutputVectorType &oV) const
void SolveLinearSystems(const MatrixType &iM, const VectorType &iBx, const VectorType &iBy, const VectorType &iBz, VectorType &oX, VectorType &oY, VectorType &oZ)
Solve linears systems : and and .
itksys::hash_map< OutputQEPrimal *, OutputCoordRepType, HashOutputQEPrimal > CoefficientMapType
#define itkConceptMacro(name, concept)
typedef(Concept::SameDimension< InputPointDimension, OutputPointDimension >) SameDimensionCheck1
(abstract) base class for laplacian surface mesh deformation.
void SetDisplacement(OutputPointIdentifier vId, const OutputVectorType &iV)
Superclass for all the matrix coefficients computation classes.