Commit 8754f621 authored by Baptiste Esteban's avatar Baptiste Esteban
Browse files

Fix pipeline

parent 0697169a
Pipeline #28143 passed with stage
in 20 minutes and 40 seconds
......@@ -14,7 +14,7 @@ Alpha Tree
:param input: The input image
:param nbh: The neighborhood
:param dist: The function weighting the edges between two pixels
:param dist: The function weighting the edges between two pixels. For grayscale images, this is generally the absolute difference between two values.
:return: A pair `(tree, node_map)` where *tree* is of type ``component_tree<std::invoke_result_t<F, image_value_t<Image>, image_value_t<Image>>>`` and *node_map* is a mapping between the image pixels and the node of the tree.
.. rubric:: Requirements
......
......@@ -15,13 +15,11 @@ void process_example(const mln::image2d<V>& img, const std::string& cut_filename
// 2. Build the alphatree
auto [t, nm] = mln::morpho::alphatree(img, mln::c4);
using th_value_type = decltype(t.values)::value_type;
// 3. Compute the mean attribute
auto mean = t.compute_attribute_on_values(nm, img, mln::accu::accumulators::mean<V>());
// 4. Compute a cut of the alphatree
auto cut_nm = t.horizontal_cut(th_value_type(threshold), nm);
auto cut_nm = t.horizontal_cut(threshold, nm);
// 5. Labelize the cut
auto cut = t.reconstruct_from(cut_nm, ::ranges::make_span(mean));
......
......@@ -388,7 +388,7 @@ namespace mln::morpho
for (std::size_t node = 0; node < parent.size(); ++node)
{
int parent_node = parent[node];
root_cut_cc[node] = levels[parent_node] > threshold ? node : root_cut_cc[parent_node];
root_cut_cc[node] = levels[parent_node] > threshold ? static_cast<int>(node) : root_cut_cc[parent_node];
}
auto out = mln::clone(nodemap);
......
......@@ -386,9 +386,10 @@ TEST(Morpho, AlphaTreeCutMeanLabelization)
auto [t, nm] = mln::morpho::alphatree(ima, mln::c4);
auto val = t.compute_attribute_on_values(nm, ima, mln::accu::accumulators::mean<std::uint8_t, std::uint8_t>());
auto make_cut = [&t, &nm, &val](const typename decltype(t.values)::value_type threshold) {
auto lbl = t.horizontal_cut(threshold, nm);
return t.reconstruct_from(lbl, ::ranges::make_span(val));
// Renaming t and nm because clang does not allow to capture structured bindings
auto make_cut = [&lt=t, &lnm=nm, &val](const typename decltype(t.values)::value_type threshold) {
auto lbl = lt.horizontal_cut(threshold, lnm);
return lt.reconstruct_from(lbl, ::ranges::make_span(val));
};
ASSERT_IMAGES_EQ_EXP(make_cut(0), ima);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment