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

itkSimplexMesh.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003 Program:   Insight Segmentation & Registration Toolkit
00004 Module:    $RCSfile: itkSimplexMesh.h,v $
00005 Language:  C++
00006 Date:      $Date: 2009-06-21 16:25:08 $
00007 Version:   $Revision: 1.14 $
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 __itkSimplexMesh_h
00018 #define __itkSimplexMesh_h
00019 
00020 #if defined(_MSC_VER)
00021 #pragma warning ( disable : 4786 )
00022 #endif
00023 
00024 #include "itkMesh.h"
00025 #include "itkSimplexMeshGeometry.h"
00026 #include "itkVertexCell.h"
00027 #include "itkTriangleCell.h"
00028 #include "itkCellInterface.h"
00029 #include "itkMapContainer.h"
00030 #include "itkFixedArray.h"
00031 #include "itkNumericTraits.h"
00032 #include <itkCovariantVector.h>
00033 #include <vector>
00034 #include <algorithm>
00035 #include <set>
00036 
00037 namespace itk
00038 {
00049   template <typename TPixelType, unsigned int VDimension = 3,
00050     typename TMeshTraits = DefaultStaticMeshTraits< TPixelType , VDimension, VDimension, TPixelType , TPixelType , TPixelType >
00051   >
00052 class SimplexMesh : public Mesh<TPixelType, VDimension, TMeshTraits>
00053 {
00054 public:
00056   typedef SimplexMesh                Self;
00057 
00059   typedef Mesh<TPixelType, VDimension, TMeshTraits>  Superclass;
00060 
00062   typedef SmartPointer<Self>  Pointer;
00063 
00065   typedef SmartPointer<const Self>  ConstPointer;
00066 
00068   typedef typename SimplexMeshGeometry::IndexArray            IndexArray;
00069 
00071   typedef std::set<unsigned long>                             NeighborSetType;
00072 
00074   typedef typename NeighborSetType::iterator                  NeighborSetIterator;
00075 
00077   typedef std::vector<unsigned long>                          NeighborListType;
00078 
00080   typedef typename TMeshTraits::PointType                     PointType;
00081 
00083   typedef typename TMeshTraits::PointIdentifier               PointIdentifier;
00084 
00086   typedef typename PointType::VectorType VectorType;
00087 
00089   typedef CovariantVector<typename VectorType::ValueType, 3>  CovariantVectorType;
00090 
00092   typedef typename Superclass::CellType                       CellType;
00093 
00095   typedef typename CellType::CellAutoPointer                  CellAutoPointer;
00096 
00098   typedef itk::LineCell<CellType>                             LineType;
00099 
00102   typedef itk::MapContainer<unsigned long, SimplexMeshGeometry *>   GeometryMapType;
00103 
00105   typedef typename GeometryMapType::Pointer GeometryMapPointer;
00106 
00108   typedef typename GeometryMapType::Iterator GeometryMapIterator;
00109 
00111   itkNewMacro(Self);
00112 
00114   itkTypeMacro(SimplexMesh, Mesh);
00115 
00117   typedef TMeshTraits                                          MeshTraits;
00118   typedef typename MeshTraits::PixelType                       PixelType;  
00119   typedef typename MeshTraits::PointsContainer                 PointsContainer;
00120   typedef typename Superclass::PointsContainerPointer          PointsContainerPointer;
00121   typedef typename Superclass::PointsContainer::Iterator       PointsContainerIterator;
00122   typedef typename Superclass::PointsContainerConstIterator    PointsContainerConstIterator;
00123   typedef typename Superclass::CellsContainerPointer           CellsContainerPointer;
00124   typedef typename Superclass::CellsContainerConstPointer      CellsContainerConstPointer;
00125   typedef typename Superclass::CellsContainerIterator          CellsContainerIterator;
00126   typedef typename Superclass::CellsContainerConstIterator     CellsContainerConstIterator;
00127 
00129   itkSetMacro(GeometryData, GeometryMapPointer );
00130 
00132   itkGetConstReferenceMacro(GeometryData, GeometryMapPointer );
00133 
00135   itkSetMacro(LastCellId, unsigned long);
00136 
00138   itkGetConstMacro(LastCellId, unsigned long);
00139 
00144   virtual void CopyInformation(const DataObject *data);
00145 
00146 
00153   unsigned long AddEdge(unsigned long startPointId, unsigned long endPointId);
00154 
00155 
00163   unsigned long AddFace(CellAutoPointer &cellPointer);
00164 
00169     unsigned long ReplaceFace(unsigned long replaceIndex, CellAutoPointer &cellPointer);
00170 
00174   IndexArray GetNeighbors(unsigned long pointId) const;
00175 
00179   NeighborListType* GetNeighbors(unsigned long pointId, unsigned int radius, NeighborListType* list = NULL) const;
00180 
00186   void AddNeighbor(unsigned long pointId, unsigned long neighborId);
00187 
00191   void ReplaceNeighbor(unsigned long pointId, unsigned long oldNeighborId,unsigned long newNeighborIdx);
00192 
00196   void SwapNeighbors(unsigned long pointId, unsigned long firstNeighborId,unsigned long secondNeighborId);
00197 
00201   void SetGeometryData(unsigned long pointId, SimplexMeshGeometry*);
00202 
00206   void SetBarycentricCoordinates(unsigned long idx, PointType values);
00207 
00211   PointType GetBarycentricCoordinates(unsigned long idx) const;
00212 
00216   void SetReferenceMetrics(unsigned long idx, PointType values);
00217 
00221   PointType GetReferenceMetrics(unsigned long idx) const;
00222 
00226   void SetPhi(unsigned long idx, double values);
00227 
00231   double GetPhi(unsigned long idx) const;
00232 
00236   void SetMeanCurvature(unsigned long idx, double values);
00237 
00241   double GetMeanCurvature(unsigned long idx) const;
00242 
00246   void SetRadius(unsigned long idx, double values);
00247 
00251   double GetRadius(unsigned long idx) const;
00252 
00256   void SetDistance(unsigned long idx, double values);
00257 
00261   double GetDistance(unsigned long idx) const;
00262 
00264   CovariantVectorType ComputeNormal(unsigned long idx ) const;
00265 
00266 protected:
00268   SimplexMesh();
00269   virtual ~SimplexMesh();
00270   void PrintSelf(std::ostream& os, Indent indent) const;
00272 
00276   GeometryMapPointer m_GeometryData;
00277 
00284   unsigned long m_LastCellId;
00285 
00286 private:
00287   SimplexMesh(const Self&); //purposely not implemented
00288   //  void operator=(const Self&); //purposely not implemented
00289 }; // End Class:  SimplexMesh
00290 
00291 } // end namespace itk
00292 
00293 #ifndef ITK_MANUAL_INSTANTIATION
00294 #include "itkSimplexMesh.txx"
00295 #endif
00296 
00297 #endif
00298 

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