tcElevationOptimization::loadSnapShot: simplify reliability expression
[tecorrec.git] / geo / tcIlluminantDirection.h
blob25cc26bd6bff991094734df97ca41572ae8a9a0f
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 _tcIlluminantDirection_h_
21 #define _tcIlluminantDirection_h_
23 /**
24 * @file tcIlluminantDirection.h
25 * @brief Illuminant direction based calculation.
28 #include "tcChannelGroup.h"
29 #include "tcPixelData.h"
30 #include <VarVector.h>
32 #include <QList>
34 class tcChannel;
36 /// Illuminant direction based calculation.
37 class tcIlluminantDirection : public tcChannelGroup
39 Q_OBJECT
41 public:
44 * Constructors + destructor
47 /// Primary constructor.
48 tcIlluminantDirection(const QList<tcChannel*>& chromaticities,
49 int outputs, const QString& name, const QString& description);
51 /// Destructor.
52 virtual ~tcIlluminantDirection();
55 * Accessors
58 /// Get the number of chromaticity channels.
59 int numChromaticities() const;
61 /// Get the list of chromaticitiy channels.
62 const QList<tcChannel*>& chromaticities() const;
64 /// Get the illuminant direction.
65 const maths::VarVector<float>& illuminantDirection() const;
68 * Main image interface
71 // Reimplemented
72 virtual tcChannelConfigWidget* configWidget();
74 private slots:
77 * Private slots
80 /// Reset the illuminant direction vector.
81 void resetIlluminantDirection();
83 /// Start choosing a shadow / non shadow pair.
84 void startShadowNonShadow();
86 /// New shadow point.
87 void selectShadowPoint(const maths::Vector<2,float>& point);
89 /// New non-shadow point.
90 void selectNonShadowPoint(const maths::Vector<2,float>& point);
92 protected:
95 * Interface for derived class to implement
98 // Reimplemented
99 virtual void roundPortion(double* x1, double* y1, double* x2, double* y2);
101 // Reimplemented
102 virtual void loadPortions(double x1, double y1, double x2, double y2, bool changed);
104 /// Load portions using nicely accessed chromaticity data.
105 virtual void loadPortions(const QList< Reference< tcPixelData<float> > >& chromaticities, int width, int height) = 0;
107 private:
110 * Variables
113 /// Input chromaticities.
114 QList<tcChannel*> m_chromaticities;
116 /// Current log chromaticity illuminant direction.
117 maths::VarVector<float> m_illuminantDirection;
119 /// Number of samples used to approximate illuminant direction.
120 int m_illuminantDirectionSamples;
122 /// Configuration widget.
123 tcChannelConfigWidget* m_configWidget;
125 /// Current shadow point.
126 maths::Vector<2,float> m_shadowPoint;
129 #endif