OGS
VtkCompositeImageToCylindersFilter Class Reference

Detailed Description

Creates cylinders that stand on top of the image with the length of the corresponding first sub-pixel value (the red value). Useful to visualize precipitation maps as a 3d bar chart.

Definition at line 24 of file VtkCompositeImageToCylindersFilter.h.

#include <VtkCompositeImageToCylindersFilter.h>

Inheritance diagram for VtkCompositeImageToCylindersFilter:
[legend]
Collaboration diagram for VtkCompositeImageToCylindersFilter:
[legend]

Public Member Functions

 VtkCompositeImageToCylindersFilter (vtkAlgorithm *inputAlgorithm)
 
 ~VtkCompositeImageToCylindersFilter () override
 
void init () override
 
void SetUserProperty (QString name, QVariant value) override
 Sets a user property. This should be implemented by subclasses.
 
void SetUserVectorProperty (QString name, QList< QVariant > values) override
 Sets a vector user property. This should be implemented by subclasses.
 
- Public Member Functions inherited from VtkCompositeFilter
 VtkCompositeFilter (vtkAlgorithm *inputAlgorithm)
 Constructor.
 
 ~VtkCompositeFilter () override
 Destructor.
 
int GetInputDataObjectType () const
 
int GetOutputDataObjectType () const
 
vtkAlgorithm * GetOutputAlgorithm () const
 
- Public Member Functions inherited from VtkAlgorithmProperties
 VtkAlgorithmProperties (QObject *parent=nullptr)
 Constructor (sets default values)
 
 ~VtkAlgorithmProperties () override
 
vtkProperty * GetProperties () const
 Returns the vtk properties.
 
vtkTexture * GetTexture ()
 Returns a texture (if one has been assigned).
 
void SetTexture (vtkTexture *t)
 Sets a texture for the VtkVisPipelineItem.
 
vtkLookupTable * GetLookupTable (const QString &array_name)
 Returns the colour lookup table (if one has been assigned).
 
void RemoveLookupTable (const QString &array_name)
 Removes the lookup table for the given scalar.
 
void SetLookUpTable (const QString &array_name, vtkLookupTable *lut)
 Sets a colour lookup table for the given scalar array of the VtkVisPipelineItem.
 
void SetLookUpTable (const QString &array_name, const QString &filename)
 Loads a predefined color lookup table from a file for the specified scalar array.
 
bool GetScalarVisibility () const
 Returns the scalar visibility.
 
void SetScalarVisibility (bool on)
 Sets the scalar visibility.
 
QString GetName () const
 Returns the name. This is set to the file path if it is a source algorithm.
 
void SetName (QString name)
 Sets the name.
 
bool IsRemovable () const
 Is this algorithm removable from the pipeline (view).
 
QMap< QString, QVariant > * GetAlgorithmUserProperties () const
 Returns a map of user properties.
 
QMap< QString, QList< QVariant > > * GetAlgorithmUserVectorProperties () const
 Returns a map of vector user properties.
 
QVariant GetUserProperty (QString name) const
 Returns the value of a user property.
 
QList< QVariant > GetUserVectorProperty (QString name) const
 Returns a list of values of a vector user property.
 
void SetActiveAttribute (QString name)
 Set the active attribute.
 
QString GetActiveAttribute () const
 Returns the desired active attribute.
 

Private Attributes

VtkImageDataToLinePolyDataFilter_lineFilter
 

Additional Inherited Members

- Signals inherited from VtkAlgorithmProperties
void ScalarVisibilityChanged (bool on)
 
- Protected Member Functions inherited from VtkCompositeFilter
double GetInitialRadius () const
 Calculates a 1/200th of the largest extension of the bounding box (this is used as default radius for various filters)
 
- Protected Attributes inherited from VtkCompositeFilter
int _inputDataObjectType
 
int _outputDataObjectType
 
vtkAlgorithm * _inputAlgorithm
 
vtkAlgorithm * _outputAlgorithm
 
- Protected Attributes inherited from VtkAlgorithmProperties
vtkProperty * _property
 
vtkTexture * _texture
 
bool _scalarVisibility
 
std::map< QString, vtkLookupTable * > _lut
 
QString _name
 
QString _activeAttributeName
 
bool _removable
 
QMap< QString, QVariant > * _algorithmUserProperties
 
QMap< QString, QList< QVariant > > * _algorithmUserVectorProperties
 

Constructor & Destructor Documentation

◆ VtkCompositeImageToCylindersFilter()

VtkCompositeImageToCylindersFilter::VtkCompositeImageToCylindersFilter ( vtkAlgorithm * inputAlgorithm)
explicit

Definition at line 31 of file VtkCompositeImageToCylindersFilter.cpp.

33 : VtkCompositeFilter(inputAlgorithm), _lineFilter(nullptr)
34{
35 this->init();
36}
VtkCompositeFilter(vtkAlgorithm *inputAlgorithm)
Constructor.

References init().

◆ ~VtkCompositeImageToCylindersFilter()

VtkCompositeImageToCylindersFilter::~VtkCompositeImageToCylindersFilter ( )
override

Definition at line 144 of file VtkCompositeImageToCylindersFilter.cpp.

145{
146 _lineFilter->Delete();
147}

References _lineFilter.

Member Function Documentation

◆ init()

void VtkCompositeImageToCylindersFilter::init ( )
overridevirtual

Implements VtkCompositeFilter.

Definition at line 38 of file VtkCompositeImageToCylindersFilter.cpp.

39{
40 this->_inputDataObjectType = VTK_IMAGE_DATA;
41 this->_outputDataObjectType = VTK_POLY_DATA;
42
44 _lineFilter->SetInputConnection(_inputAlgorithm->GetOutputPort());
45 _lineFilter->SetLengthScaleFactor(1);
46 (*_algorithmUserProperties)["LengthScaleFactor"] = 1.0;
47 _lineFilter->Update();
48
49 double range[2];
50 // The data is always on points
51 vtkDataSet::SafeDownCast(_lineFilter->GetOutputDataObject(0))
52 ->GetPointData()
53 ->GetScalars()
54 ->GetRange(range);
55
56 vtkLookupTable* colormap = vtkLookupTable::New();
57 colormap->SetTableRange(range[0], range[1]);
58 colormap->SetHueRange(0.0, 0.666);
59 colormap->SetNumberOfTableValues(256);
60 colormap->ForceBuild();
61 QList<QVariant> tableRangeList;
62 tableRangeList.push_back(range[0]);
63 tableRangeList.push_back(range[1]);
64 QList<QVariant> hueRangeList;
65 hueRangeList.push_back(0.0);
66 hueRangeList.push_back(0.666);
67 (*_algorithmUserVectorProperties)["TableRange"] = tableRangeList;
68 (*_algorithmUserVectorProperties)["HueRange"] = hueRangeList;
69
70 this->SetLookUpTable("P-Colors", colormap);
71
72 vtkTubeFilter* tubeFilter = vtkTubeFilter::New();
73 tubeFilter->SetInputConnection(_lineFilter->GetOutputPort());
74 tubeFilter->CappingOn();
75 tubeFilter->SetNumberOfSides(6);
76 tubeFilter->SetRadius(_lineFilter->GetImageSpacing() * 0.25);
77 (*_algorithmUserProperties)["NumberOfColors"] = 256;
78 (*_algorithmUserProperties)["Capping"] = true;
79 (*_algorithmUserProperties)["NumberOfSides"] = 6;
80 (*_algorithmUserProperties)["RadiusFactor"] = 0.25;
81
82 _outputAlgorithm = tubeFilter;
83}
void SetLookUpTable(const QString &array_name, vtkLookupTable *lut)
Sets a colour lookup table for the given scalar array of the VtkVisPipelineItem.
vtkAlgorithm * _outputAlgorithm
vtkAlgorithm * _inputAlgorithm
static VtkImageDataToLinePolyDataFilter * New()
Create new objects with New() because of VTKs reference counting.

References VtkCompositeFilter::_inputAlgorithm, VtkCompositeFilter::_inputDataObjectType, _lineFilter, VtkCompositeFilter::_outputAlgorithm, VtkCompositeFilter::_outputDataObjectType, VtkImageDataToLinePolyDataFilter::New(), and VtkAlgorithmProperties::SetLookUpTable().

Referenced by VtkCompositeImageToCylindersFilter().

◆ SetUserProperty()

void VtkCompositeImageToCylindersFilter::SetUserProperty ( QString name,
QVariant value )
overridevirtual

Sets a user property. This should be implemented by subclasses.

Reimplemented from VtkAlgorithmProperties.

Definition at line 85 of file VtkCompositeImageToCylindersFilter.cpp.

87{
89
90 _lineFilter->SetUserProperty(name, value);
91
92 // VtkImageDataToLinePolyDataFilter is equal to _firstAlgorithm
93 // vtkTubeFilter is equal _outputAlgorithm
94 if (name.compare("NumberOfColors") == 0)
95 {
96 vtkLookupTable* lut = this->GetLookupTable("P-Colors");
97 if (lut)
98 {
99 lut->SetNumberOfTableValues(value.toInt());
100 }
101 }
102 else if (name.compare("NumberOfSides") == 0)
103 {
104 static_cast<vtkTubeFilter*>(_outputAlgorithm)
105 ->SetNumberOfSides(value.toInt());
106 }
107 else if (name.compare("Capping") == 0)
108 {
109 static_cast<vtkTubeFilter*>(_outputAlgorithm)
110 ->SetCapping(value.toBool());
111 }
112 else if (name.compare("RadiusFactor") == 0)
113 {
114 static_cast<vtkTubeFilter*>(_outputAlgorithm)
115 ->SetRadius(_lineFilter->GetImageSpacing() * value.toDouble());
116 }
117}
vtkLookupTable * GetLookupTable(const QString &array_name)
Returns the colour lookup table (if one has been assigned).
virtual void SetUserProperty(QString name, QVariant value)
Sets a user property. This should be implemented by subclasses.
void SetUserProperty(QString name, QVariant value) override
Sets a user property.

References _lineFilter, VtkCompositeFilter::_outputAlgorithm, VtkAlgorithmProperties::GetLookupTable(), VtkAlgorithmProperties::SetUserProperty(), and VtkImageDataToLinePolyDataFilter::SetUserProperty().

◆ SetUserVectorProperty()

void VtkCompositeImageToCylindersFilter::SetUserVectorProperty ( QString name,
QList< QVariant > values )
overridevirtual

Sets a vector user property. This should be implemented by subclasses.

Reimplemented from VtkAlgorithmProperties.

Definition at line 119 of file VtkCompositeImageToCylindersFilter.cpp.

121{
123
124 _lineFilter->SetUserVectorProperty(name, values);
125
126 if (name.compare("TableRange") == 0)
127 {
128 vtkLookupTable* lut = this->GetLookupTable("P-Colors");
129 if (lut)
130 {
131 lut->SetTableRange(values[0].toDouble(), values[1].toDouble());
132 }
133 }
134 else if (name.compare("HueRange") == 0)
135 {
136 vtkLookupTable* lut = this->GetLookupTable("P-Colors");
137 if (lut)
138 {
139 lut->SetHueRange(values[0].toDouble(), values[1].toDouble());
140 }
141 }
142}
virtual void SetUserVectorProperty(QString name, QList< QVariant > values)
Sets a vector user property. This should be implemented by subclasses.

References _lineFilter, VtkAlgorithmProperties::GetLookupTable(), and VtkAlgorithmProperties::SetUserVectorProperty().

Member Data Documentation

◆ _lineFilter

VtkImageDataToLinePolyDataFilter* VtkCompositeImageToCylindersFilter::_lineFilter
private

The documentation for this class was generated from the following files: