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::OverlappingChromatogram Class Reference

dummy chromatogram class for overlapping draw More...

#include <OverlappingChromatogram.h>

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

Public Member Functions

 OverlappingChromatogram ()
 constructor
 
virtual ~OverlappingChromatogram ()
 destructor
 
void clearChromatograms ()
 clears chromatograms
 
void addChromatogram (Chromatogram *chrom)
 adds chromatogram More...
 
void removeChromatogram (Chromatogram *chrom)
 removes chromatogram More...
 
void update ()
 updates canvas
 
- Public Member Functions inherited from kome::objects::Chromatogram
 Chromatogram (Sample *sample)
 constructor More...
 
virtual ~Chromatogram ()
 destructor
 
void setOperationFlag (const bool op)
 sets the operation flag value More...
 
bool getOperationFlag ()
 gets the operation flag value More...
 
void setId (int id)
 sets chromatogram id More...
 
int getId ()
 gets chromatogram id More...
 
SamplegetSample ()
 gets sample More...
 
void setName (const char *name)
 sets chromatogram name More...
 
const char * getName ()
 gets chromatogram name More...
 
void setMz (const double mz)
 sets m/z More...
 
double getMz ()
 gets m/z More...
 
void setGroup (DataGroupNode *group)
 sets spectrum group More...
 
DataGroupNodegetGroup ()
 gets spectrum group More...
 
void setIcon (const char *icon)
 sets icon name More...
 
const char * getIcon ()
 gets icon name More...
 
void setTitle (const char *title)
 sets title More...
 
const char * getTitle ()
 gets title More...
 
kome::core::PropertiesgetProperties ()
 gets properties More...
 
kome::core::PropertiesgetUserProperties ()
 gets user properties More...
 
void setAutoCreated (const bool autoCreated=true)
 sets auto created flag More...
 
bool isAutoCreated ()
 gets auto created flag value More...
 
void setVisible (const bool visible)
 sets the visible flag More...
 
bool isVisible ()
 gets the visible flag value More...
 
void setOrgChromatogram (Chromatogram *chrom)
 sets original chromatogram More...
 
ChromatogramgetOrgChromatogram ()
 gets original chromatogram More...
 
void setQ1 (const double q1)
 sets the Q1 Mass More...
 
double getQ1 ()
 gets the Q1 Mass More...
 
void setQ3 (const double q3)
 sets the Q3 Mass More...
 
double getQ3 ()
 gets the Q3 Mass 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 chromatogram data points More...
 
SpectrumsearchSpectrum (const double rt, const SearchType search=SEARCH_NEAR)
 searches spectrum More...
 
void getSpectra (DataSet &dataSet, const double startRt, const double endRt, const SearchType startSearch=SEARCH_NEAR, const SearchType endSearch=SEARCH_NEAR)
 get spectra in specified RT range More...
 
double getMass (const unsigned int index)
 gets mass More...
 
int getMsStage (const unsigned int index)
 gets MS stage More...
 
double getPrecursor (const unsigned int index)
 gets precursor mass More...
 
void getProperties (kome::core::Properties &properties)
 gets spectrum and spectrum group properties More...
 
void getUserProperties (kome::core::Properties &userProperties)
 gets chromatogram and chromatogram group user properties More...
 

Protected Member Functions

int searchChromatogram (Chromatogram *chrom)
 searches chromatogram More...
 
virtual void onGetXYData (kome::core::XYData *const xyData)
 gets chromatogram data points (override method) More...
 
virtual void onGetSpectra (DataSet &dataSet, const double startRt, const double endRt, const SearchType startSearch, const SearchType endSearch)
 This method is called by searchSpectrum or getSpectra method (override method) More...
 
virtual double onGetMass (const unsigned int index)
 This method is called by getMass method (override method) More...
 
virtual int onGetMsStage (const unsigned int index)
 This method is called by getMsStage method (override method) More...
 
virtual double onGetPrecursor (const unsigned int index)
 This method is called by getPrecursor method (override method) More...
 

Protected Attributes

std::vector< Chromatogram * > m_chroms
 
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::Chromatogram
Samplem_sample
 
DataGroupNodem_group
 
std::string m_name
 
double m_mz
 
std::string m_icon
 
std::string m_title
 
kome::core::Properties m_props
 
kome::core::Properties m_userProps
 
bool m_autoCreated
 
bool m_visible
 
Chromatogramm_orgChrom
 
bool m_op
 
int m_chromId
 
double m_q1
 
double m_q3
 

Additional Inherited Members

- Static Public Member Functions inherited from kome::objects::Chromatogram
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::Chromatogram
static std::vector< std::string > m_commonProps
 

Detailed Description

dummy chromatogram class for overlapping draw

Definition at line 28 of file OverlappingChromatogram.h.

Member Function Documentation

void kome::objects::OverlappingChromatogram::addChromatogram ( Chromatogram chrom)

adds chromatogram

Parameters
[in]chromchromatogram object to be added

Definition at line 54 of file OverlappingChromatogram.cpp.

54  {
55  // check the chromatogram
56  if( chrom == NULL || searchChromatogram( chrom ) >= 0 ) {
57  return;
58  }
59 
60  // add
61  m_chroms.push_back( chrom );
62 
63  // set group
64  if( m_chroms.size() == 1 ) {
65  setGroup( m_chroms[ 0 ]->getGroup() );
66  }
67  else {
68  setGroup( NULL );
69  }
70 }
void setGroup(DataGroupNode *group)
sets spectrum group
DataGroupNode * getGroup()
gets spectrum group
#define NULL
Definition: CoreMacros.h:18
int searchChromatogram(Chromatogram *chrom)
searches chromatogram

Here is the call graph for this function:

double kome::objects::OverlappingChromatogram::onGetMass ( const unsigned int  index)
protectedvirtual

This method is called by getMass method (override method)

Parameters
[in]indexdata index
Returns
mass

Implements kome::objects::Chromatogram.

Definition at line 267 of file OverlappingChromatogram.cpp.

267  {
268  return -1.0;
269 }
int kome::objects::OverlappingChromatogram::onGetMsStage ( const unsigned int  index)
protectedvirtual

This method is called by getMsStage method (override method)

Parameters
[in]indexdata index
Returns
MS stage.

Implements kome::objects::Chromatogram.

Definition at line 272 of file OverlappingChromatogram.cpp.

272  {
273  return -1;
274 }
double kome::objects::OverlappingChromatogram::onGetPrecursor ( const unsigned int  index)
protectedvirtual

This method is called by getPrecursor method (override method)

Parameters
[in]indexdata index
Returns
precursor mass

Implements kome::objects::Chromatogram.

Definition at line 277 of file OverlappingChromatogram.cpp.

277  {
278  return -1.0;
279 }
void kome::objects::OverlappingChromatogram::onGetSpectra ( DataSet dataSet,
const double  startRt,
const double  endRt,
const SearchType  startSearch,
const SearchType  endSearch 
)
protectedvirtual

This method is called by searchSpectrum or getSpectra method (override method)

Parameters
[out]dataSetdata set object to store spectra
[in]startRtstart RT
[in]endRtend RT
[in]startSearchstart search type
[in]endSearchend search type

Implements kome::objects::Chromatogram.

Definition at line 251 of file OverlappingChromatogram.cpp.

257  {
258  // chromatograms
259  if( m_chroms.size() == 1 ) {
260  Chromatogram* chrom = m_chroms[ 0 ];
261 
262  chrom->getSpectra( dataSet, startRt, endRt, startSearch, endSearch );
263  }
264 }
void getSpectra(DataSet &dataSet, const double startRt, const double endRt, const SearchType startSearch=SEARCH_NEAR, const SearchType endSearch=SEARCH_NEAR)
get spectra in specified RT range
chromatogram information management class
Definition: Chromatogram.h:33

Here is the call graph for this function:

void kome::objects::OverlappingChromatogram::onGetXYData ( kome::core::XYData *const  xyData)
protectedvirtual

gets chromatogram data points (override method)

Parameters
[out]xyDataobject to store data points

Implements kome::objects::Chromatogram.

Definition at line 127 of file OverlappingChromatogram.cpp.

127  {
128  // check the member
129  if( m_chroms.size() == 0 ) {
130  return;
131  }
132 
133  // min, max
134  double minX = 0.0;
135  double maxX = 0.0;
136 
137 #if 0
138  for( unsigned int i = 0; i < m_chroms.size(); i++ ) {
139 
141  // get data points
143  chrom->getXYData( &dps, chrom->getOperationFlag() );
144 
145  double tmpMinX = dps.getMinX();
146  double tmpMaxX = dps.getMaxX();
147 
148  if( i == 0 || tmpMinX < minX ) {
149  minX = tmpMinX;
150  }
151 
152  if( i == 0 || tmpMaxX > maxX ) {
153  maxX = tmpMaxX;
154  }
155  }
156 #else
157  // 新規に登録されたchromatogramの最大最小値をスタックして、
158  // スタックされている情報から最大最小値を求めます
159  // ※chromatogram内の最大最小値を求める時間が省けます
160  //
161  if ( m_chroms.size() > m_dMinX.size() )
162  {
163  kome::objects::Chromatogram* chrom = m_chroms[ m_chroms.size() - 1 ];
164  // get data points
166  chrom->getXYData( &dps, chrom->getOperationFlag() );
167 
168  double tmpMinX = dps.getMinX();
169  double tmpMaxX = dps.getMaxX();
170  double tmpMinY = dps.getMinY();
171  double tmpMaxY = dps.getMaxY();
172 
173  m_dMinX.push_back( tmpMinX );
174  m_dMaxX.push_back( tmpMaxX );
175  m_dMinY.push_back( tmpMinY );
176  m_dMaxY.push_back( tmpMaxY );
177  }
178 
179  for( unsigned int i = 0; i < m_chroms.size(); i++ ) {
180  double tmpMinX = m_dMinX[ i ];
181  double tmpMaxX = m_dMaxX[ i ];
182  double tmpMinY = m_dMinY[ i ];
183  double tmpMaxY = m_dMaxY[ i ];
184 
185  if( i == 0 || tmpMinX < minX ) {
186  minX = tmpMinX;
187  }
188  if( i == 0 || tmpMaxX > maxX ) {
189  maxX = tmpMaxX;
190  }
191  }
192 #endif
193 
194  // index
195  const double spacing = 0.2;
196  const int startIdx = std::max( 0, roundnum( minX / spacing ) );
197  const int endIdx = std::max( 0, roundnum( maxX / spacing ) );
198 
199  // length
200  const int len = endIdx - startIdx + 1;
201  if( len <= 0 ) {
202  return;
203  }
204 
205  // array
206  bool* flags = new bool[ len ];
207  double* ints = new double[ len ];
208 
209  for( int i = 0; i < len; i++ ) {
210  flags[ i ] = false;
211  ints[ i ] = 0.0;
212  }
213 
214  // fill array
215  for( unsigned int i = 0; i < m_chroms.size(); i++ ) {
217  // get data points
219  chrom->getXYData( &dps, chrom->getOperationFlag() );
220 
221  for( unsigned int j = 0; j < dps.getLength(); j++ ){
222 
223  const double x = dps.getX( j );
224  const double y = dps.getY( j );
225 
226  int idx = roundnum( x / spacing );
227  idx = CLAMP( idx, startIdx, endIdx ) - startIdx;
228 
229  flags[ idx ] = true;
230  if( fabs( y ) > fabs( ints[ idx ] ) ) {
231  ints[ idx ] = y;
232  }
233  }
234  }
235 
236  // add array
237  for( int i = 0; i < len; i++ ) {
238  if( flags[ i ] ) {
239  double x = spacing * ( i + startIdx );
240  double y = ints[ i ];
241 
242  xyData->addPoint( x, y );
243  }
244  }
245 
246  delete[] ints;
247  delete[] flags;
248 }
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
kome::core::XYData * getXYData()
gets xy data from data manager
double getMinX()
gets minimum x
Definition: XYData.cpp:113
#define CLAMP(x, low, high)
Definition: CoreMacros.h:35
bool getOperationFlag()
gets the operation flag value
Definition: Chromatogram.h:111
void addPoint(const double x, const double y)
adds point
Definition: XYData.cpp:149
chromatogram information management class
Definition: Chromatogram.h:33
double getMaxY()
gets maximum y
Definition: XYData.cpp:131
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::OverlappingChromatogram::removeChromatogram ( Chromatogram chrom)

removes chromatogram

Parameters
[in]chromchromatogram object to be removed

Definition at line 96 of file OverlappingChromatogram.cpp.

96  {
97  // search
98  int idx = searchChromatogram( chrom );
99  if( idx < 0 ) {
100  return;
101  }
102 
103  // remove
104  m_chroms.erase( m_chroms.begin() + idx );
105 
106  // set group
107  if( m_chroms.size() == 1 ) {
108  setGroup( m_chroms[ 0 ]->getGroup() );
109  }
110  else {
111  setGroup( NULL );
112  }
113 }
void setGroup(DataGroupNode *group)
sets spectrum group
DataGroupNode * getGroup()
gets spectrum group
#define NULL
Definition: CoreMacros.h:18
int searchChromatogram(Chromatogram *chrom)
searches chromatogram

Here is the call graph for this function:

int kome::objects::OverlappingChromatogram::searchChromatogram ( Chromatogram chrom)
protected

searches chromatogram

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

Definition at line 116 of file OverlappingChromatogram.cpp.

116  {
117  // search
118  for( int i = 0; i < (int)m_chroms.size(); i++ ) {
119  if( chrom == m_chroms[ i ] ) {
120  return i;
121  }
122  }
123  return -1;
124 }

Member Data Documentation

std::vector< Chromatogram* > kome::objects::OverlappingChromatogram::m_chroms
protected

chromatograms

Definition at line 44 of file OverlappingChromatogram.h.

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

maximum value of Y

Definition at line 49 of file OverlappingChromatogram.h.

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

maximum value of Y

Definition at line 53 of file OverlappingChromatogram.h.

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

minimum value of X

Definition at line 47 of file OverlappingChromatogram.h.

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

minimum value of Y

Definition at line 51 of file OverlappingChromatogram.h.


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