OGS
VtkImageDataToPointCloudFilter.h
Go to the documentation of this file.
1
11#pragma once
12
13#include <vtkPolyDataAlgorithm.h>
14
15#include "MathLib/Point3d.h"
17
18class vtkInformation;
19class vtkInformationVector;
20
23class VtkImageDataToPointCloudFilter : public vtkPolyDataAlgorithm
24{
25public:
28
30
32 void PrintSelf(ostream& os, vtkIndent indent) override;
33
34 void useLinearInterpolation() { SetIsLinear(true); }
35 void useLogarithmicInterpolation(double gamma)
36 {
37 SetIsLinear(false);
38 SetGamma(gamma);
39 }
40
43
46
49
52
55
58
61
64
67
68protected:
70 ~VtkImageDataToPointCloudFilter() override = default;
71
73 int FillInputPortInformation(int port, vtkInformation* info) override;
74
76 int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
77 vtkInformationVector* outputVector) override;
78
79 double Gamma{1.0};
80 double PointScaleFactor{1.0};
81 double MinValueRange{-1};
82 double MaxValueRange{-1};
83 double MinHeight{0};
84 double MaxHeight{1000};
87 bool IsLinear{true};
88
89private:
91 void createPoints(vtkSmartPointer<vtkPoints>& points,
92 vtkSmartPointer<vtkCellArray>& cells, std::size_t pnt_idx,
93 std::size_t n_points, MathLib::Point3d const& min_pnt,
94 MathLib::Point3d const& max_pnt) const;
95
97 double getRandomNumber(double const& min, double const& max) const;
98
103 std::size_t interpolate(double low, double high, double p, double gamma) const;
104};
Definition of the Point3d class.
Definition of the VtkAlgorithmProperties class.
vtkTypeMacro(VtkImageDataToPointCloudFilter, vtkPolyDataAlgorithm)
int FillInputPortInformation(int port, vtkInformation *info) override
Sets input port to vtkImageData.
void PrintSelf(ostream &os, vtkIndent indent) override
Prints information about the filter.
vtkSetMacro(PointScaleFactor, double)
void createPoints(vtkSmartPointer< vtkPoints > &points, vtkSmartPointer< vtkCellArray > &cells, std::size_t pnt_idx, std::size_t n_points, MathLib::Point3d const &min_pnt, MathLib::Point3d const &max_pnt) const
Creates the point objects based on the parameters set by the user.
vtkGetMacro(MinValueRange, double)
~VtkImageDataToPointCloudFilter() override=default
vtkGetMacro(MinNumberOfPointsPerCell, vtkIdType)
vtkGetMacro(MaxNumberOfPointsPerCell, vtkIdType)
vtkSetMacro(MinValueRange, double)
vtkSetMacro(MinNumberOfPointsPerCell, vtkIdType)
double getRandomNumber(double const &min, double const &max) const
Returns a random number in [min, max].
vtkSetMacro(MinHeight, double)
std::size_t interpolate(double low, double high, double p, double gamma) const
vtkSetMacro(MaxNumberOfPointsPerCell, vtkIdType)
vtkSetMacro(MaxHeight, double)
vtkSetMacro(MaxValueRange, double)
static VtkImageDataToPointCloudFilter * New()
Create a new objects (required because of VTKs reference counting)
vtkGetMacro(MaxValueRange, double)
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
Updates the graphical object.
vtkGetMacro(PointScaleFactor, double)
vtkGetMacro(MaxHeight, double)
vtkGetMacro(MinHeight, double)