File: vtkPointSetToOctreeImageFilter.h

package info (click to toggle)
vtk9 9.5.2%2Bdfsg3-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 205,916 kB
  • sloc: cpp: 2,336,565; ansic: 327,116; python: 111,200; yacc: 4,104; java: 3,977; sh: 3,032; xml: 2,771; perl: 2,189; lex: 1,787; makefile: 178; javascript: 165; objc: 153; tcl: 59
file content (171 lines) | stat: -rw-r--r-- 5,086 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
// SPDX-License-Identifier: BSD-3-Clause
/**
 * @class   vtkPointSetToOctreeImageFilter
 * @brief   convert a point set to an octree image
 *
 * vtkPointSetToOctreeImageFilter is a filter that converts a vtkPointSet to an
 * a vtkPartitionedDataset with one vtkImageData with a number of points per cell target.
 *
 * The reason we output a vtkPartitionedDataset is because the WHOLE_EXTENT needs to be dynamic.
 *
 * The scalars of the vtkImageData are an octree unsigned char cell data array. Each bit of the
 * unsigned char indicates if the point-set had a point close to one of the 8 corners of the cell.
 *
 * It can optionally also output a cell data array based on an input point-data scalar array by
 * setting SetInputArrayToProcess. This array will have 1 or many components that represent
 * different functions i.e. last value, min, max, count, sum, mean.
 *
 * @warning
 * This class has been threaded with vtkSMPTools. Using TBB or other
 * non-sequential type (set in the CMake variable
 * VTK_SMP_IMPLEMENTATION_TYPE) may improve performance significantly.
 *
 * @sa vtkOctreeImageToPointSetFilter
 */
#ifndef vtkPointSetToOctreeImageFilter_h
#define vtkPointSetToOctreeImageFilter_h

#include "vtkFiltersGeometryPreviewModule.h" // For export macro
#include "vtkPartitionedDataSetAlgorithm.h"

VTK_ABI_NAMESPACE_BEGIN
class VTKFILTERSGEOMETRYPREVIEW_EXPORT vtkPointSetToOctreeImageFilter
  : public vtkPartitionedDataSetAlgorithm
{
public:
  vtkTypeMacro(vtkPointSetToOctreeImageFilter, vtkPartitionedDataSetAlgorithm);
  void PrintSelf(ostream& os, vtkIndent indent) override;
  static vtkPointSetToOctreeImageFilter* New();

  ///@{
  /**
   * Specify the average number of points in each cell of the output image.
   * This data member is used to determine the number dimensions of the output image.
   *
   * The default is 1.
   */
  vtkSetClampMacro(NumberOfPointsPerCell, int, 1, VTK_INT_MAX);
  vtkGetMacro(NumberOfPointsPerCell, int);
  ///@}

  ///@{
  /**
   * Set/Get if array defined using SetInputArrayToProcess, which MUST be a point data array, will
   * be processed.
   *
   * The default is off.
   */
  vtkSetMacro(ProcessInputPointArray, bool);
  vtkGetMacro(ProcessInputPointArray, bool);
  vtkBooleanMacro(ProcessInputPointArray, bool);
  ///@}

  ///@{
  /**
   * Set/Get if the last value for each cell id of the point data array will be computed.
   *
   * The default is false.
   *
   * Note: Because multithreading is employed the last value computation is not deterministic.
   */
  vtkSetMacro(ComputeLastValue, bool);
  vtkGetMacro(ComputeLastValue, bool);
  vtkBooleanMacro(ComputeLastValue, bool);
  ///@}

  ///@{
  /**
   * Set/Get if the min value for each cell id of the point data array will be computed.
   *
   * The default is false.
   */
  vtkSetMacro(ComputeMin, bool);
  vtkGetMacro(ComputeMin, bool);
  vtkBooleanMacro(ComputeMin, bool);
  ///@}

  ///@{
  /**
   * Set/Get if the max value for each cell id of the point data array will be computed.
   *
   * The default is false.
   */
  vtkSetMacro(ComputeMax, bool);
  vtkGetMacro(ComputeMax, bool);
  vtkBooleanMacro(ComputeMax, bool);
  ///@}

  ///@{
  /**
   * Set/Get if the count of the values for each cell id of the point data array will be computed.
   *
   * The default is false.
   */
  vtkSetMacro(ComputeCount, bool);
  vtkGetMacro(ComputeCount, bool);
  vtkBooleanMacro(ComputeCount, bool);
  ///@}

  ///@{
  /**
   * Set/Get if the sum of the values for each cell id of the point data array will be computed.
   *
   * The default is false.
   */
  vtkSetMacro(ComputeSum, bool);
  vtkGetMacro(ComputeSum, bool);
  vtkBooleanMacro(ComputeSum, bool);
  ///@}

  ///@{
  /**
   * Set/Get if the mean value for each cell id of the point data array will be computed.
   *
   * The default is false.
   *
   * Note: if ComputeMean is true, the sum and count will be computed regardless if they are on or
   * not.
   */
  vtkSetMacro(ComputeMean, bool);
  vtkGetMacro(ComputeMean, bool);
  vtkBooleanMacro(ComputeMean, bool);
  ///@}

protected:
  vtkPointSetToOctreeImageFilter();
  ~vtkPointSetToOctreeImageFilter() override;

  int FillInputPortInformation(int port, vtkInformation* info) override;
  int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;

private:
  vtkPointSetToOctreeImageFilter(const vtkPointSetToOctreeImageFilter&) = delete;
  void operator=(const vtkPointSetToOctreeImageFilter&) = delete;

  vtkIdType NumberOfPointsPerCell = 1;
  bool ProcessInputPointArray = false;
  bool ComputeLastValue = true;
  bool ComputeMin = false;
  bool ComputeMax = false;
  bool ComputeCount = false;
  bool ComputeSum = false;
  bool ComputeMean = false;

  enum class FieldFunctions
  {
    LAST_VALUE,
    MIN,
    MAX,
    COUNT,
    SUM,
    MEAN
  };

  template <typename TPointsArray>
  struct PointSetToImageFunctor;
  struct PointSetToImageWorker;
};

VTK_ABI_NAMESPACE_END
#endif // vtkPointSetToOctreeImageFilter_h