27 #ifndef SCRIBO_TABLE_REBUILD_HH
28 # define SCRIBO_TABLE_REBUILD_HH
34 # include <mln/core/concept/image.hh>
35 # include <mln/core/alias/neighb2d.hh>
36 # include <mln/labeling/background.hh>
37 # include <mln/util/array.hh>
38 # include <mln/util/couple.hh>
39 # include <mln/value/label_8.hh>
40 # include <mln/literal/colors.hh>
42 # include <scribo/table/align_lines_verticaly.hh>
43 # include <scribo/table/align_lines_horizontaly.hh>
44 # include <scribo/table/connect_vertical_lines.hh>
45 # include <scribo/table/connect_horizontal_lines.hh>
46 # include <scribo/table/repair_horizontal_lines.hh>
47 # include <scribo/table/repair_vertical_lines.hh>
49 # include <scribo/debug/save_table_image.hh>
77 template <
typename I,
typename L>
82 const component_set<L>& vlines,
83 const component_set<L>& hlines,
84 unsigned max_dist_lines,
85 mln_value(L)& ncells);
88 # ifndef MLN_INCLUDE_ONLY
91 template <
typename I,
typename L>
96 const component_set<L>& vlines,
97 const component_set<L>& hlines,
98 unsigned max_dist_lines,
101 mln_trace(
"scribo::table::rebuild");
102 const I& input =
exact(input_);
104 mlc_equal(mln_value(I),
bool)::check();
105 mln_precondition(input.is_valid());
107 # ifndef SCRIBO_DEBUG
109 literal::red,
"table-raw.ppm");
115 # ifndef SCRIBO_DEBUG
117 literal::red,
"table-aligned.ppm");
123 # ifndef SCRIBO_DEBUG
125 literal::red,
"table-repaired.ppm");
132 # ifndef SCRIBO_DEBUG
134 literal::red,
"table-connected.ppm");
139 initialize(res, input);
141 for_all_comps(i, vlines)
142 mln::draw::
box(res, vlines(i).
bbox(), true);
143 for_all_comps(i, hlines)
144 mln::draw::
box(res, hlines(i).bbox(), true);
148 return mln::make::couple(lbl,
149 mln::make::couple(vlines, hlines));
153 # endif // ! MLN_INCLUDE_ONLY
159 #endif // ! SCRIBO_TABLE_REBUILD_HH