detectRowPeaks method
Detects the peaks in each matrix
row (1D picking for each row).
ixstartRows, ixendRows, ixstartCols, ixendCols
(end exclusive).
All peaks <= threshold
will not be added to the list.
peakSign
is one of PeakPicker1D.PICK_POS, PICK_NEG, PICK_POSNEG.
If maxPeaks
> 0, the returned list will only contain the maxPeaks
biggest peaks (or smallest for negative peaks) of all detected ones.
Possibly in this case the returned list has not the length maxPeaks*2
,
but it is smaller, even 0.
Returns the peak coordinates as a list of row,col
pairs:
row, col
, row, col
, ...
The resulting array's length is the number of peaks found.
Puts result also into rowPeaks used by detectPeaks().
Implementation
List<List<int>> detectRowPeaks(
List<Float64List> matrix,
int startRow,
int endRow,
int startCol,
int endCol,
double noise,
double threshold,
String peakSign,
int maxPeaks) {
rowPeaks = Map<int, List<int>>();
Float64List row;
List<int> peaks1D;
for (int i = startRow; i < endRow; i++) {
row = matrix[i];
peaks1D = PeakPicker1D.detectPeaks(
row, startCol, endCol, noise, threshold, peakSign, maxPeaks);
if (peaks1D.isNotEmpty) rowPeaks[i] = peaks1D;
}
List<List<int>> peaklist = [];
rowPeaks.forEach((int row, List<int> cols) {
cols.forEach((int col) {
peaklist.add([row, col]);
});
});
return peaklist;
}