cpvoids program to copy voids from one HGT dataset to another
[tecorrec.git] / geo / tcNegativeProduct.h
blob9d7ef4f67d26ac6cbfa94b1f03294ca0c25320f1
1 /***************************************************************************
2 * This file is part of Tecorrec. *
3 * Copyright 2008 James Hogan <james@albanarts.com> *
4 * *
5 * Tecorrec is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * Tecorrec is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with Tecorrec. If not, write to the Free Software Foundation, *
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************/
20 #ifndef _tcNegativeProduct_h_
21 #define _tcNegativeProduct_h_
23 /**
24 * @file tcNegativeProduct.h
25 * @brief Highlights the parts of an image which are dark in all channels.
28 #include "tcChannel.h"
30 #include <QList>
32 class QSlider;
33 class QLabel;
34 class QComboBox;
36 /// Highlights the parts of an image which are dark in all channels.
37 class tcNegativeProduct : public tcChannel
39 Q_OBJECT
41 public:
44 * Constructors + destructor
47 /// Primary constructor.
48 tcNegativeProduct(const QList<tcChannel*>& inputChannels);
50 /// Destructor.
51 virtual ~tcNegativeProduct();
54 * Main image interface
57 // Reimplemented
58 virtual tcChannelConfigWidget* configWidget();
61 * Parameters
64 /// Load parameters.
65 void loadParams(const QString& filename);
67 protected:
70 * Interface for derived class to implement
73 // Reimplemented
74 virtual void roundPortion(double* x1, double* y1, double* x2, double* y2);
76 // Reimplemented
77 virtual tcAbstractPixelData* loadPortion(double x1, double y1, double x2, double y2, bool changed);
79 signals:
82 * Signals
85 /// Emitted when the threshold text changes.
86 void thresholdChanged(const QString& threshold);
88 private slots:
91 * Private slots
94 /// Set whether the theshold is enabled.
95 void setThresholdEnabled(bool thresholdEnabled);
97 /// Move the theshold value slider.
98 void moveThreshold(int threshold);
100 /// Set the theshold value.
101 void setThreshold(int threshold);
103 /// Indicates that the power slider of a channel has moved.
104 void movePower(int channel);
106 /// Indicates that the power of a channel has changed.
107 void changePower(int channel);
109 /// Optimise the threshold for the parameters using a classification channel.
110 void optimiseThreshold();
112 /// Save threshold errors.
113 void saveThresholdErrors();
115 /// Optimise the parameters using a classification channel.
116 void optimiseParameters();
118 /// Save parameters to a file.
119 void saveParams();
121 /// Load parameters from a file.
122 void loadParams();
124 private:
127 * Private functions
130 /// Calculate an error using some channel as a classifier.
131 float calculateError(tcChannel* classifier);
133 private:
136 * Variables
139 /// Input channels.
140 QList<tcChannel*> m_inputChannels;
142 /// Whether threshold is enabled.
143 bool m_thresholdEnabled;
145 /// Threshold to classify shadows.
146 float m_threshold;
148 /// Powers to raise the negative channels to.
149 float* m_powers;
151 /// Filename in which to save threshold-error values.
152 QString m_saveThresholdError;
154 /// Filename in which to save parameter-error values.
155 QString m_saveParametersError;
157 /// Filename in which to save parameters.
158 QString m_saveParameters;
160 /// Configuration widget.
161 tcChannelConfigWidget* m_configWidget;
163 /// Threshold slider.
164 QSlider* m_sliderThreshold;
166 /// Power sliders in config widget.
167 QList<QSlider*> m_powerSliders;
169 /// Power sliders labelsin config widget.
170 QList<QLabel*> m_powerLabels;
172 /// Classifier channel.
173 QComboBox* m_comboClassifier;
175 /// Slider for log learning rate.
176 QSlider* m_sliderLearningRate;
178 /// Label to show error.
179 QLabel* m_labelError;
181 /// Last calculated optimal threshold error.
182 int m_optimalThresholdError;
185 #endif