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: 2005/08/19 02:30:18 $
00007   Version:   $Revision: 1.3 $
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 _DeformableSimplexMesh3DGradientConstraintForceFilter_h
00018 #define _DeformableSimplexMesh3DGradientConstraintForceFilter_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 vpos[3];
00037   // subvoxel coordinates (in cartesian space)
00038   double  spos[3];
00039   // voxel value converted to a double
00040   double value;
00041   // distance from line origin
00042   double distance;
00043   // index
00044   unsigned int index;
00045 
00046   ImageVoxel() {};
00047   ImageVoxel(int *pos, double *subpos, double value, double distance, unsigned int index)
00048   {
00049     this->vpos[0] = pos[0];
00050     this->vpos[1] = pos[1];
00051     this->vpos[2] = pos[2];
00052     this->spos[0] = subpos[0];
00053     this->spos[1] = subpos[1];
00054     this->spos[2] = subpos[2];
00055     this->value = value;
00056     this->distance = distance;
00057     this->index = index;
00058   };
00059 
00061   unsigned int getX(void) const { return vpos[0]; }
00063   unsigned int getY(void) const { return vpos[1]; }
00065   unsigned int getZ(void) const { return vpos[2]; }
00067   double getDistance(void) const { return distance; }
00069   double getValue(void) const { return value; }
00071   
00073   void setValue(const double val) { value = val; }
00074   
00075 };
00076   
00087 template <class TInputMesh, class TOutputMesh>
00088 class 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   typedef typename Superclass::PointType                  PointType;
00111   typedef typename Superclass::GradientIndexType          GradientIndexType;
00112   typedef typename Superclass::GradientIndexValueType     GradientIndexValueType;
00113 
00114   /* Mesh pointer definition. */
00115   typedef typename InputMeshType::Pointer     InputMeshPointer;
00116   typedef typename OutputMeshType::Pointer    OutputMeshPointer;
00117 
00118   typedef typename InputMeshType::PixelType         PixelType;
00119 
00120   typedef Image<PixelType, 3>                                   GradientIntensityImageType;
00121   typedef typename GradientIntensityImageType::Pointer          GradientIntensityImagePointer;
00122 
00123   typedef Image<float, 3>                        OriginalImageType;
00124   typedef typename OriginalImageType::IndexType           OriginalImageIndexType;
00125   typedef typename OriginalImageIndexType::IndexValueType      ImageIndexValueType;
00126   typedef typename OriginalImageType::Pointer             OriginalImagePointer;
00128   itkSetMacro(Range, int);
00129   itkGetMacro(Range, int);
00130   
00131   // full segment or half segment direction
00132   enum SIDE
00133   {
00134     // half segment in direction
00135     NORMAL,
00136     // half segment in -direction
00137     INVERSE,
00138     // complete segment
00139     BOTH
00140   };
00141 
00145   itkSetMacro(Image, OriginalImagePointer);
00146 
00147 protected:
00148   DeformableSimplexMesh3DGradientConstraintForceFilter();
00149   ~DeformableSimplexMesh3DGradientConstraintForceFilter();
00150   DeformableSimplexMesh3DGradientConstraintForceFilter(const Self&) 
00151   {
00152   }
00153   void operator=(const Self&){};
00154   void PrintSelf(std::ostream& os, Indent indent) const;
00155 
00159   virtual void ComputeExternalForce(SimplexMeshGeometry* data);  
00160 
00164   int m_Range;
00165 
00166 private:
00167   double NextVoxel(const double* pp, int *ic, double *x, double *y, double *z);
00168     
00169   int Signi(double a);
00170   
00171   void Clear();
00172 
00173   // line starting voxel
00174   ImageVoxel *m_StartVoxel;
00175   // line voxels in direction
00176   std::vector<ImageVoxel *> m_Positive;
00177   // line voxels in -direction
00178   std::vector<ImageVoxel *> m_Negative;
00179 
00180   OriginalImagePointer m_Image;
00181 
00182 }; // end of class
00183 
00184 } // namespace itk
00185 
00186 #ifndef ITK_MANUAL_INSTANTIATION
00187 #include "itkDeformableSimplexMesh3DGradientConstraintForceFilter.txx"
00188 #endif
00189 
00190 #endif /* __DeformableSimplexMesh3DGradientConstraintForceFilter_h */

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