Function trx::format_groups_summary

Function Documentation

std::string trx::format_groups_summary(const std::map<std::string, size_t> &groups, int prefix_depth = 0, const std::string &line_prefix = "")

Format a group listing with optional prefix-based collapsing.

When prefix_depth is 0 (the default), every group is listed individually:

glasser_Left_V1: 123 streamlines
glasser_Left_V2: 456 streamlines

When prefix_depth > 0, group names are split on ‘_’ and the first prefix_depth tokens form the aggregation key. Groups that share a key have their streamline counts summed and are shown as a single collapsed line:

glasser_*: 579 streamlines (2 groups)
If only one group maps to a given prefix key the wildcard suffix is omitted and the original group name is used as-is.

Parameters:
  • groups – Map from group name to streamline count.

  • prefix_depth – Number of ‘_’-delimited tokens used as the grouping key (0 = flat list).

  • line_prefix – String prepended to every output line (e.g. for indentation).

Returns:

Formatted multi-line string (no trailing newline).