| 141 | } |
| 142 | |
| 143 | void vtkMarchingContourFilter::StructuredPointsContour( |
| 144 | int dim, vtkDataSet* input, vtkPolyData* thisOutput) |
| 145 | { |
| 146 | vtkPolyData* output; |
| 147 | vtkIdType numContours = this->ContourValues->GetNumberOfContours(); |
| 148 | double* values = this->ContourValues->GetValues(); |
| 149 | |
| 150 | if (dim == 2) // marching squares |
| 151 | { |
| 152 | vtkMarchingSquares* msquares; |
| 153 | int i; |
| 154 | |
| 155 | msquares = vtkMarchingSquares::New(); |
| 156 | msquares->SetInputData((vtkImageData*)input); |
| 157 | msquares->SetDebug(this->Debug); |
| 158 | msquares->SetNumberOfContours(numContours); |
| 159 | for (i = 0; i < numContours; i++) |
| 160 | { |
| 161 | msquares->SetValue(i, values[i]); |
| 162 | } |
| 163 | |
| 164 | msquares->SetContainerAlgorithm(this); |
| 165 | msquares->Update(); |
| 166 | output = msquares->GetOutput(); |
| 167 | output->Register(this); |
| 168 | msquares->Delete(); |
| 169 | } |
| 170 | |
| 171 | else // marching cubes |
| 172 | { |
| 173 | vtkMarchingCubes* mcubes; |
| 174 | int i; |
| 175 | |
| 176 | mcubes = vtkMarchingCubes::New(); |
| 177 | mcubes->SetInputData((vtkImageData*)input); |
| 178 | mcubes->SetComputeNormals(this->ComputeNormals); |
| 179 | mcubes->SetComputeGradients(this->ComputeGradients); |
| 180 | mcubes->SetComputeScalars(this->ComputeScalars); |
| 181 | mcubes->SetDebug(this->Debug); |
| 182 | mcubes->SetNumberOfContours(numContours); |
| 183 | for (i = 0; i < numContours; i++) |
| 184 | { |
| 185 | mcubes->SetValue(i, values[i]); |
| 186 | } |
| 187 | |
| 188 | mcubes->SetContainerAlgorithm(this); |
| 189 | mcubes->Update(); |
| 190 | output = mcubes->GetOutput(); |
| 191 | output->Register(this); |
| 192 | mcubes->Delete(); |
| 193 | } |
| 194 | |
| 195 | thisOutput->CopyStructure(output); |
| 196 | thisOutput->GetPointData()->ShallowCopy(output->GetPointData()); |
| 197 | output->UnRegister(this); |
| 198 | } |
| 199 | |
| 200 | void vtkMarchingContourFilter::DataSetContour(vtkDataSet* input, vtkPolyData* output) |
no test coverage detected