18 #ifndef itkQuadEdgeMeshToQuadEdgeMeshFilter_h
19 #define itkQuadEdgeMeshToQuadEdgeMeshFilter_h
36 template <
typename TInputMesh,
typename TOutputMesh>
101 CopyInputMeshToOutputMesh();
104 CopyInputMeshToOutputMeshGeometry();
107 CopyInputMeshToOutputMeshPoints();
110 CopyInputMeshToOutputMeshCells();
113 CopyInputMeshToOutputMeshEdgeCells();
116 CopyInputMeshToOutputMeshFieldData();
119 CopyInputMeshToOutputMeshPointData();
122 CopyInputMeshToOutputMeshCellData();
130 template <
typename TInputMesh,
typename TOutputMesh>
142 template <
typename TInputMesh,
typename TOutputMesh>
146 using InputCellDataContainer =
typename TInputMesh::CellDataContainer;
147 using OutputCellDataContainer =
typename TOutputMesh::CellDataContainer;
148 using InputCellDataContainerConstPointer =
typename InputCellDataContainer::ConstPointer;
149 using OutputCellDataContainerPointer =
typename OutputCellDataContainer::Pointer;
151 InputCellDataContainerConstPointer inputCellData = in->GetCellData();
153 if (inputCellData ==
nullptr)
159 OutputCellDataContainerPointer outputCellData = OutputCellDataContainer::New();
160 outputCellData->Reserve(inputCellData->Size());
163 using InputCellDataContainerConstIterator =
typename InputCellDataContainer::ConstIterator;
164 InputCellDataContainerConstIterator inIt = inputCellData->Begin();
165 while (inIt != inputCellData->End())
167 typename OutputCellDataContainer::Element point(inIt.Value());
168 outputCellData->SetElement(inIt.Index(), point);
172 out->SetCellData(outputCellData);
176 template <
typename TInputMesh,
typename TOutputMesh>
180 using OutputPointDataContainer =
typename TOutputMesh::PointDataContainer;
181 using OutputPointDataContainerPointer =
typename OutputPointDataContainer::Pointer;
182 using InputPointDataContainer =
typename TInputMesh::PointDataContainer;
184 const InputPointDataContainer * inputPointData = in->GetPointData();
186 if (inputPointData ==
nullptr)
192 OutputPointDataContainerPointer outputPointData = OutputPointDataContainer::New();
193 outputPointData->Reserve(inputPointData->Size());
196 using InputPointDataContainerConstIterator =
typename InputPointDataContainer::ConstIterator;
197 InputPointDataContainerConstIterator inIt = inputPointData->Begin();
198 while (inIt != inputPointData->End())
200 typename OutputPointDataContainer::Element point(inIt.Value());
201 outputPointData->SetElement(inIt.Index(), point);
205 out->SetPointData(outputPointData);
209 template <
typename TInputMesh,
typename TOutputMesh>
214 using InputCellsContainer =
typename TInputMesh::CellsContainer;
215 using InputCellsContainerConstPointer =
typename InputCellsContainer::ConstPointer;
216 using InputCellsContainerConstIterator =
typename InputCellsContainer::ConstIterator;
217 using InputPolygonCellType =
typename TInputMesh::PolygonCellType;
218 using InputPointIdList =
typename TInputMesh::PointIdList;
219 using InputCellTraits =
typename TInputMesh::CellTraits;
220 using InputPointsIdInternalIterator =
typename InputCellTraits::PointIdInternalIterator;
224 InputCellsContainerConstPointer inCells = in->GetCells();
226 if (inCells ==
nullptr)
232 InputCellsContainerConstIterator cIt = inCells->Begin();
233 InputCellsContainerConstIterator cEnd = inCells->End();
236 auto * pe = dynamic_cast<InputPolygonCellType *>(cIt.Value());
239 InputPointIdList points;
240 InputPointsIdInternalIterator pIt = pe->InternalPointIdsBegin();
241 InputPointsIdInternalIterator pEnd = pe->InternalPointIdsEnd();
245 points.push_back((*pIt));
248 out->AddFaceWithSecurePointList(points,
false);
255 template <
typename TInputMesh,
typename TOutputMesh>
260 using InputCellsContainer =
typename TInputMesh::CellsContainer;
261 using InputCellsContainerConstPointer =
typename InputCellsContainer::ConstPointer;
262 using InputCellsContainerConstIterator =
typename InputCellsContainer::ConstIterator;
263 using InputEdgeCellType =
typename TInputMesh::EdgeCellType;
265 InputCellsContainerConstPointer inEdgeCells = in->GetEdgeCells();
267 if (inEdgeCells ==
nullptr)
273 InputCellsContainerConstIterator ecIt = inEdgeCells->Begin();
274 InputCellsContainerConstIterator ecEnd = inEdgeCells->End();
276 while (ecIt != ecEnd)
278 auto * pe = dynamic_cast<InputEdgeCellType *>(ecIt.Value());
281 out->AddEdgeWithSecurePointList(pe->GetQEGeom()->GetOrigin(), pe->GetQEGeom()->GetDestination());
288 template <
typename TInputMesh,
typename TOutputMesh>
293 using InputPointsContainerConstPointer =
typename TInputMesh::PointsContainerConstPointer;
294 using InputPointsContainerConstIterator =
typename TInputMesh::PointsContainerConstIterator;
296 using OutputPointsContainer =
typename TOutputMesh::PointsContainer;
297 using OutputPointsContainerPointer =
typename TOutputMesh::PointsContainerPointer;
300 InputPointsContainerConstPointer inPoints = in->GetPoints();
302 if (inPoints ==
nullptr)
308 InputPointsContainerConstIterator inIt = inPoints->
Begin();
309 InputPointsContainerConstIterator inEnd = inPoints->End();
311 OutputPointsContainerPointer oPoints = out->GetPoints();
312 if (oPoints ==
nullptr)
314 oPoints = OutputPointsContainer::New();
315 out->SetPoints(oPoints);
317 OutputPointType pOut;
319 while (inIt != inEnd)
321 pOut.CastFrom(inIt.Value());
322 oPoints->InsertElement(inIt.Index(), pOut);
328 #ifndef ITK_MANUAL_INSTANTIATION
329 # include "itkQuadEdgeMeshToQuadEdgeMeshFilter.hxx"