PAGE_RES_IT Class Reference

#include <pageres.h>

List of all members.


Detailed Description

Page results iterator.

Definition at line 296 of file pageres.h.

Public Member Functions

Public Attributes

Private Attributes


Constructor & Destructor Documentation

PAGE_RES_IT::PAGE_RES_IT (  )  [inline]

Definition at line 301 of file pageres.h.

00301                   { 
00302     }                            //empty contructor

PAGE_RES_IT::PAGE_RES_IT ( PAGE_RES the_page_res  )  [inline]

Definition at line 304 of file pageres.h.

References page_res, and restart_page().

00305                                         {  //page result
00306       page_res = the_page_res;
00307       restart_page();  //ready to scan
00308     }


Member Function Documentation

BLOCK_RES* PAGE_RES_IT::block (  )  [inline]

Definition at line 336 of file pageres.h.

References block_res.

Referenced by doc_and_block_rejection(), output_pass(), unrej_good_quality_words(), and write_results().

00336                        {  //block of cur. word
00337       return block_res;
00338     }

WERD_RES* PAGE_RES_IT::forward (  )  [inline]

Definition at line 315 of file pageres.h.

References FALSE, and internal_forward().

Referenced by doc_and_block_rejection(), font_recognition_pass(), output_pass(), recog_all_words(), reject_whole_page(), TessBaseAPI::TesseractToText(), tilde_crunch(), tilde_delete(), and unrej_good_quality_words().

00315                         {  //get next word
00316       return internal_forward (FALSE);
00317     }

WERD_RES * PAGE_RES_IT::forward_block (  ) 

Move to the first word of the next block

Can be followed by subsequent calls to forward() BUT at the first word in the block, the prev block, row and word are all NULL.

Definition at line 284 of file pageres.cpp.

References block_res, block_res_it, FALSE, internal_forward(), next_block_res, next_row_res, next_word_res, NULL, row_res, TRUE, and word_res.

00284                                      { 
00285   if (block_res == next_block_res) {
00286     block_res_it.forward ();;
00287     block_res = NULL;
00288     row_res = NULL;
00289     word_res = NULL;
00290     next_block_res = NULL;
00291     next_row_res = NULL;
00292     next_word_res = NULL;
00293     internal_forward(TRUE); 
00294   }
00295   return internal_forward (FALSE);
00296 }

WERD_RES * PAGE_RES_IT::internal_forward ( BOOL8  new_block  ) 

Find the next word on the page. Empty blocks and rows are skipped.

The iterator maintains pointers to block, row and word for the previous, current and next words. These are correct, regardless of block/row boundaries. NULL values denote start and end of the page.

Definition at line 225 of file pageres.cpp.

References block_res, block_res_it, FALSE, next_block_res, next_row_res, next_word_res, NULL, prev_block_res, prev_row_res, prev_word_res, row_res, row_res_it, TRUE, word_res, and word_res_it.

Referenced by forward(), forward_block(), and restart_page().

00225                                                        { 
00226   BOOL8 found_next_word = FALSE;
00227   BOOL8 new_row = FALSE;
00228 
00229   prev_block_res = block_res;
00230   prev_row_res = row_res;
00231   prev_word_res = word_res;
00232   block_res = next_block_res;
00233   row_res = next_row_res;
00234   word_res = next_word_res;
00235 
00236   while (!found_next_word && !block_res_it.cycled_list ()) {
00237     if (new_block) {
00238       new_block = FALSE;
00239       row_res_it.set_to_list (&block_res_it.data ()->row_res_list);
00240       row_res_it.mark_cycle_pt ();
00241       new_row = TRUE;
00242     }
00243     while (!found_next_word && !row_res_it.cycled_list ()) {
00244       if (new_row) {
00245         new_row = FALSE;
00246         word_res_it.set_to_list (&row_res_it.data ()->word_res_list);
00247         word_res_it.mark_cycle_pt ();
00248       }
00249       while (!found_next_word && !word_res_it.cycled_list ()) {
00250         next_block_res = block_res_it.data ();
00251         next_row_res = row_res_it.data ();
00252         next_word_res = word_res_it.data ();
00253         found_next_word = TRUE;
00254         do {
00255           word_res_it.forward ();
00256         }
00257         while (word_res_it.data ()->part_of_combo);
00258       }
00259       if (!found_next_word) {    //end of row reached
00260         row_res_it.forward ();
00261         new_row = TRUE;
00262       }
00263     }
00264     if (!found_next_word) {      //end of block reached
00265       block_res_it.forward ();
00266       new_block = TRUE;
00267     }
00268   }
00269   if (!found_next_word) {        //end of page reached
00270     next_block_res = NULL;
00271     next_row_res = NULL;
00272     next_word_res = NULL;
00273   }
00274   return word_res;
00275 }

BLOCK_RES* PAGE_RES_IT::next_block (  )  [inline]

Definition at line 345 of file pageres.h.

References next_block_res.

Referenced by output_pass().

00345                             {  //block of next word
00346       return next_block_res;
00347     }

ROW_RES* PAGE_RES_IT::next_row (  )  [inline]

Definition at line 342 of file pageres.h.

References next_row_res.

00342                         {  //row of next word
00343       return next_row_res;
00344     }

WERD_RES* PAGE_RES_IT::next_word (  )  [inline]

Definition at line 339 of file pageres.h.

References next_word_res.

Referenced by output_pass().

00339                           {  //next word
00340       return next_word_res;
00341     }

BLOCK_RES* PAGE_RES_IT::prev_block (  )  [inline]

Definition at line 327 of file pageres.h.

References prev_block_res.

00327                             {  //block of prev word
00328       return prev_block_res;
00329     }

ROW_RES* PAGE_RES_IT::prev_row (  )  [inline]

Definition at line 324 of file pageres.h.

References prev_row_res.

Referenced by doc_and_block_rejection().

00324                         {  //row of prev word
00325       return prev_row_res;
00326     }

WERD_RES* PAGE_RES_IT::prev_word (  )  [inline]

Definition at line 321 of file pageres.h.

References prev_word_res.

00321                           {  //previous word
00322       return prev_word_res;
00323     }

void PAGE_RES_IT::rej_stat_word (  ) 

What does this do?

Definition at line 302 of file pageres.cpp.

References block_res, ROW_RES::char_count, BLOCK_RES::char_count, REJMAP::length(), page_res, ROW_RES::rej_count, BLOCK_RES::rej_count, REJMAP::reject_count(), WERD_RES::reject_map, row_res, ROW_RES::whole_word_rej_count, and word_res.

Referenced by recog_all_words(), and unrej_good_quality_words().

00302                                 { 
00303   INT16 chars_in_word;
00304   INT16 rejects_in_word = 0;
00305 
00306   chars_in_word = word_res->reject_map.length ();
00307   page_res->char_count += chars_in_word;
00308   block_res->char_count += chars_in_word;
00309   row_res->char_count += chars_in_word;
00310 
00311   rejects_in_word = word_res->reject_map.reject_count ();
00312 
00313   page_res->rej_count += rejects_in_word;
00314   block_res->rej_count += rejects_in_word;
00315   row_res->rej_count += rejects_in_word;
00316   if (chars_in_word == rejects_in_word)
00317     row_res->whole_word_rej_count += rejects_in_word;
00318 }

WERD_RES * PAGE_RES_IT::restart_page (  ) 

Set things up at the start of the page

Definition at line 204 of file pageres.cpp.

References block_res, block_res_it, FALSE, internal_forward(), next_block_res, next_row_res, next_word_res, NULL, page_res, row_res, TRUE, and word_res.

Referenced by doc_and_block_rejection(), font_recognition_pass(), output_pass(), PAGE_RES_IT(), recog_all_words(), reject_whole_page(), TessBaseAPI::TesseractToText(), tilde_crunch(), tilde_delete(), and unrej_good_quality_words().

00204                                     { 
00205   block_res_it.set_to_list (&page_res->block_res_list);
00206   block_res_it.mark_cycle_pt ();
00207   block_res = NULL;
00208   row_res = NULL;
00209   word_res = NULL;
00210   next_block_res = NULL;
00211   next_row_res = NULL;
00212   next_word_res = NULL;
00213   internal_forward(TRUE); 
00214   return internal_forward (FALSE);
00215 }

ROW_RES* PAGE_RES_IT::row (  )  [inline]

Definition at line 333 of file pageres.h.

References row_res.

Referenced by doc_and_block_rejection(), font_recognition_pass(), recog_all_words(), unrej_good_quality_words(), and write_results().

00333                    {  //row of current word
00334       return row_res;
00335     }

WERD_RES* PAGE_RES_IT::word (  )  [inline]

Definition at line 330 of file pageres.h.

References word_res.

Referenced by doc_and_block_rejection(), font_recognition_pass(), output_pass(), recog_all_words(), reject_whole_page(), TessBaseAPI::TesseractToText(), tilde_crunch(), tilde_delete(), unrej_good_quality_words(), and write_results().

00330                      {  //current word
00331       return word_res;
00332     }


Member Data Documentation

BLOCK_RES* PAGE_RES_IT::block_res [private]

Definition at line 357 of file pageres.h.

Referenced by block(), forward_block(), internal_forward(), rej_stat_word(), and restart_page().

BLOCK_RES_IT PAGE_RES_IT::block_res_it [private]

Definition at line 363 of file pageres.h.

Referenced by forward_block(), internal_forward(), and restart_page().

BLOCK_RES* PAGE_RES_IT::next_block_res [private]

Definition at line 361 of file pageres.h.

Referenced by forward_block(), internal_forward(), next_block(), and restart_page().

ROW_RES* PAGE_RES_IT::next_row_res [private]

Definition at line 360 of file pageres.h.

Referenced by forward_block(), internal_forward(), next_row(), and restart_page().

WERD_RES* PAGE_RES_IT::next_word_res [private]

Definition at line 359 of file pageres.h.

Referenced by forward_block(), internal_forward(), next_word(), and restart_page().

PAGE_RES* PAGE_RES_IT::page_res

Definition at line 299 of file pageres.h.

Referenced by doc_and_block_rejection(), PAGE_RES_IT(), rej_stat_word(), reject_whole_page(), restart_page(), and unrej_good_quality_words().

BLOCK_RES* PAGE_RES_IT::prev_block_res [private]

Definition at line 353 of file pageres.h.

Referenced by internal_forward(), and prev_block().

ROW_RES* PAGE_RES_IT::prev_row_res [private]

Definition at line 352 of file pageres.h.

Referenced by internal_forward(), and prev_row().

WERD_RES* PAGE_RES_IT::prev_word_res [private]

Definition at line 351 of file pageres.h.

Referenced by internal_forward(), and prev_word().

ROW_RES* PAGE_RES_IT::row_res [private]

Definition at line 356 of file pageres.h.

Referenced by forward_block(), internal_forward(), rej_stat_word(), restart_page(), and row().

ROW_RES_IT PAGE_RES_IT::row_res_it [private]

Definition at line 364 of file pageres.h.

Referenced by internal_forward().

WERD_RES* PAGE_RES_IT::word_res [private]

Definition at line 355 of file pageres.h.

Referenced by forward_block(), internal_forward(), rej_stat_word(), restart_page(), and word().

WERD_RES_IT PAGE_RES_IT::word_res_it [private]

Definition at line 365 of file pageres.h.

Referenced by internal_forward().


The documentation for this class was generated from the following files:
Generated on Wed Feb 28 19:49:33 2007 for Tesseract by  doxygen 1.5.1