Commit 8d7a72d5 authored by Baptiste Esteban's avatar Baptiste Esteban
Browse files

Add mtos to the public API

parent a9eb755c
Pipeline #30538 canceled with stages
in 21 minutes and 58 seconds
...@@ -86,6 +86,7 @@ target_sources(Pylene-core PRIVATE ...@@ -86,6 +86,7 @@ target_sources(Pylene-core PRIVATE
src/morpho/hvector_unbounded.cpp src/morpho/hvector_unbounded.cpp
src/morpho/immersion.cpp src/morpho/immersion.cpp
src/morpho/maxtree.cpp src/morpho/maxtree.cpp
src/morpho/mtos.cpp
src/morpho/satmaxtree.cpp src/morpho/satmaxtree.cpp
src/morpho/trees_fusion.cpp src/morpho/trees_fusion.cpp
src/morpho/unionfind.cpp src/morpho/unionfind.cpp
......
#pragma once
#include <mln/core/colors.hpp>
#include <mln/morpho/component_tree.hpp>
#include <tuple>
namespace mln::morpho
{
std::pair<component_tree<>, image2d<int>> mtos(image2d<rgb8> ima, point2d pstart);
}
\ No newline at end of file
#include <mln/core/image/view/channel.hpp>
#include <mln/morpho/private/satmaxtree.hpp>
#include <mln/morpho/private/trees_fusion.hpp>
#include <mln/morpho/mtos.hpp>
#include <mln/morpho/tos.hpp>
namespace mln::morpho
{
std::pair<component_tree<>, image2d<int>> mtos(image2d<rgb8> ima, point2d pstart)
{
mln::morpho::component_tree<> trees[3];
mln::image2d<int> nodemaps[3];
std::vector<int> depths[3];
for (int c = 0; c < 3; c++)
{
std::tie(trees[c], nodemaps[c]) = mln::morpho::tos(mln::view::channel(ima, c), pstart);
depths[c] = trees[c].compute_depth();
}
const auto [gos, tree_to_graph] = mln::morpho::details::compute_inclusion_graph(trees, nodemaps, depths, 3);
auto depth_map = mln::morpho::details::compute_depth_map(gos, tree_to_graph, nodemaps);
auto [t, nm] = mln::morpho::details::satmaxtree(depth_map);
return {std::move(t), std::move(nm)};
}
} // namespace mln::morpho
\ No newline at end of file
Markdown is supported
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