![]() |
ImFusion SDK 4.3
|
#include <ImFusion/Mesh/PoissonSurfaceReconstructionAlgorithm.h>
Algorithm for computing poisson reconstruction from a point cloud with normals. More...
Algorithm for computing poisson reconstruction from a point cloud with normals.
This is an Algorithm frontend for the low-level algorithm in PoissonReconstruction, which can be used directly if the application does not rely on the Algorithm interface being used or if one needs fine control over all algorithm parameters.
In this algorithm only the most relevant parameters of PoissonReconstruction are forwarded to the respective getters and setters, see PoissonReconstruction::PoissonParams for their documentation and for additional parameters that were omitted here.
A common use case for this algorithm is creating a Mesh out of a point cloud that was obtained from a 3D scanner (should there be multiple scans we need to register and merge them into a single point cloud first):
In addition to the usually watertight Mesh produced by PoissonReconstruction this algorithm offers the option to filter the resulting mesh w.r.t distance to the original point cloud, allowing to keep gaps in the measurements open:
setSurfaceDistanceR2() works together with setMaxAngleDegrees() to filter out faces by distance if also the angle between point and face normal falls below the given threshold.
Colors are taken from the point cloud by default if the point cloud has colors. If this is not desired setColorSource() can be used. The other parameters have reasonable default values that should usually not need to be changed.
Public Types | |
enum | ColorSource { Color = 0 , NoColor = 1 , Density = 2 } |
Source of the color for the generated Mesh. More... | |
![]() | |
enum | Status { Unknown = -1 , Success = 0 , Error = 1 , InvalidInput , IncompleteInput , OutOfMemoryHost , OutOfMemoryGPU , UnsupportedGPU , UnknownAction , AbortedByUser , User = 1000 } |
Status codes. More... | |
Public Member Functions | |
PoissonSurfaceReconstructionAlgorithm (const PointCloud *pointCloud) | |
int | level () const |
Octree level of the reconstruction. | |
void | setLevel (int level) |
Sets level(). | |
double | spacing () const |
Voxel spacing of the output volume. | |
void | setSpacing (double spacing) |
Sets spacing(). | |
std::array< double, 2 > | surfaceDistanceThresholds () const |
Thresholds for filtering generated triangles w.r.t their distance to the original point cloud. | |
void | setSurfaceDistanceThresholds (double lowerBound, double upperBound) |
Sets surfaceDistanceThresholds(). | |
double | maxSurfaceDistance () const |
Maximum distance of generated triangles to original point cloud. Set to 0 to obtain watertight mesh which interpolates all holes. | |
void | setMaxSurfaceDistance (double dist) |
Sets maxSurfaceDistance(). | |
double | surfaceDistanceR1 () const |
Maximum distance of generated triangles to original point cloud. | |
void | setSurfaceDistanceR1 (double dist) |
Sets surfaceDistanceR1(). | |
double | surfaceDistanceR2 () const |
Maximum distance of generated triangles to original point cloud given similar normals. | |
void | setSurfaceDistanceR2 (double dist) |
Sets surfaceDistanceR2(). | |
double | maxAngleDegrees () const |
Maximum normal deviation for surfaceDistanceThresholds(). | |
void | setMaxAngleDegrees (double angle) |
Sets maxAngleDegrees(). | |
ColorSource | colorSource () const |
Source for mesh colors. | |
void | setColorSource (ColorSource source) |
Sets colorSource(). | |
float | samplesPerNode () |
Minimum number of sample points that should fall within an octree node as the octree construction is adapted to sampling density. | |
void | setSamplesPerNode (float val) |
Sets samplesPerNode(). | |
PoissonReconstruction::DensityThresholdMode | densityThresholdMode () const |
Mode of density thresholding. | |
void | setDensityThresholdMode (PoissonReconstruction::DensityThresholdMode val) |
Sets densityThresholdMode(). | |
float | densityThreshold () const |
Threshold to be used for the respective densityThresholdMode(). | |
void | setDensityThreshold (float val) |
Sets densityThreshold(). | |
void | compute () override |
Execute the algorithm. | |
OwningDataList | takeOutput () override |
Return any new Data that was created by the Algorithm during the last call to compute(). | |
void | configure (const Properties *p) override |
Configure this object instance by de-serializing the given Properties. | |
void | configuration (Properties *p) const override |
Serialize the current object configuration into the given Properties object. | |
![]() | |
Algorithm () | |
Default constructor will registers a single "compute" action that calls compute() and returns status(). | |
virtual void | setProgress (Progress *progress) |
Sets a Progress interface the algorithm can use to notify observers about its computing progress. | |
Progress * | progress () const |
Returns the progress interface if set. | |
virtual int | status () const |
Indicates the status of the last call to compute(). | |
virtual bool | survivesDataDeletion (const Data *) const |
Indicates whether the algorithm can handle (partial) deletion of the specified data, by default this checks whether the data is in the input list. | |
const FactoryInfo & | factoryInfo () const |
Returns the record describing how this Algorithm was instantiated by the AlgorithmFactory. | |
void | setFactoryInfo (const FactoryInfo &value) |
Sets the record describing how this Algorithm was instantiated by the AlgorithmFactory. | |
Status | runAction (const std::string &id) |
Run the action with name id if it exists. | |
const std::vector< Action > & | actions () |
Get a mapping from Action id to Action as registered in this algorithm. | |
![]() | |
virtual void | configureDefaults () |
Retrieve the properties of this object, replaces values with their defaults and sets it again. | |
void | registerParameter (ParameterBase *param) |
Register the given Parameter or SubProperty, so that it will be configured during configure()/configuration(). | |
void | unregisterParameter (const ParameterBase *param) |
Remove the given Parameter or SubProperty from the list of registered parameters. | |
Configurable (const Configurable &rhs) | |
Configurable (Configurable &&rhs) noexcept | |
Configurable & | operator= (const Configurable &) |
Configurable & | operator= (Configurable &&) noexcept |
Static Public Member Functions | |
static bool | createCompatible (const DataList &data, Algorithm **a=0) |
Factory method to check for applicability or to create the algorithm. | |
![]() | |
static bool | createCompatible (const DataList &data, Algorithm **a=nullptr) |
Factory function to check algorithm compatibility with input data and optionally instantiate it. | |
Additional Inherited Members | |
![]() | |
Signal | signalOutputChanged |
Signal should be emitted by Algorithms when their output/result has changed. | |
Signal | signalParametersChanged |
Signal should be emitted by Algorithms when their parameter configuration has changed. | |
![]() | |
Signal | signalParametersChanged |
Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted. | |
![]() | |
void | loadDefaults () |
void | registerAction (const std::string &id, const std::string &guiName, const std::function< Algorithm::Status(void)> &action) |
Register an action to be run via runAction. | |
template<typename D> | |
void | registerAction (const std::string &id, const std::string &guiName, Algorithm::Status(D::*action)(void)) |
Template version of runAction that can be used with a pointer to a member function. | |
void | registerAction (const Action &action) |
Register an action. | |
![]() | |
std::string | m_name |
Algorithm name. | |
Progress * | m_progress = nullptr |
Non-owing pointer to a progress interface. May be a nullptr. | |
FactoryInfo | m_factoryInfo = {} |
Record describing how this algorithm was instantiated by the AlgorithmFactory. | |
int | m_status = Status::Unknown |
Algorithm status after last call to compute() | |
std::vector< Action > | m_actions |
Map of key given by the id of the action, of the available actions of this algorithm. | |
![]() | |
std::vector< Param > | m_params |
List of all registered Parameter and SubProperty instances. | |
enum ColorSource |
Source of the color for the generated Mesh.
Enumerator | |
---|---|
Color | Take the color information from point-cloud. |
NoColor | Do not use any color information. |
Density | Colormap the density information. |
|
inline |
Octree level of the reconstruction.
Overrides voxel spacing setting.
Set to -1 to use voxel spacing.
Default value is 7.
|
inline |
Voxel spacing of the output volume.
Ignored if level is not -1.
Default value is 0.
|
inline |
Thresholds for filtering generated triangles w.r.t their distance to the original point cloud.
The two thresholds form a pair of <lower bound, upper bound>, which work as follows: The lower bound determines a distance below which triangles are always kept, the upper bound determines a distance above which triangles are always deleted. Between the two bounds the decision is based on maxAngleDegrees(): triangles in this range are deleted only if their normal deviates from the closest point's normal by more than maxAngleDegrees() degrees.
Set both values to 0.0 to disable the filtering.
Default values are <2.0, 4.0>.
|
inline |
Maximum distance of generated triangles to original point cloud. Set to 0 to obtain watertight mesh which interpolates all holes.
|
inline |
Sets maxSurfaceDistance().
|
inline |
Maximum distance of generated triangles to original point cloud.
Set this and surfaceDistanceR2() to '0' to obtain watertight mesh which interpolates all holes.
Default value is 2.
|
inline |
Sets surfaceDistanceR1().
|
inline |
Maximum distance of generated triangles to original point cloud given similar normals.
Works in connection with maxAngleDegrees() to filter out triangles that exceed the distance threshold and have a sufficiently similar normal to the closest point.
Set this and surfaceDistanceR1() to '0' to obtain watertight mesh which interpolates all holes.
Default value is 4.
|
inline |
Sets surfaceDistanceR2().
|
inline |
Maximum normal deviation for surfaceDistanceThresholds().
Works in connection with the two bounds to filter out triangles that have a distance between lower and upper bound and have a sufficiently different normal to the closest point.
Default value is 180.
|
inline |
Source for mesh colors.
Default value is ColorSource::Color.
|
inline |
Minimum number of sample points that should fall within an octree node as the octree construction is adapted to sampling density.
Default value is 1.5.
|
inline |
Mode of density thresholding.
Default value is PoissonReconstruction::DensityThresholdMode::None.
|
inline |
Threshold to be used for the respective densityThresholdMode().
Default value is 0.0.
|
overridevirtual |
Execute the algorithm.
Implements Algorithm.
|
overridevirtual |
|
overridevirtual |
Configure this object instance by de-serializing the given Properties.
The default implementation will do so automatically for all registered Parameter and SubProperty instances.
Reimplemented from Configurable.
|
overridevirtual |
Serialize the current object configuration into the given Properties object.
The default implementation will do so automatically for all registered Parameter and SubProperty instances.
Reimplemented from Configurable.