20 #ifndef TESSERACT_IMAGE_IMAGEDATA_H_ 21 #define TESSERACT_IMAGE_IMAGEDATA_H_ 23 #include "genericvector.h" 64 int* max_x,
int* max_y);
70 int x()
const {
return x_; }
71 int y()
const {
return y_; }
92 static int SortByXBucket(
const void*,
const void*);
114 static ImageData* Build(
const char* name,
int page_number,
const char* lang,
115 const char* imagedata,
int imagedatasize,
116 const char* truth_text,
const char* box_text);
123 static bool SkipDeSerialize(
TFile* fp);
127 return imagefilename_;
130 imagefilename_ = name;
148 return transcription_;
157 return box_texts_[index];
160 void SetPix(Pix* pix);
169 Pix* PreScale(
int target_height,
int max_height,
float* scale_factor,
170 int* scaled_width,
int* scaled_height,
173 int MemoryUsed()
const;
176 void Display()
const;
191 bool AddBoxes(
const char* box_text);
214 bool LoadDocument(
const char* filename,
int start_page, int64_t max_memory,
217 void SetDocument(
const char* filename, int64_t max_memory,
FileReader reader);
219 bool SaveDocument(
const char* filename,
FileWriter writer);
227 return document_name_;
248 void LoadPageInBackground(
int index);
255 bool IsPageAvailable(
int index,
ImageData** page);
260 pages_[index] =
nullptr;
276 total_pages_ = total;
280 memory_used_ = memory_used;
322 num_pages_per_doc_ = 0;
339 return GetPageSequential(serial);
341 return GetPageRoundRobin(serial);
355 const ImageData* GetPageRoundRobin(
int serial);
359 const ImageData* GetPageSequential(
int serial);
363 int CountNeighbourDocs(
int index,
int dir);
379 #endif // TESSERACT_IMAGE_IMAGEDATA_H_ GenericVector< char > image_data_
Definition: imagedata.h:196
void Clear()
Definition: imagedata.h:320
int64_t max_memory_
Definition: imagedata.h:373
const STRING & document_name() const
Definition: imagedata.h:225
const STRING & transcription() const
Definition: imagedata.h:147
void * ReCachePagesFunc(void *data)
Definition: imagedata.cpp:369
ImageData * TakePage(int index)
Definition: imagedata.h:257
int NumPages() const
Definition: imagedata.h:229
PointerVector< DocumentData > documents_
Definition: imagedata.h:366
int16_t x_
Definition: imagedata.h:81
STRING document_name_
Definition: imagedata.h:288
STRING language_
Definition: imagedata.h:197
CachingStrategy
Definition: imagedata.h:42
Definition: imagedata.h:105
GenericVector< STRING > box_texts_
Definition: imagedata.h:200
const GenericVector< char > & image_data() const
Definition: imagedata.h:138
const GenericVector< TBOX > & boxes() const
Definition: imagedata.h:150
bool Serialize(FILE *fp) const
Definition: imagedata.cpp:86
int page_number() const
Definition: imagedata.h:132
void set_page_number(int num)
Definition: imagedata.h:135
const STRING & box_text(int index) const
Definition: imagedata.h:156
Definition: imagedata.h:314
float x
Definition: imagedata.h:94
GenericVector< TBOX > boxes_
Definition: imagedata.h:199
const STRING & imagefilename() const
Definition: imagedata.h:126
bool vertical_text_
Definition: imagedata.h:201
bool(* FileReader)(const STRING &filename, GenericVector< char > *data)
Definition: genericvector.h:360
Definition: serialis.h:77
int x() const
Definition: imagedata.h:70
const int kImagePadding
Definition: imagedata.h:39
const GenericVector< STRING > & box_texts() const
Definition: imagedata.h:153
Definition: baseapi.cpp:94
const int kFeaturePadding
Definition: imagedata.h:37
PointerVector< ImageData > pages_
Definition: imagedata.h:290
int32_t page_number_
Definition: imagedata.h:195
int total_pages_
Definition: imagedata.h:294
bool(* FileWriter)(const GenericVector< char > &data, const STRING &filename)
Definition: genericvector.h:363
SVMutex general_mutex_
Definition: imagedata.h:306
bool DeSerialize(bool swap, FILE *fp)
Definition: imagedata.cpp:93
int dir() const
Definition: imagedata.h:72
uint8_t dir_
Definition: imagedata.h:83
bool IsCached() const
Definition: imagedata.h:265
int64_t memory_used_
Definition: imagedata.h:296
const PointerVector< DocumentData > & documents() const
Definition: imagedata.h:344
Definition: imagedata.h:54
STRING imagefilename_
Definition: imagedata.h:194
float y
Definition: imagedata.h:95
void set_language(const STRING &lang)
Definition: imagedata.h:144
static void ComputeSize(const GenericVector< WordFeature > &features, int *max_x, int *max_y)
Definition: imagedata.cpp:58
Definition: imagedata.h:88
void set_memory_used(int64_t memory_used)
Definition: imagedata.h:278
float dir
Definition: imagedata.h:96
const STRING & language() const
Definition: imagedata.h:141
FileReader reader_
Definition: imagedata.h:300
Definition: genericvector.h:457
int64_t memory_used() const
Definition: imagedata.h:233
Definition: imagedata.h:49
const ImageData * GetPageBySerial(int serial)
Definition: imagedata.h:337
int x_bucket
Definition: imagedata.h:97
Definition: imagedata.h:205
STRING transcription_
Definition: imagedata.h:198
CachingStrategy cache_strategy_
Definition: imagedata.h:368
void set_imagefilename(const STRING &name)
Definition: imagedata.h:129
int64_t max_memory_
Definition: imagedata.h:298
SVMutex pages_mutex_
Definition: imagedata.h:303
int y() const
Definition: imagedata.h:71
static void Draw(const GenericVector< WordFeature > &features, ScrollView *window)
Definition: imagedata.cpp:69
Definition: imagedata.h:57
WordFeature()
Definition: imagedata.cpp:48
int pages_offset_
Definition: imagedata.h:292
void set_total_pages(int total)
Definition: imagedata.h:274
int num_pages_per_doc_
Definition: imagedata.h:371
uint8_t y_
Definition: imagedata.h:82