本文整理汇总了C++中PeakMap::resize方法的典型用法代码示例。如果您正苦于以下问题:C++ PeakMap::resize方法的具体用法?C++ PeakMap::resize怎么用?C++ PeakMap::resize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PeakMap
的用法示例。
在下文中一共展示了PeakMap::resize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
Int main(int argc, const char ** argv)
{
if (argc < 2) return 1;
// the path to the data should be given on the command line
String tutorial_data_path(argv[1]);
QApplication app(argc, const_cast<char **>(argv));
PeakMap exp;
exp.resize(1);
DTAFile().load(tutorial_data_path + "/data/Tutorial_Spectrum1D.dta", exp[0]);
LayerData::ExperimentSharedPtrType exp_sptr(new PeakMap(exp));
Spectrum1DWidget * widget = new Spectrum1DWidget(Param(), 0);
widget->canvas()->addLayer(exp_sptr);
widget->show();
return app.exec();
} //end of main
示例2: pickExperiment
/**
@brief Applies the peak-picking algorithm to a map (MSExperiment). This
method picks peaks for each scan in the map consecutively. The resulting
picked peaks are written to the output map.
Currently we have to give up const-correctness but we know that everything on disc is constant
*/
void PeakPickerHiRes::pickExperiment(/* const */ OnDiscMSExperiment& input, PeakMap& output, const bool check_spectrum_type) const
{
// make sure that output is clear
output.clear(true);
// copy experimental settings
static_cast<ExperimentalSettings &>(output) = *input.getExperimentalSettings();
Size progress = 0;
startProgress(0, input.size() + input.getNrChromatograms(), "picking peaks");
// resize output with respect to input
output.resize(input.size());
if (input.getNrSpectra() > 0)
{
for (Size scan_idx = 0; scan_idx != input.size(); ++scan_idx)
{
if (ms_levels_.empty()) //auto mode
{
MSSpectrum s = input[scan_idx];
s.sortByPosition();
// determine type of spectral data (profile or centroided)
SpectrumSettings::SpectrumType spectrumType = s.getType();
if (spectrumType == SpectrumSettings::CENTROID)
{
output[scan_idx] = input[scan_idx];
}
else
{
pick(s, output[scan_idx]);
}
}
else if (!ListUtils::contains(ms_levels_, input[scan_idx].getMSLevel())) // manual mode
{
output[scan_idx] = input[scan_idx];
}
else
{
MSSpectrum s = input[scan_idx];
s.sortByPosition();
// determine type of spectral data (profile or centroided)
SpectrumSettings::SpectrumType spectrum_type = s.getType();
if (spectrum_type == SpectrumSettings::CENTROID && check_spectrum_type)
{
throw OpenMS::Exception::IllegalArgument(__FILE__, __LINE__, __FUNCTION__, "Error: Centroided data provided but profile spectra expected.");
}
pick(s, output[scan_idx]);
}
setProgress(++progress);
}
}
for (Size i = 0; i < input.getNrChromatograms(); ++i)
{
MSChromatogram chromatogram;
pick(input.getChromatogram(i), chromatogram);
output.addChromatogram(chromatogram);
setProgress(++progress);
}
endProgress();
return;
}