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: 2004/12/21 22:47:26 $
00007 Version:   $Revision: 1.10 $
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 This software is distributed WITHOUT ANY WARRANTY; without even 
00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014 PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 #ifndef __itkDeformableSimplexMesh3DFilter_H
00018 #define __itkDeformableSimplexMesh3DFilter_H
00019 
00020 #include "itkMeshToMeshFilter.h"
00021 #include "itkSimplexMesh.h"
00022 #include "itkSimplexMeshGeometry.h"
00023 #include "itkImage.h"
00024 #include "itkCovariantVector.h"
00025 #include "itkVector.h"
00026 #include "itkSphereSpatialFunction.h"
00027 #include "itkFloodFilledSpatialFunctionConditionalIterator.h"
00028 #include "itkVectorGradientMagnitudeImageFilter.h"
00029 #include "itkBinaryThresholdImageFilter.h"
00030 #include "itkArray.h"
00031 
00032 #include <set>
00033 
00034 namespace itk
00035   {
00036 
00072   template <class TInputMesh, class TOutputMesh>
00073 class DeformableSimplexMesh3DFilter : public MeshToMeshFilter<TInputMesh, TOutputMesh>
00074   {
00075   public:
00077     typedef DeformableSimplexMesh3DFilter  Self;
00078 
00080     typedef MeshToMeshFilter<TInputMesh, TOutputMesh> Superclass;
00081 
00083     typedef SmartPointer<Self>  Pointer;
00084     typedef SmartPointer<const Self>  ConstPointer;
00085 
00087     itkNewMacro(Self);
00088 
00090     itkTypeMacro(DeformableSimplexMesh3DFilter,MeshToMeshFilter);
00091 
00093     typedef TInputMesh InputMeshType;
00094     typedef TOutputMesh OutputMeshType;
00095 
00096     typedef typename InputMeshType::PointsContainerPointer  InputPointsContainerPointer;
00097     typedef typename InputMeshType::PointsContainer  InputPointsContainer;
00098     typedef typename InputMeshType::PointsContainer::Iterator  InputPointsContainerIterator;
00099 
00101     typedef typename InputMeshType::PointType             PointType;
00102     typedef typename PointType::VectorType                VectorType;
00103     typedef CovariantVector< 
00104                     typename VectorType::ValueType, 3 >   CovariantVectorType;
00105     typedef typename InputMeshType::PixelType             PixelType;
00106 
00108     typedef CovariantVector<PixelType, 3>                   GradientType;
00109     typedef Image<GradientType, 3>                          GradientImageType;
00110     typedef Image<unsigned char, 3>                         BinaryOutput;
00111     typedef Image<float, 3>                                 MagnitudeOutput;
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     typedef std::vector<GradientIndexType>                   ArrayGradientIndexType;
00119     
00120     /* Mesh pointer definition. */
00121     typedef typename InputMeshType::Pointer     InputMeshPointer;
00122     typedef typename OutputMeshType::Pointer    OutputMeshPointer;
00123 
00124 
00125     typedef typename InputMeshType::PointType                     MeshPointType;
00126     typedef typename InputMeshType::CellsContainerPointer         CellsContainerPointer;
00127     typedef typename InputMeshType::CellsContainer::Iterator      CellsContainerIterator;
00128     typedef typename InputMeshType::NeighborListType              InputNeighbors;
00129     typedef typename InputMeshType::NeighborListType::iterator    InputNeighborsIterator;
00130 
00131     typedef itk::MapContainer<unsigned long, std::set<unsigned long> > VertexNeighborListType;
00132     typedef std::set<unsigned long>      NeighborSetType;
00133     typedef std::set<unsigned long>      IndexSetType;
00134     typedef typename NeighborSetType::iterator    NeighborSetIterator;
00135     typedef typename IndexSetType::iterator       IndexSetIterator;
00136 
00137 
00138     typedef typename InputMeshType::GeometryMapType   GeometryMapType;
00139     typedef typename GeometryMapType::Pointer         GeometryMapPointer;
00140     typedef typename GeometryMapType::Iterator        GeometryMapIterator;
00141 
00142 
00150     itkSetMacro(Gradient, GradientImagePointer);
00151 
00155     itkGetMacro(Gradient, GradientImagePointer);
00156 
00160     itkSetMacro(Iterations, int);
00161     itkGetMacro(Iterations, int);
00162 
00164     itkSetMacro(Alpha, double);
00165 
00167     itkGetMacro(Alpha, double);
00168 
00170     itkSetMacro(Beta, double);
00171 
00173     itkGetMacro(Beta, double);
00174 
00176     itkSetMacro(Gamma, double);
00177 
00179     itkGetMacro(Gamma, double);
00180 
00182     itkSetMacro(Damping, double);
00183 
00185     itkGetMacro(Damping, double);
00186 
00188     itkSetMacro(Rigidity, unsigned int);
00189 
00191     itkGetMacro(Rigidity, unsigned int);
00192 
00194     itkSetMacro(Locality, double);
00195     
00197     itkGetMacro(Locality, double);
00198 
00200     itkSetMacro(MaxMagnitude, float);
00201 
00202 
00204     itkSetMacro(Range, int);
00205     
00207     itkGetMacro(Range, int);
00208 
00209     itkSetObjectMacro(Data, GeometryMapType );
00210     itkGetObjectMacro(Data, GeometryMapType );
00211 
00213     itkGetMacro(ImageWidth,int);
00214     itkGetMacro(ImageHeight,int);
00215     itkGetMacro(ImageDepth,int);
00216 
00218     itkGetMacro(Step, int);
00219 
00220 
00221   protected:
00222     DeformableSimplexMesh3DFilter();
00223     ~DeformableSimplexMesh3DFilter();
00224     DeformableSimplexMesh3DFilter(const Self&); //purposely not implemented
00225     void operator=(const Self&); //purposely not implemented
00226 
00227     void PrintSelf(std::ostream& os, Indent indent) const;
00228 
00229 
00231     virtual void GenerateData();
00232 
00233 
00239     virtual void Initialize();
00240 
00246     virtual void ComputeGeometry();
00247 
00253     virtual void ComputeDisplacement();
00254 
00258     virtual void ComputeInternalForce(SimplexMeshGeometry* data);
00259 
00263     virtual void ComputeExternalForce(SimplexMeshGeometry* data);  
00264 
00269     virtual void ComputeOutput();
00270 
00274     virtual void UpdateReferenceMetrics();
00275 
00279     double L_Func(double r,double d, double phi);
00280 
00284     GradientIndexType BresenhamLine(GradientIndexType a,GradientIndexType b);
00285 
00289     PointType ComputeBarycentricCoordinates(PointType p, SimplexMeshGeometry* data);
00290 
00291 
00299     double    m_Alpha;
00300 
00307     double    m_Beta;
00308 
00315     double    m_Gamma;      
00316 
00317     double    m_Damping;
00324     unsigned int m_Rigidity;
00325 
00329     double   m_Locality;
00330 
00331 
00335     int m_Range;
00336 
00337     // definition of internal parameters
00339     int       m_Step;          
00341     int       m_ImageWidth;      
00343     int       m_ImageHeight;
00345     int       m_ImageDepth;
00346 
00348     int       m_Iterations;
00349 
00350 
00351     float     m_MaxMagnitude;
00355     GeometryMapPointer m_Data;
00356 
00357     /* gradient image pointer */
00358     GradientImagePointer m_Gradient;
00359 
00360 
00361   }; // end of class
00362 
00363 
00364   } // end namespace itk
00365 
00366 #ifndef ITK_MANUAL_INSTANTIATION
00367 #include "itkDeformableSimplexMesh3DFilter.txx"
00368 #endif
00369 
00370 #endif //__itkDeformableSimplexMesh3DFilter_H

Generated at Tue Mar 29 23:49:51 2005 for ITK by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2000