trees_fusion.hpp 1.52 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
#pragma once

#include <mln/morpho/component_tree.hpp>

#include <set>
#include <tuple>
#include <vector>

namespace mln::morpho::details
{
Baptiste Esteban's avatar
Baptiste Esteban committed
11
12
13
14
15
16
17
  /// \brief Compute the inclusion graph of the trees given in input
  /// \param trees The input trees
  /// \param nodemaps The nodemaps related to each tree
  /// \param depths The depths attribute of each tree
  /// \param The number of tree given in argument
  /// \return A pair (graph, tree_to_graph) where graph is the inclusion graph and tree_to_graph
  ///         is a map (tree_index, tree_node) -> graph_node
18
19
20
  std::pair<std::vector<std::set<int>>, std::vector<std::vector<int>>>
  compute_inclusion_graph(component_tree<>* trees, image2d<int>* nodemaps, std::vector<int>* depths, int ntrees);

Baptiste Esteban's avatar
Baptiste Esteban committed
21
22
23
24
25
26
27
28
  /// \brief Compute the depth map of an inclusion graph
  /// \param graph The inclusion graph
  /// \param tree_to_graph A map (tree_index, tree_node) -> graph_node
  /// \param nodemaps The nodemaps of each tree which built the inclusion graph
  /// \return The depth map of the inclusion graph (The depth should not exceed 2^16)
  /// FIXME: For future optimization, the arguments should be change to
  /// (const std::vector<std::set<int>>&    graph, const std::vector<int>& tree_to_graph, image2d<int>* nodemaps, const
  /// std::vector<int>& tree_shapes)
29
30
31
  image2d<std::uint16_t> compute_depth_map(const std::vector<std::set<int>>&    graph,
                                           const std::vector<std::vector<int>>& tree_to_graph, image2d<int>* nodemaps);
} // namespace mln::morpho::details