20 #ifndef TESSERACT_IMAGE_IMAGEDATA_H_ 21 #define TESSERACT_IMAGE_IMAGEDATA_H_ 64 int* max_x,
int* max_y);
70 int x()
const {
return x_; }
71 int y()
const {
return y_; }
72 int dir()
const {
return dir_; }
115 const char* imagedata,
int imagedatasize,
116 const char* truth_text,
const char*
box_text);
127 return imagefilename_;
130 imagefilename_ = name;
148 return transcription_;
157 return box_texts_[index];
169 Pix*
PreScale(
int target_height,
int max_height,
float* scale_factor,
170 int* scaled_width,
int* scaled_height,
195 int32_t page_number_;
214 bool LoadDocument(
const char* filename,
int start_page, int64_t max_memory,
227 return document_name_;
260 pages_[index] =
nullptr;
274 void set_total_pages(
int total) {
276 total_pages_ = total;
290 PointerVector<ImageData> pages_;
296 int64_t memory_used_;
306 mutable SVMutex general_mutex_;
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);
371 int num_pages_per_doc_;
379 #endif // TESSERACT_IMAGE_IMAGEDATA_H_ void AddPageToDocument(ImageData *page)
bool Serialize(FILE *fp) const
const GenericVector< TBOX > & boxes() const
friend void * ReCachePagesFunc(void *data)
const ImageData * GetPage(int index)
void LoadPageInBackground(int index)
bool Serialize(TFile *fp) const
const STRING & language() const
bool SaveToBuffer(GenericVector< char > *buffer)
const ImageData * GetPageBySerial(int serial)
DocumentCache(int64_t max_memory)
DocumentData(const STRING &name)
const STRING & imagefilename() const
void SetDocument(const char *filename, int64_t max_memory, FileReader reader)
int64_t memory_used() const
const GenericVector< STRING > & box_texts() const
Pix * PreScale(int target_height, int max_height, float *scale_factor, int *scaled_width, int *scaled_height, GenericVector< TBOX > *boxes) const
const STRING & document_name() const
bool DeSerialize(TFile *fp)
const GenericVector< char > & image_data() const
const STRING & transcription() const
static ImageData * Build(const char *name, int page_number, const char *lang, const char *imagedata, int imagedatasize, const char *truth_text, const char *box_text)
bool AddToCache(DocumentData *data)
void set_imagefilename(const STRING &name)
bool(* FileReader)(const STRING &filename, GenericVector< char > *data)
const STRING & box_text(int index) const
ImageData * TakePage(int index)
bool IsPageAvailable(int index, ImageData **page)
void AddBoxes(const GenericVector< TBOX > &boxes, const GenericVector< STRING > &texts, const GenericVector< int > &box_pages)
DocumentData * FindDocument(const STRING &document_name) const
static void FromWordFeatures(const GenericVector< WordFeature > &word_features, GenericVector< FloatWordFeature > *float_features)
static void Draw(const GenericVector< WordFeature > &features, ScrollView *window)
bool LoadDocuments(const GenericVector< STRING > &filenames, CachingStrategy cache_strategy, FileReader reader)
bool LoadDocument(const char *filename, int start_page, int64_t max_memory, FileReader reader)
bool DeSerialize(bool swap, FILE *fp)
bool SaveDocument(const char *filename, FileWriter writer)
const PointerVector< DocumentData > & documents() const
static int SortByXBucket(const void *, const void *)
void set_language(const STRING &lang)
static bool SkipDeSerialize(TFile *fp)
bool(* FileWriter)(const GenericVector< char > &data, const STRING &filename)
void set_page_number(int num)
static void ComputeSize(const GenericVector< WordFeature > &features, int *max_x, int *max_y)
const int kFeaturePadding