vtkPVExtractHistogram2D.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
12 #ifndef vtkPVExtractHistogram2D_h
13 #define vtkPVExtractHistogram2D_h
14 
15 // VTK includes
16 #include "vtkImageAlgorithm.h"
17 #include "vtkPVVTKExtensionsMiscModule.h" // needed for exports
18 
19 // Forward declarations
20 class vtkDataArray;
23 
25 {
26 public:
30  static vtkPVExtractHistogram2D* New();
31 
33 
37  void PrintSelf(ostream& os, vtkIndent indent) override;
39 
41 
45  virtual void SetController(vtkMultiProcessController*);
46  vtkGetObjectMacro(Controller, vtkMultiProcessController);
48 
50 
55  vtkSetMacro(Component0, int);
56  vtkGetMacro(Component0, int);
57  vtkSetMacro(Component1, int);
58  vtkGetMacro(Component1, int);
59  void SetComponent(int id, int val) { (id == 0) ? SetComponent0(val) : SetComponent1(val); }
60  int GetComponent(int id) { return ((id == 0) ? GetComponent0() : GetComponent1()); }
62 
64 
67  vtkSetVector2Macro(NumberOfBins, int);
68  vtkGetVector2Macro(NumberOfBins, int);
70 
72 
75  vtkSetVector2Macro(CustomBinRanges0, double);
76  vtkGetVector2Macro(CustomBinRanges0, double);
77  vtkSetVector2Macro(CustomBinRanges1, double);
78  vtkGetVector2Macro(CustomBinRanges1, double);
79  vtkSetMacro(UseCustomBinRanges0, bool);
80  vtkGetMacro(UseCustomBinRanges0, bool);
81  vtkBooleanMacro(UseCustomBinRanges0, bool);
82  vtkSetMacro(UseCustomBinRanges1, bool);
83  vtkGetMacro(UseCustomBinRanges1, bool);
84  vtkBooleanMacro(UseCustomBinRanges1, bool);
86 
88 
91  vtkSetMacro(UseGradientForYAxis, bool);
92  vtkGetMacro(UseGradientForYAxis, bool);
93  vtkBooleanMacro(UseGradientForYAxis, bool);
95 
97 
104  vtkSetMacro(UseInputRangesForOutputBounds, bool);
105  vtkGetMacro(UseInputRangesForOutputBounds, bool);
106  vtkBooleanMacro(UseInputRangesForOutputBounds, bool);
108 
110 
115  vtkSetVector2Macro(OutputOrigin, double);
116  vtkGetVector2Macro(OutputOrigin, double);
117  vtkSetVector2Macro(OutputSpacing, double);
118  vtkGetVector2Macro(OutputSpacing, double);
120 
121 protected:
123  ~vtkPVExtractHistogram2D() override;
124 
125  // Helper members
126  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
127  vtkInformationVector* outputVector) override;
128  int RequestInformation(vtkInformation* request, vtkInformationVector** inputVector,
129  vtkInformationVector* outputVector) override;
130  int RequestUpdateExtent(vtkInformation* request, vtkInformationVector** inputVector,
131  vtkInformationVector* outputVector) override;
132 
133  int FillInputPortInformation(int port, vtkInformation* info) override;
134 
135  void ComputeHistogram2D(vtkImageData* histogram);
136  void ComputeGradient(vtkDataObject* input);
137 
138  int Component0 = 0;
139  int Component1 = 0;
140  int NumberOfBins[2] = { 256, 256 };
141  bool UseGradientForYAxis = false;
142 
143  double CustomBinRanges0[2];
144  double CustomBinRanges1[2];
145  bool UseCustomBinRanges0 = false;
146  bool UseCustomBinRanges1 = false;
147  vtkMultiProcessController* Controller = nullptr;
148  bool UseInputRangesForOutputBounds = true;
149  double OutputOrigin[2] = { 0.0, 0.0 };
150  double OutputSpacing[2] = { 1.0, 1.0 };
151 
152  // Cache of internal array and range
153  int ComponentIndexCache[2];
154  vtkDataArray* ComponentArrayCache[2];
156  unsigned char GhostsToSkip;
157  double ComponentRangeCache[2][2];
158 
159  void InitializeCache();
160  void GetInputArrays(vtkInformationVector**);
161  void ComputeVectorMagnitude(vtkDataArray*, vtkDataArray*&);
162  void ComputeComponentRange();
163 
164 private:
166  void operator=(const vtkPVExtractHistogram2D) = delete;
167 };
168 
169 #endif // vtkPVExtractHistogram2D_h
Extract 2D histogram for a parallel dataset.
info
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
#define VTKPVVTKEXTENSIONSMISC_EXPORT
virtual int FillInputPortInformation(int port, vtkInformation *info)
int GetComponent(int id)
Set/Get the components of interest from the two arrays.
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
static vtkAlgorithm * New()
port
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
void operator=(const vtkObjectBase &)
void SetComponent(int id, int val)
Set/Get the components of interest from the two arrays.
vtkUnsignedCharArray * GhostArray