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: 2005/05/05 21:23:12 $
00007 Version:   $Revision: 1.12 $
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 
00068   template <class TInputMesh, class TOutputMesh>
00069 class DeformableSimplexMesh3DFilter : public MeshToMeshFilter<TInputMesh, TOutputMesh>
00070   {
00071   public:
00073     typedef DeformableSimplexMesh3DFilter  Self;
00074 
00076     typedef MeshToMeshFilter<TInputMesh, TOutputMesh> Superclass;
00077 
00079     typedef SmartPointer<Self>  Pointer;
00080     typedef SmartPointer<const Self>  ConstPointer;
00081 
00083     itkNewMacro(Self);
00084 
00086     itkTypeMacro(DeformableSimplexMesh3DFilter,MeshToMeshFilter);
00087 
00089     typedef TInputMesh InputMeshType;
00090     typedef TOutputMesh OutputMeshType;
00091 
00092     typedef typename InputMeshType::PointsContainerPointer  InputPointsContainerPointer;
00093     typedef typename InputMeshType::PointsContainer  InputPointsContainer;
00094     typedef typename InputMeshType::PointsContainer::Iterator  InputPointsContainerIterator;
00095 
00097     typedef typename InputMeshType::PointType             PointType;
00098     typedef typename PointType::VectorType                VectorType;
00099     typedef CovariantVector< 
00100                     typename VectorType::ValueType, 3 >   CovariantVectorType;
00101     typedef typename InputMeshType::PixelType             PixelType;
00102 
00104     typedef CovariantVector<PixelType, 3>                   GradientType;
00105     typedef Image<GradientType, 3>                          GradientImageType;
00106     typedef Image<unsigned char, 3>                         BinaryOutput;      
00107     typedef Image<float, 3>                                 MagnitudeOutput;
00108     
00109     typedef typename GradientImageType::Pointer             GradientImagePointer;
00110     typedef typename GradientImageType::IndexType           GradientIndexType;
00111     typedef typename GradientImageType::PixelType           GradientPixelType;
00112     typedef typename GradientIndexType::IndexValueType      GradientIndexValueType;
00113     typedef typename GradientImageType::SizeType            GradientImageSizeType;
00114 
00115 
00116     //typedef Image<PixelType, 3>                                   GradientIntensityImageType;
00117     //typedef typename GradientIntensityImageType::Pointer          GradientIntensityImagePointer;
00118 
00119     //typedef typename itk::MapContainer<unsigned long, PointType> ForceOriginMapType;
00120     //typedef typename itk::MapContainer<unsigned long, VectorType> ForceMapType;
00121 
00122     /* Mesh pointer definition. */
00123     typedef typename InputMeshType::Pointer     InputMeshPointer;
00124     typedef typename OutputMeshType::Pointer    OutputMeshPointer;
00125 
00126 
00127     typedef typename InputMeshType::PointType                     MeshPointType;
00128     typedef typename InputMeshType::CellsContainerPointer         CellsContainerPointer;
00129     typedef typename InputMeshType::CellsContainer::Iterator      CellsContainerIterator;
00130     typedef typename InputMeshType::NeighborListType              InputNeighbors;
00131     typedef typename InputMeshType::NeighborListType::iterator    InputNeighborsIterator;
00132 
00133     typedef itk::MapContainer<unsigned long, std::set<unsigned long> > VertexNeighborListType;
00134     typedef std::set<unsigned long>      NeighborSetType;
00135     typedef std::set<unsigned long>      IndexSetType;
00136     typedef typename NeighborSetType::iterator    NeighborSetIterator;
00137     typedef typename IndexSetType::iterator       IndexSetIterator;
00138 
00139 
00140     typedef typename InputMeshType::GeometryMapType   GeometryMapType;
00141     typedef typename GeometryMapType::Pointer         GeometryMapPointer;
00142     typedef typename GeometryMapType::Iterator        GeometryMapIterator;
00143 
00144 
00152     itkSetMacro(Gradient, GradientImagePointer);
00153 
00157     itkGetMacro(Gradient, GradientImagePointer);
00158 
00162     itkSetMacro(Iterations, int);
00163     itkGetMacro(Iterations, int);
00164 
00166     itkSetMacro(Alpha, double);
00167 
00169     itkGetMacro(Alpha, double);
00170 
00172     itkSetMacro(Beta, double);
00173 
00175     itkGetMacro(Beta, double);
00176 
00178     itkSetMacro(Gamma, double);
00179     
00181     itkGetMacro(Gamma, double);
00182     
00184     itkSetMacro(Damping, double);
00185     
00187     itkGetMacro(Damping, double);
00188     
00190     itkSetMacro(Rigidity, unsigned int);
00191 
00193     itkGetMacro(Rigidity, unsigned int);
00194 
00195     itkSetObjectMacro(Data, GeometryMapType );
00196     itkGetObjectMacro(Data, GeometryMapType );
00197      
00199     itkGetMacro(ImageWidth,int);
00200     itkGetMacro(ImageHeight,int);
00201     itkGetMacro(ImageDepth,int);
00202     
00204     itkGetMacro(Step, int);
00205 
00206   protected:
00207     DeformableSimplexMesh3DFilter();
00208     ~DeformableSimplexMesh3DFilter();
00209     DeformableSimplexMesh3DFilter(const Self&); //purposely not implemented
00210     void operator=(const Self&); //purposely not implemented
00211 
00212     void PrintSelf(std::ostream& os, Indent indent) const;
00213 
00214 
00216     virtual void GenerateData();
00217 
00218 
00224     virtual void Initialize();
00225 
00231     virtual void ComputeGeometry();
00232 
00238     virtual void ComputeDisplacement();
00239 
00243     virtual void ComputeInternalForce(SimplexMeshGeometry* data);
00244 
00248     virtual void ComputeExternalForce(SimplexMeshGeometry* data);  
00249 
00254     virtual void ComputeOutput();
00255 
00259     virtual void UpdateReferenceMetrics();
00260 
00264     double L_Func(double r,double d, double phi);
00265 
00269     PointType ComputeBarycentricCoordinates(PointType p, SimplexMeshGeometry* data);
00270 
00271 
00279     double    m_Alpha;
00280 
00287     double    m_Beta;
00288 
00295     double    m_Gamma;      
00296     double    m_Damping;
00303     unsigned int m_Rigidity;
00304 
00305     // definition of internal parameters
00307     int       m_Step;          
00309     int       m_ImageWidth;      
00311     int       m_ImageHeight;
00313     int       m_ImageDepth;
00314 
00316     int       m_Iterations;
00317 
00318 
00322     GeometryMapPointer m_Data;
00323 
00324     /* gradient image pointer */
00325     GradientImagePointer m_Gradient;
00326 
00327 
00328   }; // end of class
00329 
00330 
00331   } // end namespace itk
00332 
00333 #ifndef ITK_MANUAL_INSTANTIATION
00334 #include "itkDeformableSimplexMesh3DFilter.txx"
00335 #endif
00336 
00337 #endif //__itkDeformableSimplexMesh3DFilter_H

Generated at Wed May 24 23:01:58 2006 for ITK by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2000