18 #include <vtkDataSetSurfaceFilter.h>
19 #include <vtkIdFilter.h>
20 #include <vtkPointData.h>
21 #include <vtkSmartPointer.h>
22 #include <vtkThreshold.h>
23 #include <vtkUnstructuredGrid.h>
24 #include <vtkUnstructuredGridAlgorithm.h>
32 vtkAlgorithm* inputAlgorithm)
35 _selection_name(
"Selection")
41 double thresholdLower(
_range.first);
42 double thresholdUpper(
_range.second);
48 vtkSmartPointer<VtkAppendArrayFilter> selFilter(
nullptr);
51 selFilter = vtkSmartPointer<VtkAppendArrayFilter>::New();
57 vtkSmartPointer<vtkIdFilter> idFilter = vtkSmartPointer<vtkIdFilter>::New();
65 idFilter->SetInputConnection(selFilter->GetOutputPort());
67 idFilter->PointIdsOn();
68 idFilter->CellIdsOn();
69 idFilter->FieldDataOn();
72 vtkThreshold* threshold = vtkThreshold::New();
73 threshold->SetInputConnection(idFilter->GetOutputPort());
74 threshold->SetInputArrayToProcess(0, 0, 0,
75 vtkDataObject::FIELD_ASSOCIATION_CELLS,
77 threshold->SetSelectedComponent(0);
78 threshold->ThresholdBetween(thresholdLower, thresholdUpper);
81 QList<QVariant> thresholdRangeList;
82 thresholdRangeList.push_back(thresholdLower);
83 thresholdRangeList.push_back(thresholdUpper);
84 (*_algorithmUserVectorProperties)[
"Threshold Between"] = thresholdRangeList;
89 const std::string& selection_name,
const std::vector<double>& selection)
97 QString
name, QList<QVariant> values)
101 if (
name.compare(
"Threshold Between") == 0)
104 ->ThresholdBetween(values[0].toDouble(), values[1].toDouble());
111 lut->SetTableRange(0, 1);
Definition of the VtkAppendArrayFilter class.
Definition of the VtkColorLookupTable class.
Definition of the VtkCompositeSelectionFilter class.
Definition of the VtkCompositePointToGlyphFilter class.
Definition of the VtkPointsSource class.
virtual void SetUserVectorProperty(QString name, QList< QVariant > values)
Sets a vector user property. This should be implemented by subclasses.
void SetLookUpTable(const QString &array_name, vtkLookupTable *lut)
Sets a colour lookup table for the given scalar array of the VtkVisPipelineItem.
Calculates and stores a colour lookup table.
void setColor(double pos, DataHolderLib::Color const &color)
void Build() override
Builds the colour table based on the previously set parameters. This method should only be called aft...
static VtkColorLookupTable * New()
Create new objects with New() because of VTKs object reference counting.
VtkCompositeElementSelectionFilter(vtkAlgorithm *inputAlgorithm)
void setSelectionArray(const std::string &selection_name, const std::vector< double > &selection=std::vector< double >())
std::string _selection_name
void SetUserVectorProperty(QString name, QList< QVariant > values) override
Sets a vector user property. This should be implemented by subclasses.
std::vector< double > _selection
VtkColorLookupTable * GetLookupTable()
Returns a colour lookup table optimised for quality measures.
std::pair< double, double > _range
Is used to combine several filter in one VtkVisPipelineItem. You can use vtk filter and custom filter...
vtkAlgorithm * _outputAlgorithm
int _outputDataObjectType
vtkAlgorithm * _inputAlgorithm
std::array< unsigned char, 4 > Color