18 #include <vtkCellData.h>
19 #include <vtkThreshold.h>
20 #include <vtkUnstructuredGrid.h>
25 vtkAlgorithm* inputAlgorithm)
40 vtkThreshold* threshold = vtkThreshold::New();
47 vtkDataSetAttributes* pointAttributes =
48 dataSet->GetAttributes(vtkDataObject::AttributeTypes::POINT);
49 vtkDataSetAttributes* cellAttributes =
50 dataSet->GetAttributes(vtkDataObject::AttributeTypes::CELL);
51 if (pointAttributes->GetNumberOfArrays() > 0)
53 threshold->SetInputArrayToProcess(
54 0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_POINTS,
55 pointAttributes->GetArray(0)->GetName());
57 else if (cellAttributes->GetNumberOfArrays() > 0)
59 threshold->SetInputArrayToProcess(
60 0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_CELLS,
61 cellAttributes->GetArray(0)->GetName());
65 WARN(
"Threshold filter could not find an array on its input object!");
70 threshold->SetSelectedComponent(0);
74 const double dMin = std::numeric_limits<double>::lowest();
75 const double dMax = std::numeric_limits<double>::max();
76 threshold->ThresholdBetween(dMin, dMax);
79 QList<QVariant> thresholdRangeList;
81 thresholdRangeList.push_back(dMin);
82 thresholdRangeList.push_back(dMax);
84 (*_algorithmUserVectorProperties)[
"Range"] = thresholdRangeList;
87 (*_algorithmUserProperties)[
"Selected Component"] = 0;
90 threshold->SetAllScalars(1);
91 (*_algorithmUserProperties)[
"Evaluate all points"] =
true;
102 if (
name.compare(
"Selected Component") == 0)
106 ->SetSelectedComponent(value.toInt());
108 else if (
name.compare(
"Evaluate all points") == 0)
111 ->SetAllScalars(value.toBool());
116 QList<QVariant> values)
121 if (
name.compare(
"Range") == 0)
125 ->ThresholdBetween(values[0].toDouble(), values[1].toDouble());
void WARN(char const *fmt, Args const &... args)
Definition of the VtkCompositeThresholdFilter class.
virtual void SetUserVectorProperty(QString name, QList< QVariant > values)
Sets a vector user property. This should be implemented by subclasses.
virtual void SetUserProperty(QString name, QVariant value)
Sets a user property. This should be implemented by subclasses.
Is used to combine several filter in one VtkVisPipelineItem. You can use vtk filter and custom filter...
vtkAlgorithm * _outputAlgorithm
int _outputDataObjectType
vtkAlgorithm * _inputAlgorithm
VtkCompositeThresholdFilter(vtkAlgorithm *inputAlgorithm)
void SetUserVectorProperty(QString name, QList< QVariant > values) override
Sets a vector user property. This should be implemented by subclasses.
void SetUserProperty(QString name, QVariant value) override
Sets a user property. This should be implemented by subclasses.
~VtkCompositeThresholdFilter() override