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

itkBalloonForce3DFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkBalloonForce3DFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2002/09/23 18:12:27 $
00007   Version:   $Revision: 1.20 $
00008 
00009   Copyright (c) 2002 Insight 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 __itkBalloonForce3DFilter_h
00018 #define __itkBalloonForce3DFilter_h
00019 
00020 #include "itkMeshToMeshFilter.h"
00021 #include "vnl/vnl_matrix_fixed.h"
00022 #include "vnl/vnl_math.h"
00023 #include "itkMesh.h"
00024 #include "itkVector.h"
00025 #include "itkTriangleCell.h"
00026 #include "itkImage.h"
00027 #include "itkImageRegionIterator.h"
00028 #include <itkCovariantVector.h>
00029 
00030 namespace itk
00031 {
00032 
00074 template <class TInputMesh, class TOutputMesh>
00075 class BalloonForce3DFilter : public MeshToMeshFilter<TInputMesh, TOutputMesh>
00076 {
00077 public:
00078 
00080   typedef BalloonForce3DFilter  Self;
00081 
00083   typedef MeshToMeshFilter<TInputMesh, TOutputMesh> Superclass;
00084 
00086   typedef SmartPointer<Self>  Pointer;
00087   typedef SmartPointer<const Self>  ConstPointer;
00088 
00090   itkNewMacro(Self);
00091   
00093   itkTypeMacro(BalloonForce3DFilter,MeshToMeshFilter);
00094 
00096   typedef TInputMesh InputMeshType;
00097   typedef TOutputMesh OutputMeshType;
00098   typedef typename InputMeshType::PointsContainerPointer
00099       InputPointsContainerPointer;
00100   typedef typename InputMeshType::PointsContainer::Iterator
00101       InputPointsContainerIterator;
00102   typedef typename InputMeshType::PointDataContainerPointer
00103       InputPointDataContainerPointer;
00104   typedef typename InputMeshType::PointDataContainer::Iterator
00105       InputPointDataContainerIterator;
00106   typedef typename InputMeshType::CellsContainerPointer
00107       InputCellsContainerPointer;
00108   typedef typename InputMeshType::CellsContainer::Iterator
00109       InputCellsContainerIterator;
00110   typedef typename InputMeshType::CellDataContainerPointer
00111       InputCellDataContainerPointer;
00112   typedef typename InputMeshType::CellDataContainer::Iterator
00113       InputCellDataContainerIterator;
00114   typedef typename OutputMeshType::PointsContainerPointer
00115       OutputPointsContainerPointer;
00116   typedef typename OutputMeshType::PointsContainer::Iterator
00117       OutputPointsContainerIterator;
00118 
00120   typedef typename InputMeshType::CellType          CellType;
00121   typedef typename InputMeshType::CellTraits        CellTraits;
00122   typedef typename InputMeshType::PointType         InputPointType;
00123   typedef typename InputMeshType::PixelType         PixelType;
00124   typedef CellInterface<PixelType,CellTraits>       CellInterface;
00125   typedef TriangleCell<CellInterface>               TriCell;
00126 
00128   typedef CovariantVector<PixelType, 3>             GradientType;
00129   typedef Image<GradientType, 3>                    GradientImageType;
00130   typedef Image<unsigned short, 3>                  ImageType;
00131   typedef typename ImageType::Pointer               ImagePointer;
00132   typedef typename ImageType::IndexType             IndexType;
00133   typedef ImageRegionIterator<ImageType>            ImageIterator;
00134   typedef ImageRegionIterator<GradientImageType>    GradientIterator;
00135   typedef ImageType::SizeType PotentialSizeType;
00136   typedef typename GradientImageType::Pointer       GradientImagePointer;
00137 
00139   typedef Vector<float, 3>     FloatVector;
00140   typedef Vector<int, 3>       IntVector;
00141 
00142   /* Mesh pointer definition */
00143   typedef typename InputMeshType::Pointer   InputMeshPointer;
00144   typedef typename OutputMeshType::Pointer  OutputMeshPointer;
00145 
00147   void ComputeForce(); 
00148   void Initialize();   
00149   void SetStiffnessMatrix(); 
00150   void Advance();      
00151   void ComputeDt();    
00152   void ComputeOutput(); 
00153   void NodeAddition();  
00154   void NodesRearrange();  
00155   void GradientFit(); 
00156   void ComputeNormals();  
00157   void ACDSearch();   
00158   void ComputeShrinkForce();  
00159   void InitialFit();          
00162   itkSetMacro(ImageOutput, ImagePointer);
00163   itkGetMacro(ImageOutput, ImagePointer);
00164 
00165   itkSetMacro(Potential, ImagePointer);
00166   itkGetMacro(Potential, ImagePointer);
00167 
00168   itkSetMacro(Gradient, GradientImagePointer);
00169   itkGetMacro(Gradient, GradientImagePointer);
00170 
00171   itkSetMacro(FirstSlice, int);
00172   itkGetMacro(FirstSlice, int);
00173 
00174   itkSetMacro(NeighborRadius, int);
00175 
00176   itkSetMacro(StepThreshold1, int);
00177   itkSetMacro(StepThreshold2, int);
00178 
00179   itkSetMacro(XResolution, int);
00180   itkSetMacro(YResolution, int);
00181   itkSetMacro(ZResolution, int);
00182 
00183   itkSetMacro(StiffnessV, double);
00184   itkSetMacro(StiffnessH, double);
00185 
00186   itkSetMacro(TimeStep, double);
00187 
00188   itkSetMacro(Center, IndexType);
00189 
00190   itkGetMacro(Normals, InputMeshPointer);
00191 
00192 protected:
00193   BalloonForce3DFilter();
00194   ~BalloonForce3DFilter() {}
00195   BalloonForce3DFilter(const Self&) {}
00196   void operator=(const Self&) {}
00197   void PrintSelf(std::ostream& os, Indent indent) const;
00198 
00199   virtual void GenerateData();
00200 
00201 private:
00203   InputMeshPointer  m_Forces; 
00204   InputMeshPointer  m_Normals;
00205   InputMeshPointer  m_Displacements;
00206   InputMeshPointer  m_Derives;
00207   InputMeshPointer  m_Locations;
00208   InputMeshPointer  m_Input;
00209   OutputMeshPointer m_Output;
00210 
00212   vnl_matrix_fixed<double, 4, 4> NStiffness;
00213   vnl_matrix_fixed<double, 4, 4> SStiffness;
00214   vnl_matrix_fixed<double, 4, 4> CStiffness;
00215   vnl_matrix_fixed<double, 4, 4> **K;
00216   
00218   double    m_StiffnessV, m_StiffnessH;
00219   double    m_TimeStep;      
00220   int       m_XResolution, m_YResolution, m_ZResolution; 
00221   IndexType m_Center;        
00222   double    m_MiniT;         
00223   int       m_Step;          
00224   int       m_NumNodes;      
00225   int       m_NumCells;      
00226   int       m_NumNewNodes;   
00227   int       *m_GapLocations;
00228   int       m_ImageWidth;      
00229   int       m_ImageHeight;
00230   int       m_ImageDepth;
00231   int       m_ModelXUpLimit; 
00232   int       m_ModelXDownLimit;
00233   int       m_ModelYUpLimit;
00234   int       m_ModelYDownLimit;
00235   int       m_NewNode;       
00236   int       **m_ACD;         
00237   int       m_StepThreshold1;
00238   int       m_StepThreshold2;
00239   int       m_FirstSlice;    
00240   int       m_NeighborRadius;
00241   unsigned short        m_ObjectLabel; 
00244   ImagePointer          m_Potential;
00246   GradientImagePointer  m_Gradient; 
00248   ImagePointer          m_ImageOutput; 
00249   
00250 };
00251 
00252 } // end namespace itk
00253 
00254 #ifndef ITK_MANUAL_INSTANTIATION
00255 #include "itkBalloonForce3DFilter.txx"
00256 #endif
00257 
00258 #endif

Generated at Wed Mar 12 01:12:47 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000