Hugin trunk 0.1
Loading...
Searching...
No Matches
PanoramaAlgorithm.h
Go to the documentation of this file.
1// -*- c-basic-offset: 4 -*-
30#ifndef _ALGORITHM_PANORAMAALGORITHM_H
31#define _ALGORITHM_PANORAMAALGORITHM_H
32
33#include <hugin_shared.h>
35
36
37namespace HuginBase {
38
39 class PanoramaData;
40
41
46 {
47
48 protected:
51 : o_panorama(panorama), o_successful(false)
52 { };
53
54 public:
56 virtual ~PanoramaAlgorithm() {};
57
58
59 public:
61 virtual bool modifiesPanoramaData() const =0;
62
64 virtual bool hasRunSuccessfully()
65 {
66 return o_successful;
67 }
68
70 virtual void run()
71 {
72 o_successful = runAlgorithm();
73 }
74
75#if 0
77 template<class AlgorithmClass>
79 {
80 AlgorithmClass& THIS = static_cast<AlgorithmClass&>(*this);
81 THIS.run();
82 return THIS;
83 }
84#endif
85
89 virtual bool runAlgorithm() =0;
90
91 /*
92 * Here is the informal interface guidelines that you should follow when
93 * you subclass from this class:
94 *
95 * 1. You should provide [ SomeType getSomeResult() ] methods if there
96 * is any result from the algorithm.
97 *
98 * 2. For complicated algorithms, you can have [ MyErrorEnum getError() ]
99 * that returns error.
100 *
101 * 3. You can optionaly implement your algorithm as
102 * [ static SomeType executeMyAlgorithm(PanoramaData& panorama, all parameters) ].
103 *
104 */
105
106 protected:
109
110 };
111
112
113
118 {
119
120 protected:
126
127 public:
130
131
132 public:
133 /*
134 * Please follow the same guideline as the PanoramaAlgorithm class, but with:
135 *
136 * 3. should now be
137 * [ static SomeType executeMyAlgorithm(PanoramaData& panorama, ProgressDisplay* progressDisplay, all parameters) ]
138 * instead.
139 *
140 */
141
142
143 // -- access to the ProgressDisplay --
144
145 protected:
148 { return m_progressDisplay; };
149
151 virtual bool hasProgressDisplay() const
152 { return getProgressDisplay() != NULL; };
153
154
155 // -- cancelling process --
156
157 public:
159 virtual bool wasCancelled() const
160 { return m_wasCancelled; };
161
162 protected:
166 virtual void cancelAlgorithm()
167 {
168 m_wasCancelled = true;
169 algorithmCancelled();
170 }
171
176 virtual void algorithmCancelled() {};
177
178
179 // -- private variables --
180
181 private:
184
185 };
186
187
188}; // namespace
189#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:40
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:40