iRoCS Toolbox  1.1.0
PlattProbModel.hh
Go to the documentation of this file.
1 /**************************************************************************
2  *
3  * Copyright (C) 2004-2015 Olaf Ronneberger, Florian Pigorsch, Jörg Mechnich,
4  * Thorsten Falk
5  *
6  * Image Analysis Lab, University of Freiburg, Germany
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software Foundation,
20  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  *
22  **************************************************************************/
23 
24 /**************************************************************************
25 ** Title: Model Wrapper for Platts Probability estimates
26 ** $RCSfile$
27 ** $Revision: 604 $$Name$
28 ** $Date: 2005-02-11 13:26:53 +0100 (Fri, 11 Feb 2005) $
29 ** Copyright: GPL $Author: ronneber $
30 ** Description:
31 **
32 **
33 **
34 **-------------------------------------------------------------------------
35 **
36 ** $Log$
37 ** Revision 1.1 2005/02/11 12:26:53 ronneber
38 ** - initial revision
39 **
40 **
41 **
42 **************************************************************************/
43 
44 #ifndef PLATTPROBMODEL_HH
45 #define PLATTPROBMODEL_HH
46 
47 #ifdef HAVE_CONFIG_H
48 #include <config.hh>
49 #endif
50 
51 #include <vector>
52 
53 
54 namespace svt
55 {
56  template< typename WrappedModel>
57  class PlattProbModel : public WrappedModel
58  {
59  public:
60 
62  :_probA(0),
63  _probB(0)
64  {}
65 
66 
67  void setProbAB( double a, double b)
68  {
69  _probA = a;
70  _probB = b;
71  }
72 
73  double probA() const
74  {
75  return _probA;
76  }
77 
78 
79  double probB() const
80  {
81  return _probB;
82  }
83 
84  /*======================================================================*/
94  /*======================================================================*/
95  template<typename STDATA>
96  void saveParameters( STDATA& stData,
97  const std::string& prefix = "") const
98  {
99  stData.setValue( prefix+"probA", _probA);
100  stData.setValue( prefix+"probB", _probB);
101  WrappedModel::saveParameters( stData, prefix);
102  }
103 
104  /*======================================================================*/
114  /*======================================================================*/
115  template<typename STDATA>
116  void loadParameters( STDATA& stData,
117  const std::string& prefix = "")
118  {
119  WrappedModel::loadParameters( stData, prefix);
120  stData.getValue( prefix+"probA", _probA);
121  stData.getValue( prefix+"probB", _probB);
122  }
123 
124  /*======================================================================*/
135  /*======================================================================*/
136  template<typename STDATA>
137  void saveParametersWithUIDs( STDATA& stData,
138  const std::string& prefix = "") const
139  {
140  stData.setValue( prefix+"probA", _probA);
141  stData.setValue( prefix+"probB", _probB);
142  WrappedModel::saveParametersWithUIDs( stData, prefix);
143  }
144 
145  /*======================================================================*/
155  /*======================================================================*/
156  template<typename STDATA, typename FV>
157  void loadParametersWithUIDs( STDATA& stData,
158  const std::vector<FV*>& fvsByUID,
159  const std::string& prefix = "")
160  {
161  WrappedModel::loadParametersWithUIDs( stData, fvsByUID, prefix);
162  stData.getValue( prefix+"probA", _probA);
163  stData.getValue( prefix+"probB", _probB);
164  }
165 
166  /*======================================================================*/
178  /*======================================================================*/
180  const std::vector<char>& leaveOutFlagsByUID) const
181  {
182  // No optimization yet, return true everey time!
183  return true;
184  }
185 
186  private:
187  double _probA; /* offset of fitted sigmoid */
188  double _probB; /* scale factor for dec_value, before using
189  as sigmoid argument */
190  };
191 
192 
193 }
194 
195 #endif
bool isModelAffectedByLeftOutVectors(const std::vector< char > &leaveOutFlagsByUID) const
check, if this model is affected by specified left out vectors, which means, that it needs to be retr...
void saveParametersWithUIDs(STDATA &stData, const std::string &prefix="") const
save the model data to string-string map.
void saveParameters(STDATA &stData, const std::string &prefix="") const
save the model data to given structured data.
void loadParameters(STDATA &stData, const std::string &prefix="")
load the model data from given structured data.
double probA() const
void loadParametersWithUIDs(STDATA &stData, const std::vector< FV *> &fvsByUID, const std::string &prefix="")
(description)
void setProbAB(double a, double b)
double probB() const