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
105 virtual void CopyMeshToMesh(
const TInputMesh *in, TOutputMesh *out);
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 &);
135 template<
class TInputMesh,
class TOutputMesh >
138 typedef typename TInputMesh::CellDataContainer InputCellDataContainer;
139 typedef typename TOutputMesh::CellDataContainer OutputCellDataContainer;
140 typedef typename InputCellDataContainer::ConstPointer InputCellDataContainerConstPointer;
141 typedef typename OutputCellDataContainer::Pointer OutputCellDataContainerPointer;
143 InputCellDataContainerConstPointer inputCellData = in->GetCellData();
145 if ( inputCellData.IsNull() )
151 OutputCellDataContainerPointer outputCellData = OutputCellDataContainer::New();
152 outputCellData->Reserve( inputCellData->Size() );
155 typedef typename InputCellDataContainer::ConstIterator InputCellDataContainerConstIterator;
156 InputCellDataContainerConstIterator inIt = inputCellData->Begin();
157 while ( inIt != inputCellData->End() )
159 outputCellData->SetElement( inIt.Index(), inIt.Value() );
163 out->SetCellData(outputCellData);
167 template<
class TInputMesh,
class TOutputMesh >
170 typedef typename TOutputMesh::PointDataContainer OutputPointDataContainer;
171 typedef typename OutputPointDataContainer::Pointer OutputPointDataContainerPointer;
172 typedef typename TInputMesh::PointDataContainer InputPointDataContainer;
174 const InputPointDataContainer *inputPointData = in->GetPointData();
176 if ( inputPointData ==
NULL )
182 OutputPointDataContainerPointer outputPointData = OutputPointDataContainer::New();
183 outputPointData->Reserve( inputPointData->Size() );
186 typedef typename InputPointDataContainer::ConstIterator InputPointDataContainerConstIterator;
187 InputPointDataContainerConstIterator inIt = inputPointData->Begin();
188 while ( inIt != inputPointData->End() )
190 outputPointData->SetElement( inIt.Index(), inIt.Value() );
194 out->SetPointData(outputPointData);
198 template<
class TInputMesh,
class TOutputMesh >
202 typedef typename TInputMesh::CellsContainer InputCellsContainer;
203 typedef typename InputCellsContainer::ConstPointer InputCellsContainerConstPointer;
204 typedef typename InputCellsContainer::ConstIterator InputCellsContainerConstIterator;
205 typedef typename TInputMesh::PolygonCellType InputPolygonCellType;
206 typedef typename TInputMesh::PointIdList InputPointIdList;
207 typedef typename TInputMesh::CellTraits InputCellTraits;
208 typedef typename InputCellTraits::PointIdInternalIterator
209 InputPointsIdInternalIterator;
211 out->SetCellsAllocationMethod(TOutputMesh::CellsAllocatedDynamicallyCellByCell);
213 InputCellsContainerConstPointer inCells = in->GetCells();
217 InputCellsContainerConstIterator cIt = inCells->Begin();
218 while ( cIt != inCells->End() )
220 InputPolygonCellType *pe =
dynamic_cast< InputPolygonCellType *
>( cIt.Value() );
223 InputPointIdList points;
224 InputPointsIdInternalIterator pit = pe->InternalPointIdsBegin();
225 while ( pit != pe->InternalPointIdsEnd() )
227 points.push_back( ( *pit ) );
230 out->AddFaceWithSecurePointList(points,
false);
238 template<
class TInputMesh,
class TOutputMesh >
242 typedef typename TInputMesh::CellsContainer InputCellsContainer;
243 typedef typename InputCellsContainer::ConstPointer InputCellsContainerConstPointer;
244 typedef typename InputCellsContainer::ConstIterator InputCellsContainerConstIterator;
245 typedef typename TInputMesh::EdgeCellType InputEdgeCellType;
247 InputCellsContainerConstPointer inEdgeCells = in->GetEdgeCells();
251 InputCellsContainerConstIterator ecIt = inEdgeCells->Begin();
252 while ( ecIt != inEdgeCells->End() )
254 InputEdgeCellType *pe =
dynamic_cast< InputEdgeCellType *
>( ecIt.Value() );
257 out->AddEdgeWithSecurePointList( pe->GetQEGeom()->GetOrigin(),
258 pe->GetQEGeom()->GetDestination() );
266 template<
class TInputMesh,
class TOutputMesh >
270 typedef typename TInputMesh::PointsContainer InputPointsContainer;
271 typedef typename InputPointsContainer::ConstPointer InputPointsContainerConstPointer;
272 typedef typename InputPointsContainer::ConstIterator InputPointsContainerConstIterator;
273 typedef typename TOutputMesh::PointType OutputPointType;
275 InputPointsContainerConstPointer inPoints = in->GetPoints();
279 InputPointsContainerConstIterator inIt = inPoints->Begin();
280 OutputPointType pOut;
282 while ( inIt != inPoints->End() )
284 pOut.CastFrom( inIt.Value() );
285 out->SetPoint(inIt.Index(), pOut);
292 #ifndef ITK_MANUAL_INSTANTIATION
293 #include "itkQuadEdgeMeshToQuadEdgeMeshFilter.hxx"