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-05-12 17:23:01 $
00007 Version:   $Revision: 1.6 $
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 
00078   typedef typename TOutputMesh::Pointer                   OutputMeshPointer;
00079   typedef typename TOutputMesh::PointType                 OutputPointType;
00080   typedef typename TOutputMesh::PixelType                 OutputPixelType;
00081   typedef typename TOutputMesh::PointsContainer           OutputPointsContainer;
00082   typedef typename OutputPointsContainer::Pointer         OutputPointsContainerPointer;
00083   typedef typename TOutputMesh::PointsContainer::Iterator OutputPointsContainerIterator;
00084 
00085   typedef typename TInputMesh::BoundaryAssignmentIdentifier InputBoundnaryAssignmentIdentifier;
00086 
00087   typedef typename TInputMesh::CellType             InputCellType;
00088   typedef typename InputCellType::CellAutoPointer   InputCellAutoPointer;
00089   typedef typename TInputMesh::CellAutoPointer      CellAutoPointer;
00090   typedef          itk::LineCell<InputCellType>     LineType;
00091   typedef          itk::PolygonCell<InputCellType>  PolygonType;
00092   typedef          itk::TriangleCell<InputCellType> TriangleType;
00093   typedef          itk::VertexCell<InputCellType>   VertexType;
00094 
00095   typedef          std::pair<unsigned long,unsigned long> EdgeIdentifierType;
00096   typedef          std::set<unsigned long>                IndexSetType;
00097 
00098   typedef          itk::MapContainer<unsigned long, EdgeIdentifierType> EdgeNeighborListType;
00099   typedef          itk::MapContainer<EdgeIdentifierType, unsigned long> LineCellIndexType;
00100 
00101   typedef          itk::MapContainer<unsigned long, IndexSetType>       VertexNeighborListType;
00102     typedef          itk::MapContainer<EdgeIdentifierType,unsigned long>  EdgeMapType;
00103   typedef typename EdgeMapType::Pointer                                 EdgeMapPointer;
00104 
00105   typedef          itk::VectorContainer<unsigned long,unsigned long>    IdVectorType;
00106   typedef typename IdVectorType::Pointer                                IdVectorPointer;
00107 
00108   typedef typename TOutputMesh::CellType             OutputCellType;
00109   typedef typename TOutputMesh::CellAutoPointer      OutputCellAutoPointer;
00110   typedef          itk::LineCell<OutputCellType>     OutputLineType;
00111   typedef          itk::PolygonCell<OutputCellType>  OutputPolygonType;
00112 
00113 protected:
00114 
00115   TriangleMeshToSimplexMeshFilter();
00116   ~TriangleMeshToSimplexMeshFilter();
00117   TriangleMeshToSimplexMeshFilter(const Self&) {}
00118 
00119   void operator=(const Self&) {}
00120 
00121   void PrintSelf(std::ostream& os, Indent indent) const;
00122 
00126   virtual void GenerateData();
00127 
00131   void Initialize();
00132 
00136   void CreateSimplexPoints();
00137 
00143   void CreateEdgeForTrianglePair( unsigned long pointIndex, unsigned long boundaryId);
00144 
00149   void CreateSimplexNeighbors();
00150 
00154   void CreateCells();
00155 
00159   void CreateNewEdge(unsigned long currentCellId, unsigned int featureId, 
00160     unsigned long startPointId, unsigned long endPointId);
00161 
00165   InputPointType ComputeFaceCenter(unsigned long faceId);
00166 
00170   IndexSetType* m_FaceSet;
00171 
00178   EdgeMapPointer m_Edges;
00179 
00183   EdgeNeighborListType::Pointer m_EdgeNeighborList;
00184 
00188   VertexNeighborListType::Pointer m_VertexNeighborList;
00189 
00193   LineCellIndexType::Pointer m_LineCellIndices;
00194 
00198   unsigned long m_CellIdxOffset;
00199 
00203   unsigned long m_IdOffset;
00204 
00208   unsigned long m_EdgeCellId;
00209 
00213   IdVectorPointer m_HandledEdgeIds;
00214 
00218   InputCellAutoPointer m_NewInputMeshCellPointer;
00219 
00223   OutputCellAutoPointer  m_NewSimplexCellPointer;
00224 };
00225 
00226 } //end of namespace
00227 
00228 #ifndef ITK_MANUAL_INSTANTIATION
00229 #include "itkTriangleMeshToSimplexMeshFilter.txx"
00230 #endif
00231 
00232 #endif
00233 

Generated at Tue Sep 15 05:10:56 2009 for ITK by doxygen 1.5.8 written by Dimitri van Heesch, © 1997-2000