Commit 2fcf9e57 authored by Baptiste Esteban's avatar Baptiste Esteban
Browse files

Finish doc + format

parent d72ab3b6
Pipeline #30578 passed with stage
in 23 minutes and 41 seconds
......@@ -16,18 +16,19 @@ Pylene.
:param ima: The input image in RGB format.
:param pstart: The rooting point
:return: A tree of type ``component_tree<void>`` (no values are related to the nodes of the tree since they do not have a unique value) and a map from image point to node tree.
:return: A tree of type ``component_tree<void>`` (no values are related to the nodes of the tree since they do not have a natural value) and a map from image point to node tree.
Notes
-----
* Before computing the MToS, the user should add a border to the image, with the values of this border set to the median value of the border of the original image.
* The MToS not having values related to the nodes, the user has to compute a value.
* The resulting nodemap has a domain size of ``4d - 3`` with ``d`` the input image domain.
* The MToS not having values related to the nodes, the user has to compute a value for each node, such as the mean of each node (as shown below in example with the ``mean_node_accu`` accumulator).
Example
-------
This example computes a grain filter, which removes all the node which have an area inferior to 100.
This example computes a grain filter, which removes all the node having an area inferior to 100.
::
......@@ -105,7 +106,7 @@ This example computes a grain filter, which removes all the node which have an a
- .. image:: /images/mtos_rec.png
:width: 100%
* - The depth map resulting of the fusion of the trees
* - The depth map resulting of the fusion of the trees (see [Car15]_ for more details)
- The reconstructed image from the filtered tree
References
......
......@@ -152,7 +152,7 @@ int main(int argc, char* argv[])
nm = reduce_nodemap(nm);
nm = remove_border(nm);
auto area = t.compute_attribute_on_points(nm, mln::accu::accumulators::count<int>());
t.filter(mln::morpho::CT_FILTER_DIRECT, nm, [&area](int n) { return area[n] >= 200; });
t.filter(mln::morpho::CT_FILTER_DIRECT, nm, [&area](int n) { return area[n] >= 100; });
auto mean = t.compute_attribute_on_values(nm, ima, mean_node_accu());
auto rec = t.reconstruct_from(nm, ranges::make_span(mean.data(), mean.size()));
mln::io::imsave(mln::view::cast<mln::rgb8>(rec), argv[3]);
......
......@@ -7,5 +7,9 @@
namespace mln::morpho
{
/// \brief Compute the multivariate tree of shapes
/// \param ima The input image
/// \param pstart The rooting point
/// \return A pair (tree, nodemap)
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/mtos.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
......@@ -18,7 +18,6 @@ namespace mln::morpho
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, pstart);
......
......@@ -84,7 +84,7 @@ namespace mln::morpho::details
std::vector<std::vector<int>> tree_to_graph(ntrees); // Link tree node -> graph node
std::vector<std::set<int>> graph(1); // The graph (the container of out vertices is a set since there can only be
// one edge between two nodes, with ensure faster result for removing)
const auto add_vertex = [&graph]() -> int {
int n = static_cast<int>(graph.size());
graph.push_back(std::set<int>());
......
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