26 #ifndef SCRIBO_PRIMITIVE_LINK_INTERNAL_LINK_SINGLE_DMAX_RATIO_ALIGNED_DELTA_BASE_HH_
27 # define SCRIBO_PRIMITIVE_LINK_INTERNAL_LINK_SINGLE_DMAX_RATIO_ALIGNED_DELTA_BASE_HH_
35 # include <mln/accu/center.hh>
36 # include <mln/labeling/compute.hh>
37 # include <mln/math/abs.hh>
38 # include <mln/math/max.hh>
39 # include <mln/util/array.hh>
40 # include <mln/value/rgb8.hh>
41 # include <mln/draw/line.hh>
42 # include <mln/literal/colors.hh>
43 # include <mln/norm/l1.hh>
45 # include <scribo/core/macros.hh>
46 # include <scribo/core/tag/anchor.hh>
47 # include <scribo/core/component_set.hh>
48 # include <scribo/core/object_links.hh>
49 # include <scribo/core/concept/dmax_functor.hh>
51 # include <scribo/debug/logger.hh>
53 # include <scribo/primitive/link/internal/link_single_dmax_ratio_base.hh>
54 # include <scribo/filter/internal/component_aligned.hh>
68 using namespace scribo::debug;
71 template <
typename L,
typename F,
typename E>
78 typedef mln_site(L) P;
84 anchor::Direction delta_direction)
85 :
super_(components, anchor::Horizontal,
exact(dmax_f)),
86 delta_pixel_(delta_pixel), delta_direction_(delta_direction)
93 start_point_(
unsigned current_object, anchor::Type anchor)
95 return link::internal::compute_anchor(this->components_,
96 current_object, anchor);
102 valid_link_(
unsigned current_object,
103 const P& start_point,
107 if (!super_::valid_link_(current_object, start_point, p, anchor))
114 p1 = compute_anchor(this->components_, current_object, anchor),
115 p2 = compute_anchor(this->components_, this->labeled_image_(p),
118 return std::abs(p1[this->delta_direction_]
119 - p2[this->delta_direction_]) <= delta_pixel_;
123 void validate_link_(
unsigned current_object,
124 const P& start_point,
128 super_::validate_link_(current_object, start_point, p, anchor);
131 void invalidate_link_(
unsigned current_object,
132 const P& start_point,
136 super_::invalidate_link_(current_object, start_point, p, anchor);
140 anchor::Direction delta_direction_;
144 # ifndef MLN_INCLUDE_ONLY
147 # endif // ! MLN_INCLUDE_ONLY
159 #endif // SCRIBO_PRIMITIVE_LINK_INTERNAL_LINK_SINGLE_DMAX_RATIO_ALIGNED_DELTA_BASE_HH_