Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __itkDeformableSimplexMesh3DFilter_h
00021 #define __itkDeformableSimplexMesh3DFilter_h
00022
00023 #include "itkMeshToMeshFilter.h"
00024 #include "itkSimplexMesh.h"
00025 #include "itkSimplexMeshGeometry.h"
00026 #include "itkImage.h"
00027 #include "itkCovariantVector.h"
00028 #include "itkVector.h"
00029 #include "itkSphereSpatialFunction.h"
00030 #include "itkFloodFilledSpatialFunctionConditionalIterator.h"
00031 #include "itkVectorGradientMagnitudeImageFilter.h"
00032 #include "itkBinaryThresholdImageFilter.h"
00033 #include "itkArray.h"
00034
00035 #include <set>
00036
00037 namespace itk
00038 {
00039
00071 template <class TInputMesh, class TOutputMesh>
00072 class ITK_EXPORT DeformableSimplexMesh3DFilter : public MeshToMeshFilter<TInputMesh, TOutputMesh>
00073 {
00074 public:
00076 typedef DeformableSimplexMesh3DFilter Self;
00077
00079 typedef MeshToMeshFilter<TInputMesh, TOutputMesh> Superclass;
00080
00082 typedef SmartPointer<Self> Pointer;
00083 typedef SmartPointer<const Self> ConstPointer;
00084
00086 itkNewMacro(Self);
00087
00089 itkTypeMacro(DeformableSimplexMesh3DFilter,MeshToMeshFilter);
00090
00092 typedef TInputMesh InputMeshType;
00093 typedef TOutputMesh OutputMeshType;
00094
00095 typedef typename InputMeshType::PointsContainerPointer InputPointsContainerPointer;
00096 typedef typename InputMeshType::PointsContainer InputPointsContainer;
00097 typedef typename InputMeshType::PointsContainer::ConstIterator InputPointsContainerConstIterator;
00098
00100 typedef typename SimplexMeshGeometry::PointType PointType;
00101 typedef typename PointType::VectorType VectorType;
00102 typedef CovariantVector<
00103 typename VectorType::ValueType, 3 > CovariantVectorType;
00104 typedef typename InputMeshType::PixelType PixelType;
00105
00107 typedef CovariantVector<PixelType, 3> GradientType;
00108 typedef Image<GradientType, 3> GradientImageType;
00109 typedef Image<unsigned char, 3> BinaryOutput;
00110 typedef Image<float, 3> MagnitudeOutput;
00111
00112 typedef typename GradientImageType::Pointer GradientImagePointer;
00113 typedef typename GradientImageType::IndexType GradientIndexType;
00114 typedef typename GradientImageType::PixelType GradientPixelType;
00115 typedef typename GradientIndexType::IndexValueType GradientIndexValueType;
00116 typedef typename GradientImageType::SizeType GradientImageSizeType;
00117
00118
00119 typedef typename InputMeshType::Pointer InputMeshPointer;
00120 typedef typename OutputMeshType::Pointer OutputMeshPointer;
00121
00122 typedef typename InputMeshType::PointType MeshPointType;
00123 typedef typename InputMeshType::CellsContainerPointer CellsContainerPointer;
00124 typedef typename InputMeshType::CellsContainer::Iterator CellsContainerIterator;
00125 typedef typename InputMeshType::NeighborListType InputNeighbors;
00126 typedef typename InputMeshType::NeighborListType::iterator InputNeighborsIterator;
00127
00128 typedef itk::MapContainer<unsigned long, std::set<unsigned long> >
00129 VertexNeighborListType;
00130 typedef std::set<unsigned long> NeighborSetType;
00131 typedef std::set<unsigned long> IndexSetType;
00132 typedef typename NeighborSetType::iterator NeighborSetIterator;
00133 typedef typename IndexSetType::iterator IndexSetIterator;
00134
00135
00136 typedef typename InputMeshType::GeometryMapType GeometryMapType;
00137 typedef typename GeometryMapType::Pointer GeometryMapPointer;
00138 typedef typename GeometryMapType::Iterator GeometryMapIterator;
00139
00140
00148 itkSetMacro(Gradient, GradientImagePointer);
00149
00153 itkGetConstMacro(Gradient, GradientImagePointer);
00154
00158 itkSetMacro(Iterations, int);
00159 itkGetConstMacro(Iterations, int);
00161
00163 itkSetMacro(Alpha, double);
00164
00166 itkGetConstMacro(Alpha, double);
00167
00169 itkSetMacro(Beta, double);
00170
00172 itkGetConstMacro(Beta, double);
00173
00175 itkSetMacro(Gamma, double);
00176
00178 itkGetConstMacro(Gamma, double);
00179
00181 itkSetMacro(Damping, double);
00182
00184 itkGetConstMacro(Damping, double);
00185
00187 itkSetMacro(Rigidity, unsigned int);
00188
00190 itkGetConstMacro(Rigidity, unsigned int);
00191
00192 itkSetObjectMacro(Data, GeometryMapType );
00193 itkGetConstObjectMacro(Data, GeometryMapType );
00194
00196 itkGetConstMacro(ImageWidth,int);
00197 itkGetConstMacro(ImageHeight,int);
00198 itkGetConstMacro(ImageDepth,int);
00200
00202 itkGetConstMacro(Step, int);
00203
00204 protected:
00205 DeformableSimplexMesh3DFilter();
00206 ~DeformableSimplexMesh3DFilter();
00207 DeformableSimplexMesh3DFilter(const Self&);
00208 void operator=(const Self&);
00209
00210 void PrintSelf(std::ostream& os, Indent indent) const;
00211
00213 virtual void GenerateData();
00214
00220 virtual void Initialize();
00221
00227 virtual void ComputeGeometry();
00228
00234 virtual void ComputeDisplacement();
00235
00239 virtual void ComputeInternalForce(SimplexMeshGeometry* data);
00240
00244 virtual void ComputeExternalForce(SimplexMeshGeometry* data);
00245
00250 virtual void ComputeOutput();
00251
00255 virtual void UpdateReferenceMetrics();
00256
00260 double L_Func(double r,double d, double phi);
00261
00265 PointType ComputeBarycentricCoordinates(PointType p, SimplexMeshGeometry* data);
00266
00274 double m_Alpha;
00275
00282 double m_Beta;
00283
00290 double m_Gamma;
00291 double m_Damping;
00292
00299 unsigned int m_Rigidity;
00300
00301
00303 int m_Step;
00304
00306 int m_ImageWidth;
00307
00309 int m_ImageHeight;
00310
00312 int m_ImageDepth;
00313
00315 int m_Iterations;
00316
00320 GeometryMapPointer m_Data;
00321
00322
00323 GradientImagePointer m_Gradient;
00324
00325
00326 };
00327
00328
00329 }
00330
00331 #ifndef ITK_MANUAL_INSTANTIATION
00332 #include "itkDeformableSimplexMesh3DFilter.txx"
00333 #endif
00334
00335 #endif //__itkDeformableSimplexMesh3DFilter_h
00336