comparison data/model/DenseThreeDimensionalModel.h @ 182:f75f8a1cd7b1

* Some dull work to continue unifying the fft model and editable dense 3d model interfaces
author Chris Cannam
date Mon, 09 Oct 2006 10:49:46 +0000
parents 0ed2b2e26b44
children 91fdc752e540
comparison
equal deleted inserted replaced
181:9c652f2c39b1 182:f75f8a1cd7b1
26 { 26 {
27 Q_OBJECT 27 Q_OBJECT
28 28
29 public: 29 public:
30 /** 30 /**
31 * Return the number of sample frames covered by each set of bins. 31 * Return the number of sample frames covered by each column of bins.
32 */ 32 */
33 virtual size_t getResolution() const = 0; 33 virtual size_t getResolution() const = 0;
34 34
35 /** 35 /**
36 * Return the number of bins in each set of bins. 36 * Return the number of columns of bins in the model.
37 */ 37 */
38 virtual size_t getYBinCount() const = 0; 38 virtual size_t getWidth() const = 0;
39 39
40 /** 40 /**
41 * Return the minimum value of the value in each bin. 41 * Return the number of bins in each column.
42 */
43 virtual size_t getHeight() const = 0;
44
45 /**
46 * Return the minimum permissible value in each bin.
42 */ 47 */
43 virtual float getMinimumLevel() const = 0; 48 virtual float getMinimumLevel() const = 0;
44 49
45 /** 50 /**
46 * Return the maximum value of the value in each bin. 51 * Return the maximum permissible value in each bin.
47 */ 52 */
48 virtual float getMaximumLevel() const = 0; 53 virtual float getMaximumLevel() const = 0;
49 54
50 typedef std::vector<float> BinValueSet; 55 /**
56 * Return true if there are data available for the given column.
57 * This should return true only if getBinValues(windowStartFrame)
58 * would not have to do any substantial work to calculate its
59 * return values. If this function returns false, it may still be
60 * possible to get the bin values for that column, but they may
61 * have to be calculated.
62 */
63 virtual bool isColumnAvailable(size_t column) const = 0;
64
65 typedef std::vector<float> Column;
51 66
52 /** 67 /**
53 * Get the set of bin values at the given sample frame (i.e. the 68 * Get data from the given column of bin values.
54 * windowStartFrame/getWindowSize()'th set of bins).
55 */ 69 */
56 virtual void getBinValues(long windowStartFrame, BinValueSet &result) const = 0; 70 virtual void getColumn(size_t column, Column &result) const = 0;
57 71
58 /** 72 /**
59 * Get a single value, the one at the n'th bin of the set of bins 73 * Get the single data point from the n'th bin of the given column.
60 * starting at the given sample frame.
61 */ 74 */
62 virtual float getBinValue(long windowStartFrame, size_t n) const = 0; 75 virtual float getValueAt(size_t column, size_t n) const = 0;
63 76
77 /**
78 * Get the name of a given bin (i.e. a label to associate with
79 * that bin across all columns).
80 */
64 virtual QString getBinName(size_t n) const = 0; 81 virtual QString getBinName(size_t n) const = 0;
82
83 /**
84 * Utility function to query whether a given bin is greater than
85 * its (vertical) neighbours.
86 */
87 bool isLocalPeak(size_t x, size_t y) {
88 float value = getValueAt(x, y);
89 if (y > 0 && value < getValueAt(x, y - 1)) return false;
90 if (y < getHeight() - 1 && value < getValueAt(x, y + 1)) return false;
91 return true;
92 }
93
94 /**
95 * Utility function to query whether a given bin is greater than a
96 * certain threshold.
97 */
98 bool isOverThreshold(size_t x, size_t y, float threshold) {
99 return getValueAt(x, y) > threshold;
100 }
65 101
66 virtual int getCompletion() const = 0; 102 virtual int getCompletion() const = 0;
67 103
68 protected: 104 protected:
69 DenseThreeDimensionalModel() { } 105 DenseThreeDimensionalModel() { }