18 #ifndef __itkQuadEdgeMeshToQuadEdgeMeshFilter_h
19 #define __itkQuadEdgeMeshToQuadEdgeMeshFilter_h
35 template<
typename TInputMesh,
typename TOutputMesh >
59 typedef typename InputPointDataContainer::ConstPointer
61 typedef typename InputMeshType::PointsContainerConstIterator
63 typedef typename InputMeshType::PointsContainerConstPointer
65 typedef typename InputMeshType::CellsContainerConstIterator
67 typedef typename InputMeshType::CellsContainerConstPointer
74 typedef typename InputCellTraits::PointIdInternalIterator
89 typedef typename OutputMeshType::PointsContainerIterator
91 typedef typename OutputMeshType::PointsContainerPointer
93 typedef typename OutputMeshType::PointsContainerConstPointer
107 virtual void CopyInputMeshToOutputMesh();
109 virtual void CopyInputMeshToOutputMeshGeometry();
111 virtual void CopyInputMeshToOutputMeshPoints();
113 virtual void CopyInputMeshToOutputMeshCells();
115 virtual void CopyInputMeshToOutputMeshEdgeCells();
117 virtual void CopyInputMeshToOutputMeshFieldData();
119 virtual void CopyInputMeshToOutputMeshPointData();
121 virtual void CopyInputMeshToOutputMeshCellData();
125 void operator=(
const Self &);
133 template<
class TInputMesh,
class TOutputMesh >
144 template<
class TInputMesh,
class TOutputMesh >
147 typedef typename TInputMesh::CellDataContainer InputCellDataContainer;
148 typedef typename TOutputMesh::CellDataContainer OutputCellDataContainer;
149 typedef typename InputCellDataContainer::ConstPointer InputCellDataContainerConstPointer;
150 typedef typename OutputCellDataContainer::Pointer OutputCellDataContainerPointer;
152 InputCellDataContainerConstPointer inputCellData = in->GetCellData();
154 if ( inputCellData.IsNull() )
160 OutputCellDataContainerPointer outputCellData = OutputCellDataContainer::New();
161 outputCellData->Reserve( inputCellData->Size() );
164 typedef typename InputCellDataContainer::ConstIterator InputCellDataContainerConstIterator;
165 InputCellDataContainerConstIterator inIt = inputCellData->Begin();
166 while ( inIt != inputCellData->End() )
168 outputCellData->SetElement( inIt.Index(), inIt.Value() );
172 out->SetCellData(outputCellData);
176 template<
class TInputMesh,
class TOutputMesh >
179 typedef typename TOutputMesh::PointDataContainer OutputPointDataContainer;
180 typedef typename OutputPointDataContainer::Pointer OutputPointDataContainerPointer;
181 typedef typename TInputMesh::PointDataContainer InputPointDataContainer;
183 const InputPointDataContainer *inputPointData = in->GetPointData();
185 if ( inputPointData ==
NULL )
191 OutputPointDataContainerPointer outputPointData = OutputPointDataContainer::New();
192 outputPointData->Reserve( inputPointData->Size() );
195 typedef typename InputPointDataContainer::ConstIterator InputPointDataContainerConstIterator;
196 InputPointDataContainerConstIterator inIt = inputPointData->Begin();
197 while ( inIt != inputPointData->End() )
199 outputPointData->SetElement( inIt.Index(), inIt.Value() );
203 out->SetPointData(outputPointData);
207 template<
class TInputMesh,
class TOutputMesh >
211 typedef typename TInputMesh::CellsContainer InputCellsContainer;
212 typedef typename InputCellsContainer::ConstPointer InputCellsContainerConstPointer;
213 typedef typename InputCellsContainer::ConstIterator InputCellsContainerConstIterator;
214 typedef typename TInputMesh::PolygonCellType InputPolygonCellType;
215 typedef typename TInputMesh::PointIdList InputPointIdList;
216 typedef typename TInputMesh::CellTraits InputCellTraits;
217 typedef typename InputCellTraits::PointIdInternalIterator
218 InputPointsIdInternalIterator;
220 out->SetCellsAllocationMethod(TOutputMesh::CellsAllocatedDynamicallyCellByCell);
222 InputCellsContainerConstPointer inCells = in->GetCells();
226 InputCellsContainerConstIterator cIt = inCells->Begin();
227 InputCellsContainerConstIterator cEnd = inCells->End();
228 while ( cIt != cEnd )
230 InputPolygonCellType *pe =
dynamic_cast< InputPolygonCellType *
>( cIt.Value() );
233 InputPointIdList points;
234 InputPointsIdInternalIterator pIt = pe->InternalPointIdsBegin();
235 InputPointsIdInternalIterator pEnd = pe->InternalPointIdsEnd();
237 while ( pIt != pEnd )
239 points.push_back( ( *pIt ) );
242 out->AddFaceWithSecurePointList(points,
false);
250 template<
class TInputMesh,
class TOutputMesh >
254 typedef typename TInputMesh::CellsContainer InputCellsContainer;
255 typedef typename InputCellsContainer::ConstPointer InputCellsContainerConstPointer;
256 typedef typename InputCellsContainer::ConstIterator InputCellsContainerConstIterator;
257 typedef typename TInputMesh::EdgeCellType InputEdgeCellType;
259 InputCellsContainerConstPointer inEdgeCells = in->GetEdgeCells();
263 InputCellsContainerConstIterator ecIt = inEdgeCells->Begin();
264 InputCellsContainerConstIterator ecEnd = inEdgeCells->End();
266 while ( ecIt != ecEnd )
268 InputEdgeCellType *pe =
dynamic_cast< InputEdgeCellType *
>( ecIt.Value() );
271 out->AddEdgeWithSecurePointList( pe->GetQEGeom()->GetOrigin(),
272 pe->GetQEGeom()->GetDestination() );
280 template<
class TInputMesh,
class TOutputMesh >
284 typedef typename TInputMesh::PointsContainerConstPointer InputPointsContainerConstPointer;
285 typedef typename TInputMesh::PointsContainerConstIterator InputPointsContainerConstIterator;
287 typedef typename TOutputMesh::PointsContainer OutputPointsContainer;
288 typedef typename TOutputMesh::PointsContainerPointer OutputPointsContainerPointer;
289 typedef typename TOutputMesh::PointType OutputPointType;
291 InputPointsContainerConstPointer inPoints = in->GetPoints();
295 InputPointsContainerConstIterator inIt = inPoints->Begin();
296 InputPointsContainerConstIterator inEnd = inPoints->End();
298 OutputPointsContainerPointer oPoints = out->GetPoints();
299 if( oPoints.IsNull() )
301 oPoints = OutputPointsContainer::New();
302 out->SetPoints( oPoints );
304 OutputPointType pOut;
306 while ( inIt != inEnd )
308 pOut.CastFrom( inIt.Value() );
309 oPoints->InsertElement(inIt.Index(), pOut);
316 #ifndef ITK_MANUAL_INSTANTIATION
317 #include "itkQuadEdgeMeshToQuadEdgeMeshFilter.hxx"