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.IsNull())
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();
228 InputCellsContainerConstIterator cIt = inCells->Begin();
229 InputCellsContainerConstIterator cEnd = inCells->End();
232 auto * pe = dynamic_cast<InputPolygonCellType *>(cIt.Value());
235 InputPointIdList points;
236 InputPointsIdInternalIterator pIt = pe->InternalPointIdsBegin();
237 InputPointsIdInternalIterator pEnd = pe->InternalPointIdsEnd();
241 points.push_back((*pIt));
244 out->AddFaceWithSecurePointList(points,
false);
252 template <
typename TInputMesh,
typename TOutputMesh>
257 using InputCellsContainer =
typename TInputMesh::CellsContainer;
258 using InputCellsContainerConstPointer =
typename InputCellsContainer::ConstPointer;
259 using InputCellsContainerConstIterator =
typename InputCellsContainer::ConstIterator;
260 using InputEdgeCellType =
typename TInputMesh::EdgeCellType;
262 InputCellsContainerConstPointer inEdgeCells = in->GetEdgeCells();
266 InputCellsContainerConstIterator ecIt = inEdgeCells->Begin();
267 InputCellsContainerConstIterator ecEnd = inEdgeCells->End();
269 while (ecIt != ecEnd)
271 auto * pe = dynamic_cast<InputEdgeCellType *>(ecIt.Value());
274 out->AddEdgeWithSecurePointList(pe->GetQEGeom()->GetOrigin(), pe->GetQEGeom()->GetDestination());
282 template <
typename TInputMesh,
typename TOutputMesh>
287 using InputPointsContainerConstPointer =
typename TInputMesh::PointsContainerConstPointer;
288 using InputPointsContainerConstIterator =
typename TInputMesh::PointsContainerConstIterator;
290 using OutputPointsContainer =
typename TOutputMesh::PointsContainer;
291 using OutputPointsContainerPointer =
typename TOutputMesh::PointsContainerPointer;
294 InputPointsContainerConstPointer inPoints = in->GetPoints();
298 InputPointsContainerConstIterator inIt = inPoints->
Begin();
299 InputPointsContainerConstIterator inEnd = inPoints->End();
301 OutputPointsContainerPointer oPoints = out->GetPoints();
302 if (oPoints.IsNull())
304 oPoints = OutputPointsContainer::New();
305 out->SetPoints(oPoints);
307 OutputPointType pOut;
309 while (inIt != inEnd)
311 pOut.CastFrom(inIt.Value());
312 oPoints->InsertElement(inIt.Index(), pOut);
319 #ifndef ITK_MANUAL_INSTANTIATION
320 # include "itkQuadEdgeMeshToQuadEdgeMeshFilter.hxx"