Hugin trunk 0.1
Loading...
Searching...
No Matches
PanoramaAlgorithm.h
Go to the documentation of this file.
1// -*- c-basic-offset: 4 -*-
31#ifndef _ALGORITHM_PANORAMAALGORITHM_H
32#define _ALGORITHM_PANORAMAALGORITHM_H
33
34#include <hugin_shared.h>
36
37
38namespace HuginBase {
39
40 class PanoramaData;
41
42
47 {
48
49 protected:
52 : o_panorama(panorama), o_successful(false)
53 { };
54
55 public:
57 virtual ~PanoramaAlgorithm() {};
58
59
60 public:
62 virtual bool modifiesPanoramaData() const =0;
63
65 virtual bool hasRunSuccessfully()
66 {
67 return o_successful;
68 }
69
71 virtual void run()
72 {
73 o_successful = runAlgorithm();
74 }
75
76#if 0
78 template<class AlgorithmClass>
80 {
81 AlgorithmClass& THIS = static_cast<AlgorithmClass&>(*this);
82 THIS.run();
83 return THIS;
84 }
85#endif
86
90 virtual bool runAlgorithm() =0;
91
92 /*
93 * Here is the informal interface guidelines that you should follow when
94 * you subclass from this class:
95 *
96 * 1. You should provide [ SomeType getSomeResult() ] methods if there
97 * is any result from the algorithm.
98 *
99 * 2. For complicated algorithms, you can have [ MyErrorEnum getError() ]
100 * that returns error.
101 *
102 * 3. You can optionaly implement your algorithm as
103 * [ static SomeType executeMyAlgorithm(PanoramaData& panorama, all parameters) ].
104 *
105 */
106
107 protected:
110
111 };
112
113
114
119 {
120
121 protected:
127
128 public:
131
132
133 public:
134 /*
135 * Please follow the same guideline as the PanoramaAlgorithm class, but with:
136 *
137 * 3. should now be
138 * [ static SomeType executeMyAlgorithm(PanoramaData& panorama, ProgressDisplay* progressDisplay, all parameters) ]
139 * instead.
140 *
141 */
142
143
144 // -- access to the ProgressDisplay --
145
146 protected:
149 { return m_progressDisplay; };
150
152 virtual bool hasProgressDisplay() const
153 { return getProgressDisplay() != NULL; };
154
155
156 // -- cancelling process --
157
158 public:
160 virtual bool wasCancelled() const
161 { return m_wasCancelled; };
162
163 protected:
167 virtual void cancelAlgorithm()
168 {
169 m_wasCancelled = true;
170 algorithmCancelled();
171 }
172
177 virtual void algorithmCancelled() {};
178
179
180 // -- private variables --
181
182 private:
185
186 };
187
188
189}; // namespace
190#endif // _H
virtual bool modifiesPanoramaData() const =0
returns true if the algorithm changes the PanoramaData.
virtual void run()
runs the algorithm.
virtual bool runAlgorithm()=0
implementation of the algorithm.
PanoramaAlgorithm(PanoramaData &panorama)
Model for a panorama.
virtual void cancelAlgorithm()
Call this when the algorithm is cancelled.
TimeConsumingPanoramaAlgorithm(PanoramaData &panorama, AppBase::ProgressDisplay *progressDisplay=NULL)
[Warning! it keeps the reference to the panorama data!]
virtual void algorithmCancelled()
Called when the algorithm got cancelled; override with cleaning up process etc.
virtual AppBase::ProgressDisplay * getProgressDisplay() const
#define IMPEX
mainly consists of wrapper around the pano tools library, to assist in ressource management and to pr...
Definition wxcms.cpp:39
std::vector< deghosting::BImagePtr > threshold(const std::vector< deghosting::FImagePtr > &inputImages, const double threshold, const uint16_t flags)
Threshold function used for creating alpha masks for images.
Definition threshold.h:41