VTK  9.3.0
vtkTableFFT.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright 2009 Sandia Corporation
3 // SPDX-License-Identifier: LicenseRef-BSD-3-Clause-Sandia-NVIDIA-USGov
4 
32 #ifndef vtkTableFFT_h
33 #define vtkTableFFT_h
34 
35 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
36 #include "vtkFFT.h" // For vtkFFT::Scaling
37 #include "vtkFiltersGeneralModule.h" // For export macro
38 #include "vtkSmartPointer.h" // For internal method.
39 #include "vtkTableAlgorithm.h"
40 
41 #include <memory> // For unique_ptr
42 
43 VTK_ABI_NAMESPACE_BEGIN
44 
45 class VTKFILTERSGENERAL_EXPORT vtkTableFFT : public vtkTableAlgorithm
46 {
47 public:
49  static vtkTableFFT* New();
50  void PrintSelf(ostream& os, vtkIndent indent) override;
51 
53 
61  vtkGetMacro(CreateFrequencyColumn, bool);
62  vtkSetMacro(CreateFrequencyColumn, bool);
63  vtkBooleanMacro(CreateFrequencyColumn, bool);
65 
67 
73  vtkGetMacro(DefaultSampleRate, double);
74  vtkSetMacro(DefaultSampleRate, double);
76 
80  enum : int
81  {
82  HANNING = 0,
87 
88  MAX_WINDOWING_FUNCTION
89  };
90 
92 
99  vtkGetMacro(WindowingFunction, int);
100  virtual void SetWindowingFunction(int);
102 
104 
113  vtkGetMacro(ReturnOnesided, bool);
114  vtkSetMacro(ReturnOnesided, bool);
115  vtkBooleanMacro(ReturnOnesided, bool);
117 
119 
132  vtkGetMacro(AverageFft, bool);
133  virtual void SetAverageFft(bool);
134  vtkBooleanMacro(AverageFft, bool);
135 
137 
147  vtkGetMacro(Normalize, bool);
148  vtkSetMacro(Normalize, bool);
149  vtkBooleanMacro(Normalize, bool);
151 
153 
155 
163  vtkGetMacro(BlockSize, int);
164  virtual void SetBlockSize(int);
166 
168 
178  vtkGetMacro(BlockOverlap, int);
179  vtkSetMacro(BlockOverlap, int);
181 
183 
191  vtkGetMacro(ScalingMethod, int);
192  vtkSetClampMacro(ScalingMethod, int, vtkFFT::Scaling::Density, vtkFFT::Scaling::Spectrum);
194 
196 
205  vtkGetMacro(Detrend, bool);
206  vtkSetMacro(Detrend, bool);
207  vtkBooleanMacro(Detrend, bool);
209 
211 
218  "Deprecated in favor of always keeping the output array names the same as the input.")
219  vtkGetMacro(PrefixOutputArrays, bool);
221  "Deprecated in favor of always keeping the output array names the same as the input.")
222  vtkSetMacro(PrefixOutputArrays, bool);
224 
226 
236  VTK_DEPRECATED_IN_9_3_0("Function has been renamed GetReturnOnesided")
237  virtual bool GetOptimizeForRealInput() { return this->GetReturnOnesided(); }
238  VTK_DEPRECATED_IN_9_3_0("Function has been renamed SetReturnOnesided")
239  virtual void SetOptimizeForRealInput(bool _arg) { this->SetReturnOnesided(_arg); }
240  VTK_DEPRECATED_IN_9_3_0("Function has been renamed ReturnOnesidedOn")
241  virtual void OptimizeForRealInputOn() { this->ReturnOnesidedOn(); }
242  VTK_DEPRECATED_IN_9_3_0("Function has been renamed ReturnOnesidedOff")
243  virtual void OptimizeForRealInputOff() { this->ReturnOnesidedOff(); };
245 
247 
255  "Block behavior is not controlled using BlockSize and BlockOverlap properties.")
256  virtual int GetNumberOfBlock() { return 0; };
258  "Block behavior is not controlled using BlockSize and BlockOverlap properties.")
259  virtual void SetNumberOfBlock(int){};
261 
262 protected:
264  ~vtkTableFFT() override;
265 
266  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
267  vtkInformationVector* outputVector) override;
268 
274  void Initialize(vtkTable* input);
275 
280 
281 private:
282  vtkTableFFT(const vtkTableFFT&) = delete;
283  void operator=(const vtkTableFFT&) = delete;
284 
285  // Common
286  bool CreateFrequencyColumn = false;
287  double DefaultSampleRate = 1e4;
288  bool ReturnOnesided = false;
289  bool AverageFft = false;
290  int WindowingFunction = RECTANGULAR;
291  // Direct method
292  bool Normalize = false;
293  // Welch method
294  int BlockSize = 1024;
295  int BlockOverlap = -1;
296  bool Detrend = false;
297  int ScalingMethod = 0;
298 
299  // Deprecated variables
300  bool PrefixOutputArrays = false;
301 
302  struct vtkInternal;
303  std::unique_ptr<vtkInternal> Internals;
304 };
305 
306 VTK_ABI_NAMESPACE_END
307 #endif // vtkTableFFT_h
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:45
a simple class to control print indentation
Definition: vtkIndent.h:29
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Superclass for algorithms that produce only vtkTables as output.
FFT for table columns.
Definition: vtkTableFFT.h:46
static vtkTableFFT * New()
virtual void SetWindowingFunction(int)
Specify the windowing function to apply on the input.
~vtkTableFFT() override
virtual void SetBlockSize(int)
Specify the number of samples to use for each block / segment in the Welch method.
virtual void SetAverageFft(bool)
Specify if filter should use the Welch / periodogram method.
vtkSmartPointer< vtkDataArray > DoFFT(vtkDataArray *input)
Perform the FFT on the given data array.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void Initialize(vtkTable *input)
Initialize the internal state before performing the actual fft.
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called by the superclass.
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:59
#define VTK_DEPRECATED_IN_9_3_0(reason)
#define VTK_DEPRECATED_IN_9_2_0(reason)