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 while ( cIt != inCells->End() )
229 InputPolygonCellType *pe =
dynamic_cast< InputPolygonCellType *
>( cIt.Value() );
232 InputPointIdList points;
233 InputPointsIdInternalIterator pit = pe->InternalPointIdsBegin();
234 while ( pit != pe->InternalPointIdsEnd() )
236 points.push_back( ( *pit ) );
239 out->AddFaceWithSecurePointList(points,
false);
247 template<
class TInputMesh,
class TOutputMesh >
251 typedef typename TInputMesh::CellsContainer InputCellsContainer;
252 typedef typename InputCellsContainer::ConstPointer InputCellsContainerConstPointer;
253 typedef typename InputCellsContainer::ConstIterator InputCellsContainerConstIterator;
254 typedef typename TInputMesh::EdgeCellType InputEdgeCellType;
256 InputCellsContainerConstPointer inEdgeCells = in->GetEdgeCells();
260 InputCellsContainerConstIterator ecIt = inEdgeCells->Begin();
261 while ( ecIt != inEdgeCells->End() )
263 InputEdgeCellType *pe =
dynamic_cast< InputEdgeCellType *
>( ecIt.Value() );
266 out->AddEdgeWithSecurePointList( pe->GetQEGeom()->GetOrigin(),
267 pe->GetQEGeom()->GetDestination() );
275 template<
class TInputMesh,
class TOutputMesh >
279 typedef typename TInputMesh::PointsContainer InputPointsContainer;
280 typedef typename InputPointsContainer::ConstPointer InputPointsContainerConstPointer;
281 typedef typename InputPointsContainer::ConstIterator InputPointsContainerConstIterator;
282 typedef typename TOutputMesh::PointType OutputPointType;
284 InputPointsContainerConstPointer inPoints = in->GetPoints();
288 InputPointsContainerConstIterator inIt = inPoints->Begin();
289 OutputPointType pOut;
291 while ( inIt != inPoints->End() )
293 pOut.CastFrom( inIt.Value() );
294 out->SetPoint(inIt.Index(), pOut);
301 #ifndef ITK_MANUAL_INSTANTIATION
302 #include "itkQuadEdgeMeshToQuadEdgeMeshFilter.hxx"