SemiDiscreteOT 1.0
Semi-Discrete Optimal Transport Library
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
PointCloudHierarchy::PointCloudHierarchyManager Class Reference

Class to manage a hierarchy of point clouds with different resolutions The hierarchy is organized with coarser levels having fewer points (parents) and finer levels having more points (children). More...

#include <PointCloudHierarchy.h>

Public Member Functions

 PointCloudHierarchyManager (int min_points=100, int max_points=1000)
 Constructor.
 
template<int spacedim>
int generateHierarchy (const std::vector< Point< spacedim > > &input_points, const std::vector< double > &input_density, const std::string &output_dir)
 Generate hierarchy of point clouds from input points.
 
void setMaxPoints (int max_points)
 Set the maximum number of points for level 1.
 
void setMinPoints (int min_points)
 Set the minimum number of points for coarsest level.
 
int getNumLevels () const
 Get the number of levels in the last generated hierarchy.
 
int getPointCount (int level) const
 Get the number of points at a specific level.
 
int getPointsForLevel (int base_points, int level) const
 Calculate number of points for a given level.
 
const std::vector< std::vector< size_t > > & getParentIndices (int level) const
 Get the parent indices for points at level L-1.
 
const std::vector< std::vector< size_t > > & getChildIndices (int level) const
 Get the child indices for points at level L.
 

Private Member Functions

void ensureDirectoryExists (const std::string &path) const
 Ensure directory exists, create if it doesn't.
 
template<int spacedim>
std::tuple< std::vector< std::array< double, spacedim > >, std::vector< double >, std::vector< int > > kmeansClustering (const std::vector< std::array< double, spacedim > > &points, const std::vector< double > &densities, size_t k)
 Performs parallel k-means clustering on a set of points with parent-child tracking.
 

Private Attributes

int min_points_
 
int max_points_
 
int num_levels_
 
std::vector< int > level_point_counts_
 
std::vector< std::vector< std::vector< size_t > > > parent_indices_
 
std::vector< std::vector< std::vector< size_t > > > child_indices_
 

Detailed Description

Class to manage a hierarchy of point clouds with different resolutions The hierarchy is organized with coarser levels having fewer points (parents) and finer levels having more points (children).

Definition at line 23 of file PointCloudHierarchy.h.

Constructor & Destructor Documentation

◆ PointCloudHierarchyManager()

PointCloudHierarchy::PointCloudHierarchyManager::PointCloudHierarchyManager ( int  min_points = 100,
int  max_points = 1000 
)

Constructor.

Parameters
min_pointsMinimum number of points for the coarsest level (parent level)
max_pointsMaximum number of points for level 1 point cloud

Definition at line 18 of file PointCloudHierarchy.cc.

Member Function Documentation

◆ generateHierarchy()

template<int spacedim>
template int PointCloudHierarchy::PointCloudHierarchyManager::generateHierarchy< 3 > ( const std::vector< Point< spacedim > > &  input_points,
const std::vector< double > &  input_density,
const std::string &  output_dir 
)

Generate hierarchy of point clouds from input points.

Parameters
input_pointsVector of input points (finest level)
input_densityVector of input density values (optional, uniform density if empty)
output_dirDirectory to save the point cloud hierarchy
Returns
Number of levels generated
Exceptions
std::runtime_errorif processing fails

Definition at line 127 of file PointCloudHierarchy.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setMaxPoints()

void PointCloudHierarchy::PointCloudHierarchyManager::setMaxPoints ( int  max_points)

Set the maximum number of points for level 1.

Definition at line 24 of file PointCloudHierarchy.cc.

◆ setMinPoints()

void PointCloudHierarchy::PointCloudHierarchyManager::setMinPoints ( int  min_points)

Set the minimum number of points for coarsest level.

Definition at line 28 of file PointCloudHierarchy.cc.

◆ getNumLevels()

int PointCloudHierarchy::PointCloudHierarchyManager::getNumLevels ( ) const

Get the number of levels in the last generated hierarchy.

Definition at line 32 of file PointCloudHierarchy.cc.

◆ getPointCount()

int PointCloudHierarchy::PointCloudHierarchyManager::getPointCount ( int  level) const

Get the number of points at a specific level.

Definition at line 36 of file PointCloudHierarchy.cc.

◆ getPointsForLevel()

int PointCloudHierarchy::PointCloudHierarchyManager::getPointsForLevel ( int  base_points,
int  level 
) const

Calculate number of points for a given level.

Definition at line 63 of file PointCloudHierarchy.cc.

Here is the caller graph for this function:

◆ getParentIndices()

const std::vector< std::vector< size_t > > & PointCloudHierarchy::PointCloudHierarchyManager::getParentIndices ( int  level) const

Get the parent indices for points at level L-1.

Parameters
levelThe level of the parents (must be > 0)
Returns
For each point at level L-1, returns index of its parent at level L

Definition at line 43 of file PointCloudHierarchy.cc.

◆ getChildIndices()

const std::vector< std::vector< size_t > > & PointCloudHierarchy::PointCloudHierarchyManager::getChildIndices ( int  level) const

Get the child indices for points at level L.

Parameters
levelThe level of points whose children we want (must be < num_levels-1)
Returns
For each point at level L, returns indices of its children at level L-1

Definition at line 50 of file PointCloudHierarchy.cc.

◆ ensureDirectoryExists()

void PointCloudHierarchy::PointCloudHierarchyManager::ensureDirectoryExists ( const std::string &  path) const
private

Ensure directory exists, create if it doesn't.

Definition at line 57 of file PointCloudHierarchy.cc.

Here is the caller graph for this function:

◆ kmeansClustering()

template<int spacedim>
template std::tuple< std::vector< std::array< double, 3 > >, std::vector< double >, std::vector< int > > PointCloudHierarchy::PointCloudHierarchyManager::kmeansClustering< 3 > ( const std::vector< std::array< double, spacedim > > &  points,
const std::vector< double > &  densities,
size_t  k 
)
private

Performs parallel k-means clustering on a set of points with parent-child tracking.

Parameters
pointsInput points from finer level
densitiesInput densities
kNumber of clusters (points at coarser level)
Returns
Tuple of:
  • cluster centers (parent points)
  • aggregated densities for parents
  • assignments (mapping of each child to its parent cluster)

Definition at line 80 of file PointCloudHierarchy.cc.

Here is the call graph for this function:

Member Data Documentation

◆ min_points_

int PointCloudHierarchy::PointCloudHierarchyManager::min_points_
private

Definition at line 86 of file PointCloudHierarchy.h.

◆ max_points_

int PointCloudHierarchy::PointCloudHierarchyManager::max_points_
private

Definition at line 87 of file PointCloudHierarchy.h.

◆ num_levels_

int PointCloudHierarchy::PointCloudHierarchyManager::num_levels_
private

Definition at line 88 of file PointCloudHierarchy.h.

◆ level_point_counts_

std::vector<int> PointCloudHierarchy::PointCloudHierarchyManager::level_point_counts_
private

Definition at line 89 of file PointCloudHierarchy.h.

◆ parent_indices_

std::vector<std::vector<std::vector<size_t> > > PointCloudHierarchy::PointCloudHierarchyManager::parent_indices_
private

Definition at line 93 of file PointCloudHierarchy.h.

◆ child_indices_

std::vector<std::vector<std::vector<size_t> > > PointCloudHierarchy::PointCloudHierarchyManager::child_indices_
private

Definition at line 97 of file PointCloudHierarchy.h.


The documentation for this class was generated from the following files: