36 if (theOctree->
build(progressCb) < 1) {
48 if (theOctree && !inputOctree) {
57 unsigned numberOfPoints = (theCloud ? theCloud->
size() : 0);
58 if (numberOfPoints == 0) {
74 for (
unsigned i = 0; i < numberOfPoints; ++i) {
85 while (
static_cast<std::size_t
>(ccLabel) >= cc.size()) {
88 }
catch (
const std::bad_alloc&) {
95 if (!cc[ccLabel]->addPointIndex(i)) {
111 ScalarType minSeedDist,
117 bool applyGaussianFilter,
119 unsigned numberOfPoints = (theCloud ? theCloud->
size() : 0);
120 if (numberOfPoints == 0) {
128 if (theOctree->
build(progressCb) < 1) {
136 theCloud, radius,
true,
true, progressCb, theOctree) < 0) {
137 if (!inputOctree)
delete theOctree;
142 if (applyGaussianFilter) {
144 radius / 3, theCloud, -1, progressCb, theOctree);
147 unsigned seedPoints = 0;
148 unsigned numberOfSegmentedLists = 0;
171 sprintf(buffer,
"Octree level: %i\nNumber of points: %u",
182 if (!theDists->
resizeSafe(numberOfPoints,
true, d)) {
183 if (!inputOctree)
delete theOctree;
189 unsigned maxDistIndex = 0;
197 while (begin < numberOfPoints) {
199 const ScalarType& theDistance = theDists->at(begin);
204 theDistance >= minSeedDist) {
205 maxDist = theDistance;
206 startPoint = *thePoint;
207 maxDistIndex = begin;
213 if (maxDist < minSeedDist) {
218 for (
unsigned i = begin; i < numberOfPoints; ++i) {
220 const ScalarType& theDistance = theDists->at(i);
223 (theDistance > maxDist)) {
224 maxDist = theDistance;
225 startPoint = *thePoint;
236 cellPos.
x =
std::min(octreeLength, cellPos.
x);
237 cellPos.
y =
std::min(octreeLength, cellPos.
y);
238 cellPos.
z =
std::min(octreeLength, cellPos.
z);
251 newCloud->
size() != 0) {
252 theSegmentedLists.push_back(newCloud);
253 ++numberOfSegmentedLists;
262 static_cast<float>(numberOfSegmentedLists % 100));
270 if (maxDistIndex == begin) {
279 for (
unsigned i = 0; i < numberOfPoints; ++i) {
291 if (theOctree && !inputOctree) {
constexpr ScalarType NAN_VALUE
NaN as a ScalarType value.
float PointCoordinateType
Type of the coordinates of a (N-D) point.
virtual void release()
Decrease counter and deletes object when 0.
The octree structure used throughout the library.
static int OCTREE_LENGTH(int level)
void getTheCellPosWhichIncludesThePoint(const CCVector3 *thePoint, Tuple3i &cellPos) const
int extractCCs(const cellCodesContainer &cellCodes, unsigned char level, bool sixConnexity, GenericProgressCallback *progressCb=nullptr) const
int build(GenericProgressCallback *progressCb=nullptr)
Builds the structure.
Fast Marching algorithm for surface front propagation.
void setDetectionThreshold(float value)
Sets the threshold for propagation stop.
int propagate() override
Propagates the front.
void setJumpCoef(float value)
Sets the accceleration exageration factor.
int init(GenericCloud *theCloud, DgmOctree *theOctree, unsigned char gridLevel, bool constantAcceleration=false)
Initializes the grid with a point cloud (and ist corresponding octree)
bool extractPropagatedPoints(ReferenceCloud *Zk)
virtual bool setSeedCell(const Tuple3i &pos)
Sets a given cell as "seed".
virtual void cleanLastPropagation()
virtual bool enableScalarField()=0
Enables the scalar field associated to the cloud.
virtual unsigned size() const =0
Returns the number of points.
virtual ScalarType getPointScalarValue(unsigned pointIndex) const =0
Returns the ith point associated scalar value.
virtual void setPointScalarValue(unsigned pointIndex, ScalarType value)=0
Sets the ith point associated scalar value.
virtual bool isScalarFieldEnabled() const =0
Returns true if the scalar field is enabled, false otherwise.
A generic 3D point cloud with index-based and presistent access to points.
virtual const CCVector3 * getPoint(unsigned index) const =0
Returns the ith point.
virtual void stop()=0
Notifies the fact that the process has ended.
virtual void setInfo(const char *infoStr)=0
Notifies some information about the ongoing process.
virtual void setMethodTitle(const char *methodTitle)=0
Notifies the algorithm title.
virtual bool textCanBeEdited() const
Returns whether the dialog title and info can be updated or not.
virtual void update(float percent)=0
Notifies the algorithm progress.
A very simple point cloud (no point duplication)
unsigned size() const override
Returns the number of points.
A simple scalar field (to be associated to a point cloud)
bool resizeSafe(std::size_t count, bool initNewElements=false, ScalarType valueForNewElements=0)
Resizes memory (no exception thrown)
Generic file read and write utility for python interface.
std::vector< ReferenceCloud * > ReferenceCloudContainer
A standard container to store several subsets of points.