Commit 85854cca authored by Edlira Nano's avatar Edlira Nano
Browse files

removed visual c++ warnings

git-svn-id: https://subversion.renater.fr/masschroq/trunk@2264 e4b6dbb4-9209-464b-83f7-6257456c460c
parent 4a59c77f
......@@ -60,11 +60,11 @@ class peakDetectionBase {
protected:
/// pure virtual method that detects and returns a vector of xicPeak-s
virtual std::vector<xicPeak *> * privNewDetectedPeaks
(const QuantiItemBase mz_quanti_item,
const Msrun * p_msrun,
const std::vector<mcq_double> * p_v_rt,
const std::vector<mcq_double> * p_v_intensity) const = 0;
virtual std::vector<xicPeak *> * privNewDetectedPeaks(
const QuantiItemBase mz_quanti_item,
const Msrun * p_msrun,
const std::vector<mcq_double> * p_v_rt,
const std::vector<mcq_double> * p_v_intensity) const = 0;
void findPeakRangeWalkingFromMax(unsigned int * begin,
unsigned int * end,
......
......@@ -10,83 +10,92 @@
#include <deque>
#include <map>
peakDetectionMoulon::peakDetectionMoulon() {
coeff_detect_range = 1;
peakDetectionMoulon::peakDetectionMoulon()
{
coeff_detect_range = 1;
}
peakDetectionMoulon::~peakDetectionMoulon() {
peakDetectionMoulon::~peakDetectionMoulon()
{
}
void
peakDetectionMoulon::printInfos(QTextStream & out) const {
out << "\t detection of type 'moulon' with parameters :" << endl;
out << "\t _half_smoothing_window_size = "
<< _half_smoothing_window_size << endl;
out << "\t _tic_start = " << _tic_start << endl;
out << "\t _tic_stop = " << _tic_stop << endl;
peakDetectionMoulon::printInfos(QTextStream & out) const
{
out << "\t detection of type 'moulon' with parameters :" << endl;
out << "\t _half_smoothing_window_size = "
<< _half_smoothing_window_size << endl;
out << "\t _tic_start = " << _tic_start << endl;
out << "\t _tic_stop = " << _tic_stop << endl;
}
std::vector<xicPeak *> *
peakDetectionMoulon::privNewDetectedPeaks
(QuantiItemBase mz_lookfor,
const Msrun * p_msrun,
const std::vector<mcq_double> * p_v_rt,
const std::vector<mcq_double> * p_v_intensity) const {
std::vector<xicPeak *> * peakDetectionMoulon::privNewDetectedPeaks(
const QuantiItemBase quanti_item,
const Msrun * p_msrun,
const std::vector<mcq_double> * p_v_rt,
const std::vector<mcq_double> * p_v_intensity) const
{
std::vector<xicPeak *> * result = new std::vector<xicPeak *>;
std::vector<xicPeak *> * result = new std::vector<xicPeak *>;
/// smoothing
std::vector<mcq_double> * p_v_smoothing = Utilities::newVectorByApplyingWindowsOperation
(p_v_intensity, _half_smoothing_window_size, &get_average);
/// smoothing
std::vector<mcq_double> * p_v_smoothing =
Utilities::newVectorByApplyingWindowsOperation
(p_v_intensity, _half_smoothing_window_size, &get_average);
// detect peaks :
mcq_double rtime;
mcq_double intensity;
bool banked(false);
xicPeak * current_peak(0);
unsigned int nb_tic_start(0);
current_peak = NULL;
constvdoubleit it;
unsigned int i;
for (i = 0, it = p_v_smoothing->begin();
it != p_v_smoothing->end();
++it, ++i)
{
rtime = (*p_v_rt)[i];
intensity = (*p_v_intensity)[i];
if ((nb_tic_start == 0)
&& (current_peak != NULL)
&& (banked == false)) {
delete (current_peak);
// detect peaks :
mcq_double rtime;
mcq_double intensity;
bool banked(false);
xicPeak * current_peak(0);
unsigned int nb_tic_start(0);
current_peak = NULL;
}
constvdoubleit it;
unsigned int i;
for (i = 0, it = p_v_smoothing->begin();
it != p_v_smoothing->end();
++it, ++i)
{
rtime = (*p_v_rt)[i];
intensity = (*p_v_intensity)[i];
if ((nb_tic_start == 0)
&& (current_peak != NULL)
&& (banked == false))
{
delete (current_peak);
current_peak = NULL;
}
if (*it >= _tic_start) {
nb_tic_start++;
if (current_peak == NULL) {
current_peak = new xicPeak(mz_lookfor, p_msrun);
banked = false;
}
if ((nb_tic_start == 2) && (banked == false)) {
result->push_back(current_peak);
banked = true;
}
} else {
nb_tic_start = 0;
}
if (current_peak != NULL) {
current_peak->add_measure(rtime, intensity);
}
if (*it <= _tic_stop) {
if (current_peak != NULL) {
current_peak = NULL;
banked = false;
}
}
if (*it >= _tic_start)
{
nb_tic_start++;
if (current_peak == NULL) {
current_peak = new xicPeak(quanti_item, p_msrun);
banked = false;
}
if ((nb_tic_start == 2) && (banked == false))
{
result->push_back(current_peak);
banked = true;
}
} else
{
nb_tic_start = 0;
}
if (current_peak != NULL)
{
current_peak->add_measure(rtime, intensity);
}
if (*it <= _tic_stop)
{
if (current_peak != NULL)
{
current_peak = NULL;
banked = false;
}
}
}
delete p_v_smoothing;
return (result);
delete p_v_smoothing;
return (result);
}
......@@ -68,11 +68,11 @@ public:
protected:
virtual std::vector<xicPeak *> *
privNewDetectedPeaks(QuantiItemBase mz_lookfor,
const Msrun * p_msrun,
const std::vector<mcq_double> * p_v_rt,
const std::vector<mcq_double> * p_v_intensity) const;
virtual std::vector<xicPeak *> * privNewDetectedPeaks(
const QuantiItemBase quanti_item,
const Msrun * p_msrun,
const std::vector<mcq_double> * p_v_rt,
const std::vector<mcq_double> * p_v_intensity) const;
private:
......
......@@ -9,119 +9,127 @@
#include "../filters/filter_max_min.h"
#include "../filters/filter_smoothing.h"
peakDetectionZivy::peakDetectionZivy() {
_minmax_half_edge = 2;
_maxmin_half_edge = 2;
_detection_threshold_on_minmax = 5000;
_detection_threshold_on_maxmin = 0;
_mean_filter_half_edge = 0;
peakDetectionZivy::peakDetectionZivy()
{
_minmax_half_edge = 2;
_maxmin_half_edge = 2;
_detection_threshold_on_minmax = 5000;
_detection_threshold_on_maxmin = 0;
_mean_filter_half_edge = 0;
}
peakDetectionZivy::~peakDetectionZivy() {
peakDetectionZivy::~peakDetectionZivy()
{
}
void peakDetectionZivy::printInfos(QTextStream & out) const {
out << "\t detection of type 'zivy' with parameters :\n"
<< "\t _minmax_half_edge = " << _minmax_half_edge << endl;
out << "\t _maxmin_half_edge = " << _maxmin_half_edge << endl;
out << "\t _detection_threshold_on_minmax = "
<< _detection_threshold_on_minmax << endl;
out << "\t _detection_threshold_on_maxmin = "
<< _detection_threshold_on_maxmin << endl;
void peakDetectionZivy::printInfos(QTextStream & out) const
{
out << "\t detection of type 'zivy' with parameters :\n"
<< "\t _minmax_half_edge = " << _minmax_half_edge << endl;
out << "\t _maxmin_half_edge = " << _maxmin_half_edge << endl;
out << "\t _detection_threshold_on_minmax = "
<< _detection_threshold_on_minmax << endl;
out << "\t _detection_threshold_on_maxmin = "
<< _detection_threshold_on_maxmin << endl;
}
std::vector<xicPeak *> *
peakDetectionZivy::privNewDetectedPeaks
(QuantiItemBase quanti_item,
const Msrun * p_msrun,
const std::vector<mcq_double> * p_v_rt,
const std::vector<mcq_double> * p_v_intensity) const
std::vector<xicPeak *> * peakDetectionZivy::privNewDetectedPeaks(
const QuantiItemBase quanti_item,
const Msrun * p_msrun,
const std::vector<mcq_double> * p_v_rt,
const std::vector<mcq_double> * p_v_intensity) const
{
std::vector<xicPeak *> * result = new std::vector<xicPeak *>;
std::vector<mcq_double> * p_v_rtbis = new std::vector<mcq_double>(*p_v_rt);
std::vector<mcq_double> * p_v_minmax =
new std::vector<mcq_double>(*p_v_intensity);
std::vector<mcq_double> * p_v_maxmin = NULL;
if (_mean_filter_half_edge != 0) {
// Smooth signal with a smoothing (moving-average) filter before
// performing detection. The original signal is not altered.
FilterSmoothing f_mean_smoothing;
f_mean_smoothing.set_smoothing_half_window_length(_mean_filter_half_edge);
f_mean_smoothing.treatSignal(p_v_rtbis, &p_v_minmax);
p_v_maxmin = new std::vector<mcq_double>(*p_v_minmax);
}
else {
p_v_maxmin = new std::vector<mcq_double>(*p_v_intensity);
}
// Close transform
FilterMinMax f_minmax;
f_minmax.set_min_max_half_window_length(_minmax_half_edge);
f_minmax.treatSignal(p_v_rtbis, & p_v_minmax);
// Open transform
FilterMaxMin f_maxmin;
f_maxmin.set_max_min_half_window_length(_minmax_half_edge);
f_maxmin.treatSignal(p_v_rtbis, & p_v_maxmin);
//detect peak positions on close curve : a peak is an intensity value
//strictly greater than the two surrounding values. In case of
//equality (very rare, can happen with some old old spectrometers) we
//take the last equal point to be the peak
std::vector<mcq_double> & v_minmax = *p_v_minmax; //"close" courbe du haut
std::vector<mcq_double> & v_maxmin = *p_v_maxmin; //"open" courbe du bas
std::vector<mcq_double> peak_rt_position;
for (unsigned int i = 1, count = 0; i < p_v_minmax->size() - 1; ) {
// conditions to have a peak
if ( (v_minmax[i - 1 - count] < v_minmax[i]) &&
(v_minmax[i] > _detection_threshold_on_minmax) &&
(v_maxmin[i] > _detection_threshold_on_maxmin) )
{
// here we test the last condition to have a peak
// no peak case
if (v_minmax[i] < v_minmax[i + 1]) {
++i;
count = 0;
}
// there is a peak here ! case
else if (v_minmax[i] > v_minmax[i + 1]) {
xicPeak * tmp_peak = new xicPeak(quanti_item, p_msrun);
unsigned int begin_peak;
unsigned int end_peak;
findPeakRangeWalkingFromMax(&begin_peak, &end_peak, i, v_minmax);
// integrate peak surface :
for (unsigned int j = begin_peak; j <= end_peak; j++) {
tmp_peak->add_measure(p_v_rt->at(j), p_v_intensity->at(j));
}
// put peak in the results vector
if (begin_peak == end_peak)
delete tmp_peak;
else {
result->push_back(tmp_peak);
}
++i;
count = 0;
}
// equality case, skipping equal points
else {
// while (v_minmax[i] == v_minmax[i + 1]) {
++i, ++count;
std::vector<xicPeak *> * result = new std::vector<xicPeak *>;
std::vector<mcq_double> * p_v_rtbis = new std::vector<mcq_double>(*p_v_rt);
std::vector<mcq_double> * p_v_minmax =
new std::vector<mcq_double>(*p_v_intensity);
std::vector<mcq_double> * p_v_maxmin = NULL;
if (_mean_filter_half_edge != 0)
{
// Smooth signal with a smoothing (moving-average) filter before
// performing detection. The original signal is not altered.
FilterSmoothing f_mean_smoothing;
f_mean_smoothing.set_smoothing_half_window_length(_mean_filter_half_edge);
f_mean_smoothing.treatSignal(p_v_rtbis, &p_v_minmax);
p_v_maxmin = new std::vector<mcq_double>(*p_v_minmax);
} else
{
p_v_maxmin = new std::vector<mcq_double>(*p_v_intensity);
}
}
// no chance to have a peak at all, continue looping
else
++i;
} //end loop for peaks
// clean_up
delete p_v_minmax;
delete p_v_maxmin;
delete p_v_rtbis;
return (result);
// Close transform
FilterMinMax f_minmax;
f_minmax.set_min_max_half_window_length(_minmax_half_edge);
f_minmax.treatSignal(p_v_rtbis, & p_v_minmax);
// Open transform
FilterMaxMin f_maxmin;
f_maxmin.set_max_min_half_window_length(_minmax_half_edge);
f_maxmin.treatSignal(p_v_rtbis, & p_v_maxmin);
//detect peak positions on close curve : a peak is an intensity value
//strictly greater than the two surrounding values. In case of
//equality (very rare, can happen with some old old spectrometers) we
//take the last equal point to be the peak
std::vector<mcq_double> & v_minmax = *p_v_minmax; //"close" courbe du haut
std::vector<mcq_double> & v_maxmin = *p_v_maxmin; //"open" courbe du bas
std::vector<mcq_double> peak_rt_position;
for (unsigned int i = 1, count = 0; i < p_v_minmax->size() - 1; )
{
// conditions to have a peak
if ( (v_minmax[i - 1 - count] < v_minmax[i]) &&
(v_minmax[i] > _detection_threshold_on_minmax) &&
(v_maxmin[i] > _detection_threshold_on_maxmin) )
{
// here we test the last condition to have a peak
// no peak case
if (v_minmax[i] < v_minmax[i + 1])
{
++i;
count = 0;
}
// there is a peak here ! case
else if (v_minmax[i] > v_minmax[i + 1])
{
xicPeak * tmp_peak = new xicPeak(quanti_item, p_msrun);
unsigned int begin_peak;
unsigned int end_peak;
findPeakRangeWalkingFromMax(&begin_peak, &end_peak, i, v_minmax);
// integrate peak surface :
for (unsigned int j = begin_peak; j <= end_peak; j++)
{
tmp_peak->add_measure(p_v_rt->at(j), p_v_intensity->at(j));
}
// put peak in the results vector
if (begin_peak == end_peak)
delete tmp_peak;
else
{
result->push_back(tmp_peak);
}
++i;
count = 0;
}
// equality case, skipping equal points
else
{
// while (v_minmax[i] == v_minmax[i + 1]) {
++i, ++count;
}
}
// no chance to have a peak at all, continue looping
else
++i;
} //end loop for peaks
// clean_up
delete p_v_minmax;
delete p_v_maxmin;
delete p_v_rtbis;
return (result);
}
......@@ -65,11 +65,11 @@ class peakDetectionZivy : public peakDetectionBase {
protected:
virtual std::vector<xicPeak *> *
privNewDetectedPeaks(QuantiItemBase quanti_item,
const Msrun * p_msrun,
const std::vector<mcq_double> * p_v_rt,
const std::vector<mcq_double> * p_v_intensity) const;
virtual std::vector<xicPeak *> * privNewDetectedPeaks(
const QuantiItemBase quanti_item,
const Msrun * p_msrun,
const std::vector<mcq_double> * p_v_rt,
const std::vector<mcq_double> * p_v_intensity) const;
private:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment