ITK  4.3.0
Insight Segmentation and Registration Toolkit
itkDeformableSimplexMesh3DFilter.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 /*=========================================================================
19  *
20  * Portions of this file are subject to the VTK Toolkit Version 3 copyright.
21  *
22  * Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
23  *
24  * For complete copyright, license and disclaimer of warranty information
25  * please refer to the NOTICE file at the top of the ITK source tree.
26  *
27  *=========================================================================*/
28 #ifndef __itkDeformableSimplexMesh3DFilter_h
29 #define __itkDeformableSimplexMesh3DFilter_h
30 
31 #include "itkMeshToMeshFilter.h"
32 #include "itkSimplexMesh.h"
37 #include "itkArray.h"
38 
39 #include <set>
40 
41 namespace itk
42 {
75 template< class TInputMesh, class TOutputMesh >
76 class ITK_EXPORT DeformableSimplexMesh3DFilter:public MeshToMeshFilter< TInputMesh, TOutputMesh >
77 {
78 public:
81 
84 
88 
90  itkNewMacro(Self);
91 
94 
96  typedef TInputMesh InputMeshType;
97  typedef TOutputMesh OutputMeshType;
98 
99  typedef typename InputMeshType::PointsContainerPointer InputPointsContainerPointer;
100  typedef typename InputMeshType::PointsContainer InputPointsContainer;
101  typedef typename InputMeshType::PointsContainer::ConstIterator InputPointsContainerConstIterator;
102 
107  typedef typename InputMeshType::PixelType PixelType;
108 
114 
120 
121  /* Mesh pointer definition. */
122  typedef typename InputMeshType::Pointer InputMeshPointer;
123  typedef typename OutputMeshType::Pointer OutputMeshPointer;
124 
125  typedef typename InputMeshType::PointType MeshPointType;
126  typedef typename InputMeshType::CellsContainerPointer CellsContainerPointer;
127  typedef typename InputMeshType::CellsContainer::Iterator CellsContainerIterator;
128  typedef typename InputMeshType::NeighborListType InputNeighbors;
129  typedef typename InputMeshType::NeighborListType::iterator InputNeighborsIterator;
130 
131  typedef std::set< IdentifierType > NeighborSetType;
132  typedef std::set< IdentifierType > IndexSetType;
134  typedef typename NeighborSetType::iterator NeighborSetIterator;
135  typedef typename IndexSetType::iterator IndexSetIterator;
136 
137  typedef typename InputMeshType::GeometryMapType GeometryMapType;
138  typedef typename GeometryMapType::Pointer GeometryMapPointer;
139  typedef typename GeometryMapType::Iterator GeometryMapIterator;
140 
148  void SetGradient( const GradientImageType * gradientImage );
149 
153  const GradientImageType * GetGradient() const;
154 
158  itkSetMacro(Iterations, int);
159  itkGetConstMacro(Iterations, int);
161 
163  itkSetMacro(Alpha, double);
164 
166  itkGetConstMacro(Alpha, double);
167 
169  itkSetMacro(Beta, double);
170 
172  itkGetConstMacro(Beta, double);
173 
175  itkSetMacro(Gamma, double);
176 
178  itkGetConstMacro(Gamma, double);
179 
181  itkSetMacro(Damping, double);
182 
184  itkGetConstMacro(Damping, double);
185 
187  itkSetMacro(Rigidity, unsigned int);
188 
190  itkGetConstMacro(Rigidity, unsigned int);
191 
192  itkSetObjectMacro(Data, GeometryMapType);
193  itkGetConstObjectMacro(Data, GeometryMapType);
194 
196  itkGetConstMacro(ImageWidth, int);
197  itkGetConstMacro(ImageHeight, int);
198  itkGetConstMacro(ImageDepth, int);
200 
202  itkGetConstMacro(Step, int);
203 
204 protected:
207  DeformableSimplexMesh3DFilter(const Self &); //purposely not implemented
208  void operator=(const Self &); //purposely not implemented
209 
210  void PrintSelf(std::ostream & os, Indent indent) const;
211 
213  virtual void GenerateData();
214 
220  virtual void Initialize();
221 
227  virtual void ComputeGeometry();
228 
234  virtual void ComputeDisplacement();
235 
239  virtual void ComputeInternalForce(SimplexMeshGeometry *data);
240 
245  virtual void ComputeExternalForce(SimplexMeshGeometry *data, const GradientImageType *gradient);
246 
251  virtual void ComputeOutput();
252 
256  virtual void UpdateReferenceMetrics();
257 
261  double L_Func(double r, double d, double phi);
262 
266  PointType ComputeBarycentricCoordinates(PointType p, SimplexMeshGeometry *data);
267 
275  double m_Alpha;
276 
283  double m_Beta;
284 
291  double m_Gamma;
292  double m_Damping;
293 
300  unsigned int m_Rigidity;
301 
302  // definition of internal parameters
304  int m_Step;
305 
308 
311 
314 
317 
322 
323 }; // end of class
324 } // end namespace itk
325 
326 #ifndef ITK_MANUAL_INSTANTIATION
327 #include "itkDeformableSimplexMesh3DFilter.hxx"
328 #endif
329 
330 #endif //__itkDeformableSimplexMesh3DFilter_h
331