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

itkDeformableSimplexMesh3DGradientConstraintForceFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkDeformableSimplexMesh3DGradientConstraintForceFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-08-16 13:33:47 $
00007   Version:   $Revision: 1.8 $
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 __itkDeformableSimplexMesh3DGradientConstraintForceFilter_h
00018 #define __itkDeformableSimplexMesh3DGradientConstraintForceFilter_h
00019 
00020 #include "itkDeformableSimplexMesh3DFilter.h"
00021 #include "itkMesh.h"
00022 #include "itkVector.h"
00023 #include "itkImage.h"
00024 #include "itkConstNeighborhoodIterator.h"
00025 #include "itkCovariantVector.h"
00026 
00027 #include <set>
00028 #include <vector>
00029 namespace itk
00030 {
00031 class ImageVoxel 
00032 {
00033   
00034 public:
00035   // voxel coordinates
00036   unsigned int m_Vpos[3];
00037   // subvoxel coordinates (in cartesian space)
00038   double  m_Spos[3];
00039   // voxel value converted to a double
00040   double m_Value;
00041   // distance from line origin
00042   double m_Distance;
00043   // index
00044   unsigned int m_Index;
00045 
00046   ImageVoxel() {};
00047   ImageVoxel(int *pos, double *subpos, double val, double dist, unsigned int ind)
00048     {
00049     this->m_Vpos[0] = pos[0];
00050     this->m_Vpos[1] = pos[1];
00051     this->m_Vpos[2] = pos[2];
00052     this->m_Spos[0] = subpos[0];
00053     this->m_Spos[1] = subpos[1];
00054     this->m_Spos[2] = subpos[2];
00055     this->m_Value = val;
00056     this->m_Distance = dist;
00057     this->m_Index = ind;
00058     }
00059 
00061   unsigned int GetX(void) const { return m_Vpos[0]; }
00063   unsigned int GetY(void) const { return m_Vpos[1]; }
00065   unsigned int GetZ(void) const { return m_Vpos[2]; }
00067   double GetDistance(void) const { return m_Distance; }
00069   double GetValue(void) const { return m_Value; }
00071   
00073   void SetValue(const double val) { m_Value = val; }
00074   
00075 };
00076   
00087 template <class TInputMesh, class TOutputMesh>
00088 class ITK_EXPORT DeformableSimplexMesh3DGradientConstraintForceFilter : public DeformableSimplexMesh3DFilter<TInputMesh, TOutputMesh>
00089 {
00090 public:
00092   typedef DeformableSimplexMesh3DGradientConstraintForceFilter Self;
00093 
00095   typedef  DeformableSimplexMesh3DFilter<TInputMesh, TOutputMesh> Superclass;
00096 
00098   typedef SmartPointer<Self>       Pointer;
00099   typedef SmartPointer<const Self> ConstPointer;
00100 
00102   itkNewMacro(Self); 
00103 
00105   itkTypeMacro(DeformableSimplexMesh3DGradientConstraintForceFilter, DeformableSimplexMesh3DFilter); 
00106 
00108   typedef TInputMesh  InputMeshType;
00109   typedef TOutputMesh OutputMeshType;
00110 
00111   typedef typename Superclass::PointType              PointType;
00112   typedef typename Superclass::GradientIndexType      GradientIndexType;
00113   typedef typename Superclass::GradientIndexValueType GradientIndexValueType;
00114 
00115   /* Mesh pointer definition. */
00116   typedef typename InputMeshType::Pointer  InputMeshPointer;
00117   typedef typename OutputMeshType::Pointer OutputMeshPointer;
00118 
00119   typedef typename InputMeshType::PixelType PixelType;
00120 
00121   typedef Image<PixelType, 3>                          GradientIntensityImageType;
00122   typedef typename GradientIntensityImageType::Pointer GradientIntensityImagePointer;
00123 
00124   typedef Image<float, 3>                                 OriginalImageType;
00125   typedef typename OriginalImageType::IndexType           OriginalImageIndexType;
00126   typedef typename OriginalImageIndexType::IndexValueType ImageIndexValueType;
00127   typedef typename OriginalImageType::ConstPointer        OriginalImagePointer;
00128 
00130   itkSetMacro(Range, int);
00131   itkGetConstMacro(Range, int);
00133 
00134   // full segment or half segment direction
00135   enum SIDE
00136   {
00137     // half segment in direction
00138     NORMAL,
00139     // half segment in -direction
00140     INVERSE,
00141     // complete segment
00142     BOTH
00143   };
00144 
00148   itkSetConstObjectMacro( Image, OriginalImageType );
00149 
00150 protected:
00151   DeformableSimplexMesh3DGradientConstraintForceFilter();
00152   ~DeformableSimplexMesh3DGradientConstraintForceFilter();
00153   DeformableSimplexMesh3DGradientConstraintForceFilter(const Self&) {}
00154   void operator=(const Self&){};
00155   void PrintSelf(std::ostream& os, Indent indent) const;
00156 
00160   virtual void ComputeExternalForce(SimplexMeshGeometry* data);  
00161 
00165   int m_Range;
00166 
00167 private:
00168   double NextVoxel(const double* pp, int *ic, double *x, double *y, double *z);
00169     
00170   int Signi(double a);
00171   
00172   void Clear();
00173 
00174   // line starting voxel
00175   ImageVoxel *m_StartVoxel;
00176   // line voxels in direction
00177   std::vector<ImageVoxel *> m_Positive;
00178   // line voxels in -direction
00179   std::vector<ImageVoxel *> m_Negative;
00180 
00181   OriginalImagePointer m_Image;
00182 
00183 }; // end of class
00184 
00185 } // namespace itk
00186 
00187 #ifndef ITK_MANUAL_INSTANTIATION
00188 #include "itkDeformableSimplexMesh3DGradientConstraintForceFilter.txx"
00189 #endif
00190 
00191 #endif /* __DeformableSimplexMesh3DGradientConstraintForceFilter_h */
00192 

Generated at Mon Jul 12 2010 18:12:03 for ITK by doxygen 1.7.1 written by Dimitri van Heesch, © 1997-2000