diff --git a/Filters/DSP/CMakeLists.txt b/Filters/DSP/CMakeLists.txt deleted file mode 100644 index 11e7103d58043f11757d1714ebad8084ab035a04..0000000000000000000000000000000000000000 --- a/Filters/DSP/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -set(classes - vtkBandFiltering - ) - -vtk_module_add_module(VTK::FiltersDSP - CLASSES ${classes}) diff --git a/Filters/DSP/Testing/CMakeLists.txt b/Filters/DSP/Testing/CMakeLists.txt deleted file mode 100644 index 35f9732a938a3b073bdf94e86007916ffcd31b49..0000000000000000000000000000000000000000 --- a/Filters/DSP/Testing/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(Cxx) diff --git a/Filters/DSP/Testing/Cxx/CMakeLists.txt b/Filters/DSP/Testing/Cxx/CMakeLists.txt deleted file mode 100644 index 20b50e5178d3c6b62748a35868a2acd192c7d432..0000000000000000000000000000000000000000 --- a/Filters/DSP/Testing/Cxx/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -vtk_add_test_cxx(vtkFiltersDSPCxxTests tests - TestBandFiltering.cxx,NO_VALID - ) - -vtk_test_cxx_executable(vtkFiltersDSPCxxTests tests) diff --git a/Filters/DSP/Testing/Cxx/TestBandFiltering.cxx b/Filters/DSP/Testing/Cxx/TestBandFiltering.cxx deleted file mode 100644 index 82a8d511c1334cbdbf0b5bbfcebd43cf0dcc96ea..0000000000000000000000000000000000000000 --- a/Filters/DSP/Testing/Cxx/TestBandFiltering.cxx +++ /dev/null @@ -1,127 +0,0 @@ -// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen -// SPDX-License-Identifier: BSD-3-Clause - -#include <vtkBandFiltering.h> -#include <vtkDoubleArray.h> -#include <vtkMath.h> -#include <vtkMathUtilities.h> -#include <vtkNew.h> -#include <vtkTable.h> -#include <vtkTableFFT.h> - -#include <array> - -namespace -{ -// These array were generated using the filter and checked visually on a chart. -constexpr std::array<double, 18> EXPECTED_VALUE1 = { 2.59867e-05, 2.59867e-05, 5.07262e-05, - 5.07262e-05, 0.000104954, 0.000104954, 0.000237649, 0.000237649, 0.000860651, 0.000860651, - 11.908427, 11.908427, 0.00472649, 0.00472649, 5.9464, 5.9464, 0.000349909, 0.000349909 }; -constexpr std::array<double, 54> EXPECTED_VALUE2 = { 1.20898e-05, 1.20898e-05, 2.11536e-05, - 2.11536e-05, 2.40023e-05, 2.40023e-05, 3.06126e-05, 3.06126e-05, 3.68393e-05, 3.68393e-05, - 4.81976e-05, 4.81976e-05, 6.14968e-05, 6.14968e-05, 7.80998e-05, 7.80998e-05, 9.88132e-05, - 9.88132e-05, 0.000126777, 0.000126777, 0.000165033, 0.000165033, 0.00021851, 0.00021851, - 0.000298669, 0.000298669, 0.00043131, 0.00043131, 0.000680222, 0.000680222, 0.00127487, - 0.00127487, 0.00342693, 0.00342693, 0.0302243, 0.0302243, 28.85516599, 28.85516599, 0.0168144, - 0.0168144, 0.000872449, 0.000872449, 0.000160902, 0.000160902, 7.95249e-05, 7.95249e-05, - 0.000637652, 0.000637652, 14.42116562, 14.42116562, 0.000539186, 0.000539186, 2.67931e-05, - 2.67931e-05 }; - -template <unsigned long N> -int CheckArray(vtkDataArray* array, std::array<double, N> expected) -{ - const auto arrayRange = vtk::DataArrayValueRange(array); - - bool failure = false; - if (array->GetNumberOfValues() != static_cast<vtkIdType>(expected.size())) - { - failure = true; - std::cerr << "ERROR: wrong output size" << std::endl; - } - else - { - vtkIdType valIdx = 0; - for (const auto value : arrayRange) - { - if (!vtkMathUtilities::FuzzyCompare(static_cast<double>(value), expected[valIdx++], 1e-4)) - { - failure = true; - break; - } - } - } - - if (failure) - { - std::cerr << "Unexpected result.\nResult : {"; - for (const auto value : arrayRange) - { - std::cerr << value << ", "; - } - std::cerr << "}\nExpected:{"; - for (const auto val : expected) - { - std::cerr << val << ", "; - } - std::cerr << "}" << std::endl; - } - - return static_cast<int>(failure); -} -} - -// ---------------------------------------------------------------------------- -int TestBandFiltering(int vtkNotUsed(argc), char* vtkNotUsed(argv)[]) -{ - constexpr int N_ELEMENTS = 1000; - - // Fill our data - vtkNew<vtkTable> input; - vtkNew<vtkDoubleArray> column; - column->SetName("Signal"); - column->SetNumberOfComponents(1); - column->SetNumberOfTuples(N_ELEMENTS); - for (vtkIdType i = 0; i < N_ELEMENTS; i++) - { - column->SetValue(i, std::cos(0.5 * i) + 2.0 * std::cos(2.0 * i)); - } - input->AddColumn(column); - int exitCode = EXIT_SUCCESS; - - // Testing Octave band filtering - vtkNew<vtkBandFiltering> bandFiltering; - bandFiltering->SetInputData(input); - bandFiltering->SetBandFilteringMode(vtkBandFiltering::OCTAVE); - bandFiltering->SetWindowType(vtkTableFFT::HANNING); - bandFiltering->SetDefaultSamplingRate(1000); - bandFiltering->Update(); - - vtkDataArray* arr = - vtkDataArray::SafeDownCast(bandFiltering->GetOutput()->GetColumnByName("Signal")); - exitCode += ::CheckArray(arr, EXPECTED_VALUE1); - - // Check that we have the same result using an external FFT - vtkNew<vtkTableFFT> tableFFT; - tableFFT->SetInputData(input); - tableFFT->SetWindowingFunction(vtkTableFFT::HANNING); - tableFFT->CreateFrequencyColumnOn(); - tableFFT->ReturnOnesidedOn(); - tableFFT->SetDefaultSampleRate(1000); - tableFFT->Update(); - - bandFiltering->SetInputData(tableFFT->GetOutput()); - bandFiltering->SetApplyFFT(false); - bandFiltering->Update(); - - arr = vtkDataArray::SafeDownCast(bandFiltering->GetOutput()->GetColumnByName("Signal")); - exitCode += ::CheckArray(arr, EXPECTED_VALUE1); - - // Check third octave result - bandFiltering->SetBandFilteringMode(vtkBandFiltering::THIRD_OCTAVE); - bandFiltering->Update(); - - arr = vtkDataArray::SafeDownCast(bandFiltering->GetOutput()->GetColumnByName("Signal")); - exitCode += ::CheckArray(arr, EXPECTED_VALUE2); - - return exitCode; -} diff --git a/Filters/DSP/vtk.module b/Filters/DSP/vtk.module deleted file mode 100644 index 24f8703db9457b45f8d3117949e40ebcda3b1c22..0000000000000000000000000000000000000000 --- a/Filters/DSP/vtk.module +++ /dev/null @@ -1,23 +0,0 @@ -NAME - VTK::FiltersDSP -LIBRARY_NAME - vtkFiltersDSP -DESCRIPTION - Digital Signal Processing module -KIT - VTK::Filters -GROUPS - StandAlone -SPDX_LICENSE_IDENTIFIER - BSD-3-Clause -SPDX_COPYRIGHT_TEXT - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen -DEPENDS - VTK::CommonCore - VTK::CommonDataModel - VTK::CommonExecutionModel - VTK::FiltersGeneral -PRIVATE_DEPENDS - VTK::CommonMath -TEST_DEPENDS - VTK::TestingCore diff --git a/Filters/DSP/vtkBandFiltering.cxx b/Filters/DSP/vtkBandFiltering.cxx deleted file mode 100644 index fd32b87c3635f31551cefaba5ab52cae7b37f9d2..0000000000000000000000000000000000000000 --- a/Filters/DSP/vtkBandFiltering.cxx +++ /dev/null @@ -1,318 +0,0 @@ -// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen -// SPDX-License-Identifier: BSD-3-Clause - -#include "vtkBandFiltering.h" - -#include "vtkDataArray.h" -#include "vtkDataArrayRange.h" -#include "vtkDoubleArray.h" -#include "vtkMath.h" -#include "vtkNew.h" -#include "vtkObjectFactory.h" -#include "vtkSMPTools.h" -#include "vtkSmartPointer.h" -#include "vtkTable.h" -#include "vtkType.h" - -#include <array> -#include <numeric> -#include <string> -#include <vector> - -namespace -{ -/// Return x clamped in [min;max] range -inline double Clamp(double x, double min, double max) -{ - return std::min(std::max(x, min), max); -} - -/// Return the overlapping factor of r1 relative to r2 : -/// - if r2 is totally inside r1 return 1 -/// - if r2 is totally outside r1 return 0 -/// - else return the percentage of r2 inside r1 -double Overlap(std::array<double, 2> r1, std::array<double, 2> r2) -{ - const double cmin = Clamp(r1[0], r2[0], r2[1]); - const double cmax = Clamp(r1[1], r2[0], r2[1]); - return (cmax - cmin) / (r2[1] - r2[0]); -} - -/// Represent a frequency band. A band is represented by its lower and upper -/// frequency. Because the FFT return bins of FFT and generated bands can -/// overlap 2 bins at the same time, each band limit has a Ratio that represents -/// how much the limit is overlapping with the FFT bin. -struct Band -{ - struct Limit - { - std::size_t Index; ///< Index of the frequency bin in the FFT frequency array - double Ratio; ///< Overlap ratio of the limit with the FFT bin - }; - Limit Lower; - Limit Upper; -}; - -/// Given the FFT frequency array and the bandwidth, construct the frequency bands -/// limits that will be used for generating the fitlered values per band later. -/// Also construct the xAxis which contains the range for each generated bin so -/// that user can plot the bins nicely. -/// -/// See `struct Band` -std::vector<Band> GenerateOctaveBands( - vtkDataArray* frequencies, double bandWidth, vtkDoubleArray* xAxis) -{ - // Compute frequency range. Always ignore bin of frequency = 0 - double frange[2] = { frequencies->GetTuple1(0), - frequencies->GetTuple1(frequencies->GetNumberOfTuples() - 1) }; - if (frange[0] == 0.0) - { - frange[0] = frequencies->GetTuple1(1); - } - - // From IEC 6126 - constexpr double F_BASE = 1000.0; - constexpr double F_RATIO = 1.9952623149688795; // -> pow(10, 0.3); - - const int lowestBand = - static_cast<int>(std::floor(bandWidth * std::log10(frange[0] / F_BASE) / 0.3 + 0.5)) + 1; - const int highestBand = - static_cast<int>(std::floor(bandWidth * std::log10(frange[1] / F_BASE) / 0.3 + 0.5)) + 1; - - const int nBand = highestBand - lowestBand; - if (nBand <= 0) - { - vtkGenericWarningMacro("Cannot create band spectrum of width " << bandWidth << ": too narrow"); - return {}; - } - - // Construct xAxis array as well as the LUT for constructing bands later on - xAxis->SetName("Frequency"); - xAxis->SetNumberOfComponents(1); - xAxis->SetNumberOfTuples(nBand * 2); - std::vector<Band> bands(nBand); - const double halfBinSize = (frequencies->GetTuple1(1) - frequencies->GetTuple1(0)) / 2; - - vtkSMPTools::For(0, nBand, [&](int begin, int end) { - for (int i = begin; i < end; ++i) - { - const int currentBand = lowestBand + i; - const std::array<double, 2> bandLimits = { F_BASE * - std::pow(F_RATIO, (currentBand - 0.5) / bandWidth), - F_BASE * std::pow(F_RATIO, (currentBand + 0.5) / bandWidth) }; - - xAxis->SetValue(i * 2, bandLimits[0]); - xAxis->SetValue(i * 2 + 1, bandLimits[1]); - - const auto fArrayRange = vtk::DataArrayValueRange<1>(frequencies); - - const auto lowerIndex = - std::lower_bound(fArrayRange.cbegin(), fArrayRange.cend(), bandLimits[0] - halfBinSize); - bands[i].Lower.Index = std::distance(fArrayRange.cbegin(), lowerIndex); - bands[i].Lower.Ratio = - ::Overlap(bandLimits, { *lowerIndex - halfBinSize, *lowerIndex + halfBinSize }); - - const auto upperIndex = - std::upper_bound(fArrayRange.cbegin(), fArrayRange.cend(), bandLimits[1] + halfBinSize) - 1; - bands[i].Upper.Index = std::distance(fArrayRange.cbegin(), upperIndex); - bands[i].Upper.Ratio = - ::Overlap(bandLimits, { *upperIndex - halfBinSize, *upperIndex + halfBinSize }); - } - }); - - return bands; -} - -/// Given the FFT and the frequency bands to generate, returns the averaged value of column -/// per band. -vtkSmartPointer<vtkDataArray> ProcessColumn( - vtkDataArray* column, const std::vector<::Band>& bands, bool decibel, double reference) -{ - if (column == nullptr || vtksys::SystemTools::Strucmp(column->GetName(), "Frequency") == 0 || - column->GetNumberOfTuples() == 0 || column->GetNumberOfComponents() != 2) - { - return nullptr; - } - - std::vector<double> amplitudes; - amplitudes.resize(column->GetNumberOfTuples()); - auto inputRange = vtk::DataArrayTupleRange<2>(column); - vtkSMPTools::Transform(inputRange.cbegin(), inputRange.cend(), amplitudes.begin(), - [decibel, reference](decltype(inputRange)::ConstTupleReferenceType complex) { - double tuple[2]; - complex->GetTuple(tuple); - const double mag = - decibel ? 20.0 * std::log10(vtkMath::Norm2D(tuple) / reference) : vtkMath::Norm2D(tuple); - return mag; - }); - - auto resultBands = vtkSmartPointer<vtkDoubleArray>::New(); - resultBands->SetNumberOfComponents(1); - resultBands->SetNumberOfValues(bands.size() * 2); - resultBands->SetName(column->GetName()); - - vtkSMPTools::For(0, bands.size(), [&](std::size_t begin, std::size_t end) { - for (std::size_t bandIdx = begin; bandIdx < end; ++bandIdx) - { - const auto& band = bands[bandIdx]; - double mean = 0.0; - mean += amplitudes[band.Lower.Index] * band.Lower.Ratio; - mean += amplitudes[band.Upper.Index] * band.Upper.Ratio; - double divider = band.Lower.Ratio + band.Upper.Ratio; - - for (std::size_t i = band.Lower.Index + 1; i < band.Upper.Index; ++i) - { - mean += amplitudes[i]; - divider += 1.0; - } - - mean /= divider; - resultBands->SetValue(bandIdx * 2, mean); - resultBands->SetValue(bandIdx * 2 + 1, mean); - } - }); - - return resultBands; -} -}; - -VTK_ABI_NAMESPACE_BEGIN -//------------------------------------------------------------------------------ -vtkStandardNewMacro(vtkBandFiltering); - -//---------------------------------------------------------------------------- -int vtkBandFiltering::RequestData(vtkInformation* vtkNotUsed(request), - vtkInformationVector** inputVector, vtkInformationVector* outputVector) -{ - vtkSmartPointer<vtkTable> input = vtkTable::GetData(inputVector[0]); - auto output = vtkTable::GetData(outputVector); - if (!input || !output) - { - vtkErrorMacro("Input/Output is not initialized"); - return 0; - } - if (input->GetNumberOfColumns() <= 0) - { - return 1; - } - - // Apply the FFT on the input if necessary and get the frequency bins of the input - this->UpdateProgress(0.0); - vtkSmartPointer<vtkDataArray> frequencies; - if (this->ApplyFFT) - { - input = vtkBandFiltering::ApplyFFTInternal(input, this->WindowType, this->DefaultSamplingRate); - frequencies = vtkDataArray::SafeDownCast(input->GetColumnByName("Frequency")); - } - else - { - for (vtkIdType i = 0; i < input->GetNumberOfColumns(); ++i) - { - vtkDataArray* column = vtkDataArray::SafeDownCast(input->GetColumn(i)); - if (column && this->FrequencyArrayName == column->GetName()) - { - frequencies = column; - break; - } - } - - if (frequencies.Get() == nullptr) - { - // in this case we have to create the range of frequencies ourself - // We always consider that the input is an FFT with its mirrored - // part discarded - auto* dblFrequencies = vtkDoubleArray::New(); - dblFrequencies->SetNumberOfValues(input->GetNumberOfRows()); - auto range = vtk::DataArrayValueRange<1>(dblFrequencies); - const double sampleSpacing = this->DefaultSamplingRate / (2 * (range.size() - 1)); - for (vtkIdType i = 0; i < range.size(); ++i) - { - range[i] = i * sampleSpacing; - } - frequencies.TakeReference(dblFrequencies); - } - } - this->UpdateProgress(0.5); - - // Generate LUT for each frequency bands, as well as the new frequency column - // corresponding to the frequency bounds of each bands - double bandWidth = static_cast<double>(this->OctaveSubdivision); - if (this->BandFilteringMode == OCTAVE) - { - bandWidth = 1.0; - } - else if (this->BandFilteringMode == THIRD_OCTAVE) - { - bandWidth = 3.0; - } - vtkNew<vtkDoubleArray> xAxis; - auto bands = ::GenerateOctaveBands(frequencies, bandWidth, xAxis); - if (bands.empty()) - { - return 1; - } - output->AddColumn(xAxis); - - // Process all compatible arrays - this->SetProgressShiftScale(0.5, 0.5); - for (vtkIdType colID = 0; colID < input->GetNumberOfColumns(); colID++) - { - auto resultBands = ::ProcessColumn(vtkDataArray::SafeDownCast(input->GetColumn(colID)), bands, - this->OutputInDecibel, this->ReferenceValue); - if (resultBands.Get() != nullptr) - { - output->AddColumn(resultBands); - } - this->UpdateProgress(static_cast<double>(colID) / input->GetNumberOfColumns()); - } - this->SetProgressShiftScale(0.0, 1.0); - - return 1; -} - -//---------------------------------------------------------------------------- -vtkSmartPointer<vtkTable> vtkBandFiltering::ApplyFFTInternal( - vtkTable* input, int window, double defaultSampleRate) -{ - bool couldReturnOnesided = true; - for (vtkIdType col = 0; col < input->GetNumberOfColumns(); col++) - { - if (input->GetColumn(col)->GetNumberOfComponents() == 2) - { - couldReturnOnesided = false; - break; - } - } - - vtkNew<vtkTableFFT> tableFFT; - tableFFT->SetInputData(input); - tableFFT->SetReturnOnesided(couldReturnOnesided); - tableFFT->CreateFrequencyColumnOn(); - tableFFT->SetWindowingFunction(window); - tableFFT->SetDefaultSampleRate(defaultSampleRate); - tableFFT->Update(); - vtkSmartPointer<vtkTable> processTable = tableFFT->GetOutput(); - - // Drop the second half of the table if we couldn't optimize the FFT : - // we only process the real part of the FFT - if (!couldReturnOnesided) - { - processTable->SetNumberOfRows(processTable->GetNumberOfRows() / 2 + 1); - } - - return processTable; -} - -//---------------------------------------------------------------------------- -void vtkBandFiltering::PrintSelf(ostream& os, vtkIndent indent) -{ - this->Superclass::PrintSelf(os, indent); - - os << indent << "ApplyFFT: " << this->ApplyFFT << std::endl; - os << indent << "DefaultSamplingRate: " << this->DefaultSamplingRate << std::endl; - os << indent << "WindowType: " << this->WindowType << std::endl; - os << indent << "BandFilteringMode: " << this->BandFilteringMode << std::endl; - os << indent << "OutputInDecibel: " << this->OutputInDecibel << std::endl; -} - -VTK_ABI_NAMESPACE_END diff --git a/Filters/DSP/vtkBandFiltering.h b/Filters/DSP/vtkBandFiltering.h deleted file mode 100644 index 80c4b54f8ca53493de521cbba62fe0b753285910..0000000000000000000000000000000000000000 --- a/Filters/DSP/vtkBandFiltering.h +++ /dev/null @@ -1,170 +0,0 @@ -// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen -// SPDX-License-Identifier: BSD-3-Clause - -/** - * @class vtkBandFiltering - * @brief Band filtering for table columns - * - * vtkBandFiltering performs a band filtering in frequency space. It takes as input a table with - * at least a column for a specific quantity and an optional time array like the vtkTableFFT. The - * output will be an table with the mean of this quantity (in the original unit or in decibels) for - * each frequencies defined in the frequency column (in Hz). - */ - -#ifndef vtkBandFiltering_h -#define vtkBandFiltering_h - -#include "vtkFiltersDSPModule.h" // for export macro -#include "vtkTableAlgorithm.h" -#include "vtkTableFFT.h" // for vtkTableFFT enums - -#include <string> // std::string - -VTK_ABI_NAMESPACE_BEGIN -class VTKFILTERSDSP_EXPORT vtkBandFiltering : public vtkTableAlgorithm -{ -public: - vtkTypeMacro(vtkBandFiltering, vtkTableAlgorithm); - static vtkBandFiltering* New(); - void PrintSelf(ostream& os, vtkIndent indent) override; - - enum - { - OCTAVE = 0, - THIRD_OCTAVE, - CUSTOM - }; - - ///@{ - /** - * Specify if the filter should use octave, third or custom octave band. - * - * Default is OCTAVE - * - * @see SetOctaveSubdivision - */ - vtkGetMacro(BandFilteringMode, int); - vtkSetClampMacro(BandFilteringMode, int, OCTAVE, CUSTOM); - ///@} - - ///@{ - /** - * Get/Set the number of octave subdivision when using - * BandFilteringMode == CUSTOM . Only odd numbers are valid. - * When using even numbers, the number just below will be used. - * 1 is equivalent to using the OCTAVE mode, and 3 the THIRD_OCTAVE - * mode. - * - * Default is 1 - * - * @see vtkBandFiltering::SetBandFilteringMode(int) - */ - vtkGetMacro(OctaveSubdivision, int); - vtkSetClampMacro(OctaveSubdivision, int, 1, VTK_INT_MAX); - ///@} - - ///@{ - /** - * Get/set the windowing function for the FFT. Only used if ApplyFFT is true. - * Windowing function enum is defined in vtkTableFFT. - * - * Default is vtkTableFFT::HANNING. - */ - vtkGetMacro(WindowType, int); - vtkSetClampMacro(WindowType, int, vtkTableFFT::HANNING, vtkTableFFT::RECTANGULAR); - ///@} - - ///@{ - /** - * Specify the frequency sample rate in Hz. - * If ApplyFFT is true: this will be used if the filter cannot find a time column - * If ApplyFFT is false: this will be used if the filter cannot find a frequency column. - * - * @see vtkBandFiltering::SetFrequencyArrayName(std::string) - * - * Default is 10000. - */ - vtkGetMacro(DefaultSamplingRate, double); - vtkSetMacro(DefaultSamplingRate, double); - ///@} - - ///@{ - /** - * Specify if we want to output band filtering in dB. Reference value used is the one - * for sound pressure, i.e. 2e-5 (Pa). - * - * Default is false. - */ - vtkGetMacro(OutputInDecibel, bool); - vtkSetMacro(OutputInDecibel, bool); - ///@} - - ///@{ - /** - * Specify the reference value used to convert the input quantity to decibel. - * - * Default is 2e-5 - */ - vtkGetMacro(ReferenceValue, double); - vtkSetMacro(ReferenceValue, double); - ///@} - - ///@{ - /** - * Specify if one want to apply an FFT on the input before computing the band filtering. - * It should be set to true if the input is a sound signal and false if it has already been - * processed by an FFT. When taking an FFT as its input, the filter expects it to be a - * signal of real values where its mirrored part has already been removed. - * - * If false then one should specify which array is the Frequency array. - * - * Default is true. - * - * @see vtkTableFFT::SetReturnOnesided(bool) - */ - vtkGetMacro(ApplyFFT, bool); - vtkSetMacro(ApplyFFT, bool); - ///@} - - ///@{ - /** - * When ApplyFFT is false, specify the frequency array to use when filtering the signals. - * If no array with this name is found then use the specified default sample rate to create - * a new one. - * - * Default is "Frequency". - * - * @see vtkTableFFT::SetDefaultSamplingRate(double) - * @see vtkTableFFT::SetApplyFFT(bool) - */ - vtkGetMacro(FrequencyArrayName, std::string); - vtkSetMacro(FrequencyArrayName, std::string); - ///@} - -protected: - vtkBandFiltering() = default; - ~vtkBandFiltering() override = default; - - int RequestData(vtkInformation* request, vtkInformationVector** inputVector, - vtkInformationVector* outputVector) override; - - static vtkSmartPointer<vtkTable> ApplyFFTInternal( - vtkTable* input, int window, double defaultSampleRate); - -private: - vtkBandFiltering(const vtkBandFiltering&) = delete; - void operator=(const vtkBandFiltering&) = delete; - - int WindowType = vtkTableFFT::HANNING; - double DefaultSamplingRate = 10000.0; - std::string FrequencyArrayName = "Frequency"; - - bool ApplyFFT = true; - int BandFilteringMode = vtkBandFiltering::OCTAVE; - int OctaveSubdivision = 1; - bool OutputInDecibel = false; - double ReferenceValue = 2e-5; -}; -VTK_ABI_NAMESPACE_END - -#endif // vtkBandFiltering_h