LocalMaxMassDetectorParameters.noiseLevel).getValue();
// List of found mz peaks
ArrayList<DataPoint> mzPeaks = new ArrayList<DataPoint>();
DataPoint dataPoints[] = scan.getDataPoints();
// All data points of current m/z peak
// Top data point of current m/z peak
DataPoint currentMzPeakTop = null;
// True if we haven't reached the current local maximum yet
boolean ascending = true;
// Iterate through all data points
for (int i = 0; i < dataPoints.length - 1; i++) {
boolean nextIsBigger = dataPoints[i + 1].getIntensity() > dataPoints[i]
.getIntensity();
boolean nextIsZero = dataPoints[i + 1].getIntensity() == 0;
boolean currentIsZero = dataPoints[i].getIntensity() == 0;
// Ignore zero intensity regions
if (currentIsZero)
continue;
// Check for local maximum
if (ascending && (!nextIsBigger)) {
currentMzPeakTop = dataPoints[i];
ascending = false;
continue;
}
assert currentMzPeakTop != null;
// Check for the end of the peak
if ((!ascending) && (nextIsBigger || nextIsZero)) {
// Add the m/z peak if it is above the noise level
if (currentMzPeakTop.getIntensity() > noiseLevel) {
mzPeaks.add(currentMzPeakTop);
}
// Reset and start with new peak
ascending = true;