18 #ifndef itkBalloonForceFilter_h
19 #define itkBalloonForceFilter_h
20 #if !defined( ITK_LEGACY_REMOVE )
23 #include "vnl/vnl_matrix_fixed.h"
24 #include "vnl/vnl_math.h"
57 template<
typename TInputMesh,
typename TOutputMesh >
58 class BalloonForceFilter:
public MeshToMeshFilter< TInputMesh, TOutputMesh >
62 typedef BalloonForceFilter Self;
63 typedef MeshToMeshFilter< TInputMesh, TOutputMesh > Superclass;
71 itkTypeMacro(BalloonForceFilter, MeshToMeshFilter);
74 typedef TInputMesh InputMeshType;
75 typedef TOutputMesh OutputMeshType;
78 typedef typename InputMeshType::PointsContainerPointer
79 InputPointsContainerPointer;
80 typedef typename InputMeshType::PointsContainer::Iterator
81 InputPointsContainerIterator;
82 typedef typename InputMeshType::PointsContainerConstPointer
83 InputPointsContainerConstPointer;
84 typedef typename InputMeshType::PointsContainer::ConstIterator
85 InputPointsContainerConstIterator;
86 typedef typename InputMeshType::PointDataContainerPointer
87 InputPointDataContainerPointer;
88 typedef typename InputMeshType::PointDataContainer::Iterator
89 InputPointDataContainerIterator;
90 typedef typename InputMeshType::CellsContainerPointer
91 InputCellsContainerPointer;
92 typedef typename InputMeshType::CellsContainer::Iterator
93 InputCellsContainerIterator;
94 typedef typename InputMeshType::CellDataContainerPointer
95 InputCellDataContainerPointer;
96 typedef typename InputMeshType::CellDataContainer::Iterator
97 InputCellDataContainerIterator;
98 typedef typename InputMeshType::CellsContainerConstPointer
99 InputCellsContainerConstPointer;
100 typedef typename InputMeshType::CellsContainer::ConstIterator
101 InputCellsContainerConstIterator;
102 typedef typename InputMeshType::CellDataContainerConstPointer
103 InputCellDataContainerConstPointer;
104 typedef typename InputMeshType::CellDataContainer::ConstIterator
105 InputCellDataContainerConstIterator;
107 typedef typename OutputMeshType::PointsContainerPointer
108 OutputPointsContainerPointer;
109 typedef typename OutputMeshType::PointsContainer::Iterator
110 OutputPointsContainerIterator;
113 typedef typename InputMeshType::PointType IPixelType;
114 typedef typename InputMeshType::PixelType PixelType;
116 typedef Image< unsigned short, 2 > ImageType;
117 typedef CovariantVector< PixelType, 2 > GradientType;
118 typedef Image< GradientType, 2 > GradientImageType;
119 typedef typename InputMeshType::Pointer InputMeshPointer;
120 typedef typename InputMeshType::ConstPointer InputMeshConstPointer;
121 typedef typename OutputMeshType::Pointer OutputMeshPointer;
122 typedef typename ImageType::Pointer ImagePointer;
123 typedef typename ImageType::IndexType IndexType;
124 typedef typename GradientImageType::Pointer GradientImagePointer;
125 typedef typename GradientImageType::IndexType GradientIndexType;
126 typedef ImageRegionIterator< ImageType > ImageIterator;
127 typedef Vector< float, 3 > FloatVector;
128 typedef Vector< int, 3 > IntVector;
129 typedef Vector< double, 2 > Double2Vector;
130 typedef Vector< int, 2 > Int2Vector;
133 typedef typename InputMeshType::CellType CellType;
134 typedef typename InputMeshType::CellTraits CellTraits;
135 typedef::itk::CellInterface< PixelType, CellTraits > CellInterface;
136 typedef::itk::TriangleCell< CellInterface > TriCell;
143 void SetStiffnessMatrix();
151 void ComputeOutput();
153 void NodeAddition(
int i,
int res, IPixelType z);
157 void NodesRearrange();
163 void ComputeNormals();
168 itkSetMacro(ImageOutput, ImagePointer);
169 itkGetConstMacro(ImageOutput, ImagePointer);
170 itkSetMacro(Gradient, GradientImagePointer);
174 itkSetMacro(Stiffness, Double2Vector);
175 itkSetMacro(TimeStep,
double);
176 itkSetMacro(GradientBegin,
int);
177 itkSetMacro(Resolution,
int);
178 itkSetMacro(Center, IndexType);
179 itkGetConstMacro(Normals, InputMeshPointer);
180 itkSetMacro(DistanceForGradient,
float);
181 itkSetMacro(DistanceToStop,
float);
182 itkSetMacro(Potential, ImagePointer);
183 itkGetConstMacro(Locations, InputMeshPointer);
184 itkGetConstMacro(Displacements, InputMeshPointer);
185 itkGetConstMacro(Derives, InputMeshPointer);
186 itkGetConstMacro(Forces, InputMeshPointer);
190 BalloonForceFilter();
191 ~BalloonForceFilter();
192 void PrintSelf(std::ostream & os, Indent indent)
const ITK_OVERRIDE;
194 virtual void GenerateData();
197 BalloonForceFilter(
const Self &);
198 void operator=(
const Self &);
201 InputMeshPointer m_Forces;
202 InputMeshPointer m_Normals;
203 InputMeshPointer m_Displacements;
204 InputMeshPointer m_Derives;
205 InputMeshPointer m_Locations;
206 InputMeshPointer m_Input;
207 OutputMeshPointer m_Output;
210 vnl_matrix_fixed< double, 4, 4 > m_NStiffness;
211 vnl_matrix_fixed< double, 4, 4 > m_SStiffness;
212 vnl_matrix_fixed< double, 4, 4 > m_CStiffness;
213 vnl_matrix_fixed< double, 4, 4 > **m_K;
215 Double2Vector m_Stiffness;
223 unsigned int m_NumberOfNodes;
224 unsigned int m_NumberOfCells;
225 unsigned int m_NumNewNodes;
227 int * m_GapLocations;
229 int m_NewNodesExisted;
230 unsigned int m_NewNodeLimit;
231 unsigned int m_ImageWidth;
232 unsigned int m_ImageHeight;
233 unsigned int m_ImageDepth;
237 int m_ModelXDownLimit;
239 int m_ModelYDownLimit;
244 Int2Vector m_StepThreshold;
248 float m_DistanceToBoundary;
249 float m_DistanceToStop;
250 float m_DistanceForGradient;
252 ImagePointer m_Potential;
254 GradientImagePointer m_Gradient;
258 ImagePointer m_ImageOutput;
259 unsigned short m_ObjectLabel;
261 typedef ImageType::SizeType ImageSizeType;
265 #ifndef ITK_MANUAL_INSTANTIATION
266 #include "itkBalloonForceFilter.hxx"
269 #endif //#if !defined( ITK_LEGACY_REMOVE )