iRoCS Toolbox  1.1.0
LoadSaveHdf5.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: load/save policy for SVMApplication for Hdf5 files
26 ** $RCSfile: $
27 ** $Revision: $$Name: $
28 ** $Date: $
29 ** Copyright: GPL $Author: $
30 ** Description:
31 **
32 **
33 **
34 **-------------------------------------------------------------------------
35 **
36 ** $Log: $
37 **
38 **
39 **************************************************************************/
40 
41 #ifndef LOADSAVEHDF5_HH
42 #define LOADSAVEHDF5_HH
43 
44 #ifdef HAVE_CONFIG_H
45 #include <config.hh>
46 #endif
47 
48 #include <iostream>
49 #include <fstream>
50 #include <cerrno>
51 
52 #include "StDataHdf5.hh"
53 #include <StDataCmdLine.hh>
54 #include <PrettyOptionPrinter.hh>
55 #include <BasicSVMAdapter.hh>
56 #include <BasicSVMFactory.hh>
57 #include <ParamInfo.hh>
58 
59 namespace svt
60 {
61  template<typename STDATATYPE>
63  {
64  public:
65 
67  {}
68 
69  typedef STDATATYPE STDATA;
70 
71 
72  /*======================================================================*/
81  /*======================================================================*/
82  static void getParamInfosForLoadFeatureVectors( std::vector<ParamInfo>& p);
83 
84  /*======================================================================*/
92  /*======================================================================*/
94 
95 
96  /*======================================================================*/
105  /*======================================================================*/
106  template< typename FV>
107  void loadFeatureVectors( StDataCmdLine& cmdline,
108  std::vector<FV>& featureVectors);
109 
110 
111 
112  /*======================================================================*/
121  /*======================================================================*/
122  static void getParamInfosForLoadSubsetLabels( std::vector<ParamInfo>& p);
123 
124  /*======================================================================*/
132  /*======================================================================*/
133  bool checkParamsForLoadSubsetLabels(StDataCmdLine& cmdline) const;
134 
135 
136  /*======================================================================*/
146  /*======================================================================*/
147  void loadSubsetLabels( StDataCmdLine& cmdline,
148  std::vector<int>& subsetIndexByUID);
149 
150 
151 
152  /*======================================================================*/
161  /*======================================================================*/
162  static void getParamInfosForSaveModel( std::vector<ParamInfo>& p);
163 
164  /*======================================================================*/
172  /*======================================================================*/
173  void checkParamsForSaveModel(StDataCmdLine& cmdline) const;
174 
175 
176  /*======================================================================*/
189  /*======================================================================*/
190  template< typename FV>
191  void saveModel( StDataCmdLine& cmdline,
193  int detailLevel,
194  std::ostream& os) const;
195 
196 
197  /*======================================================================*/
206  /*======================================================================*/
208  std::vector<ParamInfo>& p);
209 
210  /*======================================================================*/
224  /*======================================================================*/
225  template< typename FV, typename ALGORITHMS>
227  StDataCmdLine& cmdline) const;
228 
229 
230 
231  /*======================================================================*/
240  /*======================================================================*/
242  std::vector<ParamInfo>& p);
243 
244 
245  /*======================================================================*/
253  /*======================================================================*/
255  StDataCmdLine& cmdline) const;
256 
257 
258  /*======================================================================*/
272  /*======================================================================*/
274  StDataCmdLine& cmdline,
275  const std::vector<double>& results,
276  const std::vector< StDataASCII>& details,
277  bool saveDetails,
278  std::ostream& os) const;
279  };
280 
282 
283 }
284 
285 #include "LoadSaveHdf5.icc"
286 
287 #endif
void loadSubsetLabels(StDataCmdLine &cmdline, std::vector< int > &subsetIndexByUID)
load feature vectors
void checkParamsForSaveModel(StDataCmdLine &cmdline) const
Just accesses all parameters, that are used in saveModel() so that they are no longer unknwon to StDa...
void saveClassificationResults(StDataCmdLine &cmdline, const std::vector< double > &results, const std::vector< StDataASCII > &details, bool saveDetails, std::ostream &os) const
save classification results.
static void getParamInfosForCreateSVMAndLoadModel(std::vector< ParamInfo > &p)
get information about the parameters, that are used in createSVMAndLoadModel().
bool checkParamsForLoadSubsetLabels(StDataCmdLine &cmdline) const
checks wether the "--subset_att" parameter was given.
LoadSaveHdf5Templ< StDataHdf5 > LoadSaveHdf5
static void getParamInfosForSaveClassificationResults(std::vector< ParamInfo > &p)
get information about the parameters, that are used in createSVMAndLoadModel().
static void getParamInfosForLoadFeatureVectors(std::vector< ParamInfo > &p)
get information about the parameters, that are used in loadFeatureVectors().
static void getParamInfosForLoadSubsetLabels(std::vector< ParamInfo > &p)
get information about the parameters, that are used in loadSubsetLabels().
bool checkParamsForSaveClassificationResults(StDataCmdLine &cmdline) const
Just accesses all parameters, that are used in saveClassificationResults() so that they are no longer...
void loadFeatureVectors(StDataCmdLine &cmdline, std::vector< FV > &featureVectors)
load feature vectors
static void getParamInfosForSaveModel(std::vector< ParamInfo > &p)
get information about the parameters, that are used in saveModel().
BasicSVMAdapter< FV, STDATA > * createSVMAndLoadModel(StDataCmdLine &cmdline) const
create SVM from file and load Model data
void saveModel(StDataCmdLine &cmdline, BasicSVMAdapter< FV, STDATA > *svm, int detailLevel, std::ostream &os) const
save Model.
void checkParamsForLoadFeatureVectors(StDataCmdLine &cmdline) const
Just accesses all parameters, that are used in loadFeatureVectors() so that they are no longer unknwo...