Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The implementation contains incorrect indexing, unsafe concurrent access, missing scalar-field output, memory leaks, and a nonfunctional default octree path.
Review effort: Balanced
Findings: 4
Open (6)
Add missing declarations and includes to Graph.h · New Validate point count and feature data dimensions · New Include all components in cumulative offsets · New Initialize all first-edge cumulative offsets · New Restore the caller's OpenMP thread limit · New Prevent leaks of caller-owned monitoring buffers · New
What changed in this PR
Adds Parallel Cut Pursuit point-cloud segmentation with graph construction and max-flow support.
Changes:
- Adds graph, cut-pursuit, max-flow, and memory-block implementations.
- Exposes segmentation through
AutoSegmentationTools. - Registers new sources and headers with CMake.
| File | Description |
|---|---|
src/Maxflow.cpp |
Implements max-flow processing. |
src/Graph.cpp |
Builds KNN graphs and invokes cut pursuit. |
src/CutPursuit.cpp |
Implements the parallel segmentation algorithm. |
src/CMakeLists.txt |
Registers new sources. |
src/AutoSegmentationTools.cpp |
Adds the segmentation entry point. |
include/OMPNumThreads.h |
Provides OpenMP thread helpers. |
include/Maxflow.h |
Declares the max-flow implementation. |
include/Graph.h |
Declares graph construction and partitioning. |
include/CutPursuit.h |
Declares the cut-pursuit engine. |
include/CMakeLists.txt |
Registers new headers. |
include/Block.h |
Adds block allocators for max-flow. |
include/AutoSegmentationTools.h |
Exposes the new public API. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if (nullptr == theCloud) | ||
| { | ||
| return -1; | ||
| } |
| { | ||
| first_vertex[comp_assign[v] + 1]++; | ||
| } | ||
| for (int32_t rv = 1; rv < rV - 1; rv++) |
| for (int32_t v = 0; v < V; v++) | ||
| { | ||
| first_edge[v] = 0; | ||
| } |
| omp_set_num_threads(compute_num_threads(rV)); | ||
| sort(sort_comp, sort_comp + rV, [comp_sizes](int32_t ru, int32_t rv) -> bool | ||
| { return comp_sizes[ru] > comp_sizes[rv]; }); // decreasing order | ||
| omp_set_num_threads(omp_get_num_procs()); |
| // monitoring arrays | ||
| float* Obj = nullptr; | ||
| if (compute_Obj) | ||
| { | ||
| Obj = (float*)malloc(sizeof(float) * (cp_it_max + 1)); | ||
| } | ||
|
|
||
| double* Time = nullptr; | ||
| if (compute_Time) | ||
| { | ||
| Time = (double*)malloc(sizeof(double) * (cp_it_max + 1)); | ||
| } | ||
|
|
||
| float* Dif = nullptr; | ||
| if (compute_Dif) | ||
| { | ||
| Dif = (float*)malloc(sizeof(float) * cp_it_max); | ||
| } |
|
Hi. Since there are a lot of files only for this feature, and the coding style is quite different from CCCoreLib (it almost looks like a 3rd party) could you instead move this to a dedicated CC plugin? Or a separate lib at least? (also I was made aware that TreeIso already relie on this algorithm) |
|


This PR intergates the Parallel Cut Pursuit algorithm (with d0) for graph-cut point cloud segmentation.
Introduces a new class 'Graph' to facilitate computations.