Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkDeformableSimplexMesh3DFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkDeformableSimplexMesh3DFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2006/02/05 20:57:46 $
00007   Version:   $Revision: 1.13 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012   Portions of this code are covered under the VTK copyright.
00013   See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details.
00014 
00015      This software is distributed WITHOUT ANY WARRANTY; without even 
00016      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00017      PURPOSE.  See the above copyright notices for more information.
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 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::Iterator  InputPointsContainerIterator;
00098 
00100     typedef typename InputMeshType::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 Image<PixelType, 3>                                   GradientIntensityImageType;
00120     //typedef typename GradientIntensityImageType::Pointer          GradientIntensityImagePointer;
00121 
00122     //typedef typename itk::MapContainer<unsigned long, PointType> ForceOriginMapType;
00123     //typedef typename itk::MapContainer<unsigned long, VectorType> ForceMapType;
00124 
00125     /* Mesh pointer definition. */
00126     typedef typename InputMeshType::Pointer     InputMeshPointer;
00127     typedef typename OutputMeshType::Pointer    OutputMeshPointer;
00128 
00129 
00130     typedef typename InputMeshType::PointType                     MeshPointType;
00131     typedef typename InputMeshType::CellsContainerPointer         CellsContainerPointer;
00132     typedef typename InputMeshType::CellsContainer::Iterator      CellsContainerIterator;
00133     typedef typename InputMeshType::NeighborListType              InputNeighbors;
00134     typedef typename InputMeshType::NeighborListType::iterator    InputNeighborsIterator;
00135 
00136     typedef itk::MapContainer<unsigned long, std::set<unsigned long> > VertexNeighborListType;
00137     typedef std::set<unsigned long>      NeighborSetType;
00138     typedef std::set<unsigned long>      IndexSetType;
00139     typedef typename NeighborSetType::iterator    NeighborSetIterator;
00140     typedef typename IndexSetType::iterator       IndexSetIterator;
00141 
00142 
00143     typedef typename InputMeshType::GeometryMapType   GeometryMapType;
00144     typedef typename GeometryMapType::Pointer         GeometryMapPointer;
00145     typedef typename GeometryMapType::Iterator        GeometryMapIterator;
00146 
00147 
00155     itkSetMacro(Gradient, GradientImagePointer);
00156 
00160     itkGetMacro(Gradient, GradientImagePointer);
00161 
00165     itkSetMacro(Iterations, int);
00166     itkGetMacro(Iterations, int);
00168 
00170     itkSetMacro(Alpha, double);
00171 
00173     itkGetMacro(Alpha, double);
00174 
00176     itkSetMacro(Beta, double);
00177 
00179     itkGetMacro(Beta, double);
00180 
00182     itkSetMacro(Gamma, double);
00183 
00185     itkGetMacro(Gamma, double);
00186 
00188     itkSetMacro(Damping, double);
00189 
00191     itkGetMacro(Damping, double);
00192 
00194     itkSetMacro(Rigidity, unsigned int);
00195 
00197     itkGetMacro(Rigidity, unsigned int);
00198 
00199     itkSetObjectMacro(Data, GeometryMapType );
00200     itkGetObjectMacro(Data, GeometryMapType );
00201      
00203     itkGetMacro(ImageWidth,int);
00204     itkGetMacro(ImageHeight,int);
00205     itkGetMacro(ImageDepth,int);
00207 
00209     itkGetMacro(Step, int);
00210 
00211   protected:
00212     DeformableSimplexMesh3DFilter();
00213     ~DeformableSimplexMesh3DFilter();
00214     DeformableSimplexMesh3DFilter(const Self&); //purposely not implemented
00215     void operator=(const Self&); //purposely not implemented
00216 
00217     void PrintSelf(std::ostream& os, Indent indent) const;
00218 
00219 
00221     virtual void GenerateData();
00222 
00223 
00229     virtual void Initialize();
00230 
00236     virtual void ComputeGeometry();
00237 
00243     virtual void ComputeDisplacement();
00244 
00248     virtual void ComputeInternalForce(SimplexMeshGeometry* data);
00249 
00253     virtual void ComputeExternalForce(SimplexMeshGeometry* data);  
00254 
00259     virtual void ComputeOutput();
00260 
00264     virtual void UpdateReferenceMetrics();
00265 
00269     double L_Func(double r,double d, double phi);
00270 
00274     PointType ComputeBarycentricCoordinates(PointType p, SimplexMeshGeometry* data);
00275 
00276 
00284     double    m_Alpha;
00285 
00292     double    m_Beta;
00293 
00300     double    m_Gamma;      
00301     double    m_Damping;
00302 
00309     unsigned int m_Rigidity;
00310 
00311     // definition of internal parameters
00313     int       m_Step;          
00314 
00316     int       m_ImageWidth;      
00317 
00319     int       m_ImageHeight;
00320 
00322     int       m_ImageDepth;
00323 
00325     int       m_Iterations;
00326 
00327 
00331     GeometryMapPointer m_Data;
00332 
00333     /* gradient image pointer */
00334     GradientImagePointer m_Gradient;
00335 
00336 
00337   }; // end of class
00338 
00339 
00340   } // end namespace itk
00341 
00342 #ifndef ITK_MANUAL_INSTANTIATION
00343 #include "itkDeformableSimplexMesh3DFilter.txx"
00344 #endif
00345 
00346 #endif //__itkDeformableSimplexMesh3DFilter_h
00347 

Generated at Mon Mar 12 00:01:50 2007 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000