General contouring filter. Handles arbitrary input.
| 80 | // General contouring filter. Handles arbitrary input. |
| 81 | // |
| 82 | int vtkMarchingContourFilter::RequestData(vtkInformation* vtkNotUsed(request), |
| 83 | vtkInformationVector** inputVector, vtkInformationVector* outputVector) |
| 84 | { |
| 85 | // get the info objects |
| 86 | vtkInformation* inInfo = inputVector[0]->GetInformationObject(0); |
| 87 | vtkInformation* outInfo = outputVector->GetInformationObject(0); |
| 88 | |
| 89 | // get the input and output |
| 90 | vtkDataSet* input = vtkDataSet::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 91 | vtkPolyData* output = vtkPolyData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 92 | |
| 93 | vtkDataArray* inScalars; |
| 94 | vtkIdType numCells; |
| 95 | |
| 96 | vtkDebugMacro(<< "Executing marching contour filter"); |
| 97 | |
| 98 | numCells = input->GetNumberOfCells(); |
| 99 | inScalars = input->GetPointData()->GetScalars(); |
| 100 | if (!inScalars || numCells < 1) |
| 101 | { |
| 102 | vtkErrorMacro(<< "No data to contour"); |
| 103 | return 1; |
| 104 | } |
| 105 | |
| 106 | // If structured points, use more efficient algorithms |
| 107 | if ((input->GetDataObjectType() == VTK_STRUCTURED_POINTS)) |
| 108 | { |
| 109 | if (inScalars->GetDataType() != VTK_BIT) |
| 110 | { |
| 111 | int dim = input->GetCell(0)->GetCellDimension(); |
| 112 | |
| 113 | if (input->GetCell(0)->GetCellDimension() >= 2) |
| 114 | { |
| 115 | vtkDebugMacro(<< "Structured Points"); |
| 116 | this->StructuredPointsContour(dim, input, output); |
| 117 | return 1; |
| 118 | } |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | if ((input->GetDataObjectType() == VTK_IMAGE_DATA)) |
| 123 | { |
| 124 | if (inScalars->GetDataType() != VTK_BIT) |
| 125 | { |
| 126 | int dim = input->GetCell(0)->GetCellDimension(); |
| 127 | |
| 128 | if (input->GetCell(0)->GetCellDimension() >= 2) |
| 129 | { |
| 130 | vtkDebugMacro(<< "Image"); |
| 131 | this->ImageContour(dim, input, output); |
| 132 | return 1; |
| 133 | } |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | vtkDebugMacro(<< "Unoptimized"); |
| 138 | this->DataSetContour(input, output); |
| 139 |
nothing calls this directly
no test coverage detected