iRoCS Toolbox  1.1.0
Kernel_HISTINTERSECT.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: histogram intersection kernel
26 ** $RCSfile$
27 ** $Revision: 4820 $$Name$
28 ** $Date: 2011-11-08 10:57:01 +0100 (Tue, 08 Nov 2011) $
29 ** Copyright: LGPL $Author: tschmidt $
30 ** Description:
31 **
32 **
33 **
34 **-------------------------------------------------------------------------
35 **
36 **
37 ** $Log:
38 **
39 **
40 **
41 **************************************************************************/
42 
43 #ifndef KERNEL_HISTINTERSECT_HH
44 #define KERNEL_HISTINTERSECT_HH
45 
46 #ifdef HAVE_CONFIG_H
47 #include <config.hh>
48 #endif
49 
50 // std includes
51 #include <map>
52 #include <algorithm>
53 #include <set>
54 #include <string>
55 
56 // libsvmtl includes
57 #include "ProgressReporter.hh"
58 
59 // requirements of template parameters
61 
62 namespace svt
63 {
64  /*======================================================================*/
70  /*======================================================================*/
72  {
73  public:
75  {};
76 
78  {};
79 
80  template< typename ForwardIter, typename Accessor>
81  void updateCache( const ForwardIter&,
82  const ForwardIter&,
83  Accessor,
84  ProgressReporter*) const
85  {
86  // nothing to do here
87  }
88 
89  // new updateCache-Syntax:
90  template< typename ForwardIter1, typename Accessor1,
91  typename ForwardIter2, typename Accessor2 >
92  void updateCache( const ForwardIter1&,
93  const ForwardIter1&,
94  Accessor1,
95  const ForwardIter2&,
96  const ForwardIter2&,
97  Accessor2,
98  ProgressReporter* = 0) const
99  {
100  // nothing to do here
101  }
102 
103  void clearCache() const
104  {
105  // nothing to do here
106  }
107 
108  template< typename FV>
109  double k_function( const FV& x, const FV& y) const
110  {
111  double temp = 0.0;
112  for (int i = 0; i < static_cast<int>(x.size()); i++)
113  temp += std::min(x[i],y[i]);
114  return temp;
115  }
116 
117  template<typename STDATA>
118  void loadParameters( STDATA&)
119  {}
120 
121  template<typename STDATA>
122  void saveParameters( STDATA& stData) const
123  {
125  stData.setValue( "kernel_type", name());
126  }
127 
128  static const char* name()
129  {
130  return "histintersect";
131  }
132 
133  static const char* description()
134  {
135  return "histintersect kernel: min(u(i),v(i))";
136  }
137 
138  /*======================================================================*/
147  /*======================================================================*/
148  static void getParamInfos( std::vector<ParamInfo>&)
149  {}
150 
151 
152 
153  };
154 }
155 
156 #endif
void saveParameters(STDATA &stData) const
void updateCache(const ForwardIter &, const ForwardIter &, Accessor, ProgressReporter *) const
#define CHECK_MEMBER_TEMPLATE(c)
double k_function(const FV &x, const FV &y) const
static const char * description()
The Kernel_HISTINTERSECT class specifies a HISTINTERSECT kernel function: min(u&#39;(i),v(i))
static void getParamInfos(std::vector< ParamInfo > &)
get information about the parameters, that are used in loadParameters() and saveParameters().
void updateCache(const ForwardIter1 &, const ForwardIter1 &, Accessor1, const ForwardIter2 &, const ForwardIter2 &, Accessor2, ProgressReporter *=0) const