CGAL 5.3 - Shape Detection
CGAL::Shape_detection::Region_growing< InputRange, NeighborQuery, RegionType, SeedMap > Class Template Reference

#include <CGAL/Shape_detection/Region_growing/Region_growing.h>

Definition

template<typename InputRange, typename NeighborQuery, typename RegionType, typename SeedMap = CGAL::Identity_property_map<std::size_t>>
class CGAL::Shape_detection::Region_growing< InputRange, NeighborQuery, RegionType, SeedMap >

Main class/entry point for running the region growing algorithm.

This version of the region growing algorithm enables to detect regions in a set of user-defined items

  • given a way to access neighbors of each item via the NeighborQuery parameter class and
  • control if items form a valid region type via the RegionType parameter class,
  • the SeedMap property map enables to define the seeding order of items and skip unnecessary items.
Template Parameters
InputRangemust be a model of ConstRange.
NeighborQuerymust be a model of NeighborQuery.
RegionTypemust be a model of RegionType.
SeedMapmust be an LvaluePropertyMap whose key and value types are std::size_t. Default is CGAL::Identity_property_map.
Examples:
Shape_detection/region_growing_on_point_set_2.cpp, Shape_detection/region_growing_on_point_set_3.cpp, Shape_detection/region_growing_on_polygon_mesh.cpp, and Shape_detection/region_growing_with_custom_classes.cpp.

Initialization

 Region_growing (const InputRange &input_range, NeighborQuery &neighbor_query, RegionType &region_type, const SeedMap seed_map=SeedMap())
 initializes the region growing algorithm. More...
 

Detection

template<typename OutputIterator >
OutputIterator detect (OutputIterator regions)
 runs the region growing algorithm and fills an output iterator with the found regions. More...
 

Unassigned Items

template<typename OutputIterator >
OutputIterator unassigned_items (OutputIterator output) const
 fills an output iterator with indices of all unassigned items. More...
 

Constructor & Destructor Documentation

◆ Region_growing()

template<typename InputRange , typename NeighborQuery , typename RegionType , typename SeedMap = CGAL::Identity_property_map<std::size_t>>
CGAL::Shape_detection::Region_growing< InputRange, NeighborQuery, RegionType, SeedMap >::Region_growing ( const InputRange &  input_range,
NeighborQuery neighbor_query,
RegionType region_type,
const SeedMap  seed_map = SeedMap() 
)

initializes the region growing algorithm.

Parameters
input_rangea range of input items for region growing
neighbor_queryan instance of NeighborQuery that is used internally to access item's neighbors
region_typean instance of RegionType that is used internally to control if items form a valid region type
seed_mapan instance of SeedMap property map that is used internally to set the order of items in the region growing processing queue. If it maps to std::size_t(-1), the corresponding item is skipped.
Precondition
input_range.size() > 0

Member Function Documentation

◆ detect()

template<typename InputRange , typename NeighborQuery , typename RegionType , typename SeedMap = CGAL::Identity_property_map<std::size_t>>
template<typename OutputIterator >
OutputIterator CGAL::Shape_detection::Region_growing< InputRange, NeighborQuery, RegionType, SeedMap >::detect ( OutputIterator  regions)

runs the region growing algorithm and fills an output iterator with the found regions.

Template Parameters
OutputIteratormust be an output iterator whose value type is std::vector<std::size_t>.
Parameters
regionsan output iterator that stores regions, where each region is returned as a vector of indices of the items, which belong to this region
Returns
past-the-end position in the output sequence

◆ unassigned_items()

template<typename InputRange , typename NeighborQuery , typename RegionType , typename SeedMap = CGAL::Identity_property_map<std::size_t>>
template<typename OutputIterator >
OutputIterator CGAL::Shape_detection::Region_growing< InputRange, NeighborQuery, RegionType, SeedMap >::unassigned_items ( OutputIterator  output) const

fills an output iterator with indices of all unassigned items.

Template Parameters
OutputIteratormust be an output iterator whose value type is std::size_t.
Parameters
outputan output iterator that stores indices of all items, which are not assigned to any region
Returns
past-the-end position in the output sequence