Stats<floating_t> stats_downward_links(const Pyramid& p, const Node& node) { using accumulators::extract::sum; using accumulators::stat_acc; namespace tag = accumulators::tag; using accumulators::left; auto acc = stat_acc<floating_t>{tag::tail<left>::cache_size = 16}; for (const auto& desc : common::descs(node)) { acc(p.get_links()(node, desc)); } return Stats<floating_t>{"down links", node.level, acc}; }
void print_stats(const Pyramid& p, level_t lv) { using namespace stats; if (lv > 0) { std::cout << std::endl << analyse_weights(p.get_links(), lv); } std::cout << std::endl << detail::analyse("area", p.get_area()[lv]); std::cout << std::endl << detail::analyse("looks", p.get_looks()[lv]); std::cout << std::endl << detail::analyse("var", p.get_var()[lv]); std::cout << std::endl << detail::analyse("v1_00", p.get_value1()[lv], 0); std::cout << std::endl << detail::analyse("v1_11", p.get_value1()[lv], 1); std::cout << std::endl << detail::analyse("v1_22", p.get_value1()[lv], 2); std::cout << std::endl << detail::analyse("v2_00", p.get_value2()[lv], 0); std::cout << std::endl << detail::analyse("v2_11", p.get_value2()[lv], 1); std::cout << std::endl << detail::analyse("v2_22", p.get_value2()[lv], 2); std::cout << std::endl; }
void smooth_helper(Pyramid& p, smooth_level_fun smooth, const size_t top_level) { using boost::irange; using boost::adaptors::reversed; using namespace std; auto cnt = 0; auto v_copy = ImagePyramid{p.get_value2()}; auto w_copy = LinkPyramid{p.get_links()}; auto levels = irange(0ul, top_level + 1); for (const auto lv : levels | reversed) { cout << "Smoothing Level " << lv << " ... "; cnt += smooth(v_copy, w_copy, lv); cout << endl; } p.set_result(v_copy.bottom()); cout << "Done." << endl; cout << "Number of Segments: " << cnt << endl; }