ITK
4.1.0
Insight Segmentation and Registration Toolkit
|
00001 /*========================================================================= 00002 * 00003 * Copyright Insight Software Consortium 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0.txt 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 * 00017 *=========================================================================*/ 00018 #ifndef __itkTriangleMeshToSimplexMeshFilter_h 00019 #define __itkTriangleMeshToSimplexMeshFilter_h 00020 00021 #include "itkMapContainer.h" 00022 #include "itkSimplexMesh.h" 00023 #include "itkMeshToMeshFilter.h" 00024 #include "itkVectorContainer.h" 00025 00026 #include "itkPolygonCell.h" 00027 namespace itk 00028 { 00044 template< class TInputMesh, class TOutputMesh > 00045 class ITK_EXPORT TriangleMeshToSimplexMeshFilter:public MeshToMeshFilter< TInputMesh, TOutputMesh > 00046 { 00047 public: 00048 00050 typedef TriangleMeshToSimplexMeshFilter Self; 00051 00053 typedef MeshToMeshFilter< TInputMesh, TOutputMesh > Superclass; 00054 00056 typedef SmartPointer< Self > Pointer; 00057 typedef SmartPointer< const Self > ConstPointer; 00058 00060 itkNewMacro(Self); 00061 00063 itkTypeMacro(TriangleMeshToSimplexMeshFilter, MeshToMeshFilter); 00064 00065 typedef TInputMesh InputMeshType; 00066 typedef typename TInputMesh::Pointer InputMeshPointer; 00067 typedef typename TInputMesh::PointType InputPointType; 00068 00069 typedef typename TInputMesh::BoundaryAssignmentsContainerPointer InputBoundaryAssignmentsContainerPointer; 00070 00071 typedef typename TInputMesh::PointsContainer InputPointsContainer; 00072 typedef typename InputPointsContainer::Pointer InputPointsContainerPointer; 00073 typedef typename InputPointsContainer::Iterator InputPointsContainerIterator; 00074 typedef typename InputPointsContainer::ConstIterator InputPointsContainerConstIterator; 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 typename TOutputMesh::CellIdentifier CellIdentifier; 00094 typedef typename TOutputMesh::PointIdentifier PointIdentifier; 00095 typedef typename TOutputMesh::CellFeatureIdentifier CellFeatureIdentifier; 00096 00097 typedef std::pair< CellIdentifier, CellIdentifier > EdgeIdentifierType; 00098 typedef std::set< CellIdentifier > IndexSetType; 00099 00100 typedef itk::MapContainer< CellIdentifier, EdgeIdentifierType > EdgeNeighborListType; 00101 typedef itk::MapContainer< EdgeIdentifierType, CellIdentifier > LineCellIndexType; 00102 00103 typedef itk::MapContainer< PointIdentifier, IndexSetType > VertexNeighborListType; 00104 typedef itk::MapContainer< EdgeIdentifierType, CellIdentifier > EdgeMapType; 00105 typedef typename EdgeMapType::Pointer EdgeMapPointer; 00106 00107 typedef itk::VectorContainer< CellIdentifier, CellIdentifier > IdVectorType; 00108 typedef typename IdVectorType::Pointer IdVectorPointer; 00109 00110 typedef typename TOutputMesh::CellType OutputCellType; 00111 typedef typename TOutputMesh::CellAutoPointer OutputCellAutoPointer; 00112 typedef itk::LineCell< OutputCellType > OutputLineType; 00113 typedef itk::PolygonCell< OutputCellType > OutputPolygonType; 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(CellIdentifier pointIndex, CellIdentifier boundaryId); 00145 00150 void CreateSimplexNeighbors(); 00151 00155 void CreateCells(); 00156 00160 void CreateNewEdge(CellIdentifier currentCellId, CellFeatureIdentifier featureId, 00161 PointIdentifier startPointId, PointIdentifier endPointId); 00162 00166 InputPointType ComputeFaceCenter(CellIdentifier faceId); 00167 00171 IndexSetType *m_FaceSet; 00172 00179 EdgeMapPointer m_Edges; 00180 00184 typename EdgeNeighborListType::Pointer m_EdgeNeighborList; 00185 00189 typename VertexNeighborListType::Pointer m_VertexNeighborList; 00190 00194 typename LineCellIndexType::Pointer m_LineCellIndices; 00195 00199 CellIdentifier m_CellIdxOffset; 00200 00204 PointIdentifier m_IdOffset; 00205 00209 CellIdentifier m_EdgeCellId; 00210 00214 IdVectorPointer m_HandledEdgeIds; 00215 00219 InputCellAutoPointer m_NewInputMeshCellPointer; 00220 00224 OutputCellAutoPointer m_NewSimplexCellPointer; 00225 }; 00226 } //end of namespace 00227 00228 #ifndef ITK_MANUAL_INSTANTIATION 00229 #include "itkTriangleMeshToSimplexMeshFilter.hxx" 00230 #endif 00231 00232 #endif 00233