Mass++ Common Libraries v2.7.5
 All Classes Namespaces Files Functions Variables Enumerations Macros
Normalization.cpp
Go to the documentation of this file.
1 
11 #include "stdafx.h"
12 #include "Normalization.h"
13 
14 using namespace kome::operation;
15 
16 
17 #include <crtdbg.h>
18 #ifdef _DEBUG
19  #define new new( _NORMAL_BLOCK, __FILE__, __LINE__ )
20  #define malloc( s ) _malloc_dbg( s, _NORMAL_BLOCK, __FILE__, __LINE__ )
21 #endif // _DEBUG
22 
23 
24 // constructor
26  m_fun = NULL;
27  m_settings.clear();
28 
29  m_stdGroup = NULL;
30  m_trmtGroup = NULL;
31 
32  setName( "" );
33 }
34 
35 // destructor
37  init();
38 }
39 
40 // initialze
42  m_fun = NULL;
43  m_settings.clear();
44 
45  setName( "" );
46 }
47 
48 // set normalization function
50  kome::plugin::PluginCall* func,
53 ){
54  // initialize
55  init();
56  if( func == NULL ){
57  return;
58  }
59 
60  if( stdGroup != NULL ){
61  m_stdGroup = stdGroup;
62  }
63 
64  // set information
65  m_fun = func;
66  if( settings != NULL ){
67  m_settings = *settings;
68  }
69 
70  // item
71  kome::plugin::PluginFunctionItem item;
72  item.setInfo( func );
73 
74  // set name
75  std::string name = FMT( "Normalization [%s", item.getLongName() );
76  std::string paramStr;
77  for( unsigned int i=0; i < m_settings.getNumberOfParameters(); i++ ){
78  // add parameter name
79  if( !paramStr.empty() ){
80  paramStr.append( ", " );
81  }
82 
83  std::string name = m_settings.getParameterName( i );
84  std::string value = m_settings.getParameterValue( i );
85 
86  paramStr.append( FMT( "%s=%s", name.c_str(), value.c_str() ) );
87  }
88 
89  if( paramStr.empty() ){
90  name.append( "]" );
91  }else{
92  name.append( FMT( "(%s)]", paramStr.c_str() ) );
93  }
94 
95  setName( name.c_str() );
96 }
97 
98 // update data point
100  kome::core::XYData& src,
101  kome::core::XYData& dst,
103 ){
104  // check the member
105  if( m_fun == NULL ){
106  LOG_WARN_CODE( FMT( "The filter function is not assigned." ), ERR_NULL_POINTER );
107  return;
108  }
109 
110  // parameters
112 
113  kome::plugin::PluginCallTool::setXYData( params, src );
114  kome::plugin::PluginCallTool::setUpdatedXYData( params, dst );
115  kome::plugin::PluginCallTool::setSettingValues( params, m_settings );
116  kome::plugin::PluginCallTool::setSpectrum( params, *spec );
117 
118  kome::plugin::PluginCallTool::setControlGroup( params, *m_stdGroup );
119  kome::plugin::PluginCallTool::setGroup( params, *m_trmtGroup );
120 
121  // normalization methods
122  m_fun->invoke( &params );
123 }
124 
125 //on update (chromatogram)
127  kome::core::XYData& src,
128  kome::core::XYData& dst,
130 ){
131  m_trmtGroup = chrom.getOrgChromatogram()->getGroup(); // @date 2014.03.06 <Mod> M.Izumi
132  getUpdatedData( src, dst, NULL );
133 }
134 
135 // on update (spectrum)
137  kome::core::XYData& src,
138  kome::core::XYData& dst,
140 ){
141  m_trmtGroup = spec.getOrgSpectrum()->getGroup(); // @date 2014.03.06 <Mod> M.Izumi
142  getUpdatedData( src, dst, &spec );
143 }
144 
145 // on update (sample)
147  kome::core::XYData& src,
148  kome::core::XYData& dst,
149  kome::objects::Sample& sample
150 ) {
152  getUpdatedData( src, dst, NULL );
153 }
abstraction class of two dimention coordinate data
Definition: XYData.h:34
kome::objects::SettingParameterValues m_settings
Definition: Normalization.h:47
Normalization class.
group of spectrum management class
Definition: DataGroupNode.h:33
const unsigned int ERR_NULL_POINTER
Definition: ErrorCode.h:69
virtual ~Normalization()
destructor
sample information management class
Definition: Sample.h:34
setting parameter values management class
DataGroupNode * getGroup()
gets spectrum group
kome::objects::DataGroupNode * m_trmtGroup
Definition: Normalization.h:53
Spectrum * getOrgSpectrum()
gets original spectrum
Definition: Spectrum.cpp:1003
void setName(const char *name)
sets name
kome::objects::DataGroupNode * m_stdGroup
Definition: Normalization.h:50
#define NULL
Definition: CoreMacros.h:18
virtual void getUpdatedData(kome::core::XYData &src, kome::core::XYData &dst, kome::objects::Spectrum *spec)
gets updated data points
virtual void onUpdate(kome::core::XYData &src, kome::core::XYData &dst, kome::objects::Chromatogram &chrom)
This method is called by update method. (override method)
const char * getParameterValue(const unsigned int index)
gets parameter value
kome::plugin::PluginCall * m_fun
Definition: Normalization.h:44
const char * getParameterName(const unsigned int index)
gets parameter name
DataGroupNode * getGroup()
gets spectrum group
Definition: Spectrum.cpp:898
unsigned int getNumberOfParameters()
gets the number of parameters
parameters of plug-in function management class
Definition: Parameters.h:28
DataGroupNode * getRootDataGroupNode()
gets root spectrum group
Definition: Sample.cpp:219
spectrum information management class
Definition: Spectrum.h:30
Chromatogram * getOrgChromatogram()
gets original chromatogram
void setNormalizInfo(kome::plugin::PluginCall *func, kome::objects::SettingParameterValues *settings, kome::objects::DataGroupNode *stdGroup)
sets filter information
chromatogram information management class
Definition: Chromatogram.h:33