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:
00052     typedef TriangleMeshToSimplexMeshFilter  Self;
00053 
00055     typedef MeshToMeshFilter<TInputMesh, TOutputMesh> Superclass;
00056 
00058     typedef SmartPointer<Self>  Pointer;
00059     typedef SmartPointer<const Self>  ConstPointer;
00060 
00062     itkNewMacro(Self);
00063 
00065     itkTypeMacro(TriangleMeshToSimplexMeshFilter,MeshToMeshFilter);
00066 
00067     typedef TInputMesh                                                    InputMeshType;
00068     typedef typename TInputMesh::Pointer                                  InputMeshPointer;
00069     typedef typename TInputMesh::PointType                                InputPointType;
00070     typedef typename TInputMesh::BoundaryAssignmentsContainerPointer      InputBoundaryAssignmentsContainerPointer;
00071     typedef typename TInputMesh::PointsContainer                          InputPointsContainer;
00072     typedef typename InputPointsContainer::Pointer                        InputPointsContainerPointer;
00073     typedef typename InputPointsContainer::Iterator                       InputPointsContainerIterator;
00074 
00075     typedef typename TOutputMesh::Pointer                                 OutputMeshPointer;
00076     typedef typename TOutputMesh::PointType                               OutputPointType;
00077     typedef typename TOutputMesh::PixelType                               OutputPixelType;
00078     typedef typename TOutputMesh::PointsContainer                         OutputPointsContainer;
00079     typedef typename OutputPointsContainer::Pointer                       OutputPointsContainerPointer;
00080     typedef typename TOutputMesh::PointsContainer::Iterator               OutputPointsContainerIterator;
00081 
00082     typedef typename TInputMesh::BoundaryAssignmentIdentifier             InputBoundnaryAssignmentIdentifier;
00083 
00084     typedef typename TInputMesh::CellType                                 InputCellType;
00085     typedef typename InputCellType::CellAutoPointer                       InputCellAutoPointer;
00086     typedef typename TInputMesh::CellAutoPointer                          CellAutoPointer;
00087     typedef          itk::LineCell<InputCellType>                         LineType;
00088     typedef          itk::PolygonCell<InputCellType>                      PolygonType;
00089     typedef          itk::TriangleCell<InputCellType>                     TriangleType;
00090     typedef          itk::VertexCell<InputCellType>                       VertexType;
00091 
00092     typedef          std::pair<unsigned long,unsigned long>               EdgeIdentifierType;
00093     typedef          std::set<unsigned long>                              IndexSetType;
00094     typedef          itk::MapContainer<unsigned long, EdgeIdentifierType> EdgeNeighborListType;
00095     typedef          itk::MapContainer<EdgeIdentifierType, unsigned long> LineCellIndexType;
00096 
00097     typedef          itk::MapContainer<unsigned long, IndexSetType>       VertexNeighborListType;
00098     typedef          itk::MapContainer<EdgeIdentifierType,unsigned long>  EdgeMapType;
00099     typedef typename EdgeMapType::Pointer                                 EdgeMapPointer;
00100 
00101     typedef          itk::VectorContainer<unsigned long,unsigned long>    IdVectorType;
00102     typedef typename IdVectorType::Pointer                                IdVectorPointer;
00103 
00104     typedef typename TOutputMesh::CellType                                OutputCellType;
00105     typedef typename TOutputMesh::CellAutoPointer                         OutputCellAutoPointer;
00106     typedef          itk::LineCell<OutputCellType>                        OutputLineType;
00107     typedef          itk::PolygonCell<OutputCellType>                     OutputPolygonType;
00108 
00109   protected:
00110 
00111     TriangleMeshToSimplexMeshFilter();
00112 
00113     ~TriangleMeshToSimplexMeshFilter();
00114 
00115     TriangleMeshToSimplexMeshFilter(const Self&) {}
00116 
00117   void operator=(const Self&) 
00118     {
00119     }
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 
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 
00168 
00172   IndexSetType* m_FaceSet;
00173 
00180   EdgeMapPointer m_Edges;
00181 
00185   EdgeNeighborListType::Pointer m_EdgeNeighborList;
00186 
00190   VertexNeighborListType::Pointer m_VertexNeighborList;
00191 
00195   LineCellIndexType::Pointer m_LineCellIndices;
00196 
00197 
00201   unsigned long m_CellIdxOffset;
00202 
00206   unsigned long m_IdOffset;
00207 
00208 
00212   unsigned long m_EdgeCellId;
00213 
00217   IdVectorPointer m_HandledEdgeIds;
00218 
00222   InputCellAutoPointer NewInputMeshCellPointer;
00223 
00227   OutputCellAutoPointer  NewSimplexCellPointer;
00228 
00229 
00230 
00231   };
00232 
00233   } //end of namespace
00234 
00235 #ifndef ITK_MANUAL_INSTANTIATION
00236 #include "itkTriangleMeshToSimplexMeshFilter.txx"
00237 #endif
00238 
00239 #endif //_TRIANGLE_MESH_TO_SIMPLEX_MESH_FILTER_H

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