25 #include <VisionX/gui-plugins/UserAssistedSegmenterGui/ui_UserAssistedSegmenterGuiWidget.h>
28 #include <Eigen/Dense>
30 #include <pcl/point_cloud.h>
31 #include <pcl/point_types.h>
32 #include <pcl/PointIndices.h>
41 #include <VisionX/interface/components/UserAssistedSegmenter.h>
48 class UserAssistedSegmenterConfigDialog;
77 public visionx::UserAssistedSegmenterListener
81 using PointT = pcl::PointXYZRGBL;
82 using PointCloudT = pcl::PointCloud<PointT>;
95 virtual void loadSettings(QSettings* settings)
override;
98 virtual void saveSettings(QSettings* settings)
override;
101 virtual QPointer<QDialog> getConfigDialog(QWidget* parent)
override;
103 virtual void configured()
override;
107 static QString GetWidgetName();
111 virtual void onInitComponent()
override;
114 virtual void onConnectComponent()
override;
118 virtual void reportSegmentation(
const visionx::ColoredLabeledPointCloud& pointCloud,
const Ice::Current&)
override;
125 void onNewSourcePointCloud();
128 void onFilterSmallSegmentsNumEdited();
129 void updateFilters();
132 void onRadioButtonShowInputToggled(
bool checked);
133 void onRadioButtonShowResultToggle(
bool checked);
136 void onShowIDsToggled(
bool checked);
137 void updateSegmentIDs();
139 void clearVisualization();
142 void updateUserGroupingRows(
int numRows);
143 void onUserGroupingChanged(uint32_t groupID, std::vector<uint32_t> segmentIDs);
144 void onTableGroupingCellChanged(
int row,
int col);
146 void publishSegmentation();
151 void newSourcePointCloud();
156 static std::vector<armarx::DrawColor> makeColorList();
161 void applyFilters(PointCloudT& pointCloud,
162 std::map<uint32_t, pcl::PointIndices>& segmentIndex);
165 void updatePointCloud(
const PointCloudT& pointCloud,
166 const std::map<uint32_t, pcl::PointIndices>& segmentIndex);
168 void computeSegmentIndex(
const PointCloudT& pointCloud);
169 void computeCenters(
const PointCloudT& pointCloud,
170 const std::map<uint32_t, pcl::PointIndices>& segmentIndex);
172 void updateTableOverview();
173 void drawSegmentIDs(
bool onlyIfChecked =
false);
174 void drawInputPointCloud(
bool onlyIfChecked =
false);
175 void drawResultPointCloud(
bool onlyIfChecked =
false);
177 armarx::DrawColor dcolor(std::size_t
id)
const;
178 QColor qcolor(std::size_t
id)
const;
184 Ui::UserAssistedSegmenterGuiWidget widget;
185 QPointer<UserAssistedSegmenterConfigDialog> configDialog;
190 std::string userAssistedSegmenterProxyName =
"UserAssistedSegmenter";
191 std::string userAssistedSegmenterTopicName =
"UserAssistedSegmenterUpdates";
195 visionx::UserAssistedSegmenterInterfacePrx segmenterProxy;
198 PointCloudT sourcePointCloud;
199 PointCloudT pointCloud;
201 std::map<uint32_t, pcl::PointIndices> segmentIndex;
202 std::map<uint32_t, Eigen::Vector3f> centers;
205 std::vector<std::vector<std::uint32_t>> userGrouping;
207 std::string layerPointCloud =
"UserAssistedSegmenter_PointCloud";
208 std::string layerSegmentIDs =
"UserAssistedSegmenter_SegmentIDs";