iRoCS Toolbox  1.1.0
BasicSVMFactory.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:
26  ** $RCSfile$
27  ** $Revision: 2825 $$Name$
28  ** $Date: 2009-09-15 17:04:15 +0200 (Tue, 15 Sep 2009) $
29  ** Copyright: LGPL $Author: ronneber $
30  ** Description:
31  **
32  **
33  **
34  **-------------------------------------------------------------------------
35  **
36  ** $Log$
37  ** Revision 1.2 2004/09/08 14:16:32 ronneber
38  ** - changed key for two class svm selection from "svm_type" to "two_class_type"
39  **
40  ** Revision 1.1 2004/08/26 08:36:58 ronneber
41  ** initital import
42  **
43  ** Revision 1.3 2003/05/19 11:12:04 ronneber
44  ** - moved all code into templated BasicSVMFactory class, to be able to
45  ** use it with other and own FV classes
46  **
47  ** Revision 1.2 2002/09/05 13:16:44 pigorsch
48  ** *** empty log message ***
49  **
50  ** Revision 1.1 2002/09/04 10:29:57 pigorsch
51  ** - initial revision, copied from libpollenpp and modified
52  **
53  **
54  **
55  **************************************************************************/
56 
57 #ifndef BASICSVMFACTORY_HH
58 #define BASICSVMFACTORY_HH
59 
60 #ifdef HAVE_CONFIG_H
61 #include <config.hh>
62 #endif
63 
64 #include "TList.hh"
65 #include "BasicSVMAdapter.hh"
66 #include "BasicSVMAdapterTempl.hh"
67 
68 #include "MC_SVM_Finder.hh"
69 
70 
71 namespace svt
72 {
73 
74  template< typename FV, typename STDATA>
76  {
78 
79  template<typename SVMTYPE>
80  void produce( SVMTYPE*)
81  {
83  }
84  };
85 
86 
87 
88  /*======================================================================*/
106  /*======================================================================*/
107  template< typename FV, typename STDATA,
108  typename MCLIST, typename TCLIST, typename KFLIST>
110  {
111  public:
112 
113  /*======================================================================*/
132  /*======================================================================*/
133  static BasicSVMAdapter<FV,STDATA>* create( const std::string& mcName,
134  const std::string& tcName,
135  const std::string& kfName)
136  {
139  MCLIST,
140  TCLIST,
141  KFLIST
142  >::search( mcName, tcName, kfName);
143 
144  return p.svm;
145  }
146 
147 
148 
149  /*======================================================================*/
159  /*======================================================================*/
160  template< typename STDATA2>
162  {
163  std::string mcName;
164  std::string tcName;
165  std::string kfName;
166  stData.getValue( "multi_class_type", mcName);
167  stData.getValue( "two_class_type", tcName);
168  stData.getValue( "kernel_type", kfName);
169 
170  return create( mcName, tcName, kfName);
171  }
172 
173 
174  };
175 
176 }
177 
178 #endif
void produce(SVMTYPE *)
The BasicSVMFactory class is a factory, that creates the appropriate template class from given string...
The MC_SVM_Finder class finds the appropriate combination of Multiclass, Twoclass and Kernel specifie...
static BasicSVMAdapter< FV, STDATA > * create(const std::string &mcName, const std::string &tcName, const std::string &kfName)
create an BasicSVMAdapterTempl with the requested types.
static BasicSVMAdapter< FV, STDATA > * createFromStData(STDATA2 &stData)
(description)
BasicSVMAdapter< FV, STDATA > * svm