Tree of Shapes (ToS)

Include <mln/morpho/tos.hpp>

Image{I}
auto tos(I f, image_point_t<I> pinf)

Compute the ToS and returns a pair (tree, node_map). See Component Trees (Overview) for more information about the representation of tree. The value_type of the image must be an unsigned integral. It only handles regular 2D or 3D domains.

Note

Note that the size of the image is twice the original image size.

Parameters:
  • input – The input image

  • pinf – Rooting point

Returns:

A pair (tree, node_map) where tree is of type component_tree<image_value_t<I>> and

Precondition:

f.domain().has(pinf)

Requirements

Example

#include <mln/morpho/tos.hpp>
#include <mln/core/image/ndimage.hpp>

mln::image2d<uint8_t> input = ...;

auto [tree, node_map] = mln::morpho::tos(input);

Notes

Complexity

The algorithm is linear and requires \(O(n)\) extra-memory space.

References