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

itkBalloonForceFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkBalloonForceFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2002/09/23 18:12:28 $
00007   Version:   $Revision: 1.27 $
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 __itkBalloonForceFilter_h
00018 #define __itkBalloonForceFilter_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 
00029 namespace itk
00030 {
00031 
00053 template <class TInputMesh, class TOutputMesh>
00054 class BalloonForceFilter : public MeshToMeshFilter<TInputMesh, TOutputMesh>
00055 {
00056 public:
00058   typedef BalloonForceFilter  Self;
00059   typedef MeshToMeshFilter<TInputMesh, TOutputMesh> Superclass;
00060   typedef SmartPointer<Self>  Pointer;
00061   typedef SmartPointer<const Self>  ConstPointer;
00062 
00064   itkNewMacro(Self);
00065   
00067   itkTypeMacro(BalloonForceFilter,MeshToMeshFilter);
00068 
00070   typedef TInputMesh InputMeshType;
00071   typedef TOutputMesh OutputMeshType;
00072 
00074   typedef typename InputMeshType::PointsContainerPointer
00075       InputPointsContainerPointer;
00076   typedef typename InputMeshType::PointsContainer::Iterator
00077       InputPointsContainerIterator;
00078   typedef typename InputMeshType::PointDataContainerPointer
00079       InputPointDataContainerPointer;
00080   typedef typename InputMeshType::PointDataContainer::Iterator
00081       InputPointDataContainerIterator;
00082   typedef typename InputMeshType::CellsContainerPointer
00083       InputCellsContainerPointer;
00084   typedef typename InputMeshType::CellsContainer::Iterator
00085       InputCellsContainerIterator;
00086   typedef typename InputMeshType::CellDataContainerPointer
00087       InputCellDataContainerPointer;
00088   typedef typename InputMeshType::CellDataContainer::Iterator
00089       InputCellDataContainerIterator;
00090   typedef typename OutputMeshType::PointsContainerPointer
00091       OutputPointsContainerPointer;
00092   typedef typename OutputMeshType::PointsContainer::Iterator
00093       OutputPointsContainerIterator;
00094 
00096   typedef Image<unsigned short, 3>            ImageType;
00097   typedef typename InputMeshType::Pointer     InputMeshPointer;
00098   typedef typename OutputMeshType::Pointer    OutputMeshPointer;
00099   typedef typename ImageType::Pointer         ImagePointer;
00100   typedef typename ImageType::IndexType       IndexType;
00101   typedef ImageRegionIterator<ImageType>      ImageIterator;
00102   typedef Vector<float, 3>                    FloatVector;
00103   typedef Vector<int, 3>                      IntVector;
00104 
00106   typedef typename InputMeshType::CellType    CellType;
00107   typedef typename InputMeshType::CellTraits  CellTraits;
00108   typedef CellInterface<float, CellTraits>    CellInterface;
00109   typedef TriangleCell< CellInterface >       TriCell;
00110   typedef typename InputMeshType::PointType   IPT;
00111   typedef typename InputMeshType::PixelType   PT;
00112 
00114   void ComputeForce();
00115   void Initialize();
00116   void SetStiffnessMatrix();
00117   void Advance();             // update data for next iteration
00118   void SetStiffness(double a, double b);
00119   void SetResolution(int a, int b, int c);
00120   void SetCenter(int a, int b, int c);
00121   void Reset();               // reset all data
00122   void ComputeDt();             // compute point positions
00123   void ComputeOutput();
00124   void SetPotential(ImagePointer potential);
00125   void SetGradient(ImagePointer gradient);
00126   void NodeAddition(int i, int res, IPT z); // (folowing 3) for adding new nodes, now disabled for further tests
00127   void NodesRearrange();
00128   void GapSearch();       
00129   void GradientFit();           // fit the model with gradient information
00130   void ComputeNormals();
00131   void ACDSearch();             // remove weird structures on the model surface
00132 
00134   itkSetMacro(ImageOutput, ImagePointer);
00135   itkGetMacro(ImageOutput, ImagePointer);
00136 
00138   itkSetMacro(FirstSlice, int);
00139   itkGetMacro(FirstSlice, int);
00140 
00142   itkSetMacro(NeighborRadius, int);
00143   itkSetMacro(StepThreshold1, int);
00144   itkSetMacro(StepThreshold2, int);
00145   itkGetMacro(Resolution, int*);
00146   itkGetMacro(Normals, InputMeshPointer);
00147 
00148 protected:
00149   BalloonForceFilter();
00150   ~BalloonForceFilter() {}
00151   void PrintSelf(std::ostream& os, Indent indent) const;
00152 
00153   virtual void GenerateData();
00154 
00155 private:
00156   BalloonForceFilter(const Self&); //purposely not implemented
00157   void operator=(const Self&); //purposely not implemented
00158   
00160   InputMeshPointer  m_Forces; 
00161   InputMeshPointer  m_Normals;
00162   InputMeshPointer  m_Displacements;
00163   InputMeshPointer  m_Derives;
00164   InputMeshPointer  m_Locations;
00165   InputMeshPointer  m_Input;
00166   OutputMeshPointer m_Output;
00167 
00169   vnl_matrix_fixed<double, 4, 4> NStiffness;
00170   vnl_matrix_fixed<double, 4, 4> SStiffness;
00171   vnl_matrix_fixed<double, 4, 4> CStiffness;
00172   vnl_matrix_fixed<double, 4, 4> **K;
00173   
00174   double  m_Stiffness[2];
00175   double  TimeStep;       // the time step of each iteration
00176   int   m_Resolution[3];
00177   IndexType m_Center;
00178   float   m_MiniT;        // variabel help to stop the model when near potential estimation
00179   int   m_Step;         // the number of iteration 
00180   int   m_NumNodes;
00181   int   m_NumCells;
00182   int   m_NumNewNodes;      // for adding new nodes, now disabled for further tests
00183   int   *m_GapLocations;
00184   float   **m_NewNodes;
00185   int   m_NewNodesExisted;
00186   int   m_NewNodeLimit;
00187   int   m_ImageWidth;       // input image size
00188   int   m_ImageHeight;
00189   int   m_ImageDepth;
00190   int   m_ModelXUpLimit;    // the following 4 variables record the size of the model
00191   int   m_ModelXDownLimit;
00192   int   m_ModelYUpLimit;
00193   int   m_ModelYDownLimit;
00194   int   **m_ACD;        // help to remove the weird structure on the model surface
00195   int   m_ModelRestart;
00196   int   m_StepThreshold1;   // the threshold decide when to transfer from potential fit to gradient fit
00197   int   m_StepThreshold2;   // the threshold decide when to stop the model
00198   int   m_FirstSlice;     // variable help to relocate the model when try to load 
00199   int   m_NeighborRadius;   // the gradient fit range
00200 
00201   ImagePointer    m_Potential;  // for calculate of image force from potential
00202   ImagePointer    m_Gradient;   // for calculate of image force from gradient
00203 
00204   // for Gibbs Prior Model parameters' recalculation 
00205   ImagePointer    m_ImageOutput; 
00206   unsigned short  m_ObjectLabel;
00207 
00208   typedef ImageType::SizeType PotentialSizeType;
00209   
00210 };
00211 
00212 } // end namespace itk
00213 
00214 #ifndef ITK_MANUAL_INSTANTIATION
00215 #include "itkBalloonForceFilter.txx"
00216 #endif
00217 
00218 #endif

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