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: 2007/02/01 18:08:15 $
00007 Version:   $Revision: 1.11 $
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   {
00051   template <typename TPixelType, unsigned int VDimension = 3,
00052     typename TMeshTraits = DefaultStaticMeshTraits< TPixelType , VDimension, VDimension, TPixelType , TPixelType , TPixelType >
00053   >
00054 class SimplexMesh : public Mesh<TPixelType, VDimension, TMeshTraits>
00055   {
00056   public:
00058     typedef SimplexMesh                Self;
00059 
00061     typedef Mesh<TPixelType, VDimension, TMeshTraits>  Superclass;
00062 
00064     typedef SmartPointer<Self>  Pointer;
00065 
00067     typedef SmartPointer<const Self>  ConstPointer;
00068 
00070     typedef typename SimplexMeshGeometry::IndexArray            IndexArray;
00071 
00073     typedef std::set<unsigned long>                             NeighborSetType;
00074 
00076     typedef typename NeighborSetType::iterator                  NeighborSetIterator;
00077 
00079     typedef std::vector<unsigned long>                          NeighborListType;
00080 
00082     typedef typename TMeshTraits::PointType                     PointType;
00083 
00085     typedef typename TMeshTraits::PointIdentifier               PointIdentifier;
00086 
00088     typedef typename PointType::VectorType VectorType;
00089 
00091     typedef CovariantVector<typename VectorType::ValueType, 3>  CovariantVectorType;
00092 
00093 
00095     typedef typename Superclass::CellType                       CellType;
00096 
00098     typedef typename CellType::CellAutoPointer                  CellAutoPointer;
00099 
00101     typedef itk::LineCell<CellType>                             LineType;
00102 
00104     typedef itk::MapContainer<unsigned long, SimplexMeshGeometry *>   GeometryMapType;
00105 
00107     typedef typename GeometryMapType::Pointer GeometryMapPointer;
00108 
00110     typedef typename GeometryMapType::Iterator GeometryMapIterator;
00111 
00112 
00114     itkNewMacro(Self);
00115 
00117     itkTypeMacro(SimplexMesh, Mesh);
00118 
00120     typedef TMeshTraits                                          MeshTraits;
00121     typedef typename MeshTraits::PixelType                       PixelType;  
00122     typedef typename MeshTraits::PointsContainer                 PointsContainer;
00123     typedef typename Superclass::PointsContainerPointer          PointsContainerPointer;
00124     typedef typename Superclass::PointsContainer::Iterator       PointsContainerIterator;
00125     typedef typename Superclass::PointsContainerConstIterator    PointsContainerConstIterator;
00126     typedef typename Superclass::CellsContainerPointer           CellsContainerPointer;
00127     typedef typename Superclass::CellsContainerIterator          CellsContainerIterator;
00128 
00130     itkSetMacro(GeometryData, GeometryMapPointer );
00131 
00133     itkGetConstReferenceMacro(GeometryData, GeometryMapPointer );
00134 
00136     itkSetMacro(LastCellId, unsigned long);
00137 
00139     itkGetMacro(LastCellId, unsigned long);
00140 
00145     virtual void CopyInformation(const DataObject *data);
00146 
00147 
00154     unsigned long AddEdge(unsigned long startPointId, unsigned long endPointId);
00155 
00156 
00164     unsigned long AddFace(CellAutoPointer &cellPointer);
00165 
00170     unsigned long ReplaceFace(unsigned long replaceIndex, CellAutoPointer &cellPointer);
00171 
00175     IndexArray GetNeighbors(unsigned long pointId) const;
00176 
00180     NeighborListType* GetNeighbors(unsigned long pointId, unsigned int radius, NeighborListType* list = NULL) const;
00181 
00187     void AddNeighbor(unsigned long pointId, unsigned long neighborId);
00188 
00192     void ReplaceNeighbor(unsigned long pointId, unsigned long oldNeighborId,unsigned long newNeighborIdx);
00193 
00197     void SwapNeighbors(unsigned long pointId, unsigned long firstNeighborId,unsigned long secondNeighborId);
00198 
00202     void SetGeometryData(unsigned long pointId, SimplexMeshGeometry*);
00203 
00207     void SetBarycentricCoordinates(unsigned long idx, PointType values);
00208 
00212     PointType GetBarycentricCoordinates(unsigned long idx) const;
00213 
00217     void SetReferenceMetrics(unsigned long idx, PointType values);
00218 
00222     PointType GetReferenceMetrics(unsigned long idx) const;
00223 
00227     void SetPhi(unsigned long idx, double values);
00228 
00232     double GetPhi(unsigned long idx) const;
00233 
00237     void SetMeanCurvature(unsigned long idx, double values);
00238 
00242     double GetMeanCurvature(unsigned long idx) const;
00243 
00247     void SetRadius(unsigned long idx, double values);
00248 
00252     double GetRadius(unsigned long idx) const;
00253 
00257     void SetDistance(unsigned long idx, double values);
00258 
00262     double GetDistance(unsigned long idx) const;
00263 
00265     CovariantVectorType ComputeNormal(unsigned long idx ) const;
00266 
00267   protected:
00269     SimplexMesh();
00270     virtual ~SimplexMesh();
00271     void PrintSelf(std::ostream& os, Indent indent) const;
00273 
00277     GeometryMapPointer m_GeometryData;
00278 
00279     /*  */
00286     unsigned long m_LastCellId;
00287 
00288 
00289   private:
00290     SimplexMesh(const Self&); //purposely not implemented
00291     //  void operator=(const Self&); //purposely not implemented
00292 
00293 
00294 
00295   }; // End Class:  SimplexMesh
00296 
00297   } // end namespace itk
00298 
00299 #ifndef ITK_MANUAL_INSTANTIATION
00300 #include "itkSimplexMesh.txx"
00301 #endif
00302 
00303 #endif
00304 

Generated at Tue Jul 29 22:28:27 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000