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: 2004/07/27 16:06:20 $
00007 Version:   $Revision: 1.4 $
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 __TriangleMeshToSimplexMeshFilter_h
00018 #define __TriangleMeshToSimplexMeshFilter_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 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     typedef typename TInputMesh::BoundaryAssignmentsContainerPointer      InputBoundaryAssignmentsContainerPointer;
00072     typedef typename TInputMesh::PointsContainer                          InputPointsContainer;
00073     typedef typename InputPointsContainer::Pointer                        InputPointsContainerPointer;
00074     typedef typename InputPointsContainer::Iterator                       InputPointsContainerIterator;
00075 
00076     typedef typename TOutputMesh::Pointer                                 OutputMeshPointer;
00077     typedef typename TOutputMesh::PointType                               OutputPointType;
00078     typedef typename TOutputMesh::PixelType                               OutputPixelType;
00079     typedef typename TOutputMesh::PointsContainer                         OutputPointsContainer;
00080     typedef typename OutputPointsContainer::Pointer                       OutputPointsContainerPointer;
00081     typedef typename TOutputMesh::PointsContainer::Iterator               OutputPointsContainerIterator;
00082 
00083     typedef typename TInputMesh::BoundaryAssignmentIdentifier             InputBoundnaryAssignmentIdentifier;
00084 
00085     typedef typename TInputMesh::CellType                                 InputCellType;
00086     typedef typename InputCellType::CellAutoPointer                       InputCellAutoPointer;
00087     typedef typename TInputMesh::CellAutoPointer                          CellAutoPointer;
00088     typedef          itk::LineCell<InputCellType>                         LineType;
00089     typedef          itk::PolygonCell<InputCellType>                      PolygonType;
00090     typedef          itk::TriangleCell<InputCellType>                     TriangleType;
00091     typedef          itk::VertexCell<InputCellType>                       VertexType;
00092 
00093     typedef          std::pair<unsigned long,unsigned long>               EdgeIdentifierType;
00094     typedef          std::set<unsigned long>                              IndexSetType;
00095     typedef          itk::MapContainer<unsigned long, EdgeIdentifierType> EdgeNeighborListType;
00096     typedef          itk::MapContainer<EdgeIdentifierType, unsigned long> LineCellIndexType;
00097 
00098     typedef          itk::MapContainer<unsigned long, IndexSetType>       VertexNeighborListType;
00099     typedef          itk::MapContainer<EdgeIdentifierType,unsigned long>  EdgeMapType;
00100     typedef typename EdgeMapType::Pointer                                 EdgeMapPointer;
00101 
00102     typedef          itk::VectorContainer<unsigned long,unsigned long>    IdVectorType;
00103     typedef typename IdVectorType::Pointer                                IdVectorPointer;
00104 
00105     typedef typename TOutputMesh::CellType                                OutputCellType;
00106     typedef typename TOutputMesh::CellAutoPointer                         OutputCellAutoPointer;
00107     typedef          itk::LineCell<OutputCellType>                        OutputLineType;
00108     typedef          itk::PolygonCell<OutputCellType>                     OutputPolygonType;
00109 
00110   protected:
00111 
00112     TriangleMeshToSimplexMeshFilter();
00113 
00114     ~TriangleMeshToSimplexMeshFilter();
00115 
00116     TriangleMeshToSimplexMeshFilter(const Self&) {}
00117 
00118   void operator=(const Self&) 
00119     {
00120     }
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 
00157 
00161   void CreateNewEdge(unsigned long currentCellId, unsigned int featureId, 
00162     unsigned long startPointId, unsigned long endPointId);
00163 
00167   InputPointType ComputeFaceCenter(unsigned long faceId);
00168 
00169 
00173   IndexSetType* m_FaceSet;
00174 
00181   EdgeMapPointer m_Edges;
00182 
00186   EdgeNeighborListType::Pointer m_EdgeNeighborList;
00187 
00191   VertexNeighborListType::Pointer m_VertexNeighborList;
00192 
00196   LineCellIndexType::Pointer m_LineCellIndices;
00197 
00198 
00202   unsigned long m_CellIdxOffset;
00203 
00207   unsigned long m_IdOffset;
00208 
00209 
00213   unsigned long m_EdgeCellId;
00214 
00218   IdVectorPointer m_HandledEdgeIds;
00219 
00223   InputCellAutoPointer NewInputMeshCellPointer;
00224 
00228   OutputCellAutoPointer  NewSimplexCellPointer;
00229 
00230 
00231 
00232   };
00233 
00234   } //end of namespace
00235 
00236 #ifndef ITK_MANUAL_INSTANTIATION
00237 #include "itkTriangleMeshToSimplexMeshFilter.txx"
00238 #endif
00239 
00240 #endif //_TRIANGLE_MESH_TO_SIMPLEX_MESH_FILTER_H
00241 

Generated at Sun Sep 23 14:27:36 2007 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000