OGS
VtkImageDataToPointCloudFilter.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#pragma once
5
6#include <vtkPolyDataAlgorithm.h>
7
8#include "MathLib/Point3d.h"
10
11class vtkInformation;
12class vtkInformationVector;
13
16class VtkImageDataToPointCloudFilter : public vtkPolyDataAlgorithm
17{
18public:
21
23
25 void PrintSelf(ostream& os, vtkIndent indent) override;
26
27 void useLinearInterpolation() { SetIsLinear(true); }
28 void useLogarithmicInterpolation(double gamma)
29 {
30 SetIsLinear(false);
31 SetGamma(gamma);
32 }
33
36
39
42
45
48
51
54
57
60
61protected:
63 ~VtkImageDataToPointCloudFilter() override = default;
64
66 int FillInputPortInformation(int port, vtkInformation* info) override;
67
69 int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
70 vtkInformationVector* outputVector) override;
71
72 double Gamma{1.0};
73 double PointScaleFactor{1.0};
74 double MinValueRange{-1};
75 double MaxValueRange{-1};
76 double MinHeight{0};
77 double MaxHeight{1000};
80 bool IsLinear{true};
81
82private:
84 void createPoints(vtkSmartPointer<vtkPoints>& points,
85 vtkSmartPointer<vtkCellArray>& cells, std::size_t pnt_idx,
86 std::size_t n_points, MathLib::Point3d const& min_pnt,
87 MathLib::Point3d const& max_pnt) const;
88
90 double getRandomNumber(double const& min, double const& max) const;
91
96 std::size_t interpolate(double low, double high, double p, double gamma) const;
97};
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)