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

itkTriangleMeshToSimplexMeshFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003 Program:   Insight Segmentation & Registration Toolkit
00004 Module:    $RCSfile: itkTriangleMeshToSimplexMeshFilter.h,v $
00005 Language:  C++
00006 Date:      $Date: 2009-09-17 11:14:56 $
00007 Version:   $Revision: 1.7 $
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 __itkTriangleMeshToSimplexMeshFilter_h
00018 #define __itkTriangleMeshToSimplexMeshFilter_h
00019 
00020 #include <itkMesh.h>
00021 #include <itkLineCell.h>
00022 #include <itkVertexCell.h>
00023 #include <itkMapContainer.h>
00024 #include "itkSimplexMesh.h"
00025 #include "itkSimplexMeshGeometry.h"
00026 #include "itkMeshToMeshFilter.h"
00027 #include "itkVectorContainer.h"
00028 #include "itkNumericTraits.h"
00029 
00030 #include <itkPolygonCell.h>
00031 namespace itk
00032 {
00047 template <class TInputMesh, class TOutputMesh>
00048 class ITK_EXPORT TriangleMeshToSimplexMeshFilter : public MeshToMeshFilter<TInputMesh, TOutputMesh>
00049 {
00050 public:
00051 
00053   typedef TriangleMeshToSimplexMeshFilter  Self;
00054 
00056   typedef MeshToMeshFilter<TInputMesh, TOutputMesh> Superclass;
00057 
00059   typedef SmartPointer<Self>        Pointer;
00060   typedef SmartPointer<const Self>  ConstPointer;
00061 
00063   itkNewMacro(Self);
00064 
00066   itkTypeMacro(TriangleMeshToSimplexMeshFilter,MeshToMeshFilter);
00067 
00068   typedef TInputMesh                     InputMeshType;
00069   typedef typename TInputMesh::Pointer   InputMeshPointer;
00070   typedef typename TInputMesh::PointType InputPointType;
00071 
00072   typedef typename TInputMesh::BoundaryAssignmentsContainerPointer InputBoundaryAssignmentsContainerPointer;
00073 
00074   typedef typename TInputMesh::PointsContainer          InputPointsContainer;
00075   typedef typename InputPointsContainer::Pointer        InputPointsContainerPointer;
00076   typedef typename InputPointsContainer::Iterator       InputPointsContainerIterator;
00077   typedef typename InputPointsContainer::ConstIterator  InputPointsContainerConstIterator;
00078 
00079   typedef typename TOutputMesh::Pointer                   OutputMeshPointer;
00080   typedef typename TOutputMesh::PointType                 OutputPointType;
00081   typedef typename TOutputMesh::PixelType                 OutputPixelType;
00082   typedef typename TOutputMesh::PointsContainer           OutputPointsContainer;
00083   typedef typename OutputPointsContainer::Pointer         OutputPointsContainerPointer;
00084   typedef typename TOutputMesh::PointsContainer::Iterator OutputPointsContainerIterator;
00085 
00086   typedef typename TInputMesh::BoundaryAssignmentIdentifier InputBoundnaryAssignmentIdentifier;
00087 
00088   typedef typename TInputMesh::CellType             InputCellType;
00089   typedef typename InputCellType::CellAutoPointer   InputCellAutoPointer;
00090   typedef typename TInputMesh::CellAutoPointer      CellAutoPointer;
00091   typedef          itk::LineCell<InputCellType>     LineType;
00092   typedef          itk::PolygonCell<InputCellType>  PolygonType;
00093   typedef          itk::TriangleCell<InputCellType> TriangleType;
00094   typedef          itk::VertexCell<InputCellType>   VertexType;
00095 
00096   typedef          std::pair<unsigned long,unsigned long> EdgeIdentifierType;
00097   typedef          std::set<unsigned long>                IndexSetType;
00098 
00099   typedef          itk::MapContainer<unsigned long, EdgeIdentifierType> EdgeNeighborListType;
00100   typedef          itk::MapContainer<EdgeIdentifierType, unsigned long> LineCellIndexType;
00101 
00102   typedef          itk::MapContainer<unsigned long, IndexSetType>       VertexNeighborListType;
00103     typedef          itk::MapContainer<EdgeIdentifierType,unsigned long>  EdgeMapType;
00104   typedef typename EdgeMapType::Pointer                                 EdgeMapPointer;
00105 
00106   typedef          itk::VectorContainer<unsigned long,unsigned long>    IdVectorType;
00107   typedef typename IdVectorType::Pointer                                IdVectorPointer;
00108 
00109   typedef typename TOutputMesh::CellType             OutputCellType;
00110   typedef typename TOutputMesh::CellAutoPointer      OutputCellAutoPointer;
00111   typedef          itk::LineCell<OutputCellType>     OutputLineType;
00112   typedef          itk::PolygonCell<OutputCellType>  OutputPolygonType;
00113 
00114 protected:
00115 
00116   TriangleMeshToSimplexMeshFilter();
00117   ~TriangleMeshToSimplexMeshFilter();
00118   TriangleMeshToSimplexMeshFilter(const Self&) {}
00119 
00120   void operator=(const Self&) {}
00121 
00122   void PrintSelf(std::ostream& os, Indent indent) const;
00123 
00127   virtual void GenerateData();
00128 
00132   void Initialize();
00133 
00137   void CreateSimplexPoints();
00138 
00144   void CreateEdgeForTrianglePair( unsigned long pointIndex, unsigned long boundaryId);
00145 
00150   void CreateSimplexNeighbors();
00151 
00155   void CreateCells();
00156 
00160   void CreateNewEdge(unsigned long currentCellId, unsigned int featureId, 
00161     unsigned long startPointId, unsigned long endPointId);
00162 
00166   InputPointType ComputeFaceCenter(unsigned long faceId);
00167 
00171   IndexSetType* m_FaceSet;
00172 
00179   EdgeMapPointer m_Edges;
00180 
00184   EdgeNeighborListType::Pointer m_EdgeNeighborList;
00185 
00189   VertexNeighborListType::Pointer m_VertexNeighborList;
00190 
00194   LineCellIndexType::Pointer m_LineCellIndices;
00195 
00199   unsigned long m_CellIdxOffset;
00200 
00204   unsigned long m_IdOffset;
00205 
00209   unsigned long m_EdgeCellId;
00210 
00214   IdVectorPointer m_HandledEdgeIds;
00215 
00219   InputCellAutoPointer m_NewInputMeshCellPointer;
00220 
00224   OutputCellAutoPointer  m_NewSimplexCellPointer;
00225 };
00226 
00227 } //end of namespace
00228 
00229 #ifndef ITK_MANUAL_INSTANTIATION
00230 #include "itkTriangleMeshToSimplexMeshFilter.txx"
00231 #endif
00232 
00233 #endif
00234 

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