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::operation::BaselineSubtract Class Reference

baseline subtract class More...

#include <BaselineSubtract.h>

Inheritance diagram for kome::operation::BaselineSubtract:
Inheritance graph
[legend]
Collaboration diagram for kome::operation::BaselineSubtract:
Collaboration graph
[legend]

Public Member Functions

 BaselineSubtract ()
 constructor
 
virtual ~BaselineSubtract ()
 destructor
 
void setBaselineInfo (kome::plugin::PluginCall *func, kome::objects::SettingParameterValues *settings)
 sets baseline information More...
 
- Public Member Functions inherited from kome::objects::XYDataOperation
 XYDataOperation ()
 constructor
 
virtual ~XYDataOperation ()
 destructor
 
void setName (const char *name)
 sets name More...
 
const char * getName ()
 gets name More...
 
void setIndex (int index)
 set index More...
 
int getIndex ()
 get index More...
 
void update (kome::core::XYData &src, kome::core::XYData &dst, Chromatogram &chrom)
 updates xy data More...
 
void update (kome::core::XYData &src, kome::core::XYData &dst, Spectrum &spec)
 updates xy data More...
 
void update (kome::core::XYData &src, kome::core::XYData &dst, Sample &sample)
 updates xy data More...
 

Protected Member Functions

void init ()
 initializes
 
void subtractBaseline (kome::core::XYData &src, kome::core::XYData &dst, kome::core::XYData &baseline)
 subtracts baseline More...
 
virtual void getUpdatedData (kome::core::XYData &src, kome::core::XYData &dst)
 gets updated data points More...
 
virtual void onUpdate (kome::core::XYData &src, kome::core::XYData &dst, kome::objects::Chromatogram &chrom)
 This method is called by update method. (override method) More...
 
virtual void onUpdate (kome::core::XYData &src, kome::core::XYData &dst, kome::objects::Spectrum &spec)
 This method is called by update method. (override method) More...
 
virtual void onUpdate (kome::core::XYData &src, kome::core::XYData &dst, kome::objects::Sample &sample)
 This method is called by update method. (override method) More...
 

Protected Attributes

kome::plugin::PluginCall * m_fun
 
kome::objects::SettingParameterValues m_settings
 
- Protected Attributes inherited from kome::objects::XYDataOperation
std::string m_name
 
int m_index
 

Detailed Description

baseline subtract class

Definition at line 32 of file BaselineSubtract.h.

Member Function Documentation

void kome::operation::BaselineSubtract::getUpdatedData ( kome::core::XYData src,
kome::core::XYData dst 
)
protectedvirtual

gets updated data points

Parameters
[in]srcsource xy data
[out]dstthe object to store updated xy data

Definition at line 126 of file BaselineSubtract.cpp.

129  {
130  // check the member
131  if( m_fun == NULL ) {
132  LOG_WARN( FMT( "The baseline function is not assigned." ) );
133  return;
134  }
135 
136  // check the parameter
137  if( src.getLength() == 0 ) {
138  return;
139  }
140 
141  // baseline points
142  kome::core::DataPoints baseline;
143 
144  // parameters
146 
147  kome::plugin::PluginCallTool::setXYData( params, src );
148  kome::plugin::PluginCallTool::setBaseline( params, baseline );
149  kome::plugin::PluginCallTool::setSettingValues( params, m_settings );
150 
151  m_fun->invoke( &params );
152 
153  // subtract baseline
154  subtractBaseline( src, dst, baseline );
155 
156 }
data points data of profile management class
Definition: DataPoints.h:25
kome::objects::SettingParameterValues m_settings
#define NULL
Definition: CoreMacros.h:18
parameters of plug-in function management class
Definition: Parameters.h:28
void subtractBaseline(kome::core::XYData &src, kome::core::XYData &dst, kome::core::XYData &baseline)
subtracts baseline
kome::plugin::PluginCall * m_fun
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::operation::BaselineSubtract::onUpdate ( kome::core::XYData src,
kome::core::XYData dst,
kome::objects::Chromatogram chrom 
)
protectedvirtual

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

Parameters
[in]srcsource xy data
[out]dstthe object to store updated xy data
[in]chromchromatogram

Implements kome::objects::XYDataOperation.

Definition at line 159 of file BaselineSubtract.cpp.

163  {
164  getUpdatedData( src, dst );
165 }
virtual void getUpdatedData(kome::core::XYData &src, kome::core::XYData &dst)
gets updated data points

Here is the call graph for this function:

void kome::operation::BaselineSubtract::onUpdate ( kome::core::XYData src,
kome::core::XYData dst,
kome::objects::Spectrum spec 
)
protectedvirtual

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

Parameters
[in]srcsource xy data
[out]dstthe object to store updated xy data
[in]specspectrum

Implements kome::objects::XYDataOperation.

Definition at line 168 of file BaselineSubtract.cpp.

172  {
173  getUpdatedData( src, dst );
174 }
virtual void getUpdatedData(kome::core::XYData &src, kome::core::XYData &dst)
gets updated data points

Here is the call graph for this function:

void kome::operation::BaselineSubtract::onUpdate ( kome::core::XYData src,
kome::core::XYData dst,
kome::objects::Sample sample 
)
protectedvirtual

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

Parameters
[in]srcsource xy data
[out]dstthe object to store updated xy data
[in]samplesample

Implements kome::objects::XYDataOperation.

Definition at line 177 of file BaselineSubtract.cpp.

181  {
182  getUpdatedData( src, dst );
183 }
virtual void getUpdatedData(kome::core::XYData &src, kome::core::XYData &dst)
gets updated data points

Here is the call graph for this function:

void kome::operation::BaselineSubtract::setBaselineInfo ( kome::plugin::PluginCall *  func,
kome::objects::SettingParameterValues settings 
)

sets baseline information

Parameters
[in]funcbaseline function
[in]settingsbaseline setting parameter values

Definition at line 49 of file BaselineSubtract.cpp.

49  {
50  // initialize
51  init();
52  if( func == NULL ) {
53  return;
54  }
55 
56  // set information
57  m_fun = func;
58  if( settings != NULL ) {
59  m_settings = *settings;
60  }
61 
62  // function item
63  kome::plugin::PluginFunctionItem item;
64  item.setInfo( m_fun );
65 
66  // set name
67  std::string name = FMT( "Baseline Subtract[%s", item.getLongName() );
68  std::string paramStr;
69  for( unsigned int i = 0; i < m_settings.getNumberOfParameters(); i++ ) {
70  // add parameter name
71  if( !paramStr.empty() ) {
72  paramStr.append( ", " );
73  }
74 
75  std::string name = m_settings.getParameterName( i );
76  std::string value = m_settings.getParameterValue( i );
77 
78  paramStr.append( FMT( "%s=%s", name.c_str(), value.c_str() ) );
79  }
80 
81  if( paramStr.empty() ) {
82  name.append( "]" );
83  }
84  else {
85  name.append( FMT( "(%s)]", paramStr.c_str() ) );
86  }
87 
88  setName( name.c_str() );
89 }
void setName(const char *name)
sets name
kome::objects::SettingParameterValues m_settings
#define NULL
Definition: CoreMacros.h:18
const char * getParameterValue(const unsigned int index)
gets parameter value
const char * getParameterName(const unsigned int index)
gets parameter name
unsigned int getNumberOfParameters()
gets the number of parameters
kome::plugin::PluginCall * m_fun

Here is the call graph for this function:

void kome::operation::BaselineSubtract::subtractBaseline ( kome::core::XYData src,
kome::core::XYData dst,
kome::core::XYData baseline 
)
protected

subtracts baseline

Parameters
[in]srcsource xy data
[out]dstthe object to store subtracted xy data
[in]baselinebaseline data

Definition at line 92 of file BaselineSubtract.cpp.

96  {
97 
98  // linear interporeration
99  unsigned int len = src.getLength();
100  double* xArray = ( len == 0 ? NULL : new double[ len ] );
101  for( unsigned int i = 0; i < src.getLength(); i++ ) {
102  xArray[ i ] = src.getX( i );
103  }
104 
105  kome::core::DataPoints baseline2;
106  kome::numeric::Interpolation::linear( baseline, baseline2, xArray, src.getLength() );
107 
108  // delete array
109  if( xArray != NULL ) {
110  delete[] xArray;
111  xArray = NULL;
112  }
113 
114  // subtract
115  dst.reserve( len );
116  for( unsigned int i = 0; i < len; i++ ) {
117  double x = src.getX( i );
118  double y = src.getY( i ) - baseline2.getY( i );
119  y = MAX( y, 0.0 );
120 
121  dst.addPoint( x, y );
122  }
123 }
data points data of profile management class
Definition: DataPoints.h:25
double getX(const unsigned int index)
gets x coordinate
Definition: XYData.cpp:224
double getY(const unsigned int index)
gets y coordinate
Definition: XYData.cpp:243
#define NULL
Definition: CoreMacros.h:18
#define MAX(x, y)
Definition: CoreMacros.h:27
void reserve(const unsigned int num)
reserves enough contiguous memory of array
Definition: XYData.cpp:262
void addPoint(const double x, const double y)
adds point
Definition: XYData.cpp:149
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:

Member Data Documentation

kome::plugin::PluginCall* kome::operation::BaselineSubtract::m_fun
protected

baseline detect function

Definition at line 48 of file BaselineSubtract.h.

kome::objects::SettingParameterValues kome::operation::BaselineSubtract::m_settings
protected

parameter values

Definition at line 51 of file BaselineSubtract.h.


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