MCPcopy Create free account
hub / github.com/Kitware/VTK / RequestData

Method RequestData

Filters/General/vtkMarchingContourFilter.cxx:82–141  ·  view source on GitHub ↗

General contouring filter. Handles arbitrary input.

Source from the content-addressed store, hash-verified

80// General contouring filter. Handles arbitrary input.
81//
82int 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

Callers

nothing calls this directly

Calls 12

ImageContourMethod · 0.95
DataSetContourMethod · 0.95
GetInformationObjectMethod · 0.80
GetDataObjectTypeMethod · 0.80
GetMethod · 0.45
GetNumberOfCellsMethod · 0.45
GetScalarsMethod · 0.45
GetPointDataMethod · 0.45
GetDataTypeMethod · 0.45
GetCellDimensionMethod · 0.45
GetCellMethod · 0.45

Tested by

no test coverage detected