peak_finder.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #pragma once
  2. #include <vector>
  3. namespace graft_cv {
  4. const float EPS = 2.2204e-16f;
  5. void diff(std::vector<float> in, std::vector<float>& out);
  6. void vectorElementsProduct(std::vector<float> a, std::vector<float> b, std::vector<float>& out);
  7. void findIndicesLessThan(std::vector<float> in, float threshold, std::vector<int>& indices);
  8. void selectElementsFromIndices(std::vector<float> in, std::vector<int> indices, std::vector<float>& out);
  9. void selectElementsFromIndices(std::vector<int> in, std::vector<int> indices, std::vector<int>& out);
  10. void signVector(std::vector<float> in, std::vector<int>& out);
  11. void scalarProduct(float scalar, std::vector<float> in, std::vector<float>& out);
  12. /*
  13. Inputs
  14. x0: input signal
  15. extrema: 1 if maxima are desired, -1 if minima are desired
  16. includeEndpoints - If true the endpoints will be included as possible extrema otherwise they will not be included
  17. Output
  18. peakInds: Indices of peaks in x0
  19. */
  20. void findPeaks(std::vector<float> x0, std::vector<int>& peakInds, bool includeEndpoints = true, float extrema = 1);
  21. void indexPeaks(
  22. std::vector<float>&stem_width,
  23. std::vector<int>&peak_indices,
  24. float mu,
  25. std::vector<float>& peak_power);
  26. }