OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
histogram.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2020 by the OpenStructure authors
5 // Copyright (C) 2003-2010 by the IPLT authors
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License as published by the Free
9 // Software Foundation; either version 3.0 of the License, or (at your option)
10 // any later version.
11 // This library is distributed in the hope that it will be useful, but WITHOUT
12 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14 // details.
15 //
16 // You should have received a copy of the GNU Lesser General Public License
17 // along with this library; if not, write to the Free Software Foundation, Inc.,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 //------------------------------------------------------------------------------
20 #ifndef OST_IMG_ALG_HISTOGRAM_HH
21 #define OST_IMG_ALG_HISTOGRAM_HH
22 
23 /*
24  Author: Ansgar Philippsen
25 */
26 
27 #include <ost/base.hh>
28 #include <ost/message.hh>
29 
30 #include <ost/img/algorithm.hh>
31 #include <ost/img/image_state.hh>
33 
34 namespace ost { namespace img { namespace alg {
35 
36 class DLLEXPORT HistogramError: public Error {
37 public:
39  Error(String("A histogram error occurred: ") + s)
40  {}
41 };
42 
43 
45 {
46 public:
47  typedef std::vector<int> Bins;
48 
49  // default ctor used for explicit instanciation. Don't use!
50  HistogramBase();
52  HistogramBase(int bin_count, Real minimum, Real maximum);
53 
54  // image state algorithm interface
55  template <typename T, class D>
56  void VisitState(const ImageStateImpl<T,D>& isi);
57 
58  const Bins& GetBins() const;
59 
60  static String GetAlgorithmName() {return "Histogram";}
61 
62 protected:
63 
64 private:
65  int bin_count_;
66  Real min_,max_,cfac_;
67  Bins bins_;
68 };
69 
70 typedef ImageStateNonModAlgorithm<HistogramBase> Histogram;
71 
72 }
73 
74 OST_IMG_ALG_EXPLICIT_INST_DECL(class,ImageStateNonModAlgorithm<ost::img::alg::HistogramBase>)
75 
76 }} // namespaces
77 
78 #endif
std::string String
Definition: base.hh:54
float Real
Definition: base.hh:44
std::vector< int > Bins
Definition: histogram.hh:47
static String GetAlgorithmName()
Definition: histogram.hh:60
#define DLLEXPORT_IMG_ALG
HistogramError(const String &s)
Definition: histogram.hh:38
ImageStateNonModAlgorithm< HistogramBase > Histogram
Definition: histogram.hh:70
#define OST_IMG_ALG_EXPLICIT_INST_DECL(c, t)