CGAL 6.2 - Shape Detection: CGAL::Shape_detection::Region_growing< NeighborQuery, RegionType, RegionMap > Class Template Reference

CGAL 6.2 - Shape Detection

Loading...
Searching...
No Matches
List of all members
CGAL::Shape_detection::Region_growing< NeighborQuery, RegionType, RegionMap > Class Template Reference
Reference Manual » Region Growing

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

## Definition

template<typename NeighborQuery, typename RegionType, typename RegionMap = typename RegionType::Region_index_map>
class CGAL::Shape_detection::Region_growing< NeighborQuery, RegionType, RegionMap >

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,
- optional `SeedRange` defining the seeding order of items and skipping unnecessary items.

Template Parameters

  NeighborQuery | a model of `NeighborQuery`
  RegionType | a model of `RegionType`
  RegionMap | a model of `ReadWritePropertyMap` whose key type is `Item` and value type is `std::size_t`.

Examples
  Shape_detection/region_growing_circles_on_point_set_2.cpp, Shape_detection/region_growing_cylinders_on_point_set_3.cpp, Shape_detection/region_growing_lines_on_point_set_2.cpp, Shape_detection/region_growing_lines_on_segment_set.cpp, Shape_detection/region_growing_planes_on_point_set_3.cpp, Shape_detection/region_growing_planes_on_polygon_mesh.cpp, Shape_detection/region_growing_spheres_on_point_set_3.cpp, and Shape_detection/region_growing_with_custom_classes.cpp.

## Types
using | Item = typename RegionType::Item
| Item type.
using | Region = std::vector< Item >
using | Primitive_and_region = std::pair< typename Region_type::Primitive, Region >
| Primitive and region type.
using | Region_map = RegionMap
| Item to region property map.

## Initialization (RegionMap is the default type)
template<typename InputRange , typename ItemMap = Default>
| Region_growing (const InputRange &input_range, NeighborQuery &neighbor_query, RegionType &region_type, ItemMap item_map=ItemMap())
| initializes the region growing algorithm.
template<typename InputRange , typename SeedRange , typename ItemMap = Default>
| Region_growing (const InputRange &input_range, SeedRange &seed_range, NeighborQuery &neighbor_query, RegionType &region_type, ItemMap item_map=ItemMap())
| initializes the region growing algorithm.

## Initialization (RegionMap is a user provided type)
template<typename InputRange , typename ItemMap = Default>
| Region_growing (const InputRange &input_range, NeighborQuery &neighbor_query, RegionType &region_type, Region_map rm, ItemMap item_map=ItemMap())
| initializes the region growing algorithm.
template<typename InputRange , typename SeedRange , typename ItemMap = Default>
| Region_growing (const InputRange &input_range, SeedRange &seed_range, NeighborQuery &neighbor_query, RegionType &region_type, Region_map rm, ItemMap item_map=ItemMap())
| initializes the region growing algorithm.

## Detection
template<typename PrimitiveAndRegionOutputIterator = Emptyset_iterator>
PrimitiveAndRegionOutputIterator | detect (PrimitiveAndRegionOutputIterator region_out=PrimitiveAndRegionOutputIterator())
| runs the region growing algorithm and fills an output iterator with the fitted primitive and their region.
const Region_map & | region_map ()
| provides a property map that provides the region index (or std::size_t(-1)) for each input element.

## Unassigned Items
template<typename InputRange , typename ItemOutputIterator , typename ItemMap = Default>
ItemOutputIterator | unassigned_items (const InputRange &input_range, ItemOutputIterator output, ItemMap item_map=ItemMap()) const
| fills an output iterator with all unassigned items.

## Constructor & Destructor Documentation

## ◆ Region_growing() [1/4]

template<typename NeighborQuery , typename RegionType , typename RegionMap = typename RegionType::Region_index_map>
template<typename InputRange , typename ItemMap = Default>

CGAL::Shape_detection::Region_growing< NeighborQuery, RegionType, RegionMap >::Region_growing | ( | const InputRange & | input_range,
|  | NeighborQuery & | neighbor_query,
|  | RegionType & | region_type,
|  | ItemMap | item_map = `ItemMap()`
| ) |  |

initializes the region growing algorithm.

Template Parameters

  InputRange | a model of `ConstRange`
  ItemMap | a model of `ReadablePropertyMap` with `InputRange::const_iterator` as key type and `Item` as value type. A default can be deduced using the value type of `InputRange` and `Item` to be either `CGAL::Dereference_property_map` or `CGAL::Identity_property_map`.

Parameters

  input_range | a range of input items for region growing.
  neighbor_query | an instance of `NeighborQuery` that is used internally to access item's neighbors
  region_type | an instance of `RegionType` that is used internally to control if items form a valid region type
  item_map | an instance of the property map to retrieve items from input values

Precondition
  `input_range.size() > 0`

## ◆ Region_growing() [2/4]

template<typename NeighborQuery , typename RegionType , typename RegionMap = typename RegionType::Region_index_map>
template<typename InputRange , typename SeedRange , typename ItemMap = Default>

CGAL::Shape_detection::Region_growing< NeighborQuery, RegionType, RegionMap >::Region_growing | ( | const InputRange & | input_range,
|  | SeedRange & | seed_range,
|  | NeighborQuery & | neighbor_query,
|  | RegionType & | region_type,
|  | ItemMap | item_map = `ItemMap()`
| ) |  |

initializes the region growing algorithm.

Template Parameters

  InputRange | a model of `ConstRange`
  SeedRange | a model of `ConstRange` with `Item` as value type
  ItemMap | a model of `ReadablePropertyMap` with `InputRange::const_iterator` as key type and `Item` as value type. A default can be deduced using the value type of `InputRange` and `Item` to be either `CGAL::Dereference_property_map` or `CGAL::Identity_property_map`.

Parameters

  input_range | a range of input items for region growing
  neighbor_query | an instance of `NeighborQuery` that is used internally to access item's neighbors
  region_type | an instance of `RegionType` that is used internally to control if items form a valid region type
  seed_range | a vector of `Item` that is used as seeds for the region growing. Defaults to the full input_range.
  item_map | an instance of the property map to retrieve items from input values

Precondition
  `input_range.size() > 0`

## ◆ Region_growing() [3/4]

template<typename NeighborQuery , typename RegionType , typename RegionMap = typename RegionType::Region_index_map>
template<typename InputRange , typename ItemMap = Default>

CGAL::Shape_detection::Region_growing< NeighborQuery, RegionType, RegionMap >::Region_growing | ( | const InputRange & | input_range,
|  | NeighborQuery & | neighbor_query,
|  | RegionType & | region_type,
|  | Region_map | rm,
|  | ItemMap | item_map = `ItemMap()`
| ) |  |

initializes the region growing algorithm.

Template Parameters

  InputRange | a model of `ConstRange`
  ItemMap | a model of `ReadablePropertyMap` with `InputRange::const_iterator` as key type and `Item` as value type. A default can be deduced using the value type of `InputRange` and `Item` to be either `CGAL::Dereference_property_map` or `CGAL::Identity_property_map`.

Parameters

  input_range | a range of input items for region growing.
  neighbor_query | an instance of `NeighborQuery` that is used internally to access item's neighbors
  region_type | an instance of `RegionType` that is used internally to control if items form a valid region type
  item_map | an instance of the property map to retrieve items from input values
  rm | external property map that will be filled when calling `detect()`

Precondition
  `input_range.size() > 0`

## ◆ Region_growing() [4/4]

template<typename NeighborQuery , typename RegionType , typename RegionMap = typename RegionType::Region_index_map>
template<typename InputRange , typename SeedRange , typename ItemMap = Default>

CGAL::Shape_detection::Region_growing< NeighborQuery, RegionType, RegionMap >::Region_growing | ( | const InputRange & | input_range,
|  | SeedRange & | seed_range,
|  | NeighborQuery & | neighbor_query,
|  | RegionType & | region_type,
|  | Region_map | rm,
|  | ItemMap | item_map = `ItemMap()`
| ) |  |

initializes the region growing algorithm.

Template Parameters

  InputRange | a model of `ConstRange`
  SeedRange | a model of `ConstRange` with `Item` as value type
  ItemMap | a model of `ReadablePropertyMap` with `InputRange::const_iterator` as key type and `Item` as value type. A default can be deduced using the value type of `InputRange` and `Item` to be either `CGAL::Dereference_property_map` or `CGAL::Identity_property_map`.

Parameters

  input_range | a range of input items for region growing
  neighbor_query | an instance of `NeighborQuery` that is used internally to access item's neighbors
  region_type | an instance of `RegionType` that is used internally to control if items form a valid region type
  seed_range | a vector of `Item` that is used as seeds for the region growing. Defaults to the full input_range.
  item_map | an instance of the property map to retrieve items from input values
  rm | external property map that will be filled when calling `detect()`

Precondition
  `input_range.size() > 0`

## Member Function Documentation

## ◆ detect()

template<typename NeighborQuery , typename RegionType , typename RegionMap = typename RegionType::Region_index_map>
template<typename PrimitiveAndRegionOutputIterator = Emptyset_iterator>

PrimitiveAndRegionOutputIterator CGAL::Shape_detection::Region_growing< NeighborQuery, RegionType, RegionMap >::detect | ( | PrimitiveAndRegionOutputIterator | region_out = `PrimitiveAndRegionOutputIterator()` | ) |

runs the region growing algorithm and fills an output iterator with the fitted primitive and their region.

Template Parameters

  PrimitiveAndRegionOutputIterator | a model of `OutputIterator` whose value type is `Primitive_and_region`

Parameters

  region_out | an output iterator of type `PrimitiveAndRegionOutputIterator`.

Returns
  past-the-end position in the output sequence

## ◆ region_map()

template<typename NeighborQuery , typename RegionType , typename RegionMap = typename RegionType::Region_index_map>

const Region_map & CGAL::Shape_detection::Region_growing< NeighborQuery, RegionType, RegionMap >::region_map | ( |  | ) |

provides a property map that provides the region index (or std::size_t(-1)) for each input element.

Returns
  Property map that maps each iterator of the input range to a region index.

## ◆ unassigned_items()

template<typename NeighborQuery , typename RegionType , typename RegionMap = typename RegionType::Region_index_map>
template<typename InputRange , typename ItemOutputIterator , typename ItemMap = Default>

ItemOutputIterator CGAL::Shape_detection::Region_growing< NeighborQuery, RegionType, RegionMap >::unassigned_items | ( | const InputRange & | input_range,
|  | ItemOutputIterator | output,
|  | ItemMap | item_map = `ItemMap()`
| ) |  | const

fills an output iterator with all unassigned items.

Template Parameters

  ItemOutputIterator | a model of `OutputIterator` whose value type is `Item`
  InputRange | a model of `ConstRange`
  ItemMap | a model of `ReadablePropertyMap` with `InputRange::const_iterator` as key type and `Item` as value type. A default can be deduced using the value type of `InputRange` and `Item` to be either `CGAL::Dereference_property_map` or `CGAL::Identity_property_map`.

Parameters

  input_range | a range of input items for region growing
  output | an iterator of type `PrimitiveAndRegionOutputIterator`.
  item_map | an instance of the property map to retrieve items from input values

Returns
  past-the-end position in the output sequence