------------------------------------------------------------------------------
| 76 | |
| 77 | //------------------------------------------------------------------------------ |
| 78 | int vtkReebGraphSurfaceSkeletonFilter::RequestData(vtkInformation* vtkNotUsed(request), |
| 79 | vtkInformationVector** inputVector, vtkInformationVector* outputVector) |
| 80 | { |
| 81 | |
| 82 | vtkInformation *inInfoMesh = inputVector[0]->GetInformationObject(0), |
| 83 | *inInfoGraph = inputVector[1]->GetInformationObject(0); |
| 84 | |
| 85 | if ((!inInfoMesh) || (!inInfoGraph)) |
| 86 | { |
| 87 | return 0; |
| 88 | } |
| 89 | vtkPolyData* inputMesh = vtkPolyData::SafeDownCast(inInfoMesh->Get(vtkPolyData::DATA_OBJECT())); |
| 90 | |
| 91 | vtkReebGraph* inputGraph = |
| 92 | vtkReebGraph::SafeDownCast(inInfoGraph->Get(vtkReebGraph::DATA_OBJECT())); |
| 93 | |
| 94 | if ((inputMesh) && (inputGraph)) |
| 95 | { |
| 96 | vtkInformation* outInfo = outputVector->GetInformationObject(0); |
| 97 | vtkTable* output = vtkTable::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 98 | |
| 99 | if (output) |
| 100 | { |
| 101 | |
| 102 | // Retrieve the information regarding the critical nodes. |
| 103 | vtkDataArray* vertexInfo = |
| 104 | vtkArrayDownCast<vtkDataArray>(inputGraph->GetVertexData()->GetAbstractArray("Vertex Ids")); |
| 105 | if (!vertexInfo) |
| 106 | // invalid Reeb graph (no information associated to the vertices) |
| 107 | return 0; |
| 108 | |
| 109 | vtkVariantArray* edgeInfo = vtkArrayDownCast<vtkVariantArray>( |
| 110 | inputGraph->GetEdgeData()->GetAbstractArray("Vertex Ids")); |
| 111 | if (!edgeInfo) |
| 112 | // invalid Reeb graph (no information associated to the edges) |
| 113 | return 0; |
| 114 | |
| 115 | vtkDataArray* scalarField = inputMesh->GetPointData()->GetArray(FieldId); |
| 116 | if (!scalarField) |
| 117 | // invalid input mesh (no scalar field associated to it) |
| 118 | return 0; |
| 119 | |
| 120 | vtkEdgeListIterator* eIt = vtkEdgeListIterator::New(); |
| 121 | inputGraph->GetEdges(eIt); |
| 122 | std::pair<int, int> criticalNodeIds; |
| 123 | |
| 124 | std::vector<std::vector<std::vector<double>>> skeleton; |
| 125 | |
| 126 | do |
| 127 | { |
| 128 | vtkEdgeType e = eIt->Next(); |
| 129 | vtkAbstractArray* vertexList = edgeInfo->GetPointer(e.Id)->ToArray(); |
| 130 | if ((vertexInfo->GetTuple(e.Source)) && (vertexInfo->GetTuple(e.Target))) |
| 131 | { |
| 132 | criticalNodeIds.first = (int)*(vertexInfo->GetTuple(e.Source)); |
| 133 | criticalNodeIds.second = (int)*(vertexInfo->GetTuple(e.Target)); |
| 134 | } |
| 135 | else |
nothing calls this directly
no test coverage detected