Mass++ Common Libraries v2.7.5
 All Classes Namespaces Files Functions Variables Enumerations Macros
TransformedChromatogram.cpp
Go to the documentation of this file.
1 
12 #include "stdafx.h"
14 
15 
16 using namespace kome::operation;
17 
18 
19 #include <crtdbg.h>
20 #ifdef _DEBUG
21  #define new new( _NORMAL_BLOCK, __FILE__, __LINE__ )
22  #define malloc( s ) _malloc_dbg( s, _NORMAL_BLOCK, __FILE__, __LINE__ )
23 #endif // _DEBUG
24 
25 
26 
27 // constructor
29  : kome::objects::Chromatogram( org.getSample() ), m_org( org ) {
30  m_scX = 1.0;
31  m_trX = 0.0;
32  m_scY = 1.0;
33  m_trY = 0.0;
34  m_op = op;
35 
36  setName( org.getName() );
37  setMz( org.getMz() );
38  setGroup( org.getGroup() );
39  setIcon( org.getIcon() );
40  setTitle( org.getTitle() );
43  setQ1( org.getQ1() );
44  setQ3( org.getQ3() );
45 }
46 
47 // destructor
49 }
50 
51 // set x scale
52 void TransformedChromatogram::setXScale( const double sc ) {
53  m_scX = std::max( sc, 1.0e-10 );
54 }
55 
56 // get x scale
58  return m_scX;
59 }
60 
61 // set x translation
63  m_trX = tr;
64 }
65 
66 // get x translation
68  return m_trX;
69 }
70 
71 // set y scale
72 void TransformedChromatogram::setYScale( const double sc ) {
73  m_scY = std::max( sc, 1.0e-10 );
74 }
75 
76 // get y scale
78  return m_scY;
79 }
80 
81 // set y translation
83  m_trY = tr;
84 }
85 
86 // get y translation
88  return m_trY;
89 }
90 
91 // on get xy data
93  // get original data
95  m_org.getXYData( &dps, m_op );
96 
97  // add to data
98  xyData->reserve( dps.getLength() );
99  for( unsigned int i = 0; i < dps.getLength(); i++ ) {
100  double x = m_scX * dps.getX( i ) + m_trX;
101  double y = m_scY * dps.getY( i ) + m_trY;
102 
103  xyData->addPoint( x, y );
104  }
105 }
106 
107 // on get spectra
109  kome::objects::DataSet& spectra,
110  const double startRt,
111  const double endRt,
112  const kome::objects::SearchType startSearch,
113  const kome::objects::SearchType endSearch
114 ) {
115  // rt range
116  double orgStartRt = ( startRt - m_trX ) / m_scX;
117  double orgEndRt = ( endRt - m_trX ) / m_scX;
118 
119  // get spectra
120  m_org.getSpectra( spectra, orgStartRt, orgEndRt, startSearch, endSearch );
121 }
122 
123 // on get mass
124 double TransformedChromatogram::onGetMass( const unsigned int index ) {
125  return m_org.getMass( index );
126 }
127 
128 // get get MS stage
129 int TransformedChromatogram::onGetMsStage( const unsigned int index ) {
130  return m_org.getMsStage( index );
131 }
132 
133 // on get precursor
134 double TransformedChromatogram::onGetPrecursor( const unsigned int index ) {
135  return m_org.getPrecursor( index );
136 }
abstraction class of two dimention coordinate data
Definition: XYData.h:34
double getQ3()
gets the Q3 Mass
data points data of profile management class
Definition: DataPoints.h:25
virtual double onGetPrecursor(const unsigned int index)
This method is called by getPrecursor method (override method)
void setXTranslation(const double tr)
sets x translation
void setXScale(const double sc)
sets x scale
double getX(const unsigned int index)
gets x coordinate
Definition: XYData.cpp:224
void setQ1(const double q1)
sets the Q1 Mass
void setGroup(DataGroupNode *group)
sets spectrum group
void setYScale(const double sc)
sets y scale
virtual double onGetMass(const unsigned int index)
This method is called by getMass method (override method)
void setMz(const double mz)
sets m/z
void setOrgChromatogram(Chromatogram *chrom)
sets original chromatogram
DataGroupNode * getGroup()
gets spectrum group
virtual int onGetMsStage(const unsigned int index)
This method is called by getMsStage method (override method)
const char * getIcon()
gets icon name
double getY(const unsigned int index)
gets y coordinate
Definition: XYData.cpp:243
void setIcon(const char *icon)
sets icon name
void setName(const char *name)
sets chromatogram name
void setAutoCreated(const bool autoCreated=true)
sets auto created flag
kome::core::XYData * getXYData()
gets xy data from data manager
virtual void onGetSpectra(kome::objects::DataSet &spectra, const double startRt, const double endRt, const kome::objects::SearchType startSearch, const kome::objects::SearchType endSearch)
This method is called by searchSpectrum or getDataSet method (overriede method)
int getMsStage(const unsigned int index)
gets MS stage
void setQ3(const double q3)
sets the Q3 Mass
double getQ1()
gets the Q1 Mass
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
virtual void onGetXYData(kome::core::XYData *const xyData)
This method is called by getXYData method (override method)
SearchType
search type
void setTitle(const char *title)
sets title
void reserve(const unsigned int num)
reserves enough contiguous memory of array
Definition: XYData.cpp:262
bool isAutoCreated()
gets auto created flag value
double getPrecursor(const unsigned int index)
gets precursor mass
interfaces of TransformedChromatogram class
Chromatogram * getOrgChromatogram()
gets original chromatogram
const char * getName()
gets chromatogram name
one or more spectra management class
Definition: DataSet.h:31
void addPoint(const double x, const double y)
adds point
Definition: XYData.cpp:149
const char * getTitle()
gets title
TransformedChromatogram(kome::objects::Chromatogram &org, const bool op=false)
constructor
void setYTranslation(const double tr)
sets y translation
chromatogram information management class
Definition: Chromatogram.h:33
double getMass(const unsigned int index)
gets mass
unsigned int getLength()
gets the number of points @return the number of points
Definition: XYData.cpp:216