final MZmineProcessingStep<PeakResolver> resolver = parameters
.getParameter(PEAK_RESOLVER).getValue();
// Create new peak list.
final PeakList resolvedPeaks = new SimplePeakList(peakList + " "
+ parameters.getParameter(SUFFIX).getValue(), dataFile);
// Load previous applied methods.
for (final PeakListAppliedMethod method : peakList.getAppliedMethods()) {
resolvedPeaks.addDescriptionOfAppliedTask(method);
}
// Add task description to peak list.
resolvedPeaks
.addDescriptionOfAppliedTask(new SimplePeakListAppliedMethod(
"Peak deconvolution by " + resolver, resolver
.getParameterSet()));
// Initialise counters.
processedRows = 0;
totalRows = peakList.getNumberOfRows();
int peakId = 1;
// Process each chromatogram.
final ChromatographicPeak[] chromatograms = peakList.getPeaks(dataFile);
final int chromatogramCount = chromatograms.length;
for (int index = 0; !isCanceled() && index < chromatogramCount; index++) {
final ChromatographicPeak chromatogram = chromatograms[index];
// Load the intensities into array.
final double[] intensities = new double[scanCount];
for (int i = 0; i < scanCount; i++) {
final DataPoint dp = chromatogram.getDataPoint(scanNumbers[i]);
intensities[i] = dp != null ? dp.getIntensity() : 0.0;
}
// Resolve peaks.
final PeakResolver resolverModule = resolver.getModule();
final ParameterSet resolverParams = resolver.getParameterSet();
final ChromatographicPeak[] peaks = resolverModule.resolvePeaks(
chromatogram, scanNumbers, retentionTimes, intensities,
resolverParams);
// Add peaks to the new peak list.
for (final ChromatographicPeak peak : peaks) {
final PeakListRow newRow = new SimplePeakListRow(peakId++);
newRow.addPeak(dataFile, peak);
resolvedPeaks.addRow(newRow);
}
processedRows++;
}