ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
qManualSeg.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 // ##########################################################################
11 // # #
12 // # CLOUDVIEWER PLUGIN: qManualSeg #
13 // # #
14 // # This program is free software; you can redistribute it and/or modify #
15 // # it under the terms of the GNU General Public License as published by #
16 // # the Free Software Foundation; version 2 of the License. #
17 // # #
18 // # This program is distributed in the hope that it will be useful, #
19 // # but WITHOUT ANY WARRANTY; without even the implied warranty of #
20 // # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
21 // # GNU General Public License for more details. #
22 // # #
23 // # Cyberbuild,2020 #
24 // # v1.2 # # #
25 // ##########################################################################
26 
27 #include "ecvStdPluginInterface.h"
28 
29 class ccManualSeg : public QObject, public ccStdPluginInterface {
30  Q_OBJECT
32 
33  Q_PLUGIN_METADATA(IID "ecvcorp.cloudviewer.plugin.qManualSeg" FILE
34  "info.json")
35 
36 public:
37  explicit ccManualSeg(QObject* parent = nullptr);
38  virtual ~ccManualSeg() override = default;
39 
40  // inherited from ccStdPluginInterface
41  void onNewSelection(const ccHObject::Container& selectedEntities) override;
42  QList<QAction*> getActions() override;
43 
44 private:
45  void doAction();
46  void doAction2();
47 
48  std::vector<int> pointIdx(ccPointCloud* cloud, ccPolyline* poly);
49  std::vector<int> stIdFromPtId(std::vector<int> pts,
50  std::vector<std::pair<int, int>> pairs);
51  std::vector<int> ptIdFromStId(std::vector<int> pts,
52  std::vector<std::pair<int, int>> pairs);
53 
54  QAction* m_action;
55 
56 protected:
61 };
cloudViewer::Polyline::isClosed
bool isClosed() const
Returns whether the polyline is closed or not.
Definition: Polyline.h:26
ccPointCloud::addScalarField
int addScalarField(const char *uniqueName) override
Creates a new scalar field and registers it.
Definition: ecvPointCloud.cpp:4210
ccPointCloud::Translate
virtual ccPointCloud & Translate(const Eigen::Vector3d &translation, bool relative=true) override
Apply translation to the geometry coordinates.
Definition: ecvPointCloud.cpp:2572
QtCompat::endl
QTextStream & endl(QTextStream &stream)
Definition: QtCompat.h:718
ccHObject::filterChildren
unsigned filterChildren(Container &filteredChildren, bool recursive=false, CV_CLASS_ENUM filter=CV_TYPES::OBJECT, bool strict=false) const
Collects the children corresponding to a certain pattern.
Definition: ecvHObject.cpp:611
ccDefaultPluginInterface::getDescription
virtual QString getDescription() const override
Returns long name/description (for tooltip, etc.)
Definition: ecvDefaultPluginInterface.cpp:104
filename
std::string filename
Definition: PointCloudIO.cpp:47
cloudViewer::ReferenceCloud::reserve
virtual bool reserve(unsigned n)
Reserves some memory for hosting the point references.
Definition: ReferenceCloud.cpp:51
ecvMainAppInterface::STD_CONSOLE_MESSAGE
@ STD_CONSOLE_MESSAGE
Definition: ecvMainAppInterface.h:117
ccDefaultPluginInterface::getName
virtual QString getName() const override
Returns (short) name (for menu entry, etc.)
Definition: ecvDefaultPluginInterface.cpp:100
cloudViewer::core::make_pair
CLOUDVIEWER_HOST_DEVICE Pair< First, Second > make_pair(const First &_first, const Second &_second)
Definition: SlabTraits.h:49
x
normal_z x
Definition: my_point_types.h:165
ccPointCloud::getPointColor
const ecvColor::Rgb & getPointColor(unsigned pointIndex) const override
Returns color corresponding to a given point.
Definition: ecvPointCloud.cpp:1535
contourPoly
ccPolyline * contourPoly(ccPointCloud *stone)
Definition: qManualSeg.cpp:175
ecvMainAppInterface::dispToConsole
virtual void dispToConsole(QString message, ConsoleMessageLevel level=STD_CONSOLE_MESSAGE)=0
Tuple3Tpl::x
Type x
Definition: CVGeom.h:137
CloudSamplingTools.h
cloudViewer::ReferenceCloud::size
unsigned size() const override
Returns the number of points.
Definition: ReferenceCloud.h:41
cloudViewer::GenericCloud::size
virtual unsigned size() const =0
Returns the number of points.
cloudViewer::ScalarField::computeMinAndMax
virtual void computeMinAndMax()
Determines the min and max values.
Definition: ScalarField.h:123
NULL
#define NULL
Definition: UVUnwrapping.cpp:40
ccPolyline::showVertices
void showVertices(bool state)
Sets whether to display or hide the polyline vertices.
Definition: ecvPolyline.h:129
cloudViewer::ScalarField::getValue
ScalarType & getValue(std::size_t index)
Definition: ScalarField.h:92
cloudViewer::PointProjectionTools::IndexedCCVector2::index
unsigned index
Point index.
Definition: PointProjectionTools.h:177
CVConst.h
CVKdTree.h
ecvMainAppInterface::getMainWindow
virtual QMainWindow * getMainWindow()=0
Returns main window.
ccObject::setName
virtual void setName(const QString &name)
Sets object name.
Definition: ecvObject.h:75
ecvCone.h
cloudViewer::CloudSamplingTools::SFModulationParams
Parameters for the scalar-field based modulation of a parameter.
Definition: CloudSamplingTools.h:138
CV_TYPES::POINT_CLOUD
@ POINT_CLOUD
Definition: CVTypes.h:104
cloudViewer::PointCloudTpl::getPoint
const CCVector3 * getPoint(unsigned index) const override
Definition: PointCloudTpl.h:143
ecvDisplayTools.h
cloudViewer::ReferenceCloud::getPoint
const CCVector3 * getPoint(unsigned index) const override
Returns the ith point.
Definition: ReferenceCloud.h:79
ecvMainAppInterface::dbRootObject
virtual ccHObject * dbRootObject()=0
Returns DB root (as a ccHObject)
ccPointCloud::reserveThePointsTable
bool reserveThePointsTable(unsigned _numberOfPoints)
Reserves memory to store the points coordinates.
Definition: ecvPointCloud.cpp:1191
cloudViewer::PointCloudTpl::size
unsigned size() const override
Definition: PointCloudTpl.h:38
ccPointCloud
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
Definition: ecvPointCloud.h:146
cloudViewer::ScalarField
A simple scalar field (to be associated to a point cloud)
Definition: ScalarField.h:25
cloudViewer::PointProjectionTools::extractConcaveHull2D
static bool extractConcaveHull2D(std::vector< IndexedCCVector2 > &points, std::list< IndexedCCVector2 * > &hullPoints, PointCoordinateType maxSquareLength=0)
Determines the 'concave' hull of a set of points.
Definition: PointProjectionTools.cpp:564
getCentroid
pair< double, double > getCentroid(vector< pair< double, double >> V)
Definition: qManualSeg.cpp:260
contourPoly2
ccPolyline * contourPoly2(ccPointCloud *cloud0, vector< int > V, QString name)
Definition: qManualSeg.cpp:455
cloudViewer::ReferenceCloud::getPointGlobalIndex
virtual unsigned getPointGlobalIndex(unsigned localIndex) const
Definition: ReferenceCloud.h:103
cloudViewer::PointCloudTpl::getScalarFieldIndexByName
int getScalarFieldIndexByName(const char *name) const
Returns the index of a scalar field represented by its name.
Definition: PointCloudTpl.h:375
profileImportDlg.h
ccHObject::Container
std::vector< ccHObject * > Container
Standard instances container (for children, etc.)
Definition: ecvHObject.h:337
ecvMainAppInterface::setView
virtual void setView(CC_VIEW_ORIENTATION view)=0
CCVector3
Vector3Tpl< PointCoordinateType > CCVector3
Default 3D Vector.
Definition: CVGeom.h:798
ccGLCameraParameters
OpenGL camera parameters.
Definition: ecvGenericDisplayTools.h:554
ccPointCloud::setCurrentDisplayedScalarField
void setCurrentDisplayedScalarField(int index)
Sets the currently displayed scalar field.
Definition: ecvPointCloud.cpp:3227
cloudViewer::PointCloudTpl::getScalarField
ScalarField * getScalarField(int index) const
Returns a pointer to a specific scalar field.
Definition: PointCloudTpl.h:354
ManualSegmentationTools.h
CVLog::Error
static bool Error(const char *format,...)
Display an error dialog with formatted message.
Definition: CVLog.cpp:143
Vector2Tpl< PointCoordinateType >
ccDrawableObject::showColors
virtual void showColors(bool state)
Sets colors visibility.
Definition: ecvDrawableObject.h:84
cloudViewer::ReferenceCloud::addPointIndex
virtual bool addPointIndex(unsigned globalIndex)
Point global index insertion mechanism.
Definition: ReferenceCloud.cpp:84
cloudViewer::ManualSegmentationTools::isPointInsidePoly
static bool isPointInsidePoly(const CCVector2 &P, const GenericIndexedCloud *polyVertices)
Tests if a point is inside a polygon (2D)
Definition: ManualSegmentationTools.cpp:61
size
int size
Definition: FileIOFactory.cpp:130
CC_FRONT_VIEW
@ CC_FRONT_VIEW
Definition: CVConst.h:105
math.h
ccGenericPointCloud::setPointSize
void setPointSize(unsigned size=0)
Sets point size.
Definition: ecvGenericPointCloud.h:275
y
normal_z y
Definition: my_point_types.h:168
setIntersectIdxPixs1D
vector< int > setIntersectIdxPixs1D(vector< int > listNew, vector< int > listOld)
Definition: qManualSeg.cpp:437
ccGenericPointCloud::getTheVisibilityArray
virtual VisibilityTableType & getTheVisibilityArray()
Returns associated visibility array.
Definition: ecvGenericPointCloud.h:168
ccGenericPointCloud
A 3D cloud interface with associated features (color, normals, octree, etc.)
Definition: ecvGenericPointCloud.h:45
cloudViewer::PointProjectionTools::IndexedCCVector2
Indexed 2D vector.
Definition: PointProjectionTools.h:161
getCommonPtsIdx
vector< vector< int > > getCommonPtsIdx(ccPointCloud *Cl1, ccPointCloud *Cl2)
Definition: qManualSeg.cpp:323
Vector3Tpl< PointCoordinateType >
e
const double * e
Definition: essential_matrix_poly.h:10
ccManualSeg::m_polyVertices
ccPointCloud * m_polyVertices
Segmentation polyline vertices.
Definition: qManualSeg.h:60
ecvGenericPointCloud.h
ecvMainAppInterface::ERR_CONSOLE_MESSAGE
@ ERR_CONSOLE_MESSAGE
Definition: ecvMainAppInterface.h:119
ccPointCloud::partialClone
ccPointCloud * partialClone(const cloudViewer::ReferenceCloud *selection, int *warnings=nullptr, bool withChildEntities=true) const
Creates a new point cloud object from a ReferenceCloud (selection)
Definition: ecvPointCloud.cpp:290
CV_TYPES::POLY_LINE
@ POLY_LINE
Definition: CVTypes.h:112
cloud2binary
void cloud2binary(ccPointCloud *cloud, Mat &corrMatS, vector< Point > &idxPxS, vector< int > &idxPx1DS, Mat &imageBWS)
Definition: qManualSeg.cpp:374
ecvColor::green
constexpr Rgb green(0, MAX, 0)
ccPointCloud::reserve
bool reserve(unsigned numberOfPoints) override
Reserves memory for all the active features.
Definition: ecvPointCloud.cpp:1452
ccStdPluginInterface::m_app
ecvMainAppInterface * m_app
Main application interface.
Definition: ecvStdPluginInterface.h:85
ecvStdPluginInterface.h
qManualSeg.h
ecvFileUtils.h
dateStamp
string dateStamp()
Definition: qManualSeg.cpp:514
getMortarMaps
ccPointCloud * getMortarMaps(ccPointCloud *f_cloudStones, ccPointCloud *f_cloudMortar)
Definition: qManualSeg.cpp:533
getNCommonPts
int getNCommonPts(vector< pair< double, double >> tar, vector< pair< double, double >> ref)
Definition: qManualSeg.cpp:300
ecvMesh.h
ecvScalarField.h
ccManualSeg::m_segmentationPoly
ccPolyline * m_segmentationPoly
Segmentation polyline.
Definition: qManualSeg.h:58
ecvProgressDialog.h
cloudViewer::utility::floor
MiniVec< float, N > floor(const MiniVec< float, N > &a)
Definition: MiniVec.h:75
a
a[190]
Definition: essential_matrix_poly.h:19
ccDrawableObject::showSF
virtual void showSF(bool state)
Sets active scalarfield visibility.
Definition: ecvDrawableObject.h:108
cloudViewer::PointCloudTpl::getPointScalarValue
ScalarType getPointScalarValue(unsigned pointIndex) const override
Definition: PointCloudTpl.h:134
cloudViewer::PointCloudTpl::getBoundingBox
void getBoundingBox(CCVector3 &bbMin, CCVector3 &bbMax) override
Definition: PointCloudTpl.h:57
ccDrawableObject::setVisible
virtual void setVisible(bool state)
Sets entity visibility.
Definition: ecvDrawableObject.h:40
POINT_VISIBLE
constexpr unsigned char POINT_VISIBLE
Definition: CVConst.h:92
ccPointCloud::addRGBColor
void addRGBColor(const ecvColor::Rgb &C)
Pushes an RGB color on stack.
Definition: ecvPointCloud.cpp:1712
Tuple3Tpl::z
Type z
Definition: CVGeom.h:137
cloudViewer::Polyline::setClosed
void setClosed(bool state)
Sets whether the polyline is closed or not.
Definition: Polyline.h:29
CVTools::FromQString
static std::string FromQString(const QString &qs)
Definition: CVTools.cpp:100
ccPointCloud::clear
void clear() override
Clears the entity from all its points and features.
Definition: ecvPointCloud.cpp:530
ecvMainAppInterface::removeFromDB
virtual void removeFromDB(ccHObject *obj, bool autoDelete=true)=0
Removes an entity from main db tree.
cloudViewer::GenericIndexedCloudPersist
A generic 3D point cloud with index-based and presistent access to points.
Definition: GenericIndexedCloudPersist.h:18
ecvMainAppInterface::addToDB
virtual void addToDB(ccHObject *obj, bool updateZoom=false, bool autoExpandDBTree=true, bool checkDimensions=false, bool autoRedraw=true)=0
ecvHObjectCaster.h
cloudViewer::GenericIndexedCloud::getPoint
virtual const CCVector3 * getPoint(unsigned index) const =0
Returns the ith point.
ccPluginInterface
Standard ECV plugin interface.
Definition: ecvPluginInterface.h:33
ecvColor::cyan
constexpr Rgb cyan(0, MAX, MAX)
ccGLCameraParameters::project
bool project(const CCVector3d &input3D, CCVector3d &output2D, bool *inFrustum=nullptr) const
Projects a 3D point in 2D (+ normalized 'z' coordinate)
Definition: ecvGenericDisplayTools.h:561
CVTools.h
CV_TYPES::HIERARCHY_OBJECT
@ HIERARCHY_OBJECT
Definition: CVTypes.h:103
cloudViewer::ReferenceCloud
A very simple point cloud (no point duplication)
Definition: ReferenceCloud.h:29
ecvColor::RgbTpl
RGB color structure.
Definition: ecvColorTypes.h:49
std
Definition: Eigen.h:85
getKNN
vector< int > getKNN(pair< double, double > P, vector< pair< double, double >> V, int k=3)
Definition: qManualSeg.cpp:274
ccHObject
Hierarchical CLOUDVIEWER Object.
Definition: ecvHObject.h:25
Tuple3Tpl::y
Type y
Definition: CVGeom.h:137
ccObject::getName
virtual QString getName() const
Returns object name.
Definition: ecvObject.h:72
ecvPolyline.h
cloudViewer::ScalarField::setValue
void setValue(std::size_t index, ScalarType value)
Definition: ScalarField.h:96
cloudViewer::PointCloudTpl::addPoint
void addPoint(const CCVector3 &P)
Adds a 3D point to the database.
Definition: PointCloudTpl.h:246
ecvMainAppInterface::refreshAll
virtual void refreshAll(bool only2D=false, bool forceRedraw=true)=0
Redraws all GL windows that have the 'refresh' flag on.
PointCoordinateType
float PointCoordinateType
Type of the coordinates of a (N-D) point.
Definition: CVTypes.h:16
z
normal_z z
Definition: my_point_types.h:165
ccStdPluginInterface
Standard ECV plugin interface.
Definition: ecvStdPluginInterface.h:31
ccGenericPointCloud::getPointSize
unsigned char getPointSize() const
Returns current point size.
Definition: ecvGenericPointCloud.h:283
skeleton
Mat skeleton(Mat I, bool flagInv)
Definition: qManualSeg.cpp:406
ccHObject::addChild
virtual bool addChild(ccHObject *child, int dependencyFlags=DP_PARENT_OF_OTHER, int insertIndex=-1)
Adds a child.
Definition: ecvHObject.cpp:534
ccPolyline::is2DMode
bool is2DMode() const
Returns whether the polyline is considered as 2D or 3D.
Definition: ecvPolyline.h:63
cloudViewer::ReferenceCloud::getAssociatedCloud
virtual GenericIndexedCloudPersist * getAssociatedCloud()
Returns the associated (source) cloud.
Definition: ReferenceCloud.h:206
patch::to_string
std::string to_string(const T &n)
Definition: Common.h:20
ccHObjectCaster::ToGenericPointCloud
static ccGenericPointCloud * ToGenericPointCloud(ccHObject *obj, bool *isLockedVertices=nullptr)
Converts current object to 'equivalent' ccGenericPointCloud.
Definition: ecvHObjectCaster.cpp:81
POINT_HIDDEN
constexpr unsigned char POINT_HIDDEN
Definition: CVConst.h:94
ccManualSeg
Definition: qManualSeg.h:29
ecvPointCloud.h
cloudViewer::utility::ceil
MiniVec< float, N > ceil(const MiniVec< float, N > &a)
Definition: MiniVec.h:89
ecvDisplayTools::GetGLCameraParameters
static void GetGLCameraParameters(ccGLCameraParameters &params)
Returns the current OpenGL camera parameters.
Definition: ecvDisplayTools.cpp:2513
ccPointCloud::scale
virtual void scale(PointCoordinateType fx, PointCoordinateType fy, PointCoordinateType fz, CCVector3 center=CCVector3(0, 0, 0)) override
Multiplies all coordinates by constant factors (one per dimension)
Definition: ecvPointCloud.cpp:2634
ccGenericPointCloud::resetVisibilityArray
virtual bool resetVisibilityArray()
Resets the associated visibility array.
Definition: ecvGenericPointCloud.cpp:47
ccPointCloud::reserveTheRGBTable
bool reserveTheRGBTable()
Reserves memory to store the RGB colors.
Definition: ecvPointCloud.cpp:1200
cloudViewer::CloudSamplingTools::resampleCloudSpatially
static ReferenceCloud * resampleCloudSpatially(GenericIndexedCloudPersist *cloud, PointCoordinateType minDistance, const SFModulationParams &modParams, DgmOctree *octree=nullptr, GenericProgressCallback *progressCb=nullptr)
Resamples a point cloud (process based on inter point distance)
Definition: CloudSamplingTools.cpp:256
ccPolyline::setColor
void setColor(const ecvColor::Rgb &col)
Sets the polyline color.
Definition: ecvPolyline.h:81
name
std::string name
Definition: FileIOFactory.cpp:129
ccPolyline
Colored polyline.
Definition: ecvPolyline.h:23
SquareMatrix.h
cloudViewer::Polyline::clear
void clear(bool unusedParam=true) override
Clears the cloud.
Definition: Polyline.cpp:15
ccGenericPointCloud::VisibilityTableType
std::vector< unsigned char > VisibilityTableType
Array of "visibility" information for each point.
Definition: ecvGenericPointCloud.h:165