39 #ifndef MORPHO_MAX_TREE_CRITERIA_H_
40 #define MORPHO_MAX_TREE_CRITERIA_H_
46 #include "DMorphoHierarQ.hpp"
53 template <
class Attr_T>
66 virtual void initialize() = 0;
67 virtual void reset() = 0;
69 virtual void update(
const size_t x,
const size_t y,
const size_t z) = 0;
70 virtual bool operator<(
const Attr_T &other_attribute) = 0;
71 Attr_T getAttributeValue()
74 return attribute_value_;
78 virtual void compute() = 0;
81 Attr_T attribute_value_;
99 virtual void initialize()
101 attribute_value_ = 1;
106 attribute_value_ = 0;
114 dynamic_cast<AreaCriterion &
>(*other_criteron).attribute_value_;
117 virtual void update(SMIL_UNUSED
const size_t x, SMIL_UNUSED
const size_t y,
118 SMIL_UNUSED
const size_t z)
120 attribute_value_ += 1;
122 virtual bool operator<(
const size_t &other_attribute)
124 return (attribute_value_ < other_attribute);
128 virtual void compute()
148 virtual void initialize()
150 attribute_value_ = 0;
152 y_max_ = std::numeric_limits<size_t>::min();
153 y_min_ = std::numeric_limits<size_t>::max();
171 virtual void update(SMIL_UNUSED
const size_t x,
const size_t y,
172 SMIL_UNUSED
const size_t z)
174 y_max_ = std::max(y_max_, y);
175 y_min_ = std::min(y_min_, y);
177 virtual bool operator<(
const size_t &other_attribute)
179 return (attribute_value_ < other_attribute);
183 virtual void compute()
185 attribute_value_ = y_max_ - y_min_ + 1;
209 virtual void initialize()
211 attribute_value_ = 0;
213 x_max_ = std::numeric_limits<size_t>::min();
214 x_min_ = std::numeric_limits<size_t>::max();
226 x_max_ = std::max(x_max_,
228 x_min_ = std::min(x_min_,
232 virtual void update(
const size_t x, SMIL_UNUSED
const size_t y,
233 SMIL_UNUSED
const size_t z)
235 x_max_ = std::max(x_max_, x);
236 x_min_ = std::min(x_min_, x);
238 virtual bool operator<(
const size_t &other_attribute)
240 return (attribute_value_ < other_attribute);
244 virtual void compute()
246 attribute_value_ = x_max_ - x_min_ + 1;
280 virtual void initialize()
282 attribute_value_.H = 1;
283 attribute_value_.A = 0;
286 y_max_ = std::numeric_limits<size_t>::min();
287 y_min_ = std::numeric_limits<size_t>::max();
299 attribute_value_.A +=
300 dynamic_cast<HACriterion &
>(*other_criteron).getAttributeValue().A;
303 std::max(y_max_,
dynamic_cast<HACriterion &
>(*other_criteron).y_max_);
305 std::min(y_min_,
dynamic_cast<HACriterion &
>(*other_criteron).y_min_);
308 virtual void update(SMIL_UNUSED
const size_t x,
const size_t y,
309 SMIL_UNUSED
const size_t z)
311 attribute_value_.A += 1;
312 y_max_ = std::max(y_max_, y);
313 y_min_ = std::min(y_min_, y);
315 virtual bool operator<(
const HA &other_attribute)
317 return (attribute_value_.H < other_attribute.H);
321 virtual void compute()
323 attribute_value_.H = y_max_ - y_min_ + 1;
347 virtual void initialize()
349 attribute_value_.H = 1;
350 attribute_value_.W = 1;
351 attribute_value_.A = 0;
354 x_max_ = std::numeric_limits<size_t>::min();
355 x_min_ = std::numeric_limits<size_t>::max();
357 y_max_ = std::numeric_limits<size_t>::min();
358 y_min_ = std::numeric_limits<size_t>::max();
370 attribute_value_.A +=
371 dynamic_cast<HWACriterion &
>(*other_criteron).getAttributeValue().A;
373 x_max_ = std::max(x_max_,
375 x_min_ = std::min(x_min_,
378 y_max_ = std::max(y_max_,
380 y_min_ = std::min(y_min_,
384 virtual void update(
const size_t x,
const size_t y,
385 SMIL_UNUSED
const size_t z)
387 attribute_value_.A += 1;
388 x_max_ = std::max(x_max_, x);
389 x_min_ = std::min(x_min_, x);
392 y_max_ = std::max(y_max_, y);
393 y_min_ = std::min(y_min_, y);
395 virtual bool operator<(
const HWA &other_attribute)
397 return (attribute_value_.H < other_attribute.H);
401 virtual void compute()
403 attribute_value_.W = x_max_ - x_min_ + 1;
404 attribute_value_.H = y_max_ - y_min_ + 1;
Area criterion. Useful for Area Opening/Closing algorithms based on max-tree.
Definition: DMorphoMaxTreeCriteria.hpp:87
Generic criterion for the max-tree. A user-defined criterion should be derived from this class.
Definition: DMorphoMaxTreeCriteria.hpp:55
HeightArea criterion. Useful for Height Opening/Closing algorithms based on max-tree.
Definition: DMorphoMaxTreeCriteria.hpp:268
HeightArea criterion. Useful for Height Opening/Closing algorithms based on max-tree.
Definition: DMorphoMaxTreeCriteria.hpp:335
Height criterion. Useful for Height Opening/Closing algorithms based on max-tree.
Definition: DMorphoMaxTreeCriteria.hpp:136
Width criterion. Useful for Width Opening/Closing algorithms based on max-tree.
Definition: DMorphoMaxTreeCriteria.hpp:197
Definition: DMorphoMaxTreeCriteria.hpp:255
Definition: DMorphoMaxTreeCriteria.hpp:259