00001 # ifndef Conjecture_Page_h
00002 # define Conjecture_Page_h Conjecture_Page_h
00003
00004
00005
00006
00007
00008 # include <iostream>
00009 # include "Element.h"
00010
00011
00012 namespace Conjecture {
00013
00014
00015 class Env;
00016 class OCRModule;
00017
00047 class Page : public Element {
00048
00049
00050
00051
00052
00053 friend class Env;
00054
00055
00056
00057
00058 friend const Image* Element::pageImage() const;
00059
00060 public:
00061
00062
00063
00064
00065 Page(Env* env, const std::string& file);
00066
00067
00068
00069
00070
00071 Page(Env* env, const std::string& imagefile, const std::string& validfile);
00072
00078 virtual bool process();
00079
00091 virtual bool segment();
00092
00103 virtual bool identify();
00104
00118 virtual bool format();
00119
00125 virtual Page* asPage() { return this; }
00126 virtual const Page* asPage() const { return this; }
00127
00132 virtual void printSummary(std::ostream& os = std::cerr, const std::string& indent = "", int index = -1) const;
00133
00142 virtual void writeText(std::ostream& os) const;
00143
00153 static void test(int argc = 0, const char* argv[] = NULL);
00154
00155
00156
00157 inline const Env* env() const { return this->_env; }
00158 inline const std::string & file() const { return this->_file; }
00159 inline const Image* image() const { return this->_image; }
00160
00161 protected:
00162 OCRModule* algorithms() const;
00163
00164
00165
00166 inline void envIs(Env* env) { this->_env = env; }
00167 inline void fileIs(const std::string & file) { this->_file = file; }
00168 virtual int type() const { return Type; }
00169 inline void imageIs(Image* image) { this->_image = image; }
00170
00171 private:
00172
00173
00174 inline Env* & envRef() { return this->_env; }
00175 inline std::string & fileRef() { return this->_file; }
00176 inline Image* & imageRef() { return this->_image; }
00177
00178
00179
00180 static const ElementType Type = ELEMENT_PAGE;
00181
00199 Env* _env;
00200
00201
00202
00203
00204
00205
00206
00207 std::string _file;
00208
00219 Image* _image;
00220 };
00221 };
00222
00223
00224 # include "Env.h"
00225
00226 # endif // Conjecture_Page_h
00227