00001 # ifndef Page_h
00002 # define Page_h Page_h
00003
00004
00005 # include <iostream>
00006 # include "Element.h"
00007
00008
00009 namespace Conjecture {
00010
00011
00012 class Env;
00013 class OCRModule;
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 class Page : public Element {
00046
00047
00048
00049
00050
00051 friend class Env;
00052
00053
00054
00055
00056 friend const Image* Element::pageImage() const;
00057
00058 public:
00059
00060
00061
00062
00063 Page(Env* env, const std::string& file);
00064
00065
00066
00067
00068
00069 Page(Env* env, const std::string& imagefile, const std::string& validfile);
00070
00076 virtual bool process();
00077
00089 virtual bool segment();
00090
00101 virtual bool identify();
00102
00115 virtual bool format();
00116
00122 virtual Page* asPage() { return this; }
00123 virtual const Page* asPage() const { return this; }
00124
00129 virtual void printSummary(std::ostream& os = std::cerr, const std::string& indent = "", int index = -1) const;
00130
00139 virtual void writeText(std::ostream& os) const;
00140
00150 static void test(int argc = 0, const char* argv[] = NULL);
00151
00152
00153
00154 inline const Env* env() const { return this->_env; }
00155 inline const std::string & file() const { return this->_file; }
00156 inline const Image* image() const { return this->_image; }
00157
00158 protected:
00159 OCRModule* algorithms() const;
00160
00161
00162
00163 inline void envIs(Env* env) { this->_env = env; }
00164 inline void fileIs(const std::string & file) { this->_file = file; }
00165 virtual int type() const { return Type; }
00166 inline void imageIs(Image* image) { this->_image = image; }
00167
00168 private:
00169
00170
00171 inline Env* & envRef() { return this->_env; }
00172 inline std::string & fileRef() { return this->_file; }
00173 inline Image* & imageRef() { return this->_image; }
00174
00175
00176
00177 static const ElementType Type = ELEMENT_PAGE;
00178
00196 Env* _env;
00197
00198
00199
00200
00201
00202
00203
00204 std::string _file;
00205
00216 Image* _image;
00217 };
00218 };
00219
00220
00221 # include "Env.h"
00222
00223 # endif // Page_h
00224