Mass++ Common Libraries v2.7.5
 All Classes Namespaces Files Functions Variables Enumerations Macros
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
kome::objects::OverlappingSpectrum Class Reference

dummy spectrum class for overlapping draw More...

#include <OverlappingSpectrum.h>

Inheritance diagram for kome::objects::OverlappingSpectrum:
Inheritance graph
[legend]
Collaboration diagram for kome::objects::OverlappingSpectrum:
Collaboration graph
[legend]

Public Member Functions

 OverlappingSpectrum ()
 constructor
 
virtual ~OverlappingSpectrum ()
 destructor
 
void addSpectrum (Spectrum *spec)
 adds spectrum More...
 
void clearSpectra ()
 clears spectra
 
void removeSpectrum (Spectrum *spec)
 removes spectrum More...
 
- Public Member Functions inherited from kome::objects::Spectrum
 Spectrum (Sample *sample, const char *name)
 constructor More...
 
virtual ~Spectrum ()
 destructor
 
void setId (int id)
 sets spectrum id More...
 
int getId ()
 gets spectrum id More...
 
void setOperationFlag (const bool op)
 sets the operation flag value More...
 
bool getOperationFlag ()
 gets the operation flag value More...
 
SamplegetSample ()
 gets the sample that has this spectrum More...
 
void setName (const char *name)
 sets spectrum name More...
 
const char * getName ()
 gets spectrum name More...
 
void setRt (const double rt)
 sets retention time More...
 
void setRt (const double startRt, const double endRt)
 gets retention time More...
 
void setStartRt (const double rt)
 sets start retention time More...
 
void setEndRt (const double rt)
 sets end retention time More...
 
double getRt ()
 gets retention time More...
 
double getStartRt ()
 gets the start of retention time More...
 
double getEndRt ()
 gets the end of retention time More...
 
void setSpecType (const char *type)
 sets spectrum type More...
 
const char * getSpecType ()
 gets spectrum type More...
 
void setTitle (const char *title)
 sets spectrum title More...
 
const char * getTitle ()
 gets spectrum title More...
 
void setIcon (const char *icon)
 sets icon name More...
 
const char * getIcon ()
 gets icon name More...
 
kome::core::XYDatagetXYData ()
 gets xy data from data manager More...
 
void deleteXYData ()
 deletes xy data of data manager
 
void getXYData (kome::core::XYData *const xyData, const bool op)
 gets data points More...
 
void getXYData (kome::core::XYData *const xyData, const double minX, const double maxX, const bool zero)
 gets data points that spectrum has More...
 
void setXRange (const double minX, const double maxX)
 sets x range More...
 
void setMinX (const double minX)
 sets min x More...
 
double getMinX ()
 gets min x More...
 
void setMaxX (const double maxX)
 sets max x More...
 
double getMaxX ()
 gets max x More...
 
void setTotalIntensity (const double intensity)
 sets total intensity of spectrum More...
 
double getTotalIntensity (const double minX=-1.0, const double maxX=-1.0)
 gets total intensity in specified range More...
 
void setMaxIntensity (const double intensity)
 sets max intensity of spectrum More...
 
double getMaxIntensity (const double minX=-1.0, const double maxX=-1.0)
 gets max intensity in specified range More...
 
void setBasePeakMass (const double mass)
 sets base peak mass More...
 
double getBasePeakMass ()
 gets base peak mass More...
 
void setMsStage (const int stage)
 sets ms stage More...
 
int getMsStage ()
 gets ms stage More...
 
void setPrecursor (const int stage, const double precursor)
 sets precursor More...
 
void setPrecursor (const double precursor)
 sets precursor More...
 
double getPrecursor (const int stage)
 gets precursor More...
 
double getPrecursor ()
 gets the precursor mass of precursor ion spectrum. More...
 
void setPrecursorIntensity (const int stage, const double intensity)
 sets precursor intensity More...
 
void setPrecursorIntensity (const double intensity)
 sets precursor intensity More...
 
double getPrecursorIntensity (const int stage)
 gets the precursor intensity More...
 
double getPrecursorIntensity ()
 gets the precursor intensity of the precursor ion spectrum. More...
 
void setPrecursorCharge (const int charge)
 sets the precursor charge More...
 
int getPrecursorCharge ()
 gets the precursor charge More...
 
void setParentSpectrum (Spectrum *const parent)
 sets parent spectrum More...
 
SpectrumgetParentSpectrum ()
 gets parent spectrum More...
 
void getChildSpectra (std::vector< Spectrum * > &children)
 gets child spectra More...
 
void setHasChromatogram (const bool chromatogram)
 sets wheher this spectrum has chromatogram More...
 
bool hasChromatogram ()
 judges whether this spectrum has chromatogram More...
 
void setGroup (DataGroupNode *group)
 sets spectrum group More...
 
DataGroupNodegetGroup ()
 gets spectrum group More...
 
void setScanNumber (const int scan)
 sets scan number More...
 
int getScanNumber ()
 gets scan number More...
 
void setPolarity (Polarity polarity)
 sets polarity More...
 
Polarity getPolarity ()
 gets polarity More...
 
void setCentroidMode (const bool centroidMode)
 sets centroid mode or not More...
 
bool isCentroidMode ()
 judget wheter this spectrum is centroid mode More...
 
void setResolution (const double resolution)
 sets resolution More...
 
double getResolution ()
 gets resolution More...
 
void setCollisionEnergy (const char *collisionEnergy)
 sets the collision energy More...
 
const char * getCollisionEnergy ()
 gets the collision energy More...
 
void setVisible (const bool visible)
 sets the visible flag More...
 
bool isVisible ()
 gets the visible flag value More...
 
void setAutoZeroPoints (const bool autoZero)
 sets auto zero points flag value More...
 
bool isAutoZeroPoints ()
 gets auto zero points flag value More...
 
kome::core::PropertiesgetProperties ()
 gets properties More...
 
kome::core::PropertiesgetUserProperties ()
 gets user properties More...
 
void setOrgSpectrum (Spectrum *spec)
 sets original spectrum More...
 
SpectrumgetOrgSpectrum ()
 gets original spectrum More...
 
void getProperties (kome::core::Properties &properties)
 gets spectrum and spectrum group properties More...
 
void getUserProperties (kome::core::Properties &userProperties)
 gets spectrum and spectrum group user properties More...
 
void setSpotId (const char *pcSpotId)
 set spot id param[in] pcSpotId SpotId information
 
const char * getSpotId (void)
 get spot id More...
 
void setRequestLoadData (void)
 set the flag of request load data More...
 
void resetRequestLoadData (void)
 
bool isRequestLoadData (void)
 check the flag of request load data More...
 
void setFirstAccess (void)
 set the flag of first access
 
void resetFirstAccess (void)
 reset the flag of first access
 
bool isFirstAccess (void)
 check the flag of first access More...
 
bool loadData (void)
 load data More...
 

Protected Member Functions

int searchSpectrum (Spectrum *spec)
 searches spectrum More...
 
virtual void onGetXYData (kome::core::XYData *const xyData, const double minX, const double maxX)
 This method is called by getXYData method. (override method) More...
 
virtual void onGetXRange (double *minX, double *maxX)
 This method is called by getMinX or getMaxX method. (override method) More...
 
virtual double onGetTotalIntensity (const double minX, const double maxX)
 This method is called by getTotalIntensity method. (override method) More...
 
virtual double onGetMaxIntensity (const double minX, const double maxX)
 This method is called by getMaxIntensity method. (override method) More...
 
- Protected Member Functions inherited from kome::objects::Spectrum
virtual void onSetRequestLoadData (void)
 This method is called by setRequestLoadData method. (abstract method)
 
virtual void onResetRequestLoadData (void)
 This method is called by resetRequestLoadData method. (abstract method)
 
virtual bool onIsRequestLoadData (void)
 This method is called by isRequestLoadData method. (abstract method) More...
 
virtual void onSetFirstAccess (void)
 This method is called by setFirstAccess method. (abstract method)
 
virtual void onResetFirstAccess (void)
 This method is called by resetFirstAccess method. (abstract method)
 
virtual bool onIsFirstAccess (void)
 This method is called by isFirstAccess method. (abstract method) More...
 
virtual bool onLoadData (void)
 This method is called by loadData method. (abstract method) More...
 
bool firstAccessProcess (void)
 method for processing when accessing the first item of this class More...
 

Protected Attributes

std::vector< Spectrum * > m_spectra
 
std::vector< double > m_dMinX
 
std::vector< double > m_dMaxX
 
std::vector< double > m_dMinY
 
std::vector< double > m_dMaxY
 
bool * m_bFlags
 
double * m_dInts
 
int m_nAllocLen
 
- Protected Attributes inherited from kome::objects::Spectrum
Spectrumm_orgSpec
 
bool m_op
 
int m_specId
 

Additional Inherited Members

- Public Types inherited from kome::objects::Spectrum
enum  Polarity { POLARITY_UNKNOWN = 0, POLARITY_POSITIVE = 1, POLARITY_NEGATIVE = 2 }
 polarity definition
 
- Static Public Member Functions inherited from kome::objects::Spectrum
static bool isCommonProperty (const char *key)
 check whther the specified property key is common property or not More...
 
- Static Protected Attributes inherited from kome::objects::Spectrum
static std::vector< std::string > m_commonProps
 

Detailed Description

dummy spectrum class for overlapping draw

Definition at line 26 of file OverlappingSpectrum.h.

Member Function Documentation

void kome::objects::OverlappingSpectrum::addSpectrum ( Spectrum spec)

adds spectrum

Parameters
[in]specspectrum object to be added

Definition at line 63 of file OverlappingSpectrum.cpp.

63  {
64  // check the spectrum
65  if( spec == NULL || searchSpectrum( spec ) >= 0 ) {
66  return;
67  }
68 
69  // add
70  m_spectra.push_back( spec );
71 
72  // set group
73  if( m_spectra.size() == 1 ) {
74  setGroup( m_spectra[ 0 ]->getGroup() );
75  }
76  else {
77  setGroup( NULL );
78  }
79 
80  // update range
81  double minX = double();
82  double maxX = double();
83 
84  onGetXRange( &minX, &maxX );
85  setXRange( minX, maxX );
86 }
virtual void onGetXRange(double *minX, double *maxX)
This method is called by getMinX or getMaxX method. (override method)
#define NULL
Definition: CoreMacros.h:18
DataGroupNode * getGroup()
gets spectrum group
Definition: Spectrum.cpp:898
std::vector< Spectrum * > m_spectra
int searchSpectrum(Spectrum *spec)
searches spectrum
void setGroup(DataGroupNode *group)
sets spectrum group
Definition: Spectrum.cpp:893
void setXRange(const double minX, const double maxX)
sets x range
Definition: Spectrum.cpp:443

Here is the call graph for this function:

double kome::objects::OverlappingSpectrum::onGetMaxIntensity ( const double  minX,
const double  maxX 
)
protectedvirtual

This method is called by getMaxIntensity method. (override method)

Parameters
[in]minXminimum x of range (If minX is negative number, minimum x value is unbounded.)
[in]maxXmaximum x of range (If maxX is negative number, maximum x value is unbounded.)
Returns
max intensity

Implements kome::objects::Spectrum.

Definition at line 366 of file OverlappingSpectrum.cpp.

366  {
367  // get data points
369  getXYData( &dps, -1.0, -1.0, false );
370 
371  // get total intensity
372  double intensity = 0.0;
373  for( unsigned int i = 0; i < dps.getLength(); i++ ) {
374  intensity += std::max( dps.getY( i ), intensity );
375  }
376 
377  return intensity;
378 }
data points data of profile management class
Definition: DataPoints.h:25
double getY(const unsigned int index)
gets y coordinate
Definition: XYData.cpp:243
kome::core::XYData * getXYData()
gets xy data from data manager
Definition: Spectrum.cpp:279
unsigned int getLength()
gets the number of points @return the number of points
Definition: XYData.cpp:216

Here is the call graph for this function:

double kome::objects::OverlappingSpectrum::onGetTotalIntensity ( const double  minX,
const double  maxX 
)
protectedvirtual

This method is called by getTotalIntensity method. (override method)

Parameters
[in]minXminimum x of range (If minX is negative number, minimum x value is unbounded.)
[in]maxXmaximum x of range (If maxX is negative number, maximum x value is unbounded.)
Returns
total intensity

Implements kome::objects::Spectrum.

Definition at line 351 of file OverlappingSpectrum.cpp.

351  {
352  // get data points
354  getXYData( &dps, -1.0, -1.0, false );
355 
356  // get total intensity
357  double intensity = 0.0;
358  for( unsigned int i = 0; i < dps.getLength(); i++ ) {
359  intensity += dps.getY( i );
360  }
361 
362  return intensity;
363 }
data points data of profile management class
Definition: DataPoints.h:25
double getY(const unsigned int index)
gets y coordinate
Definition: XYData.cpp:243
kome::core::XYData * getXYData()
gets xy data from data manager
Definition: Spectrum.cpp:279
unsigned int getLength()
gets the number of points @return the number of points
Definition: XYData.cpp:216

Here is the call graph for this function:

void kome::objects::OverlappingSpectrum::onGetXRange ( double *  minX,
double *  maxX 
)
protectedvirtual

This method is called by getMinX or getMaxX method. (override method)

Parameters
[out]minXthe pointer to store minimum x value
[out]maxXthe pointer to store maximum x value

Implements kome::objects::Spectrum.

Definition at line 325 of file OverlappingSpectrum.cpp.

325  {
326  double minXX = -1.0;
327  double maxXX = -1.0;
328 
329  // get x range
330  for( unsigned int i = 0; i < m_spectra.size(); i++ ) {
331  // spectrum
332  Spectrum* spec = m_spectra[ i ];
333 
334  double tmpMinX = spec->getMinX();
335  double tmpMaxX = spec->getMaxX();
336 
337  if( minXX < 0.0 || tmpMinX < minXX ) {
338  minXX = tmpMinX;
339  }
340  if( maxXX < 0.0 || tmpMaxX > maxXX ) {
341  maxXX = tmpMaxX;
342  }
343  }
344 
345  // store
346  *minX = minXX;
347  *maxX = maxXX;
348 }
double getMinX()
gets min x
Definition: Spectrum.cpp:461
double getMaxX()
gets max x
Definition: Spectrum.cpp:489
std::vector< Spectrum * > m_spectra
spectrum information management class
Definition: Spectrum.h:30

Here is the call graph for this function:

void kome::objects::OverlappingSpectrum::onGetXYData ( kome::core::XYData *const  xyData,
const double  minX,
const double  maxX 
)
protectedvirtual

This method is called by getXYData method. (override method)

Parameters
[out]xyDatathe object to store data points
[in]minXminimum x value. (If minX is negative number, minimum x value is not unbounded.)
[in]maxXmaximum x value. (If maxX is negative number, maximum x value is not unbounded.)

Implements kome::objects::Spectrum.

Definition at line 156 of file OverlappingSpectrum.cpp.

160  {
161  // check the member
162  if( m_spectra.size() == 0 ) {
163  return;
164  }
165 
166  // min, max
167  double minMz = 0.0;
168  double maxMz = 0.0;
169 
170  double minInt = 0.0;
171  double maxInt = 0.0;
172 
173  // 登録されているspectrumのなかで、最大・最小をを求めます
174  //
175 
176  // 新規に登録されたspectrumの最大最小値をスタックして、
177  // スタックされている情報から最大最小値を求めます
178  // ※spectrum内の最大最小値を求める時間が省けます
179  //
180  if ( m_spectra.size( ) > m_dMinX.size( ) )
181  {
182  kome::objects::Spectrum* spec = m_spectra[ m_spectra.size( ) - 1 ];
183  // get data points
185  spec->getXYData( &dps, spec->getOperationFlag( ) );
186 
187  double tmpMinX = dps.getMinX( );
188  double tmpMaxX = dps.getMaxX( );
189  double tmpMinY = dps.getMinY( );
190  double tmpMaxY = dps.getMaxY( );
191 
192  m_dMinX.push_back( tmpMinX );
193  m_dMaxX.push_back( tmpMaxX );
194  m_dMinY.push_back( tmpMinY );
195  m_dMaxY.push_back( tmpMaxY );
196  }
197  for( unsigned int i = 0; i < m_spectra.size(); i++ ) {
198  double tmpMinX = m_dMinX[ i ];
199  double tmpMaxX = m_dMaxX[ i ];
200  double tmpMinY = m_dMinY[ i ];
201  double tmpMaxY = m_dMaxY[ i ];
202 
203  if( i == 0 || tmpMinX < minMz ) {
204  minMz = tmpMinX;
205  }
206  if( i == 0 || tmpMaxX > maxMz ) {
207  maxMz = tmpMaxX;
208  }
209  //
210  if( i == 0 || tmpMinY < minInt ) {
211  minInt = tmpMinY;
212  }
213  if( i == 0 || tmpMaxY > maxInt ) {
214  maxInt = tmpMaxY;
215  }
216  }
217 
218  // index
219  const double spacing = 0.2;
220  const int startIdx = std::max( 0, roundnum( minMz / spacing ) );
221  const int endIdx = std::max( 0, roundnum( maxMz / spacing ) );
222 
223  // length
224  const int len = endIdx - startIdx + 1;
225  if( len <= 0 ) {
226  return;
227  }
228 
229  // array
230 // static bool *flags = NULL;
231 // static double *ints = NULL;
232 
233  static int nPrevStartIdx = 0;
234  static int nPrevEndIdx = 0;
235  static double dPrevMinMz = 0.0;
236  static double dPrevMaxMz = 0.0;
237  if ( 0 == m_nAllocLen )
238  {
239  m_bFlags = new bool[ len ];
240  m_dInts = new double[ len ];
241  for ( int i = 0 ; i < len ; i++ )
242  {
243  m_bFlags[ i ] = false;
244  m_dInts[ i ] = 0.0;
245  }
246  m_nAllocLen = len;
247 
248  nPrevStartIdx = startIdx;
249  nPrevEndIdx = endIdx;
250  dPrevMinMz = minMz;
251  dPrevMaxMz = maxMz;
252  }
253  else if ( m_nAllocLen < len )
254  {
255  bool *bFlags = new bool[ len ];
256  double *dInts = new double[ len ];
257 
258  int nStoreMin = roundnum( dPrevMinMz / spacing );
259  nStoreMin = CLAMP( nStoreMin, startIdx, endIdx ) - startIdx;
260  for ( int i = 0 ; i < len ; i++ )
261  {
262  if ( i >= nStoreMin && i < ( nStoreMin + m_nAllocLen ) )
263  {
264  bFlags[i] = m_bFlags[i-nStoreMin];
265  dInts[i] = m_dInts[i-nStoreMin];
266  }
267  else
268  {
269  bFlags[ i ] = false;
270  dInts[ i ] = 0.0;
271  }
272  }
273  delete[] m_dInts;
274  delete[] m_bFlags;
275 
276  m_dInts = dInts;
277  m_bFlags = bFlags;
278  m_nAllocLen = len;
279  dPrevMinMz = minMz;
280  dPrevMaxMz = maxMz;
281  }
282 
283 
284 
285  // fill array
286 //
287 // 全スペクトラムの最大Intensityのデータを抽出しているようです
288 // 拡大したときに範囲内の最大値を求めるのに使用しています
289 //
290 
291  kome::objects::Spectrum* spec = m_spectra[ m_spectra.size( ) - 1 ];
292  // get data points
294  spec->getXYData( &dps, spec->getOperationFlag() );
295 
296  for ( unsigned int j = 0 ; j < dps.getLength( ) ; j++ )
297  {
298  const double x = dps.getX( j );
299  const double y = dps.getY( j );
300 
301  if ( ( minX < 0.0 || x >= minX ) && ( maxX < 0.0 || x <= maxX ) )
302  {
303  int idx = roundnum( x / spacing );
304  idx = CLAMP( idx, startIdx, endIdx ) - startIdx;
305 
306  m_bFlags[ idx ] = true;
307  if ( fabs( y ) > fabs( m_dInts[ idx ] ) )
308  {
309  m_dInts[ idx ] = y;
310  }
311  }
312  }
313  // add array
314  for( int i = 0; i < len; i++ ) {
315  if( m_bFlags[ i ] ) {
316  double x = spacing * ( i + startIdx );
317  double y = m_dInts[ i ];
318 
319  xyData->addPoint( x, y );
320  }
321  }
322 }
data points data of profile management class
Definition: DataPoints.h:25
double getMaxX()
gets maximum x
Definition: XYData.cpp:119
double getX(const unsigned int index)
gets x coordinate
Definition: XYData.cpp:224
double getMinY()
gets minimum y
Definition: XYData.cpp:125
double getY(const unsigned int index)
gets y coordinate
Definition: XYData.cpp:243
int roundnum(const double v)
gets the closest integer to the argument
double getMinX()
gets minimum x
Definition: XYData.cpp:113
kome::core::XYData * getXYData()
gets xy data from data manager
Definition: Spectrum.cpp:279
#define CLAMP(x, low, high)
Definition: CoreMacros.h:35
std::vector< Spectrum * > m_spectra
spectrum information management class
Definition: Spectrum.h:30
void addPoint(const double x, const double y)
adds point
Definition: XYData.cpp:149
double getMaxY()
gets maximum y
Definition: XYData.cpp:131
bool getOperationFlag()
gets the operation flag value
Definition: Spectrum.h:202
unsigned int getLength()
gets the number of points @return the number of points
Definition: XYData.cpp:216

Here is the call graph for this function:

void kome::objects::OverlappingSpectrum::removeSpectrum ( Spectrum spec)

removes spectrum

Parameters
[in]specspectrum object to be removed

Definition at line 89 of file OverlappingSpectrum.cpp.

89  {
90  // search
91  int idx = searchSpectrum( spec );
92  if( idx < 0 ) {
93  return;
94  }
95 
96  // remove
97  m_spectra.erase( m_spectra.begin() + idx );
98 
99  // set group
100  if( m_spectra.size() == 1 ) {
101  setGroup( m_spectra[ 0 ]->getGroup() );
102  }
103  else {
104  setGroup( NULL );
105  }
106 
107  // update range
108  double minX = double();
109  double maxX = double();
110 
111  onGetXRange( &minX, &maxX );
112  setXRange( minX, maxX );
113 }
virtual void onGetXRange(double *minX, double *maxX)
This method is called by getMinX or getMaxX method. (override method)
#define NULL
Definition: CoreMacros.h:18
DataGroupNode * getGroup()
gets spectrum group
Definition: Spectrum.cpp:898
std::vector< Spectrum * > m_spectra
int searchSpectrum(Spectrum *spec)
searches spectrum
void setGroup(DataGroupNode *group)
sets spectrum group
Definition: Spectrum.cpp:893
void setXRange(const double minX, const double maxX)
sets x range
Definition: Spectrum.cpp:443

Here is the call graph for this function:

int kome::objects::OverlappingSpectrum::searchSpectrum ( Spectrum spec)
protected

searches spectrum

Parameters
[in]specspectrum object to be searched
Returns
spectrum index (If negative value, specified spectrum is not found.)

Definition at line 145 of file OverlappingSpectrum.cpp.

145  {
146  // search
147  for( int i = 0; i < (int)m_spectra.size(); i++ ) {
148  if( spec == m_spectra[ i ] ) {
149  return i;
150  }
151  }
152  return -1;
153 }
std::vector< Spectrum * > m_spectra

Member Data Documentation

std::vector< double > kome::objects::OverlappingSpectrum::m_dMaxX
protected

maximum value of Y

Definition at line 47 of file OverlappingSpectrum.h.

std::vector< double > kome::objects::OverlappingSpectrum::m_dMaxY
protected

maximum value of Y

Definition at line 51 of file OverlappingSpectrum.h.

std::vector< double > kome::objects::OverlappingSpectrum::m_dMinX
protected

minimum value of X

Definition at line 45 of file OverlappingSpectrum.h.

std::vector< double > kome::objects::OverlappingSpectrum::m_dMinY
protected

minimum value of Y

Definition at line 49 of file OverlappingSpectrum.h.

std::vector< Spectrum* > kome::objects::OverlappingSpectrum::m_spectra
protected

spectra

Definition at line 42 of file OverlappingSpectrum.h.


The documentation for this class was generated from the following files: