OpenWalnut  1.5.0dev
WMHistogramEqualization.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #ifndef WMHISTOGRAMEQUALIZATION_H
26 #define WMHISTOGRAMEQUALIZATION_H
27 
28 #include <memory>
29 #include <string>
30 
31 #include "core/dataHandler/WDataSetScalar.h"
32 #include "core/kernel/WModule.h"
33 #include "core/kernel/WModuleInputData.h"
34 #include "core/kernel/WModuleOutputData.h"
35 
36 /**
37  * This modules takes a dataset and equalizes its histogram.
38  *
39  * \ingroup modules
40  */
42 {
43 public:
44  /**
45  * Default constructor.
46  */
48 
49  /**
50  * Destructor.
51  */
52  virtual ~WMHistogramEqualization();
53 
54  /**
55  * Gives back the name of this module.
56  * \return the module's name.
57  */
58  virtual const std::string getName() const;
59 
60  /**
61  * Gives back a description of this module.
62  * \return description to module.
63  */
64  virtual const std::string getDescription() const;
65 
66  /**
67  * Due to the prototype design pattern used to build modules, this method returns a new instance of this method. NOTE: it
68  * should never be initialized or modified in some other way. A simple new instance is required.
69  *
70  * \return the prototype used to create every module in OpenWalnut.
71  */
72  virtual std::shared_ptr< WModule > factory() const;
73 
74  /**
75  * Get the icon for this module in XPM format.
76  * \return The icon.
77  */
78  virtual const char** getXPMIcon() const;
79 
80 protected:
81  /**
82  * Entry point after loading the module. Runs in separate thread.
83  */
84  virtual void moduleMain();
85 
86  /**
87  * Initialize the connectors this module is using.
88  */
89  virtual void connectors();
90 
91  /**
92  * Initialize the properties for this module.
93  */
94  virtual void properties();
95 
96 private:
97  /**
98  * An input connector used to get datasets from other modules. The connection management between connectors must not be handled by the module.
99  */
100  std::shared_ptr< WModuleInputData< WDataSetScalar > > m_input;
101 
102  /**
103  * The output connector used to provide the calculated data to other modules.
104  */
105  std::shared_ptr< WModuleOutputData< WDataSetScalar > > m_output;
106 
107  /**
108  * A condition used to notify about changes in several properties.
109  */
110  std::shared_ptr< WCondition > m_propCondition;
111 
112  /**
113  * If true, histogram equalization is turned on.
114  */
115  WPropBool m_equalize;
116 
117  /**
118  * True if the values should be clamped before further processing
119  */
120  WPropBool m_clamp;
121 
122  /**
123  * How many percent should be clamped from the histogram.
124  */
125  WPropDouble m_clampPerc;
126 
127  /**
128  * Resolution of the initial histogram.
129  */
131 
132  /**
133  * Resolution with which the CDF gets calculated.
134  */
135  WPropInt m_cdfResolution;
136 
137  /**
138  * Group for keeping all the clamping related props
139  */
140  WPropGroup m_clamping;
141 
142  /**
143  * Group for keeping all the equalizing-related props
144  */
145  WPropGroup m_equalizing;
146 };
147 
148 #endif // WMHISTOGRAMEQUALIZATION_H
149 
This modules takes a dataset and equalizes its histogram.
virtual std::shared_ptr< WModule > factory() const
Due to the prototype design pattern used to build modules, this method returns a new instance of this...
WMHistogramEqualization()
Default constructor.
virtual void connectors()
Initialize the connectors this module is using.
WPropInt m_histogramResolution
Resolution of the initial histogram.
WPropBool m_equalize
If true, histogram equalization is turned on.
virtual void moduleMain()
Entry point after loading the module.
WPropGroup m_equalizing
Group for keeping all the equalizing-related props.
std::shared_ptr< WModuleInputData< WDataSetScalar > > m_input
An input connector used to get datasets from other modules.
virtual const std::string getName() const
Gives back the name of this module.
WPropDouble m_clampPerc
How many percent should be clamped from the histogram.
virtual ~WMHistogramEqualization()
Destructor.
virtual const std::string getDescription() const
Gives back a description of this module.
virtual const char ** getXPMIcon() const
Get the icon for this module in XPM format.
std::shared_ptr< WModuleOutputData< WDataSetScalar > > m_output
The output connector used to provide the calculated data to other modules.
WPropGroup m_clamping
Group for keeping all the clamping related props.
virtual void properties()
Initialize the properties for this module.
WPropBool m_clamp
True if the values should be clamped before further processing.
WPropInt m_cdfResolution
Resolution with which the CDF gets calculated.
std::shared_ptr< WCondition > m_propCondition
A condition used to notify about changes in several properties.
Class representing a single module of OpenWalnut.
Definition: WModule.h:72