Mass++ Common Libraries v2.7.5
 All Classes Namespaces Files Functions Variables Enumerations Macros
ManipulatedSpectrum.cpp
Go to the documentation of this file.
1 
11 #include "stdafx.h"
12 #include "ManipulatedSample.h"
13 #include "ManipulatedSpectrum.h"
14 
15 using namespace kome::operation;
16 
17 
18 #include <crtdbg.h>
19 #ifdef _DEBUG
20  #define new new( _NORMAL_BLOCK, __FILE__, __LINE__ )
21  #define malloc( s ) _malloc_dbg( s, _NORMAL_BLOCK, __FILE__, __LINE__ )
22 #endif // _DEBUG
23 
24 
25 // constructor
27  : kome::objects::Spectrum( org.getSample(), org.getName() ), m_org( org ){
28  m_op = op;
29 
30  setName( org.getName() );
31  setRt( org.getRt() );
32  setStartRt( org.getStartRt() );
33  setEndRt( org.getEndRt() );
34  setSpecType( org.getSpecType() );
35  setTitle( org.getTitle() );
36  setIcon( org.getIcon() );
37  setMinX( org.getMinX() );
38  setMaxX( org.getMaxX() );
41  setMsStage( org.getMsStage() );
42  setPrecursor( org.getPrecursor() );
46  setGroup( org.getGroup() );
48  setPolarity( org.getPolarity() );
52 
53  m_sample = sample;
54 }
55 
56 // destructor
58 }
59 
60 // on get xy data
62  kome::core::XYData* const xyData,
63  const double minX,
64  const double maxX
65 ){
66  // manipulate
67  ManipulatedSample* sample = getSample();
68 
69  // operaiton list
70  std::vector< kome::objects::XYDataOperation* > operations;
71  if( sample != NULL ) {
72  for( unsigned int i = 0; i < sample->getNumberOfOperation(); i++ ) {
73  operations.push_back( sample->getOperation( i ) );
74  }
75  }
76 
77  // points
78  if( operations.size() == 0 ) {
79  m_org.getXYData( xyData, minX, maxX, false );
80  }
81  else {
83  m_org.getXYData( &dps, -1.0, -1.0, false );
84 
85  for( unsigned int i = 0; i < operations.size(); i++ ) {
86  kome::objects::XYDataOperation* opt = operations[ i ];
87 
89  opt->update( dps, tmp, *this );
90 
91  dps.clearPoints();
92  for( unsigned int i = 0; i < tmp.getLength(); i++ ) {
93  dps.addPoint( tmp.getX( i ), tmp.getY( i ) );
94  }
95  }
96 
97  // copy
98  for( unsigned int i = 0; i < dps.getLength(); i++ ) {
99  const double x = dps.getX( i );
100  const double y = dps.getY( i );
101  if( ( minX < 0.0 || x >= minX ) && ( maxX < 0.0 || x <= maxX ) ) {
102  xyData->addPoint( x, y );
103  }
104  }
105  }
106 }
107 
108 // on get XRange
109 void ManipulatedSpectrum::onGetXRange( double* minX, double* maxX ){
110 }
111 
112 // on get total Intensity
113 double ManipulatedSpectrum::onGetTotalIntensity( const double minX, const double maxX ){
114  // get data points
116  onGetXYData( &pt, minX, maxX );
117 
118  // get total intensity
119  double intensity = 0.0;
120  for( unsigned int i = 0; i < pt.getLength(); i++ ) {
121  intensity += pt.getY( i );
122  }
123 
124  return intensity;
125 }
126 
127 // on GetTotalIntensity
128 double ManipulatedSpectrum::onGetMaxIntensity( const double minX, const double maxX ){
129  // get data points
131  onGetXYData( &pt, minX, maxX );
132 
133  // get main intensity
134  double intensity = 0.0;
135  for( unsigned int i = 0; i < pt.getLength(); i++ ) {
136  double y = pt.getY( i );
137  intensity = MAX( y, intensity );
138  }
139 
140  return intensity;
141 }
142 
143 // >>>>>> @Date:2013/09/02 <Add> A.Ozaki
144 //
145 // set the flag of request load data (virtual)
147 {
148  return;
149 }
150 
151 // set the flag of request load data (virtual)
153 {
154  return;
155 }
156 
157 // check the flag of request load data (virtual)
159 {
161 }
162 
163 // set the flag of first access (virtual)
165 {
166  return;
167 }
168 
169 // reset the flag of first access (virtual)
171 {
172  return;
173 }
174 
175 // check the flag of first access (virtual)
177 {
179 }
180 
181 // load data (virtual)
183 {
185 }
186 
187 //
188 // <<<<<< @Date:2013/09/02 <Add> A.Ozaki
double getStartRt()
gets the start of retention time
Definition: Spectrum.cpp:191
abstraction class of two dimention coordinate data
Definition: XYData.h:34
void setTotalIntensity(const double intensity)
sets total intensity of spectrum
Definition: Spectrum.cpp:505
unsigned int getNumberOfOperation()
get number of operation
virtual bool onIsFirstAccess(void)
This method is called by isFirstAccess method. (abstract method)
Definition: Spectrum.cpp:1240
data points data of profile management class
Definition: DataPoints.h:25
double getPrecursor(const int stage)
gets precursor
Definition: Spectrum.cpp:683
virtual void onGetXRange(double *minX, double *maxX)
This method is called by getMinX or getMaxX method. (override method)
virtual bool onLoadData(void)
This method is called by loadData method. (abstract method)
ManipulatedSpectrum(ManipulatedSample *sample, kome::objects::Spectrum &org, const bool op=false)
constructor
double getRt()
gets retention time
Definition: Spectrum.cpp:184
double getX(const unsigned int index)
gets x coordinate
Definition: XYData.cpp:224
virtual void onSetFirstAccess(void)
This method is called by setFirstAccess method. (abstract method)
void setMinX(const double minX)
sets min x
Definition: Spectrum.cpp:449
const char * getName()
gets spectrum name
Definition: Spectrum.cpp:123
virtual void onResetFirstAccess(void)
This method is called by resetFirstAccess method. (abstract method)
void setRt(const double rt)
sets retention time
Definition: Spectrum.cpp:129
void setPrecursor(const int stage, const double precursor)
sets precursor
Definition: Spectrum.cpp:640
void setPolarity(Polarity polarity)
sets polarity
Definition: Spectrum.cpp:920
void setPrecursorIntensity(const int stage, const double intensity)
sets precursor intensity
Definition: Spectrum.cpp:702
void setMaxX(const double maxX)
sets max x
Definition: Spectrum.cpp:477
const char * getIcon()
gets icon name
Definition: Spectrum.cpp:273
void clearPoints()
clear all data points
Definition: XYData.cpp:137
void setIcon(const char *icon)
sets icon name
Definition: Spectrum.cpp:268
void setEndRt(const double rt)
sets end retention time
Definition: Spectrum.cpp:172
void setName(const char *name)
sets spectrum name
Definition: Spectrum.cpp:113
void setParentSpectrum(Spectrum *const parent)
sets parent spectrum
Definition: Spectrum.cpp:821
void setCentroidMode(const bool centroidMode)
sets centroid mode or not
Definition: Spectrum.cpp:935
double getY(const unsigned int index)
gets y coordinate
Definition: XYData.cpp:243
void update(kome::core::XYData &src, kome::core::XYData &dst, Chromatogram &chrom)
updates xy data
Spectrum * getOrgSpectrum()
gets original spectrum
Definition: Spectrum.cpp:1003
virtual void onResetRequestLoadData(void)
This method is called by resetRequestLoadData method. (abstract method)
double getResolution()
gets resolution
Definition: Spectrum.cpp:952
double getMinX()
gets min x
Definition: Spectrum.cpp:461
int getMsStage()
gets ms stage
Definition: Spectrum.cpp:634
double getMaxX()
gets max x
Definition: Spectrum.cpp:489
Manipulated Spectrum class.
void setHasChromatogram(const bool chromatogram)
sets wheher this spectrum has chromatogram
Definition: Spectrum.cpp:883
int getScanNumber()
gets scan number
Definition: Spectrum.cpp:915
#define NULL
Definition: CoreMacros.h:18
double getTotalIntensity(const double minX=-1.0, const double maxX=-1.0)
gets total intensity in specified range
Definition: Spectrum.cpp:516
virtual bool onIsRequestLoadData(void)
This method is called by isRequestLoadData method. (abstract method)
Definition: Spectrum.cpp:1222
kome::core::XYData * getXYData()
gets xy data from data manager
Definition: Spectrum.cpp:279
ManipulatedSample * getSample()
get sample object
#define MAX(x, y)
Definition: CoreMacros.h:27
virtual bool onLoadData(void)
This method is called by loadData method. (abstract method)
Definition: Spectrum.cpp:1246
void setMsStage(const int stage)
sets ms stage
Definition: Spectrum.cpp:587
DataGroupNode * getGroup()
gets spectrum group
Definition: Spectrum.cpp:898
void setStartRt(const double rt)
sets start retention time
Definition: Spectrum.cpp:160
void setScanNumber(const int scan)
sets scan number
Definition: Spectrum.cpp:903
void setBasePeakMass(const double mass)
sets base peak mass
Definition: Spectrum.cpp:569
const char * getTitle()
gets spectrum title
Definition: Spectrum.cpp:222
virtual void onSetRequestLoadData(void)
This method is called by setRequestLoadData method. (abstract method)
virtual double onGetMaxIntensity(const double minX, const double maxX)
This method is called by getMaxIntensity method. (override method)
void setOrgSpectrum(Spectrum *spec)
sets original spectrum
Definition: Spectrum.cpp:998
Spectrum * getParentSpectrum()
gets parent spectrum
Definition: Spectrum.cpp:850
spectrum information management class
Definition: Spectrum.h:30
virtual bool onIsFirstAccess(void)
This method is called by isFirstAccess method. (abstract method)
virtual bool onIsRequestLoadData(void)
This method is called by isRequestLoadData method. (abstract method)
double getEndRt()
gets the end of retention time
Definition: Spectrum.cpp:197
void addPoint(const double x, const double y)
adds point
Definition: XYData.cpp:149
void setSpecType(const char *type)
sets spectrum type
Definition: Spectrum.cpp:203
virtual double onGetTotalIntensity(const double minX, const double maxX)
This method is called by getTotalIntensity method. (override method)
const char * getSpecType()
gets spectrum type
Definition: Spectrum.cpp:209
virtual void onGetXYData(kome::core::XYData *const xyData, const double minX, const double maxX)
This method is called by getXYData method. (override method)
double getPrecursorIntensity(const int stage)
gets the precursor intensity
Definition: Spectrum.cpp:749
void setGroup(DataGroupNode *group)
sets spectrum group
Definition: Spectrum.cpp:893
Manipulated Sample class.
void setTitle(const char *title)
sets spectrum title
Definition: Spectrum.cpp:215
xy data operation class
bool isCentroidMode()
judget wheter this spectrum is centroid mode
Definition: Spectrum.cpp:941
void setResolution(const double resolution)
sets resolution
Definition: Spectrum.cpp:946
Polarity getPolarity()
gets polarity
Definition: Spectrum.cpp:930
kome::objects::XYDataOperation * getOperation(int index)
get operation
double getBasePeakMass()
gets base peak mass
Definition: Spectrum.cpp:581
unsigned int getLength()
gets the number of points @return the number of points
Definition: XYData.cpp:216
bool hasChromatogram()
judges whether this spectrum has chromatogram
Definition: Spectrum.cpp:888