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: 2004/11/04 20:40:41 $
00007 Version:   $Revision: 1.10 $
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 <vector>
00033 #include <algorithm>
00034 #include <set>
00035 
00036 namespace itk
00037   {
00050   template <typename TPixelType, unsigned int VDimension = 3,
00051     typename TMeshTraits = DefaultStaticMeshTraits< TPixelType , VDimension, VDimension, TPixelType , TPixelType , TPixelType >
00052   >
00053 class SimplexMesh : public Mesh<TPixelType, VDimension, TMeshTraits>
00054   {
00055   public:
00057     typedef SimplexMesh                Self;
00058 
00060     typedef Mesh<TPixelType, VDimension, TMeshTraits>  Superclass;
00061 
00063     typedef SmartPointer<Self>  Pointer;
00064 
00066     typedef SmartPointer<const Self>  ConstPointer;
00067 
00069     typedef typename SimplexMeshGeometry::IndexArray            IndexArray;
00070 
00072     typedef std::set<unsigned long>                             NeighborSetType;
00073 
00075     typedef typename NeighborSetType::iterator                  NeighborSetIterator;
00076 
00078     typedef std::vector<unsigned long>                          NeighborListType;
00079 
00081     typedef typename TMeshTraits::PointType                     PointType;
00082 
00084     typedef typename TMeshTraits::PointIdentifier               PointIdentifier;
00085 
00087     typedef typename PointType::VectorType VectorType;
00088 
00090     typedef typename Superclass::CellType                       CellType;
00091 
00093     typedef typename CellType::CellAutoPointer                  CellAutoPointer;
00095     typedef itk::LineCell<CellType>                             LineType;
00096 
00098     typedef itk::MapContainer<unsigned long, SimplexMeshGeometry *>   GeometryMapType;
00099 
00101     typedef typename GeometryMapType::Pointer GeometryMapPointer;
00102 
00104     typedef typename GeometryMapType::Iterator GeometryMapIterator;
00105 
00106 
00108     itkNewMacro(Self);
00109 
00111     itkTypeMacro(SimplexMesh, Mesh);
00112 
00114     typedef TMeshTraits                                          MeshTraits;
00115     typedef typename MeshTraits::PixelType                       PixelType;  
00116     typedef typename MeshTraits::PointsContainer                 PointsContainer;
00117     typedef typename Superclass::PointsContainerPointer          PointsContainerPointer;
00118     typedef typename Superclass::PointsContainer::Iterator       PointsContainerIterator;
00119     typedef typename Superclass::PointsContainerConstIterator    PointsContainerConstIterator;
00120     typedef typename Superclass::CellsContainerPointer           CellsContainerPointer;
00121     typedef typename Superclass::CellsContainerIterator          CellsContainerIterator;
00123     itkSetMacro(GeometryData, GeometryMapPointer );
00124 
00126     itkGetConstReferenceMacro(GeometryData, GeometryMapPointer );
00127 
00129     itkSetMacro(LastCellId, unsigned long);
00130 
00132     itkGetMacro(LastCellId, unsigned long);
00133 
00138     virtual void CopyInformation(const DataObject *data);
00139 
00140 
00147     unsigned long AddEdge(unsigned long startPointId, unsigned long endPointId);
00148 
00149 
00157     unsigned long AddFace(CellAutoPointer &cellPointer);
00158 
00163     unsigned long ReplaceFace(unsigned long replaceIndex, CellAutoPointer &cellPointer);
00164 
00168     IndexArray GetNeighbors(unsigned long pointId) const;
00169 
00173     NeighborListType* GetNeighbors(unsigned long pointId, unsigned int radius, NeighborListType* list = NULL) const;
00174 
00180     void AddNeighbor(unsigned long pointId, unsigned long neighborId);
00181 
00185     void ReplaceNeighbor(unsigned long pointId, unsigned long oldNeighborId,unsigned long newNeighborIdx);
00186 
00190     void SwapNeighbors(unsigned long pointId, unsigned long firstNeighborId,unsigned long secondNeighborId);
00191 
00195     void SetGeometryData(unsigned long pointId, SimplexMeshGeometry*);
00196 
00200     void SetBarycentricCoordinates(unsigned long idx, PointType values);
00201 
00205     PointType GetBarycentricCoordinates(unsigned long idx) const;
00206 
00210     void SetReferenceMetrics(unsigned long idx, PointType values);
00211 
00215     PointType GetReferenceMetrics(unsigned long idx) const;
00216 
00220     void SetPhi(unsigned long idx, double values);
00221 
00225     double GetPhi(unsigned long idx) const;
00226 
00230     void SetMeanCurvature(unsigned long idx, double values);
00231 
00235     double GetMeanCurvature(unsigned long idx) const;
00236 
00240     void SetRadius(unsigned long idx, double values);
00241 
00245     double GetRadius(unsigned long idx) const;
00246 
00250     void SetDistance(unsigned long idx, double values);
00251 
00255     double GetDistance(unsigned long idx) const;
00256 
00258     PointType ComputeNormal(unsigned long idx ) const;
00259 
00260   protected:
00261     //  /** Constructor for use by New() method. */
00262     SimplexMesh();
00263     virtual ~SimplexMesh();
00264     void PrintSelf(std::ostream& os, Indent indent) const;
00265 
00269     GeometryMapPointer m_GeometryData;
00270 
00271     /*  */
00278     unsigned long m_LastCellId;
00279 
00280 
00281   private:
00282     SimplexMesh(const Self&); //purposely not implemented
00283     //  void operator=(const Self&); //purposely not implemented
00284 
00285 
00286 
00287   }; // End Class:  SimplexMesh
00288 
00289   } // end namespace itk
00290 
00291 #ifndef ITK_MANUAL_INSTANTIATION
00292 #include "itkSimplexMesh.txx"
00293 #endif
00294 
00295 #endif

Generated at Thu May 25 00:04:36 2006 for ITK by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2000