Skip to content

Commit ec1a2ff

Browse files
committed
First commit
1 parent d24569b commit ec1a2ff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+34943
-0
lines changed

CMakeLists.txt

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
2+
3+
#set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR)
4+
5+
file(COPY qcustomplot.h DESTINATION ${CMAKE_BINARY_DIR})
6+
7+
project(structrock)
8+
find_package(Qt4 REQUIRED)
9+
find_package(PCL 1.6.0 REQUIRED)
10+
11+
if(${VTK_VERSION} VERSION_GREATER "6")
12+
find_package(VTK COMPONENTS
13+
vtkGUISupportQt
14+
vtkRenderingQt
15+
vtkViewsQt
16+
)
17+
else()
18+
find_package(VTK REQUIRED)
19+
set(VTK_LIBRARIES vtkRendering vtkGraphics vtkHybrid QVTK)
20+
endif()
21+
22+
include_directories(${PCL_INCLUDE_DIRS})
23+
link_directories(${PCL_LIBRARY_DIRS})
24+
add_definitions(${PCL_DEFINITIONS})
25+
26+
file(GLOB project_SOURCES . *.cpp)
27+
28+
file(GLOB project_HEADERS . *.h)
29+
30+
file(GLOB project_FORMS . *.ui)
31+
32+
QT4_WRAP_CPP(project_HEADERS_MOC ${project_HEADERS})
33+
QT4_WRAP_UI(project_FORMS_HEADERS ${project_FORMS})
34+
35+
INCLUDE(${QT_USE_FILE})
36+
INCLUDE(${VTK_USE_FILE})
37+
ADD_DEFINITIONS(${QT_DEFINITIONS})
38+
39+
set(myApp_ICON ${CMAKE_CURRENT_SOURCE_DIR}/icon.icns)
40+
41+
if(WIN32)
42+
set(GUI_TYPE WIN32)
43+
endif(WIN32)
44+
if(APPLE)
45+
set(GUI_TYPE MACOSX_BUNDLE)
46+
set(MACOSX_BUNDLE_ICON_FILE icon.icns)
47+
set_source_file_properties(${myApp_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
48+
endif(APPLE)
49+
50+
ADD_EXECUTABLE(structrock ${GUI_TYPE} ${myApp_ICON} ${project_SOURCES} ${project_FORMS_HEADERS} ${project_HEADERS_MOC})
51+
52+
TARGET_LINK_LIBRARIES(structrock ${QT_LIBRARIES} ${PCL_LIBRARIES} ${VTK_LIBRARIES})
53+
54+
#INSTALL(SCRIPT bundle.cmake)

MultiInputDialog.cpp

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/*
2+
* Software License Agreement (BSD License)
3+
*
4+
* Xin Wang
5+
*
6+
* All rights reserved.
7+
*
8+
* Redistribution and use in source and binary forms, with or without
9+
* modification, are permitted provided that the following conditions
10+
* are met:
11+
*
12+
* * Redistributions of source code must retain the above copyright
13+
* notice, this list of conditions and the following disclaimer.
14+
* * Redistributions in binary form must reproduce the above
15+
* copyright notice, this list of conditions and the following
16+
* disclaimer in the documentation and/or other materials provided
17+
* with the distribution.
18+
* * Neither the name of the copyright holder(s) nor the names of its
19+
* contributors may be used to endorse or promote products derived
20+
* from this software without specific prior written permission.
21+
*
22+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25+
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26+
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28+
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32+
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33+
* POSSIBILITY OF SUCH DAMAGE.
34+
*
35+
* Author : Xin Wang
36+
37+
*
38+
*/
39+
40+
#include "MultiInputDialog.h"
41+
42+
43+
MultiInputDialog::MultiInputDialog(void)
44+
{
45+
dialog.setupUi(this);
46+
dialog.Curvature_doubleSpinBox->setDecimals(3);
47+
dialog.Smoothness_doubleSpinBox->setDecimals(3);
48+
dialog.Residual_doubleSpinBox->setDecimals(3);
49+
dialog.SmoothModecheckBox->setChecked(true);
50+
dialog.MinNumPoints_spinBox->setMaximum(10000);
51+
}
52+
53+
54+
MultiInputDialog::~MultiInputDialog(void)
55+
{
56+
}
57+
58+
double MultiInputDialog::getSmoothnessThreshold()
59+
{
60+
return dialog.Smoothness_doubleSpinBox->value();
61+
}
62+
double MultiInputDialog::getCurvatureThreshold()
63+
{
64+
return dialog.Curvature_doubleSpinBox->value();
65+
}
66+
double MultiInputDialog::getResidualThreshold()
67+
{
68+
return dialog.Residual_doubleSpinBox->value();
69+
}
70+
int MultiInputDialog::getNumberOfNeighbors()
71+
{
72+
return dialog.NumberOfNeighbors_spinBox->value();
73+
}
74+
int MultiInputDialog::getMinNumberOfPoints()
75+
{
76+
return dialog.MinNumPoints_spinBox->value();
77+
}
78+
bool MultiInputDialog::IsSmoothMode()
79+
{
80+
return dialog.SmoothModecheckBox->isChecked();
81+
}

MultiInputDialog.h

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* Software License Agreement (BSD License)
3+
*
4+
* Xin Wang
5+
*
6+
* All rights reserved.
7+
*
8+
* Redistribution and use in source and binary forms, with or without
9+
* modification, are permitted provided that the following conditions
10+
* are met:
11+
*
12+
* * Redistributions of source code must retain the above copyright
13+
* notice, this list of conditions and the following disclaimer.
14+
* * Redistributions in binary form must reproduce the above
15+
* copyright notice, this list of conditions and the following
16+
* disclaimer in the documentation and/or other materials provided
17+
* with the distribution.
18+
* * Neither the name of the copyright holder(s) nor the names of its
19+
* contributors may be used to endorse or promote products derived
20+
* from this software without specific prior written permission.
21+
*
22+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25+
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26+
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28+
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32+
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33+
* POSSIBILITY OF SUCH DAMAGE.
34+
*
35+
* Author : Xin Wang
36+
37+
*
38+
*/
39+
40+
#pragma once
41+
#include <qdialog.h>
42+
#include "../build/ui_Thresholds.h"
43+
class MultiInputDialog :
44+
public QDialog
45+
{
46+
public:
47+
MultiInputDialog(void);
48+
~MultiInputDialog(void);
49+
double getSmoothnessThreshold();
50+
double getCurvatureThreshold();
51+
double getResidualThreshold();
52+
int getNumberOfNeighbors();
53+
int getMinNumberOfPoints();
54+
bool IsSmoothMode();
55+
56+
private:
57+
Ui::ThresholdDialog dialog;
58+
};
59+

MyThread.h

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Software License Agreement (BSD License)
3+
*
4+
* Xin Wang
5+
*
6+
* All rights reserved.
7+
*
8+
* Redistribution and use in source and binary forms, with or without
9+
* modification, are permitted provided that the following conditions
10+
* are met:
11+
*
12+
* * Redistributions of source code must retain the above copyright
13+
* notice, this list of conditions and the following disclaimer.
14+
* * Redistributions in binary form must reproduce the above
15+
* copyright notice, this list of conditions and the following
16+
* disclaimer in the documentation and/or other materials provided
17+
* with the distribution.
18+
* * Neither the name of the copyright holder(s) nor the names of its
19+
* contributors may be used to endorse or promote products derived
20+
* from this software without specific prior written permission.
21+
*
22+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25+
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26+
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28+
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32+
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33+
* POSSIBILITY OF SUCH DAMAGE.
34+
*
35+
* Author : Xin Wang
36+
37+
*
38+
*/
39+
40+
#pragma once
41+
#include <QThread>
42+
class MyThread :
43+
public QThread
44+
{
45+
Q_OBJECT
46+
47+
public:
48+
void Sleep(unsigned long ms)
49+
{
50+
msleep(ms);
51+
}
52+
};

RGSWorker.cpp

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
/*
2+
* Software License Agreement (BSD License)
3+
*
4+
* Xin Wang
5+
*
6+
* All rights reserved.
7+
*
8+
* Redistribution and use in source and binary forms, with or without
9+
* modification, are permitted provided that the following conditions
10+
* are met:
11+
*
12+
* * Redistributions of source code must retain the above copyright
13+
* notice, this list of conditions and the following disclaimer.
14+
* * Redistributions in binary form must reproduce the above
15+
* copyright notice, this list of conditions and the following
16+
* disclaimer in the documentation and/or other materials provided
17+
* with the distribution.
18+
* * Neither the name of the copyright holder(s) nor the names of its
19+
* contributors may be used to endorse or promote products derived
20+
* from this software without specific prior written permission.
21+
*
22+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25+
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26+
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28+
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32+
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33+
* POSSIBILITY OF SUCH DAMAGE.
34+
*
35+
* Author : Xin Wang
36+
37+
*
38+
*/
39+
40+
#include <qinputdialog.h>
41+
#include <qmessagebox.h>
42+
#include "RGSWorker.h"
43+
#include "dataLibrary.h"
44+
#include "globaldef.h"
45+
#include "MultiInputDialog.h"
46+
#include "geo_region_growing.h"
47+
48+
void RGSWorker::doWork()
49+
{
50+
bool is_success(false);
51+
52+
dataLibrary::checkupflow();
53+
54+
dataLibrary::Status = STATUS_RGS;
55+
56+
double curvature = dataLibrary::RGSparameter.curvature;
57+
double smoothness = dataLibrary::RGSparameter.smoothness;
58+
double residual = dataLibrary::RGSparameter.residual;
59+
int number_of_neighbors = dataLibrary::RGSparameter.number_of_neighbors;
60+
int min_number_of_Points = dataLibrary::RGSparameter.min_number_of_Points;
61+
62+
pcl::search::Search<pcl::PointXYZ>::Ptr tree(new pcl::search::KdTree<pcl::PointXYZ>);
63+
64+
GeoRegionGrowing<pcl::PointXYZ, pcl::PointNormal> reg;
65+
reg.setMinClusterSize(min_number_of_Points);
66+
reg.setSearchMethod(tree);
67+
reg.setNumberOfNeighbours(number_of_neighbors);
68+
reg.setInputCloud(dataLibrary::cloudxyz);
69+
reg.setInputNormals(dataLibrary::pointnormals);
70+
reg.setSmoothnessThreshold(smoothness/180.0*M_PI);
71+
reg.setCurvatureThreshold(curvature);
72+
if(dataLibrary::RGSparameter.IsSmoothMode)
73+
{
74+
reg.setSmoothModeFlag(true);
75+
}
76+
else
77+
{
78+
reg.setSmoothModeFlag(false);
79+
reg.setResidualThreshold(residual/180.0*M_PI);
80+
}
81+
82+
reg.extract(dataLibrary::clusters);
83+
84+
dataLibrary::cloudxyzrgb_clusters = reg.getColoredCloud();
85+
86+
emit show();
87+
is_success = true;
88+
dataLibrary::Status = STATUS_READY;
89+
emit showReadyStatus();
90+
if(this->getWorkFlowMode()&&is_success)
91+
{
92+
this->Sleep(1000);
93+
emit GoWorkFlow();
94+
}
95+
}

0 commit comments

Comments
 (0)