├── .gitignore ├── CMakeLists.txt ├── FindPostgreSQL.cmake ├── LICENSE ├── LagrangeTensorWorker.cpp ├── LagrangeTensorWorker.h ├── Miniball.hpp ├── MultiInputDialog.cpp ├── MultiInputDialog.h ├── MultiStationWorker.cpp ├── MultiStationWorker.h ├── MyThread.h ├── README.md ├── RGSWorker.cpp ├── RGSWorker.h ├── ReadFileWorker.cpp ├── ReadFileWorker.h ├── ReadPolygonMeshWorker.cpp ├── ReadPolygonMeshWorker.h ├── ReadXYZWorker.cpp ├── ReadXYZWorker.h ├── ReadnShowClassesWorker.cpp ├── ReadnShowClassesWorker.h ├── SaveClustersWorker.cpp ├── SaveClustersWorker.h ├── SaveMeshWorker.cpp ├── SaveMeshWorker.h ├── SaveNormalsWorker.cpp ├── SaveNormalsWorker.h ├── SavePcdASCIIWorker.cpp ├── SavePcdASCIIWorker.h ├── SavePcdBinaryWorker.cpp ├── SavePcdBinaryWorker.h ├── SavePolygonMeshWorker.cpp ├── SavePolygonMeshWorker.h ├── SaveTraceMapWorker.cpp ├── SaveTraceMapWorker.h ├── ShearParaWorker.cpp ├── ShearParaWorker.h ├── ShowProcessWorker.cpp ├── ShowProcessWorker.h ├── ShowSFeatureWorker.cpp ├── ShowSFeatureWorker.h ├── StaticROWorker.cpp ├── StaticROWorker.h ├── TestWorker.cpp ├── TestWorker.h ├── Thresholds.ui ├── TimingShutdown.h ├── Worker.cpp ├── Worker.h ├── bundle.cmake ├── checkstatusThread.cpp ├── checkstatusThread.h ├── dataLibrary.cpp ├── dataLibrary.h ├── downsampleWorker.cpp ├── downsampleWorker.h ├── geo_normal_3d.cpp ├── geo_normal_3d.h ├── geo_normal_3d_omp.cpp ├── geo_normal_3d_omp.h ├── geo_region_growing.cpp ├── geo_region_growing.h ├── globaldef.h ├── gmsh_io.cpp ├── gmsh_io.h ├── icon.icns ├── icon.ico ├── knnormalWorker.cpp ├── knnormalWorker.h ├── main.cpp ├── openClustersWorker.cpp ├── openClustersWorker.h ├── plotwindow.cpp ├── plotwindow.h ├── plotwindow.ui ├── qcustomplot.cpp ├── qcustomplot.h ├── ranormalWorker.cpp ├── ranormalWorker.h ├── resampleWorker.cpp ├── resampleWorker.h ├── structrock.cpp ├── structrock.h ├── structrock.rc ├── structrock.ui ├── triangulationWorker.cpp ├── triangulationWorker.h └── wiki └── img ├── Thumbs.db ├── detailed_results.jpg ├── gui.jpg └── outcrop_results.jpg /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | *.obj 6 | 7 | # Precompiled Headers 8 | *.gch 9 | *.pch 10 | 11 | # Compiled Dynamic libraries 12 | *.so 13 | *.dylib 14 | *.dll 15 | 16 | # Fortran module files 17 | *.mod 18 | 19 | # Compiled Static libraries 20 | *.lai 21 | *.la 22 | *.a 23 | *.lib 24 | 25 | # Executables 26 | *.exe 27 | *.out 28 | *.app 29 | 30 | # Directories 31 | *.directory 32 | 33 | # VSCODE 34 | *.vscode 35 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6 FATAL_ERROR) 2 | 3 | set(project_NAME structrock) 4 | 5 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}") 6 | 7 | #set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR) 8 | 9 | file(COPY qcustomplot.h DESTINATION ${CMAKE_BINARY_DIR}) 10 | 11 | project(structrock) 12 | find_package(Qt4 REQUIRED) 13 | find_package(PCL 1.6.0 REQUIRED) 14 | 15 | find_package(PostgreSQL REQUIRED) 16 | 17 | include_directories (${PostgreSQL_INCLUDE_DIRS}) 18 | link_directories(${PostgreSQL_LIBRARY_DIRS}) 19 | 20 | if(${VTK_VERSION} VERSION_GREATER "6") 21 | find_package(VTK COMPONENTS 22 | vtkGUISupportQt 23 | vtkRenderingQt 24 | vtkViewsQt 25 | ) 26 | else() 27 | find_package(VTK REQUIRED) 28 | set(VTK_LIBRARIES vtkRendering vtkGraphics vtkHybrid QVTK) 29 | endif() 30 | 31 | include_directories(${PCL_INCLUDE_DIRS}) 32 | link_directories(${PCL_LIBRARY_DIRS}) 33 | add_definitions(${PCL_DEFINITIONS}) 34 | 35 | file(GLOB project_SOURCES . *.cpp) 36 | 37 | file(GLOB project_HEADERS . *.h *.hpp) 38 | 39 | file(GLOB project_FORMS . *.ui) 40 | 41 | QT4_WRAP_CPP(project_HEADERS_MOC ${project_HEADERS}) 42 | QT4_WRAP_UI(project_FORMS_HEADERS ${project_FORMS}) 43 | 44 | INCLUDE(${QT_USE_FILE}) 45 | INCLUDE(${VTK_USE_FILE}) 46 | ADD_DEFINITIONS(${QT_DEFINITIONS}) 47 | 48 | if(WIN32) 49 | set(GUI_TYPE WIN32) 50 | endif(WIN32) 51 | if(APPLE) 52 | set(GUI_TYPE MACOSX_BUNDLE) 53 | endif(APPLE) 54 | 55 | if(APPLE) 56 | set(MACOSX_BUNDLE_ICON_FILE icon.icns) 57 | set(myApp_ICON ${CMAKE_CURRENT_SOURCE_DIR}/icon.icns) 58 | SET_SOURCE_FILES_PROPERTIES(${myApp_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") 59 | else() 60 | set(myApp_ICON ${CMAKE_CURRENT_SOURCE_DIR}/structrock.rc) 61 | endif(APPLE) 62 | 63 | if(UNIX) 64 | file(COPY icon.ico DESTINATION ${CMAKE_BINARY_DIR}) 65 | file(WRITE structrock.desktop "[Desktop Entry]\nVersion=1.0\nName=Structrock\nGenericName=Structrock\nExec=${CMAKE_BINARY_DIR}/${project_NAME}\nIcon=${CMAKE_BINARY_DIR}/icon.ico\nTerminal=false\nType=Application\nCategories=Science;Math;\nKeywords=Science;3D Point Cloud;Rock;Processing;") 66 | file(RENAME structrock.desktop ${CMAKE_BINARY_DIR}/structrock.desktop) 67 | endif(UNIX) 68 | 69 | ADD_EXECUTABLE(${project_NAME} ${GUI_TYPE} ${myApp_ICON} ${project_SOURCES} ${project_FORMS_HEADERS} ${project_HEADERS_MOC}) 70 | 71 | if(MSVC) 72 | set_target_properties(${project_NAME} PROPERTIES LINK_FLAGS "/ENTRY:mainCRTStartup") 73 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /openmp") 74 | else() 75 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp -march=native") 76 | endif(MSVC) 77 | 78 | TARGET_LINK_LIBRARIES(structrock ${QT_LIBRARIES} ${PCL_LIBRARIES} ${VTK_LIBRARIES} ${PostgreSQL_LIBRARIES}) 79 | 80 | #INSTALL(SCRIPT bundle.cmake) 81 | -------------------------------------------------------------------------------- /FindPostgreSQL.cmake: -------------------------------------------------------------------------------- 1 | #.rst: 2 | # FindPostgreSQL 3 | # -------------- 4 | # 5 | # Find the PostgreSQL installation. 6 | # 7 | # This module defines 8 | # 9 | # :: 10 | # 11 | # PostgreSQL_LIBRARIES - the PostgreSQL libraries needed for linking 12 | # PostgreSQL_INCLUDE_DIRS - the directories of the PostgreSQL headers 13 | # PostgreSQL_LIBRARY_DIRS - the link directories for PostgreSQL libraries 14 | # PostgreSQL_VERSION_STRING - the version of PostgreSQL found (since CMake 2.8.8) 15 | 16 | #============================================================================= 17 | # Copyright 2004-2009 Kitware, Inc. 18 | # 19 | # Distributed under the OSI-approved BSD License (the "License"); 20 | # see accompanying file Copyright.txt for details. 21 | # 22 | # This software is distributed WITHOUT ANY WARRANTY; without even the 23 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 24 | # See the License for more information. 25 | #============================================================================= 26 | # (To distribute this file outside of CMake, substitute the full 27 | # License text for the above reference.) 28 | 29 | # ---------------------------------------------------------------------------- 30 | # History: 31 | # This module is derived from the module originally found in the VTK source tree. 32 | # 33 | # ---------------------------------------------------------------------------- 34 | # Note: 35 | # PostgreSQL_ADDITIONAL_VERSIONS is a variable that can be used to set the 36 | # version mumber of the implementation of PostgreSQL. 37 | # In Windows the default installation of PostgreSQL uses that as part of the path. 38 | # E.g C:\Program Files\PostgreSQL\8.4. 39 | # Currently, the following version numbers are known to this module: 40 | # "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0" 41 | # 42 | # To use this variable just do something like this: 43 | # set(PostgreSQL_ADDITIONAL_VERSIONS "9.2" "8.4.4") 44 | # before calling find_package(PostgreSQL) in your CMakeLists.txt file. 45 | # This will mean that the versions you set here will be found first in the order 46 | # specified before the default ones are searched. 47 | # 48 | # ---------------------------------------------------------------------------- 49 | # You may need to manually set: 50 | # PostgreSQL_INCLUDE_DIR - the path to where the PostgreSQL include files are. 51 | # PostgreSQL_LIBRARY_DIR - The path to where the PostgreSQL library files are. 52 | # If FindPostgreSQL.cmake cannot find the include files or the library files. 53 | # 54 | # ---------------------------------------------------------------------------- 55 | # The following variables are set if PostgreSQL is found: 56 | # PostgreSQL_FOUND - Set to true when PostgreSQL is found. 57 | # PostgreSQL_INCLUDE_DIRS - Include directories for PostgreSQL 58 | # PostgreSQL_LIBRARY_DIRS - Link directories for PostgreSQL libraries 59 | # PostgreSQL_LIBRARIES - The PostgreSQL libraries. 60 | # 61 | # ---------------------------------------------------------------------------- 62 | # If you have installed PostgreSQL in a non-standard location. 63 | # (Please note that in the following comments, it is assumed that 64 | # points to the root directory of the include directory of PostgreSQL.) 65 | # Then you have three options. 66 | # 1) After CMake runs, set PostgreSQL_INCLUDE_DIR to /include and 67 | # PostgreSQL_LIBRARY_DIR to wherever the library pq (or libpq in windows) is 68 | # 2) Use CMAKE_INCLUDE_PATH to set a path to /PostgreSQL<-version>. This will allow find_path() 69 | # to locate PostgreSQL_INCLUDE_DIR by utilizing the PATH_SUFFIXES option. e.g. In your CMakeLists.txt file 70 | # set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "/include") 71 | # 3) Set an environment variable called ${PostgreSQL_ROOT} that points to the root of where you have 72 | # installed PostgreSQL, e.g. . 73 | # 74 | # ---------------------------------------------------------------------------- 75 | 76 | set(PostgreSQL_INCLUDE_PATH_DESCRIPTION "top-level directory containing the PostgreSQL include directories. E.g /usr/local/include/PostgreSQL/8.4 or C:/Program Files/PostgreSQL/8.4/include") 77 | set(PostgreSQL_INCLUDE_DIR_MESSAGE "Set the PostgreSQL_INCLUDE_DIR cmake cache entry to the ${PostgreSQL_INCLUDE_PATH_DESCRIPTION}") 78 | set(PostgreSQL_LIBRARY_PATH_DESCRIPTION "top-level directory containing the PostgreSQL libraries.") 79 | set(PostgreSQL_LIBRARY_DIR_MESSAGE "Set the PostgreSQL_LIBRARY_DIR cmake cache entry to the ${PostgreSQL_LIBRARY_PATH_DESCRIPTION}") 80 | set(PostgreSQL_ROOT_DIR_MESSAGE "Set the PostgreSQL_ROOT system variable to where PostgreSQL is found on the machine E.g C:/Program Files/PostgreSQL/8.4") 81 | 82 | 83 | set(PostgreSQL_KNOWN_VERSIONS ${PostgreSQL_ADDITIONAL_VERSIONS} 84 | "9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0") 85 | 86 | # Define additional search paths for root directories. 87 | set( PostgreSQL_ROOT_DIRECTORIES 88 | ENV PostgreSQL_ROOT 89 | ${PostgreSQL_ROOT} 90 | ) 91 | foreach(suffix ${PostgreSQL_KNOWN_VERSIONS}) 92 | if(WIN32) 93 | list(APPEND PostgreSQL_LIBRARY_ADDITIONAL_SEARCH_SUFFIXES 94 | "PostgreSQL/${suffix}/lib") 95 | list(APPEND PostgreSQL_INCLUDE_ADDITIONAL_SEARCH_SUFFIXES 96 | "PostgreSQL/${suffix}/include") 97 | list(APPEND PostgreSQL_TYPE_ADDITIONAL_SEARCH_SUFFIXES 98 | "PostgreSQL/${suffix}/include/server") 99 | endif() 100 | if(UNIX) 101 | list(APPEND PostgreSQL_TYPE_ADDITIONAL_SEARCH_SUFFIXES 102 | "postgresql/${suffix}/server") 103 | endif() 104 | endforeach() 105 | 106 | # 107 | # Look for an installation. 108 | # 109 | find_path(PostgreSQL_INCLUDE_DIR 110 | NAMES libpq-fe.h 111 | PATHS 112 | # Look in other places. 113 | ${PostgreSQL_ROOT_DIRECTORIES} 114 | PATH_SUFFIXES 115 | pgsql 116 | postgresql 117 | include 118 | ${PostgreSQL_INCLUDE_ADDITIONAL_SEARCH_SUFFIXES} 119 | # Help the user find it if we cannot. 120 | DOC "The ${PostgreSQL_INCLUDE_DIR_MESSAGE}" 121 | ) 122 | 123 | find_path(PostgreSQL_TYPE_INCLUDE_DIR 124 | NAMES catalog/pg_type.h 125 | PATHS 126 | # Look in other places. 127 | ${PostgreSQL_ROOT_DIRECTORIES} 128 | PATH_SUFFIXES 129 | postgresql 130 | pgsql/server 131 | postgresql/server 132 | include/server 133 | ${PostgreSQL_TYPE_ADDITIONAL_SEARCH_SUFFIXES} 134 | # Help the user find it if we cannot. 135 | DOC "The ${PostgreSQL_INCLUDE_DIR_MESSAGE}" 136 | ) 137 | 138 | # The PostgreSQL library. 139 | set (PostgreSQL_LIBRARY_TO_FIND pq) 140 | # Setting some more prefixes for the library 141 | set (PostgreSQL_LIB_PREFIX "") 142 | if ( WIN32 ) 143 | set (PostgreSQL_LIB_PREFIX ${PostgreSQL_LIB_PREFIX} "lib") 144 | set (PostgreSQL_LIBRARY_TO_FIND ${PostgreSQL_LIB_PREFIX}${PostgreSQL_LIBRARY_TO_FIND}) 145 | endif() 146 | 147 | find_library(PostgreSQL_LIBRARY 148 | NAMES ${PostgreSQL_LIBRARY_TO_FIND} 149 | PATHS 150 | ${PostgreSQL_ROOT_DIRECTORIES} 151 | PATH_SUFFIXES 152 | lib 153 | ${PostgreSQL_LIBRARY_ADDITIONAL_SEARCH_SUFFIXES} 154 | # Help the user find it if we cannot. 155 | DOC "The ${PostgreSQL_LIBRARY_DIR_MESSAGE}" 156 | ) 157 | get_filename_component(PostgreSQL_LIBRARY_DIR ${PostgreSQL_LIBRARY} PATH) 158 | 159 | if (PostgreSQL_INCLUDE_DIR) 160 | # Some platforms include multiple pg_config.hs for multi-lib configurations 161 | # This is a temporary workaround. A better solution would be to compile 162 | # a dummy c file and extract the value of the symbol. 163 | file(GLOB _PG_CONFIG_HEADERS "${PostgreSQL_INCLUDE_DIR}/pg_config*.h") 164 | foreach(_PG_CONFIG_HEADER ${_PG_CONFIG_HEADERS}) 165 | if(EXISTS "${_PG_CONFIG_HEADER}") 166 | file(STRINGS "${_PG_CONFIG_HEADER}" pgsql_version_str 167 | REGEX "^#define[\t ]+PG_VERSION[\t ]+\".*\"") 168 | if(pgsql_version_str) 169 | string(REGEX REPLACE "^#define[\t ]+PG_VERSION[\t ]+\"([^\"]*)\".*" 170 | "\\1" PostgreSQL_VERSION_STRING "${pgsql_version_str}") 171 | break() 172 | endif() 173 | endif() 174 | endforeach() 175 | unset(pgsql_version_str) 176 | endif() 177 | 178 | if (PostgreSQL_LIBRARY AND PostgreSQL_INCLUDE_DIR AND PostgreSQL_TYPE_INCLUDE_DIR) 179 | set(PostgreSQL_FOUND TRUE) 180 | endif() 181 | 182 | # Now try to get the include and library path. 183 | if(PostgreSQL_FOUND) 184 | set(PostgreSQL_INCLUDE_DIRS ${PostgreSQL_INCLUDE_DIR} ${PostgreSQL_TYPE_INCLUDE_DIR} ) 185 | set(PostgreSQL_LIBRARY_DIRS ${PostgreSQL_LIBRARY_DIR} ) 186 | set(PostgreSQL_LIBRARIES ${PostgreSQL_LIBRARY_TO_FIND}) 187 | endif() 188 | 189 | mark_as_advanced(PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR PostgreSQL_LIBRARY ) -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016, Xin Wang 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of structrock nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | 29 | -------------------------------------------------------------------------------- /LagrangeTensorWorker.h: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #pragma once 41 | #include "Worker.h" 42 | class LagrangeTensorWorker : public Worker{ 43 | Q_OBJECT 44 | 45 | private: 46 | QString _filename_striations; 47 | QString _filename_steps; 48 | QString _filename_size; 49 | QString _filename_tensor; 50 | bool _has_size_th; 51 | double _size_th; 52 | double _angle_th; 53 | double _striations_M_th; 54 | double _steps_M_th; 55 | bool _is_K_fixed; 56 | double _K; 57 | 58 | public: 59 | void LagrangeTensor(){ 60 | QMetaObject::invokeMethod(this, "doWork"); 61 | } 62 | void setStriationsFileName(QString name){ 63 | _filename_striations = name; 64 | } 65 | QString getStriationsFileName(){ 66 | return _filename_striations; 67 | } 68 | void setStepsFileName(QString name){ 69 | _filename_steps = name; 70 | } 71 | QString getStepsFileName(){ 72 | return _filename_steps; 73 | } 74 | void setSizeFileName(QString name){ 75 | _filename_size = name; 76 | } 77 | QString getSizeFileName(){ 78 | return _filename_size; 79 | } 80 | void setTensorFileName(QString name){ 81 | _filename_tensor = name; 82 | } 83 | QString getTensorFileName(){ 84 | return _filename_tensor; 85 | } 86 | void setSizeThMode(bool mode){ 87 | _has_size_th = mode; 88 | } 89 | bool getSizeThMode(){ 90 | return _has_size_th; 91 | } 92 | void setSizeTh(double size_th){ 93 | _size_th = size_th; 94 | } 95 | double getSizeTh(){ 96 | return _size_th; 97 | } 98 | void setAngleTh(double angle_th){ 99 | _angle_th = angle_th; 100 | } 101 | double getAngleTh(){ 102 | return _angle_th; 103 | } 104 | void setStriationsMTh(double striations_M_th){ 105 | _striations_M_th = striations_M_th; 106 | } 107 | double getStriationsMTh(){ 108 | return _striations_M_th; 109 | } 110 | void setStepsMTh(double steps_M_th){ 111 | _steps_M_th = steps_M_th; 112 | } 113 | double getStepsMTh(){ 114 | return _steps_M_th; 115 | } 116 | void setKfixedMode(bool mode){ 117 | _is_K_fixed = mode; 118 | } 119 | bool getKfixedMode(){ 120 | return _is_K_fixed; 121 | } 122 | void setK(double K){ 123 | _K = K; 124 | } 125 | double getK(){ 126 | return _K; 127 | } 128 | virtual bool is_para_satisfying(QString &message); 129 | virtual void prepare(); 130 | 131 | private slots: 132 | void doWork(); 133 | }; -------------------------------------------------------------------------------- /MultiInputDialog.cpp: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 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 | } 82 | -------------------------------------------------------------------------------- /MultiInputDialog.h: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #pragma once 41 | #include 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 | 60 | -------------------------------------------------------------------------------- /MultiStationWorker.h: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #pragma once 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include "Worker.h" 46 | 47 | class MultiStationWorker : 48 | public Worker 49 | { 50 | Q_OBJECT 51 | 52 | private: 53 | std::vector multiStationFilePath; 54 | std::vector::Ptr> multiStationPointClouds; 55 | double _pre_align_ds_leaf; 56 | double _pre_align_StdDev; 57 | int _pre_align_normals_k; 58 | double _max_correspondence_distance; 59 | double _euclidean_fitness_epsilon; 60 | 61 | public: 62 | void multiStation(){ 63 | QMetaObject::invokeMethod(this, "doWork"); 64 | } 65 | void setPreAlignDSLeaf(double pre_align_ds_leaf){ 66 | _pre_align_ds_leaf = pre_align_ds_leaf; 67 | } 68 | double getPreAlignDSLeaf(){ 69 | return _pre_align_ds_leaf; 70 | } 71 | void setPreAlignStdDev(double pre_align_StdDev){ 72 | _pre_align_StdDev = pre_align_StdDev; 73 | } 74 | double getPreAlignStdDev(){ 75 | return _pre_align_StdDev; 76 | } 77 | void setPreAlignNormalsK(int pre_align_normals_k){ 78 | _pre_align_normals_k = pre_align_normals_k; 79 | } 80 | int getPreAlignNormalsK(){ 81 | return _pre_align_normals_k; 82 | } 83 | void setMaxCorrDistance(double max_correspondence_distance){ 84 | _max_correspondence_distance = max_correspondence_distance; 85 | } 86 | double getMaxCorrDistance(){ 87 | return _max_correspondence_distance; 88 | } 89 | void setEFEpsilon(double euclidean_fitness_epsilon){ 90 | _euclidean_fitness_epsilon = euclidean_fitness_epsilon; 91 | } 92 | double getEFEpsilon(){ 93 | return _euclidean_fitness_epsilon; 94 | } 95 | virtual bool is_para_satisfying(QString &message); 96 | virtual void prepare(); 97 | 98 | private slots: 99 | void doWork(); 100 | 101 | signals: 102 | void show(int i); 103 | }; -------------------------------------------------------------------------------- /MyThread.h: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #pragma once 41 | #include 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: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #include 41 | #include 42 | #include "RGSWorker.h" 43 | #include "dataLibrary.h" 44 | #include "globaldef.h" 45 | #include "MultiInputDialog.h" 46 | #include "geo_region_growing.h" 47 | 48 | bool RGSWorker::is_para_satisfying(QString &message) 49 | { 50 | if(dataLibrary::haveBaseData()) 51 | { 52 | if(!dataLibrary::pointnormals->empty()) 53 | { 54 | this->setParaSize(6); 55 | if(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters.size()>=this->getParaSize()) 56 | { 57 | double smoothness, curvature, residual; 58 | std::stringstream ss_smoothness(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters[0]); 59 | ss_smoothness >> smoothness; 60 | std::stringstream ss_curvature(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters[1]); 61 | ss_curvature >> curvature; 62 | std::stringstream ss_residual(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters[2]); 63 | ss_residual >> residual; 64 | int min_number_of_Points, number_of_neighbors; 65 | std::stringstream ss_min_number_of_Points(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters[3]); 66 | ss_min_number_of_Points >> min_number_of_Points; 67 | std::stringstream ss_number_of_neighbors(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters[4]); 68 | ss_number_of_neighbors >> number_of_neighbors; 69 | std::string IsSmoothMode_string = dataLibrary::Workflow[dataLibrary::current_workline_index].parameters[5]; 70 | std::transform(IsSmoothMode_string.begin(), IsSmoothMode_string.end(), IsSmoothMode_string.begin(), ::tolower); 71 | if((IsSmoothMode_string == "true")||(IsSmoothMode_string == "false")) 72 | { 73 | RGSpara temp_para; 74 | if(IsSmoothMode_string == "true") 75 | { 76 | temp_para.IsSmoothMode=true; 77 | } 78 | else if(IsSmoothMode_string == "false") 79 | { 80 | temp_para.IsSmoothMode=false; 81 | } 82 | temp_para.curvature = curvature; 83 | temp_para.min_number_of_Points = min_number_of_Points; 84 | temp_para.number_of_neighbors = number_of_neighbors; 85 | temp_para.residual = residual; 86 | temp_para.smoothness = smoothness; 87 | this->setRGSpara(temp_para); 88 | 89 | this->setParaIndex(this->getParaSize()); 90 | return true; 91 | } 92 | else 93 | { 94 | message = QString("rgsegmentation: IsSmoothMode Not Set Correctly, Please Set It With \"true\" or \"false\"."); 95 | return false; 96 | } 97 | } 98 | else 99 | { 100 | message = QString("rgsegmentation: No (or not enough) Parameter Given.\n(smoothness, curvature, residual, min_number_of_Points, number_of_neighbors and IsSmoothMode)"); 101 | return false; 102 | } 103 | } 104 | else 105 | { 106 | message = QString("rgsegmentation: Please Estimate Normals First."); 107 | return false; 108 | } 109 | } 110 | else 111 | { 112 | message = QString("rgsegmentation: You Do Not Have Any Point Cloud Data in Memery!"); 113 | return false; 114 | } 115 | } 116 | 117 | void RGSWorker::prepare() 118 | { 119 | this->setUnmute(); 120 | this->setWriteLog(); 121 | this->check_mute_nolog(); 122 | } 123 | 124 | void RGSWorker::doWork() 125 | { 126 | bool is_success(false); 127 | 128 | dataLibrary::checkupflow(); 129 | 130 | dataLibrary::Status = STATUS_RGS; 131 | 132 | this->timer_start(); 133 | 134 | //begin of processing 135 | double curvature = this->getRGSpara().curvature; 136 | double smoothness = this->getRGSpara().smoothness; 137 | double residual = this->getRGSpara().residual; 138 | int number_of_neighbors = this->getRGSpara().number_of_neighbors; 139 | int min_number_of_Points = this->getRGSpara().min_number_of_Points; 140 | 141 | pcl::search::Search::Ptr tree(new pcl::search::KdTree); 142 | 143 | GeoRegionGrowing reg; 144 | reg.setMinClusterSize(min_number_of_Points); 145 | reg.setSearchMethod(tree); 146 | reg.setNumberOfNeighbours(number_of_neighbors); 147 | reg.setInputCloud(dataLibrary::cloudxyz); 148 | reg.setInputNormals(dataLibrary::pointnormals); 149 | reg.setSmoothnessThreshold(smoothness/180.0*M_PI); 150 | reg.setCurvatureThreshold(curvature); 151 | if(this->getRGSpara().IsSmoothMode) 152 | { 153 | reg.setSmoothModeFlag(true); 154 | } 155 | else 156 | { 157 | reg.setSmoothModeFlag(false); 158 | reg.setResidualThreshold(residual/180.0*M_PI); 159 | } 160 | 161 | reg.extract(dataLibrary::clusters); 162 | 163 | dataLibrary::cloudxyzrgb_clusters = reg.getColoredCloud(); 164 | 165 | is_success = true; 166 | //end of processing 167 | 168 | this->timer_stop(); 169 | 170 | if(this->getWriteLogMode()&&is_success) 171 | { 172 | std::string log_text = "\tRegion Growing Segmentation costs: "; 173 | std::ostringstream strs; 174 | strs << this->getTimer_sec(); 175 | log_text += (strs.str() +" seconds."); 176 | dataLibrary::write_text_to_log_file(log_text); 177 | } 178 | 179 | if(!this->getMuteMode()&&is_success) 180 | { 181 | emit show(); 182 | } 183 | 184 | dataLibrary::Status = STATUS_READY; 185 | emit showReadyStatus(); 186 | if(this->getWorkFlowMode()&&is_success) 187 | { 188 | this->Sleep(1000); 189 | emit GoWorkFlow(); 190 | } 191 | } 192 | -------------------------------------------------------------------------------- /RGSWorker.h: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #pragma once 41 | #include "Worker.h" 42 | #include "globaldef.h" 43 | class RGSWorker : 44 | public Worker 45 | { 46 | Q_OBJECT 47 | 48 | private: 49 | RGSpara _para; 50 | 51 | public: 52 | void rgs() 53 | { 54 | QMetaObject::invokeMethod(this, "doWork"); 55 | } 56 | void setRGSpara(RGSpara para) 57 | { 58 | _para.curvature = para.curvature; 59 | _para.IsSmoothMode = para.IsSmoothMode; 60 | _para.min_number_of_Points = para.min_number_of_Points; 61 | _para.number_of_neighbors = para.number_of_neighbors; 62 | _para.residual = para.residual; 63 | _para.smoothness = para.smoothness; 64 | } 65 | RGSpara getRGSpara() 66 | { 67 | return _para; 68 | } 69 | virtual bool is_para_satisfying(QString &message); 70 | virtual void prepare(); 71 | 72 | private slots: 73 | void doWork(); 74 | 75 | signals: 76 | void show(); 77 | }; 78 | 79 | -------------------------------------------------------------------------------- /ReadFileWorker.cpp: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include "ReadFileWorker.h" 46 | #include "globaldef.h" 47 | #include "dataLibrary.h" 48 | 49 | bool ReadFileWorker::is_para_satisfying(QString &message) 50 | { 51 | this->setParaSize(1); 52 | if(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters.size()>=this->getParaSize()) 53 | { 54 | this->setFileName(QString::fromUtf8(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters[0].c_str())); 55 | this->setParaIndex(this->getParaSize()); 56 | return true; 57 | } 58 | else 59 | { 60 | message = QString("openpcd: Location of PCD File Not Provided."); 61 | return false; 62 | } 63 | } 64 | 65 | void ReadFileWorker::prepare() 66 | { 67 | this->setUnmute(); 68 | this->setWriteLog(); 69 | this->check_mute_nolog(); 70 | } 71 | 72 | void ReadFileWorker::doWork() 73 | { 74 | bool is_success(false); 75 | 76 | QByteArray ba = this->getFileName().toLocal8Bit(); 77 | std::string* strfilename = new std::string(ba.data()); 78 | 79 | sensor_msgs::PointCloud2::Ptr cloud_blob(new sensor_msgs::PointCloud2); 80 | 81 | dataLibrary::Status = STATUS_OPENPCD; 82 | 83 | this->timer_start(); 84 | 85 | //begin of processing 86 | if(!pcl::io::loadPCDFile (*strfilename, *cloud_blob)) 87 | { 88 | dataLibrary::clearall(); 89 | 90 | pcl::fromROSMsg (*cloud_blob, *dataLibrary::cloudxyz); 91 | 92 | if(pcl::getFieldIndex (*cloud_blob, "rgb")<0) 93 | { 94 | dataLibrary::cloudID = *strfilename; 95 | 96 | if(!this->getMuteMode()) 97 | { 98 | emit ReadFileReady(CLOUDXYZ); 99 | } 100 | is_success = true; 101 | } 102 | else 103 | { 104 | pcl::fromROSMsg (*cloud_blob, *dataLibrary::cloudxyzrgb); 105 | dataLibrary::cloudID = *strfilename; 106 | 107 | if(!this->getMuteMode()) 108 | { 109 | emit ReadFileReady(CLOUDXYZRGB); 110 | } 111 | is_success = true; 112 | } 113 | } 114 | else 115 | { 116 | emit showErrors("Error opening pcd file."); 117 | } 118 | //end of processing 119 | 120 | this->timer_stop(); 121 | 122 | if(this->getWriteLogMode()&&is_success) 123 | { 124 | std::string string_filename = this->getFileName().toUtf8().constData(); 125 | std::string log_text = string_filename + "\n\tReading PCD file costs: "; 126 | std::ostringstream strs; 127 | strs << this->getTimer_sec(); 128 | log_text += (strs.str() +" seconds."); 129 | dataLibrary::write_text_to_log_file(log_text); 130 | } 131 | 132 | dataLibrary::Status = STATUS_READY; 133 | emit showReadyStatus(); 134 | delete strfilename; 135 | if(this->getWorkFlowMode()&&is_success) 136 | { 137 | this->Sleep(1000); 138 | emit GoWorkFlow(); 139 | } 140 | } -------------------------------------------------------------------------------- /ReadFileWorker.h: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #pragma once 41 | #include "Worker.h" 42 | 43 | class ReadFileWorker : public Worker 44 | { 45 | Q_OBJECT 46 | 47 | private: 48 | QString _filename; 49 | 50 | public: 51 | void readFile() 52 | { 53 | QMetaObject::invokeMethod(this, "doWork"); 54 | } 55 | void setFileName(QString name) 56 | { 57 | _filename = name; 58 | } 59 | QString getFileName() 60 | { 61 | return _filename; 62 | } 63 | virtual bool is_para_satisfying(QString &message); 64 | virtual void prepare(); 65 | 66 | public slots: 67 | void doWork(); 68 | 69 | signals: 70 | void ReadFileReady(int i); 71 | }; -------------------------------------------------------------------------------- /ReadPolygonMeshWorker.cpp: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include "ReadPolygonMeshWorker.h" 49 | #include "globaldef.h" 50 | #include "dataLibrary.h" 51 | 52 | using namespace std; 53 | 54 | bool ReadPolygonMeshWorker::is_para_satisfying(QString &message) 55 | { 56 | if(dataLibrary::Fracture_Triangles.size()>0) 57 | { 58 | message = QString("openftriangulation: Triangulation Data Already Loaded!"); 59 | return false; 60 | } 61 | else 62 | { 63 | this->setParaSize(1); 64 | if(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters.size()>=this->getParaSize()) 65 | { 66 | this->setFileName(QString::fromUtf8(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters[0].c_str())); 67 | this->setParaIndex(this->getParaSize()); 68 | return true; 69 | } 70 | else 71 | { 72 | message = QString("openftriangulation: Save Path Not Provided."); 73 | return false; 74 | } 75 | } 76 | } 77 | 78 | void ReadPolygonMeshWorker::prepare() 79 | { 80 | this->setUnmute(); 81 | this->setWriteLog(); 82 | this->check_mute_nolog(); 83 | } 84 | 85 | void ReadPolygonMeshWorker::doWork() 86 | { 87 | bool is_success(false); 88 | 89 | QByteArray ba = this->getFileName().toLocal8Bit(); 90 | string* strfilename = new string(ba.data()); 91 | 92 | dataLibrary::Status = STATUS_OPENPOLYGONMESH; 93 | 94 | this->timer_start(); 95 | 96 | //begin of processing 97 | string fracture_count_file = *strfilename + "_count.txt"; 98 | ifstream fracture_count_in; 99 | fracture_count_in.open (fracture_count_file.c_str()); 100 | if (!fracture_count_in.is_open() || fracture_count_in.fail()){ 101 | emit showErrors(QString(("Unable to open file "+fracture_count_file).c_str())); 102 | fracture_count_in.close(); 103 | } 104 | else{ 105 | string line; 106 | int linenum = 1; 107 | bool read_count_success(false); 108 | int fracture_count; 109 | while (!fracture_count_in.eof()){ 110 | getline(fracture_count_in, line); 111 | if(linenum == 1){ 112 | // Ignore empty lines 113 | if (line != ""){ 114 | boost::trim(line); 115 | fracture_count = stoi(line); 116 | read_count_success = true; 117 | } 118 | } 119 | linenum++; 120 | } 121 | fracture_count_in.close(); 122 | if(read_count_success){ 123 | for(int i=0; itimer_stop(); 141 | 142 | if(this->getWriteLogMode()&&is_success) 143 | { 144 | string log_text = "\tOpening Fractures Triangulation Data costs: "; 145 | ostringstream strs; 146 | strs << this->getTimer_sec(); 147 | log_text += (strs.str() +" seconds."); 148 | dataLibrary::write_text_to_log_file(log_text); 149 | } 150 | 151 | if(!this->getMuteMode()&&is_success) 152 | { 153 | emit show(); 154 | } 155 | 156 | dataLibrary::Status = STATUS_READY; 157 | emit showReadyStatus(); 158 | delete strfilename; 159 | if(this->getWorkFlowMode()&&is_success) 160 | { 161 | this->Sleep(1000); 162 | emit GoWorkFlow(); 163 | } 164 | } -------------------------------------------------------------------------------- /ReadPolygonMeshWorker.h: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #pragma once 41 | #include "Worker.h" 42 | class ReadPolygonMeshWorker : public Worker 43 | { 44 | Q_OBJECT 45 | 46 | private: 47 | QString _filename; 48 | 49 | public: 50 | void readpolygonmesh() 51 | { 52 | QMetaObject::invokeMethod(this, "doWork"); 53 | } 54 | void setFileName(QString name) 55 | { 56 | _filename = name; 57 | } 58 | QString getFileName() 59 | { 60 | return _filename; 61 | } 62 | virtual bool is_para_satisfying(QString &message); 63 | virtual void prepare(); 64 | 65 | public slots: 66 | void doWork(); 67 | signals: 68 | void show(); 69 | }; -------------------------------------------------------------------------------- /ReadXYZWorker.cpp: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include "ReadXYZWorker.h" 45 | #include "globaldef.h" 46 | #include "dataLibrary.h" 47 | 48 | using namespace std; 49 | 50 | bool ReadXYZWorker::is_para_satisfying(QString &message) 51 | { 52 | this->setParaSize(1); 53 | if(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters.size()>=this->getParaSize()) 54 | { 55 | this->setFileName(QString::fromUtf8(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters[0].c_str())); 56 | this->setParaIndex(this->getParaSize()); 57 | return true; 58 | } 59 | else 60 | { 61 | message = QString("openxyz: Location of XYZ File Not Provided."); 62 | return false; 63 | } 64 | } 65 | 66 | void ReadXYZWorker::prepare() 67 | { 68 | this->setUnmute(); 69 | this->setWriteLog(); 70 | this->check_mute_nolog(); 71 | } 72 | 73 | bool loadCloud (const string &filename, pcl::PointCloud &cloud) 74 | { 75 | ifstream fs; 76 | fs.open (filename.c_str (), ios::binary); 77 | if (!fs.is_open () || fs.fail ()) 78 | { 79 | PCL_ERROR ("Could not open file '%s'! Error : %s\n", filename.c_str (), strerror (errno)); 80 | fs.close (); 81 | return (false); 82 | } 83 | 84 | string line; 85 | vector st; 86 | 87 | while (!fs.eof ()) 88 | { 89 | getline (fs, line); 90 | // Ignore empty lines 91 | if (line == "") 92 | continue; 93 | 94 | // Tokenize the line 95 | boost::trim (line); 96 | boost::split (st, line, boost::is_any_of (",\t\r "), boost::token_compress_on); 97 | 98 | if (st.size () < 3) 99 | continue; 100 | 101 | cloud.push_back (pcl::PointXYZ (float (atof (st[0].c_str ())), float (atof (st[1].c_str ())), float (atof (st[2].c_str ())))); 102 | } 103 | fs.close (); 104 | 105 | cloud.width = uint32_t (cloud.size ()); cloud.height = 1; cloud.is_dense = true; 106 | return (true); 107 | } 108 | 109 | void ReadXYZWorker::doWork() 110 | { 111 | bool is_success(false); 112 | 113 | QByteArray ba = this->getFileName().toLocal8Bit(); 114 | string* strfilename = new std::string(ba.data()); 115 | 116 | dataLibrary::clearall(); 117 | 118 | dataLibrary::Status = STATUS_OPENXYZ; 119 | 120 | this->timer_start(); 121 | 122 | //begin of processing 123 | if(loadCloud (*strfilename, *dataLibrary::cloudxyz)) 124 | { 125 | if(!this->getMuteMode()) 126 | { 127 | emit ReadXYZReady(CLOUDXYZ); 128 | } 129 | is_success = true; 130 | } 131 | else 132 | { 133 | emit showErrors("Error opening xyz file."); 134 | } 135 | 136 | dataLibrary::cloudID = *strfilename; 137 | //end of processing 138 | 139 | this->timer_stop(); 140 | 141 | if(this->getWriteLogMode()&&is_success) 142 | { 143 | std::string string_filename = this->getFileName().toUtf8().constData(); 144 | std::string log_text = string_filename + "\n\tReading XYZ file costs: "; 145 | std::ostringstream strs; 146 | strs << this->getTimer_sec(); 147 | log_text += (strs.str() +" seconds."); 148 | dataLibrary::write_text_to_log_file(log_text); 149 | } 150 | 151 | dataLibrary::Status = STATUS_READY; 152 | emit showReadyStatus(); 153 | delete strfilename; 154 | if(this->getWorkFlowMode()&&is_success) 155 | { 156 | this->Sleep(1000); 157 | emit GoWorkFlow(); 158 | } 159 | } -------------------------------------------------------------------------------- /ReadXYZWorker.h: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #pragma once 41 | #include "Worker.h" 42 | class ReadXYZWorker : public Worker 43 | { 44 | Q_OBJECT 45 | 46 | private: 47 | QString _filename; 48 | 49 | public: 50 | void readXYZ() 51 | { 52 | QMetaObject::invokeMethod(this, "doWork"); 53 | } 54 | void setFileName(QString name) 55 | { 56 | _filename = name; 57 | } 58 | QString getFileName() 59 | { 60 | return _filename; 61 | } 62 | virtual bool is_para_satisfying(QString &message); 63 | virtual void prepare(); 64 | 65 | private slots: 66 | void doWork(); 67 | signals: 68 | void ReadXYZReady(int i); 69 | }; -------------------------------------------------------------------------------- /ReadnShowClassesWorker.h: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #pragma once 41 | #include "Worker.h" 42 | class ReadnShowClassesWorker : public Worker 43 | { 44 | Q_OBJECT 45 | 46 | private: 47 | QString _filename; 48 | int _feature_type; 49 | float _percent_out; 50 | float _ratio_threshold; 51 | 52 | private: 53 | bool readFeatures(const std::string &filename, std::string err_message); 54 | void saveColorBar(const std::string &filename); 55 | public: 56 | void readnshowfeatures(){ 57 | QMetaObject::invokeMethod(this, "doWork"); 58 | } 59 | void setFileName(QString name){ 60 | _filename = name; 61 | } 62 | QString getFileName(){ 63 | return _filename; 64 | } 65 | void setFeatureType(int type){ 66 | _feature_type = type; 67 | } 68 | int getFeatureType(){ 69 | return _feature_type; 70 | } 71 | void setPercentOut(float percent){ 72 | _percent_out = percent; 73 | } 74 | float getPercentOut(){ 75 | return _percent_out; 76 | } 77 | void setRatioThreshold(float threshold){ 78 | _ratio_threshold = threshold; 79 | } 80 | float getRatioThreshold(){ 81 | return _ratio_threshold; 82 | } 83 | virtual bool is_para_satisfying(QString &message); 84 | virtual void prepare(); 85 | 86 | public slots: 87 | void doWork(); 88 | 89 | signals: 90 | void show(); 91 | }; -------------------------------------------------------------------------------- /SaveClustersWorker.h: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #pragma once 41 | 42 | #include "Worker.h" 43 | #include "globaldef.h" 44 | 45 | class SaveClustersWorker : public Worker 46 | { 47 | Q_OBJECT 48 | 49 | public: 50 | void saveclusters() 51 | { 52 | QMetaObject::invokeMethod(this, "doWork"); 53 | } 54 | private: 55 | QString _filename; 56 | public: 57 | void setFileName(QString name) 58 | { 59 | _filename = name; 60 | } 61 | QString getFileName() 62 | { 63 | return _filename; 64 | } 65 | virtual bool is_para_satisfying(QString &message); 66 | virtual void prepare(); 67 | 68 | private slots: 69 | void doWork(); 70 | }; 71 | -------------------------------------------------------------------------------- /SaveMeshWorker.h: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #pragma once 41 | 42 | #include "Worker.h" 43 | #include "globaldef.h" 44 | 45 | class SaveMeshWorker : public Worker 46 | { 47 | Q_OBJECT 48 | 49 | public: 50 | void savemesh() 51 | { 52 | QMetaObject::invokeMethod(this, "doWork"); 53 | } 54 | private: 55 | QString _filename; 56 | int _aperture_length_model; 57 | double _proportionality_coefficient; 58 | public: 59 | void setApertureLengthModel(int model) 60 | { 61 | _aperture_length_model = model; 62 | } 63 | int getApertureLengthModel() 64 | { 65 | return _aperture_length_model; 66 | } 67 | void setProportionalityCoefficient(double coefficient) 68 | { 69 | _proportionality_coefficient = coefficient; 70 | } 71 | double getProportionalityCoefficient() 72 | { 73 | return _proportionality_coefficient; 74 | } 75 | void setFileName(QString name) 76 | { 77 | _filename = name; 78 | } 79 | QString getFileName() 80 | { 81 | return _filename; 82 | } 83 | virtual bool is_para_satisfying(QString &message); 84 | virtual void prepare(); 85 | 86 | private slots: 87 | void doWork(); 88 | }; 89 | -------------------------------------------------------------------------------- /SaveNormalsWorker.cpp: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #include 41 | #include 42 | #include "SaveNormalsWorker.h" 43 | #include "globaldef.h" 44 | #include "dataLibrary.h" 45 | 46 | bool SaveNormalsWorker::is_para_satisfying(QString &message) 47 | { 48 | this->setParaSize(1); 49 | if(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters.size()>=this->getParaSize()) 50 | { 51 | this->setFileName(QString::fromUtf8(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters[0].c_str())); 52 | this->setParaIndex(this->getParaSize()); 53 | return true; 54 | } 55 | else 56 | { 57 | message = QString("savenormals: Path Not Provided."); 58 | return false; 59 | } 60 | } 61 | 62 | void SaveNormalsWorker::prepare() 63 | { 64 | 65 | } 66 | 67 | void SaveNormalsWorker::doWork() 68 | { 69 | bool is_success(false); 70 | 71 | QByteArray ba = this->getFileName().toLocal8Bit(); 72 | std::string* strfilename = new std::string(ba.data()); 73 | 74 | dataLibrary::Status = STATUS_SAVENORMALS; 75 | 76 | //begin of processing 77 | if(dataLibrary::pointnormals->empty()) 78 | { 79 | emit showErrors(QString("You Haven't Extracted Any Normals Yet!")); 80 | } 81 | else 82 | { 83 | if(!pcl::io::savePCDFileBinary(*strfilename, *dataLibrary::pointnormals)) 84 | { 85 | is_success = true; 86 | } 87 | else 88 | { 89 | emit showErrors("Saving normals failed."); 90 | } 91 | } 92 | //end of processing 93 | 94 | delete strfilename; 95 | dataLibrary::Status = STATUS_READY; 96 | emit showReadyStatus(); 97 | if(this->getWorkFlowMode()&&is_success) 98 | { 99 | this->Sleep(1000); 100 | emit GoWorkFlow(); 101 | } 102 | } -------------------------------------------------------------------------------- /SaveNormalsWorker.h: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #pragma once 41 | #include "Worker.h" 42 | class SaveNormalsWorker : public Worker 43 | { 44 | Q_OBJECT 45 | 46 | private: 47 | QString _filename; 48 | 49 | public: 50 | void savenormals() 51 | { 52 | QMetaObject::invokeMethod(this, "doWork"); 53 | } 54 | void setFileName(QString name) 55 | { 56 | _filename = name; 57 | } 58 | QString getFileName() 59 | { 60 | return _filename; 61 | } 62 | virtual bool is_para_satisfying(QString &message); 63 | virtual void prepare(); 64 | 65 | public slots: 66 | void doWork(); 67 | }; -------------------------------------------------------------------------------- /SavePcdASCIIWorker.cpp: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #include 41 | #include 42 | #include "SavePcdASCIIWorker.h" 43 | #include "globaldef.h" 44 | #include "dataLibrary.h" 45 | 46 | bool SavePcdASCIIWorker::is_para_satisfying(QString &message) 47 | { 48 | this->setParaSize(1); 49 | if(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters.size()>=this->getParaSize()) 50 | { 51 | this->setFileName(QString::fromUtf8(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters[0].c_str())); 52 | this->setParaIndex(this->getParaSize()); 53 | return true; 54 | } 55 | else 56 | { 57 | message = QString("savepcdascii: Save Path Not Provided."); 58 | return false; 59 | } 60 | } 61 | 62 | void SavePcdASCIIWorker::prepare() 63 | { 64 | this->setSaveRGBMode(false); 65 | if(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters.size()>this->getParaIndex()) 66 | { 67 | if(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters[this->getParaIndex()] == "rgb") 68 | { 69 | this->setSaveRGBMode(true); 70 | this->setParaIndex(this->getParaIndex()+1); 71 | } 72 | } 73 | } 74 | 75 | void SavePcdASCIIWorker::doWork() 76 | { 77 | bool is_success(false); 78 | 79 | dataLibrary::checkupflow(); 80 | 81 | QByteArray ba = this->getFileName().toLocal8Bit(); 82 | std::string* strfilename = new std::string(ba.data()); 83 | 84 | dataLibrary::Status = STATUS_SAVEASCII; 85 | 86 | //begin of processing 87 | if(dataLibrary::cloudxyz->empty()&&dataLibrary::cloudxyzrgb->empty()) 88 | { 89 | emit showErrors(QString("You Haven't Opened Any Dataset Yet!")); 90 | } 91 | else if((!this->getSaveRGBMode())&&(!dataLibrary::cloudxyz->empty())) 92 | { 93 | if(!pcl::io::savePCDFileASCII(*strfilename, *dataLibrary::cloudxyz)) 94 | { 95 | is_success = true; 96 | } 97 | else 98 | { 99 | emit showErrors("Saving pcd as ASCII failed."); 100 | } 101 | } 102 | else if(!dataLibrary::cloudxyzrgb->empty()) 103 | { 104 | if(!pcl::io::savePCDFileASCII(*strfilename, *dataLibrary::cloudxyzrgb)) 105 | { 106 | is_success = true; 107 | } 108 | else 109 | { 110 | emit showErrors("Saving pcd as ASCII failed."); 111 | } 112 | } 113 | else 114 | { 115 | emit showErrors("You Want to Save RGB Data as ASCII, But You Haven't Opened Any RGB Dataset Yet!"); 116 | } 117 | //end of processing 118 | 119 | dataLibrary::Status = STATUS_READY; 120 | emit showReadyStatus(); 121 | delete strfilename; 122 | if(this->getWorkFlowMode()&&is_success) 123 | { 124 | this->Sleep(1000); 125 | emit GoWorkFlow(); 126 | } 127 | } -------------------------------------------------------------------------------- /SavePcdASCIIWorker.h: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #pragma once 41 | #include "Worker.h" 42 | class SavePcdASCIIWorker : public Worker 43 | { 44 | Q_OBJECT 45 | 46 | private: 47 | QString _filename; 48 | 49 | public: 50 | SavePcdASCIIWorker() : Worker() 51 | { 52 | _save_rgb = false; 53 | } 54 | void saveascii() 55 | { 56 | QMetaObject::invokeMethod(this, "doWork"); 57 | } 58 | void setFileName(QString name) 59 | { 60 | _filename = name; 61 | } 62 | QString getFileName() 63 | { 64 | return _filename; 65 | } 66 | virtual bool is_para_satisfying(QString &message); 67 | virtual void prepare(); 68 | 69 | public slots: 70 | void doWork(); 71 | 72 | private: 73 | bool _save_rgb; 74 | public: 75 | void setSaveRGBMode(bool mode) 76 | { 77 | _save_rgb = mode; 78 | } 79 | bool getSaveRGBMode() 80 | { 81 | return _save_rgb; 82 | } 83 | }; -------------------------------------------------------------------------------- /SavePcdBinaryWorker.cpp: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #include 41 | #include 42 | #include "SavePcdBinaryWorker.h" 43 | #include "globaldef.h" 44 | #include "dataLibrary.h" 45 | 46 | bool SavePcdBinaryWorker::is_para_satisfying(QString &message) 47 | { 48 | this->setParaSize(1); 49 | if(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters.size()>=this->getParaSize()) 50 | { 51 | this->setFileName(QString::fromUtf8(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters[0].c_str())); 52 | this->setParaIndex(this->getParaSize()); 53 | return true; 54 | } 55 | else 56 | { 57 | message = QString("savepcdbinary: Path Not Provided."); 58 | return false; 59 | } 60 | } 61 | 62 | void SavePcdBinaryWorker::prepare() 63 | { 64 | this->setSaveRGBMode(false); 65 | if(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters.size()>this->getParaIndex()) 66 | { 67 | if(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters[this->getParaIndex()] == "rgb") 68 | { 69 | this->setSaveRGBMode(true); 70 | this->setParaIndex(this->getParaIndex()+1); 71 | } 72 | } 73 | } 74 | 75 | void SavePcdBinaryWorker::doWork() 76 | { 77 | bool is_success(false); 78 | 79 | dataLibrary::checkupflow(); 80 | 81 | QByteArray ba = this->getFileName().toLocal8Bit(); 82 | std::string* strfilename = new std::string(ba.data()); 83 | 84 | dataLibrary::Status = STATUS_SAVEBINARY; 85 | 86 | //begin of processing 87 | if(dataLibrary::cloudxyz->empty()&&dataLibrary::cloudxyzrgb->empty()) 88 | { 89 | emit showErrors(QString("You Haven't Opened Any Dataset Yet!")); 90 | } 91 | else if((!this->getSaveRGBMode())&&(!dataLibrary::cloudxyz->empty())) 92 | { 93 | if(!pcl::io::savePCDFileBinary(*strfilename, *dataLibrary::cloudxyz)) 94 | { 95 | is_success = true; 96 | } 97 | else 98 | { 99 | emit showErrors("Saving pcd as binary failed."); 100 | } 101 | } 102 | else if(!dataLibrary::cloudxyzrgb->empty()) 103 | { 104 | if(!pcl::io::savePCDFileBinary(*strfilename, *dataLibrary::cloudxyzrgb)) 105 | { 106 | is_success = true; 107 | } 108 | else 109 | { 110 | emit showErrors("Saving pcd as binary failed."); 111 | } 112 | } 113 | else 114 | { 115 | emit showErrors("You Want to Save RGB Data as Binary, But You Haven't Opened Any RGB Dataset Yet!"); 116 | } 117 | //end of processing 118 | 119 | dataLibrary::Status = STATUS_READY; 120 | emit showReadyStatus(); 121 | delete strfilename; 122 | if(this->getWorkFlowMode()&&is_success) 123 | { 124 | this->Sleep(1000); 125 | emit GoWorkFlow(); 126 | } 127 | } -------------------------------------------------------------------------------- /SavePcdBinaryWorker.h: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #pragma once 41 | #include "Worker.h" 42 | class SavePcdBinaryWorker : public Worker 43 | { 44 | Q_OBJECT 45 | 46 | private: 47 | QString _filename; 48 | 49 | public: 50 | SavePcdBinaryWorker() : Worker() 51 | { 52 | _save_rgb = false; 53 | } 54 | void savebinary() 55 | { 56 | QMetaObject::invokeMethod(this, "doWork"); 57 | } 58 | void setFileName(QString name) 59 | { 60 | _filename = name; 61 | } 62 | QString getFileName() 63 | { 64 | return _filename; 65 | } 66 | virtual bool is_para_satisfying(QString &message); 67 | virtual void prepare(); 68 | 69 | public slots: 70 | void doWork(); 71 | 72 | private: 73 | bool _save_rgb; 74 | public: 75 | void setSaveRGBMode(bool mode) 76 | { 77 | _save_rgb = mode; 78 | } 79 | bool getSaveRGBMode() 80 | { 81 | return _save_rgb; 82 | } 83 | }; -------------------------------------------------------------------------------- /SavePolygonMeshWorker.cpp: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include "SavePolygonMeshWorker.h" 48 | #include "globaldef.h" 49 | #include "dataLibrary.h" 50 | 51 | bool SavePolygonMeshWorker::is_para_satisfying(QString &message) 52 | { 53 | if(dataLibrary::Fracture_Triangles.size()>0) 54 | { 55 | this->setParaSize(1); 56 | if(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters.size()>=this->getParaSize()) 57 | { 58 | this->setFileName(QString::fromUtf8(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters[0].c_str())); 59 | this->setParaIndex(this->getParaSize()); 60 | return true; 61 | } 62 | else 63 | { 64 | message = QString("saveftriangulation: Save Path Not Provided."); 65 | return false; 66 | } 67 | } 68 | else 69 | { 70 | message = QString("saveftriangulation: You Must Do the Triangulation First!"); 71 | return false; 72 | } 73 | } 74 | 75 | void SavePolygonMeshWorker::prepare() 76 | { 77 | 78 | } 79 | 80 | void SavePolygonMeshWorker::doWork() 81 | { 82 | bool is_success(false); 83 | 84 | QByteArray ba = this->getFileName().toLocal8Bit(); 85 | std::string* strfilename = new std::string(ba.data()); 86 | 87 | dataLibrary::Status = STATUS_SAVEPOLYGONMESH; 88 | 89 | //begin of processing 90 | std::string fracture_count_file = *strfilename + "_count.txt"; 91 | ofstream fracture_count_out(fracture_count_file.c_str()); 92 | fracture_count_out<getWorkFlowMode()&&is_success) 109 | { 110 | this->Sleep(1000); 111 | emit GoWorkFlow(); 112 | } 113 | } -------------------------------------------------------------------------------- /SavePolygonMeshWorker.h: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #pragma once 41 | #include "Worker.h" 42 | class SavePolygonMeshWorker : public Worker 43 | { 44 | Q_OBJECT 45 | 46 | private: 47 | QString _filename; 48 | 49 | public: 50 | void savepolygonmesh() 51 | { 52 | QMetaObject::invokeMethod(this, "doWork"); 53 | } 54 | void setFileName(QString name) 55 | { 56 | _filename = name; 57 | } 58 | QString getFileName() 59 | { 60 | return _filename; 61 | } 62 | virtual bool is_para_satisfying(QString &message); 63 | virtual void prepare(); 64 | 65 | public slots: 66 | void doWork(); 67 | }; -------------------------------------------------------------------------------- /SaveTraceMapWorker.h: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #pragma once 41 | 42 | #include "Worker.h" 43 | #include "globaldef.h" 44 | 45 | class SaveTraceMapWorker : public Worker 46 | { 47 | Q_OBJECT 48 | 49 | public: 50 | void savetracemap() 51 | { 52 | QMetaObject::invokeMethod(this, "doWork"); 53 | } 54 | private: 55 | bool _trim_trace_edges; 56 | QString _filename; 57 | int _fracture_map_mode; 58 | double _expand_ratio; 59 | bool _is_clusters_from_files; 60 | public: 61 | void setTrimTraceEdgesMode(bool mode) 62 | { 63 | _trim_trace_edges = mode; 64 | } 65 | bool getTrimTraceEdgesMode() 66 | { 67 | return _trim_trace_edges; 68 | } 69 | void setDefaltFMAP_Mode() 70 | { 71 | _fracture_map_mode = FMAP_LOWER_BOUND; 72 | } 73 | void setFMAP_Mode(int mode) 74 | { 75 | _fracture_map_mode = mode; 76 | } 77 | int getFMAP_Mode() 78 | { 79 | return _fracture_map_mode; 80 | } 81 | void setExpandRatio(double ratio) 82 | { 83 | _expand_ratio = ratio; 84 | } 85 | double getExpandRatio() 86 | { 87 | return _expand_ratio; 88 | } 89 | void setFileName(QString name) 90 | { 91 | _filename = name; 92 | } 93 | QString getFileName() 94 | { 95 | return _filename; 96 | } 97 | void setClustersFromFilesFlag(bool flag) 98 | { 99 | _is_clusters_from_files = flag; 100 | } 101 | bool IsClustersFromFiles() 102 | { 103 | return _is_clusters_from_files; 104 | } 105 | virtual bool is_para_satisfying(QString &message); 106 | virtual void prepare(); 107 | 108 | private slots: 109 | void doWork(); 110 | signals: 111 | void SaveTraceMapReady(const QString &filename); 112 | void ShowTraceMap(); 113 | }; 114 | -------------------------------------------------------------------------------- /ShearParaWorker.h: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #pragma once 41 | 42 | #include "Worker.h" 43 | class ShearParaWorker : public Worker 44 | { 45 | Q_OBJECT 46 | 47 | private: 48 | QString _filename; 49 | bool _save_screen_mode; 50 | 51 | public: 52 | void shearpara() 53 | { 54 | QMetaObject::invokeMethod(this, "doWork"); 55 | } 56 | void setFileName(QString name) 57 | { 58 | _filename = name; 59 | } 60 | QString getFileName() 61 | { 62 | return _filename; 63 | } 64 | void setSaveScreenMode(bool mode) 65 | { 66 | _save_screen_mode = mode; 67 | } 68 | bool getSaveScreenMode() 69 | { 70 | return _save_screen_mode; 71 | } 72 | virtual bool is_para_satisfying(QString &message); 73 | virtual void prepare(); 74 | 75 | private slots: 76 | void doWork(); 77 | signals: 78 | void show(); 79 | void prepare_2_s_f(); 80 | void show_f_save_screen(const QString &filename); 81 | }; -------------------------------------------------------------------------------- /ShowProcessWorker.h: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #pragma once 41 | #include 42 | #include 43 | #include 44 | #include "Worker.h" 45 | #include "globaldef.h" 46 | class ShowProcessWorker : public Worker 47 | { 48 | Q_OBJECT 49 | 50 | private: 51 | std::vector contents; 52 | int _fracture_map_mode; 53 | double _expand_ratio; 54 | 55 | public: 56 | void showProcess() 57 | { 58 | QMetaObject::invokeMethod(this, "doWork"); 59 | } 60 | void setDefaltFMAP_Mode() 61 | { 62 | _fracture_map_mode = FMAP_LOWER_BOUND; 63 | } 64 | void setFMAP_Mode(int mode) 65 | { 66 | _fracture_map_mode = mode; 67 | } 68 | int getFMAP_Mode() 69 | { 70 | return _fracture_map_mode; 71 | } 72 | void setExpandRatio(double ratio) 73 | { 74 | _expand_ratio = ratio; 75 | } 76 | double getExpandRatio() 77 | { 78 | return _expand_ratio; 79 | } 80 | virtual bool is_para_satisfying(QString &message); 81 | virtual void prepare(); 82 | 83 | public slots: 84 | void doWork(); 85 | 86 | signals: 87 | void show(QStringList Qcontents); 88 | }; -------------------------------------------------------------------------------- /ShowSFeatureWorker.h: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #pragma once 41 | #include 42 | #include "Worker.h" 43 | #include "globaldef.h" 44 | 45 | class ShowSFeatureWorker : public Worker 46 | { 47 | Q_OBJECT 48 | 49 | private: 50 | FeaturePara _para; 51 | 52 | public: 53 | void showSFeature() 54 | { 55 | QMetaObject::invokeMethod(this, "doWork"); 56 | } 57 | void setFPara(FeaturePara para) 58 | { 59 | _para.feature_type = para.feature_type; 60 | _para.percent_out = para.percent_out; 61 | } 62 | FeaturePara getFPara() 63 | { 64 | return _para; 65 | } 66 | virtual bool is_para_satisfying(QString &message); 67 | virtual void prepare(); 68 | 69 | public slots: 70 | void doWork(); 71 | 72 | signals: 73 | void show(); 74 | }; -------------------------------------------------------------------------------- /StaticROWorker.cpp: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #include 41 | #include 42 | #include 43 | #include "StaticROWorker.h" 44 | #include "dataLibrary.h" 45 | #include "globaldef.h" 46 | 47 | bool StaticROWorker::is_para_satisfying(QString &message) 48 | { 49 | if(dataLibrary::haveBaseData()) 50 | { 51 | this->setParaSize(1); 52 | if(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters.size()>=this->getParaSize()) 53 | { 54 | double stdDev; 55 | std::stringstream ss(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters[0]); 56 | ss >> stdDev; 57 | this->setStdDev(stdDev); 58 | 59 | this->setParaIndex(this->getParaSize()); 60 | return true; 61 | } 62 | else 63 | { 64 | message = QString("rostatic: Standard Deviation Not Given."); 65 | return false; 66 | } 67 | } 68 | else 69 | { 70 | message = QString("rostatic: You Do Not Have Any Point Cloud Data in Memery!"); 71 | return false; 72 | } 73 | } 74 | 75 | void StaticROWorker::prepare() 76 | { 77 | this->setUnmute(); 78 | this->setWriteLog(); 79 | this->check_mute_nolog(); 80 | } 81 | 82 | void StaticROWorker::doWork() 83 | { 84 | bool is_success(false); 85 | 86 | dataLibrary::checkupflow(); 87 | 88 | dataLibrary::Status = STATUS_STATICRO; 89 | 90 | this->timer_start(); 91 | 92 | //begin of processing 93 | pcl::StatisticalOutlierRemoval sor; 94 | sor.setInputCloud(dataLibrary::cloudxyz); 95 | sor.setMeanK(50); 96 | sor.setStddevMulThresh(this->getStdDev()); 97 | 98 | if(!dataLibrary::outlier_removed_outlier->empty()) 99 | { 100 | dataLibrary::outlier_removed_outlier->clear(); 101 | } 102 | sor.setNegative(true); 103 | sor.filter(*dataLibrary::outlier_removed_outlier); 104 | 105 | if(!dataLibrary::outlier_removed_inlier->empty()) 106 | { 107 | dataLibrary::outlier_removed_inlier->clear(); 108 | } 109 | sor.setNegative(false); 110 | sor.filter(*dataLibrary::outlier_removed_inlier); 111 | 112 | dataLibrary::temp_cloud->clear(); 113 | *dataLibrary::temp_cloud = *dataLibrary::outlier_removed_inlier; 114 | 115 | is_success = true; 116 | //end of processing 117 | 118 | this->timer_stop(); 119 | 120 | if(this->getWriteLogMode()&&is_success) 121 | { 122 | std::string log_text = "\tStatistical Outlier Removing costs: "; 123 | std::ostringstream strs; 124 | strs << this->getTimer_sec(); 125 | log_text += (strs.str() +" seconds."); 126 | dataLibrary::write_text_to_log_file(log_text); 127 | } 128 | 129 | if(!this->getMuteMode()&&is_success) 130 | { 131 | emit show(); 132 | } 133 | 134 | dataLibrary::Status = STATUS_READY; 135 | emit showReadyStatus(); 136 | if(this->getWorkFlowMode()&&is_success) 137 | { 138 | this->Sleep(1000); 139 | emit GoWorkFlow(); 140 | } 141 | } -------------------------------------------------------------------------------- /StaticROWorker.h: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #pragma once 41 | #include "Worker.h" 42 | class StaticROWorker : 43 | public Worker 44 | { 45 | Q_OBJECT 46 | 47 | private: 48 | double _stdDev; 49 | 50 | public: 51 | void rostatic() 52 | { 53 | QMetaObject::invokeMethod(this, "doWork"); 54 | } 55 | void setStdDev(double stdDev) 56 | { 57 | _stdDev = stdDev; 58 | } 59 | double getStdDev() 60 | { 61 | return _stdDev; 62 | } 63 | virtual bool is_para_satisfying(QString &message); 64 | virtual void prepare(); 65 | 66 | private slots: 67 | void doWork(); 68 | 69 | signals: 70 | void show(); 71 | }; 72 | 73 | -------------------------------------------------------------------------------- /TestWorker.cpp: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include "TestWorker.h" 47 | #include "globaldef.h" 48 | #include "dataLibrary.h" 49 | 50 | using namespace std; 51 | 52 | bool TestWorker::is_para_satisfying(QString &message) 53 | { 54 | this->setParaSize(1); 55 | if(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters.size()>=this->getParaSize()) 56 | { 57 | this->setFileName(QString::fromUtf8(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters[0].c_str())); 58 | this->setParaIndex(this->getParaSize()); 59 | return true; 60 | } 61 | else 62 | { 63 | message = QString("test: File Path Not Provided."); 64 | return false; 65 | } 66 | } 67 | 68 | void TestWorker::prepare() 69 | { 70 | this->setSplitMode(false); 71 | if(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters.size()>this->getParaIndex()) 72 | { 73 | if(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters[this->getParaIndex()] == "split") 74 | { 75 | this->setSplitMode(true); 76 | this->setParaIndex(this->getParaIndex()+1); 77 | } 78 | } 79 | this->setUnmute(); 80 | this->setWriteLog(); 81 | } 82 | 83 | bool transData (const string &filename, const string &savefilename) 84 | { 85 | ifstream fs; 86 | fs.open (filename.c_str (), ios::binary); 87 | if (!fs.is_open () || fs.fail ()) 88 | { 89 | PCL_ERROR ("Could not open file '%s'! Error : %s\n", filename.c_str (), strerror (errno)); 90 | fs.close (); 91 | return (false); 92 | } 93 | 94 | ofstream transedData_out; 95 | transedData_out.open(savefilename.c_str()); 96 | if (!transedData_out.is_open () || transedData_out.fail ()) 97 | { 98 | PCL_ERROR ("Could not open file '%s'! Error : %s\n", savefilename.c_str (), strerror (errno)); 99 | transedData_out.close (); 100 | return (false); 101 | } 102 | 103 | string line; 104 | vector st; 105 | 106 | while (!fs.eof ()) 107 | { 108 | getline (fs, line); 109 | // Ignore empty lines 110 | if (line == "") 111 | continue; 112 | 113 | // Tokenize the line 114 | boost::trim (line); 115 | boost::split (st, line, boost::is_any_of (",\t\r "), boost::token_compress_on); 116 | 117 | if (st.size () < 3) 118 | continue; 119 | 120 | if (st[0] == "x") 121 | continue; 122 | 123 | transedData_out<substr(0, strfilename->size()-13) += "_XYZ.txt"; 145 | 146 | dataLibrary::Status = STATUS_TESTING; 147 | 148 | //begin of processing 149 | if(transData (*strfilename, transedData)) 150 | { 151 | is_success = true; 152 | } 153 | else 154 | { 155 | emit showErrors("Error transform data."); 156 | } 157 | //end of processing 158 | 159 | dataLibrary::Status = STATUS_READY; 160 | emit showReadyStatus(); 161 | delete strfilename; 162 | if(this->getWorkFlowMode()&&is_success) 163 | { 164 | this->Sleep(1000); 165 | emit GoWorkFlow(); 166 | } 167 | }*/ 168 | 169 | void TestWorker::doWork() 170 | { 171 | bool is_success(false); 172 | 173 | QByteArray ba = this->getFileName().toLocal8Bit(); 174 | string* strfilename = new std::string(ba.data()); 175 | 176 | dataLibrary::Status = STATUS_TESTING; 177 | 178 | //begin of processing 179 | if(!pcl::io::loadPCDFile (*strfilename, *dataLibrary::cloudxyzrgb)) 180 | { 181 | dataLibrary::cloudID = *strfilename; 182 | pcl::PointCloudXYZRGBtoXYZI (*dataLibrary::cloudxyzrgb, *dataLibrary::cloudxyzi); 183 | 184 | if(!this->getMuteMode()) 185 | { 186 | emit ReadFileReady(CLOUDXYZI); 187 | } 188 | is_success = true; 189 | } 190 | else 191 | { 192 | emit showErrors("Error opening pcd file."); 193 | } 194 | //end of processing 195 | 196 | dataLibrary::Status = STATUS_READY; 197 | emit showReadyStatus(); 198 | delete strfilename; 199 | if(this->getWorkFlowMode()&&is_success) 200 | { 201 | this->Sleep(1000); 202 | emit GoWorkFlow(); 203 | } 204 | } -------------------------------------------------------------------------------- /TestWorker.h: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #pragma once 41 | #include "Worker.h" 42 | class TestWorker : public Worker 43 | { 44 | Q_OBJECT 45 | 46 | private: 47 | QString _filename; 48 | 49 | public: 50 | TestWorker() : Worker() 51 | { 52 | _is_split = false; 53 | } 54 | void testing() 55 | { 56 | QMetaObject::invokeMethod(this, "doWork"); 57 | } 58 | void setSplitMode(bool mode) 59 | { 60 | _is_split = mode; 61 | } 62 | bool getSplitMode() 63 | { 64 | return _is_split; 65 | } 66 | void setFileName(QString name) 67 | { 68 | _filename = name; 69 | } 70 | QString getFileName() 71 | { 72 | return _filename; 73 | } 74 | virtual bool is_para_satisfying(QString &message); 75 | virtual void prepare(); 76 | 77 | private slots: 78 | void doWork(); 79 | 80 | signals: 81 | void ReadFileReady(int i); 82 | 83 | private: 84 | bool _is_split; 85 | }; -------------------------------------------------------------------------------- /Thresholds.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | ThresholdDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 438 11 | 12 | 13 | 14 | Thresholds 15 | 16 | 17 | 18 | 19 | 30 20 | 380 21 | 341 22 | 32 23 | 24 | 25 | 26 | Qt::Horizontal 27 | 28 | 29 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 30 | 31 | 32 | 33 | 34 | 35 | 200 36 | 40 37 | 101 38 | 22 39 | 40 | 41 | 42 | 43 | 44 | 45 | 200 46 | 100 47 | 101 48 | 22 49 | 50 | 51 | 52 | 53 | 54 | 55 | 30 56 | 40 57 | 141 58 | 16 59 | 60 | 61 | 62 | Smoothness Threshold : 63 | 64 | 65 | 66 | 67 | 68 | 30 69 | 100 70 | 141 71 | 16 72 | 73 | 74 | 75 | Curvature Threshold : 76 | 77 | 78 | 79 | 80 | 81 | 30 82 | 280 83 | 151 84 | 16 85 | 86 | 87 | 88 | Number of Neighbors : 89 | 90 | 91 | 92 | 93 | 94 | 30 95 | 220 96 | 151 97 | 16 98 | 99 | 100 | 101 | Minimum Cluster Size : 102 | 103 | 104 | 105 | 106 | 107 | 200 108 | 220 109 | 101 110 | 22 111 | 112 | 113 | 114 | 115 | 116 | 117 | 200 118 | 280 119 | 101 120 | 22 121 | 122 | 123 | 124 | 125 | 126 | 127 | 200 128 | 160 129 | 101 130 | 22 131 | 132 | 133 | 134 | 135 | 136 | 137 | 30 138 | 160 139 | 141 140 | 16 141 | 142 | 143 | 144 | Residual Threshold : 145 | 146 | 147 | 148 | 149 | 150 | 30 151 | 330 152 | 281 153 | 16 154 | 155 | 156 | 157 | Use Smooth Mode to Perform the Segmentation 158 | 159 | 160 | 161 | 162 | 163 | 164 | buttonBox 165 | accepted() 166 | ThresholdDialog 167 | accept() 168 | 169 | 170 | 248 171 | 254 172 | 173 | 174 | 157 175 | 274 176 | 177 | 178 | 179 | 180 | buttonBox 181 | rejected() 182 | ThresholdDialog 183 | reject() 184 | 185 | 186 | 316 187 | 260 188 | 189 | 190 | 286 191 | 274 192 | 193 | 194 | 195 | 196 | 197 | -------------------------------------------------------------------------------- /TimingShutdown.h: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #pragma once 41 | #include 42 | class TimingShutdown : 43 | public QThread 44 | { 45 | Q_OBJECT 46 | 47 | public: 48 | void run() 49 | { 50 | msleep(1000); 51 | emit shutdown(); 52 | } 53 | 54 | signals: 55 | void shutdown(); 56 | }; -------------------------------------------------------------------------------- /Worker.cpp: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #include "Worker.h" 41 | #include "dataLibrary.h" 42 | 43 | void Worker::check_mute_nolog() 44 | { 45 | for(int i=1; i<=2; i++) 46 | { 47 | if(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters.size()>this->getParaIndex()) 48 | { 49 | if(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters[this->getParaIndex()] == "mute") 50 | { 51 | this->setMute(); 52 | } 53 | else if(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters[this->getParaIndex()] == "nolog") 54 | { 55 | this->setUnWriteLog(); 56 | } 57 | this->setParaIndex(this->getParaIndex()+1); 58 | } 59 | else 60 | { 61 | break; 62 | } 63 | } 64 | } -------------------------------------------------------------------------------- /Worker.h: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #pragma once 41 | 42 | #include 43 | #include 44 | #include 45 | #include "MyThread.h" 46 | 47 | class Worker : public QObject 48 | { 49 | Q_OBJECT 50 | 51 | public: 52 | Worker() : QObject() 53 | { 54 | _workflow_mode = false; 55 | _is_mute = false; 56 | _write_log = true; 57 | _para_size = 0; 58 | moveToThread(&t); 59 | t.start(); 60 | } 61 | ~Worker() 62 | { 63 | t.quit(); 64 | t.wait(); 65 | } 66 | 67 | signals: 68 | void GoWorkFlow(); 69 | void showErrors(const QString &errors); 70 | void showReadyStatus(); 71 | private: 72 | bool _workflow_mode; 73 | bool _is_mute; 74 | bool _write_log; 75 | int _para_size; 76 | int _para_index; 77 | clock_t _time_start; 78 | clock_t _time_finish; 79 | public: 80 | void setWorkFlowMode(bool mode) 81 | { 82 | _workflow_mode = mode; 83 | } 84 | bool getWorkFlowMode() 85 | { 86 | return _workflow_mode; 87 | } 88 | void setMute() 89 | { 90 | _is_mute = true; 91 | } 92 | void setUnmute() 93 | { 94 | _is_mute = false; 95 | } 96 | bool getMuteMode() 97 | { 98 | return _is_mute; 99 | } 100 | void setWriteLog() 101 | { 102 | _write_log = true; 103 | } 104 | void setUnWriteLog() 105 | { 106 | _write_log = false; 107 | } 108 | bool getWriteLogMode() 109 | { 110 | return _write_log; 111 | } 112 | void Sleep(unsigned long ms) 113 | { 114 | t.Sleep(ms); 115 | } 116 | void check_mute_nolog(); 117 | virtual bool is_para_satisfying(QString &message){return false;} 118 | virtual void prepare(){} 119 | void setParaSize(int size) 120 | { 121 | _para_size = size; 122 | } 123 | int getParaSize() 124 | { 125 | return _para_size; 126 | } 127 | void setParaIndex(int index) 128 | { 129 | _para_index = index; 130 | } 131 | int getParaIndex() 132 | { 133 | return _para_index; 134 | } 135 | void timer_start() 136 | { 137 | _time_start = clock(); 138 | } 139 | void timer_stop() 140 | { 141 | _time_finish = clock(); 142 | } 143 | double getTimer_sec() 144 | { 145 | return (double)(_time_finish-_time_start)/CLOCKS_PER_SEC; 146 | } 147 | 148 | private: 149 | MyThread t; 150 | }; -------------------------------------------------------------------------------- /bundle.cmake: -------------------------------------------------------------------------------- 1 | INCLUDE(BundleUtilities) 2 | fixup_bundle(structrock.app "" "") -------------------------------------------------------------------------------- /checkstatusThread.cpp: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #include "checkstatusThread.h" 41 | #include "globaldef.h" 42 | #include "dataLibrary.h" 43 | 44 | void checkstatusThread::run() 45 | { 46 | while(true) 47 | { 48 | int count = 0; 49 | while(dataLibrary::Status!=STATUS_READY) 50 | { 51 | emit show(count%4); 52 | msleep(500); 53 | count++; 54 | } 55 | msleep(50); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /checkstatusThread.h: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #pragma once 41 | #include 42 | class checkstatusThread : 43 | public QThread 44 | { 45 | Q_OBJECT 46 | 47 | public: 48 | void run(); 49 | 50 | signals: 51 | void show(int i); 52 | }; 53 | 54 | -------------------------------------------------------------------------------- /downsampleWorker.cpp: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #include 41 | #include 42 | #include 43 | #include "globaldef.h" 44 | #include "downsampleWorker.h" 45 | #include "dataLibrary.h" 46 | 47 | bool downsampleWorker::is_para_satisfying(QString &message) 48 | { 49 | if(dataLibrary::haveBaseData()) 50 | { 51 | this->setParaSize(1); 52 | if(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters.size()>=this->getParaSize()) 53 | { 54 | double leaf; 55 | std::stringstream ss(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters[0]); 56 | ss >> leaf; 57 | this->setLeaf(leaf); 58 | 59 | this->setParaIndex(this->getParaSize()); 60 | return true; 61 | } 62 | else 63 | { 64 | message = QString("downsample: Minimum Point Distance Not Given."); 65 | return false; 66 | } 67 | } 68 | else 69 | { 70 | message = QString("downsample: You Do Not Have Any Point Cloud Data in Memery!"); 71 | return false; 72 | } 73 | } 74 | void downsampleWorker::prepare() 75 | { 76 | this->setUnmute(); 77 | this->setWriteLog(); 78 | this->check_mute_nolog(); 79 | } 80 | 81 | void downsampleWorker::doWork() 82 | { 83 | bool is_success(false); 84 | 85 | dataLibrary::checkupflow(); 86 | 87 | dataLibrary::Status = STATUS_DOWNSAMPLE; 88 | 89 | this->timer_start(); 90 | 91 | //begin of processing 92 | // Create the filtering object 93 | pcl::VoxelGrid sor; 94 | sor.setInputCloud (dataLibrary::cloudxyz); 95 | sor.setLeafSize (this->getLeaf(), this->getLeaf(), this->getLeaf()); 96 | if(!dataLibrary::downsampledxyz->empty()) 97 | { 98 | dataLibrary::downsampledxyz->clear(); 99 | } 100 | sor.filter (*dataLibrary::downsampledxyz); 101 | 102 | dataLibrary::temp_cloud->clear(); 103 | *dataLibrary::temp_cloud = *dataLibrary::downsampledxyz; 104 | 105 | is_success = true; 106 | //end of processing 107 | 108 | this->timer_stop(); 109 | 110 | if(this->getWriteLogMode()&&is_success) 111 | { 112 | std::string log_text = "\tDownsampling costs: "; 113 | std::ostringstream strs; 114 | strs << this->getTimer_sec(); 115 | log_text += (strs.str() +" seconds."); 116 | dataLibrary::write_text_to_log_file(log_text); 117 | } 118 | 119 | if(!this->getMuteMode()&&is_success) 120 | { 121 | emit show(); 122 | } 123 | 124 | dataLibrary::Status = STATUS_READY; 125 | emit showReadyStatus(); 126 | if(this->getWorkFlowMode()&&is_success) 127 | { 128 | this->Sleep(1000); 129 | emit GoWorkFlow(); 130 | } 131 | } -------------------------------------------------------------------------------- /downsampleWorker.h: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #pragma once 41 | #include "Worker.h" 42 | class downsampleWorker : 43 | public Worker 44 | { 45 | Q_OBJECT 46 | 47 | private: 48 | double _leaf; 49 | 50 | public: 51 | void downsample() 52 | { 53 | QMetaObject::invokeMethod(this, "doWork"); 54 | } 55 | void setLeaf(double leaf) 56 | { 57 | _leaf = leaf; 58 | } 59 | double getLeaf() 60 | { 61 | return _leaf; 62 | } 63 | virtual bool is_para_satisfying(QString &message); 64 | virtual void prepare(); 65 | 66 | private slots: 67 | void doWork(); 68 | 69 | signals: 70 | void show(); 71 | }; 72 | 73 | -------------------------------------------------------------------------------- /geo_normal_3d.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Software License Agreement (BSD License) 3 | * 4 | * Point Cloud Library (PCL) - www.pointclouds.org 5 | * Copyright (c) 2010-2012, Willow Garage, Inc. 6 | * 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * * Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * * Redistributions in binary form must reproduce the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer in the documentation and/or other materials provided 18 | * with the distribution. 19 | * * Neither the name of Willow Garage, Inc. nor the names of its 20 | * contributors may be used to endorse or promote products derived 21 | * from this software without specific prior written permission. 22 | * 23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 27 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 28 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 33 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 | * POSSIBILITY OF SUCH DAMAGE. 35 | * 36 | * $Id$ 37 | * 38 | */ 39 | 40 | /* 41 | * Modified by Xin Wang 42 | * Email : ericrussell@zju.edu.cn 43 | */ 44 | 45 | #include 46 | #include 47 | #include "geo_normal_3d.h" 48 | 49 | // Instantiations of specific point types 50 | template class GeoNormalEstimation; 51 | template class GeoNormalEstimation; 52 | -------------------------------------------------------------------------------- /geo_normal_3d_omp.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Software License Agreement (BSD License) 3 | * 4 | * Point Cloud Library (PCL) - www.pointclouds.org 5 | * Copyright (c) 2010-2011, Willow Garage, Inc. 6 | * 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * * Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * * Redistributions in binary form must reproduce the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer in the documentation and/or other materials provided 18 | * with the distribution. 19 | * * Neither the name of Willow Garage, Inc. nor the names of its 20 | * contributors may be used to endorse or promote products derived 21 | * from this software without specific prior written permission. 22 | * 23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 27 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 28 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 33 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 | * POSSIBILITY OF SUCH DAMAGE. 35 | * 36 | * $Id$ 37 | * 38 | */ 39 | 40 | #include 41 | #include 42 | #include "geo_normal_3d_omp.h" 43 | 44 | // Instantiations of specific point types 45 | template class GeoNormalEstimationOMP; 46 | template class GeoNormalEstimationOMP; 47 | -------------------------------------------------------------------------------- /geo_region_growing.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Software License Agreement (BSD License) 3 | * 4 | * Point Cloud Library (PCL) - www.pointclouds.org 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 : Sergey Ushakov 36 | * Email : mine_all_mine@bk.ru 37 | * 38 | */ 39 | 40 | /* 41 | * Modified by Xin Wang 42 | * Email : ericrussell@zju.edu.cn 43 | */ 44 | 45 | #include 46 | #include 47 | #include "geo_region_growing.h" 48 | 49 | // Instantiations of specific point types 50 | template class GeoRegionGrowing; -------------------------------------------------------------------------------- /globaldef.h: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #pragma once 41 | #include 42 | 43 | #define EXIT_CODE_REBOOT -123456789 44 | 45 | #define CLOUDXYZ 1 46 | #define CLOUDXYZRGB 2 47 | #define CLOUDXYZI 3 48 | #define EPSILON 0.0000001 49 | #define TWOPI 6.283185307179586476925287 50 | 51 | #define STATUS_READY 100 52 | #define STATUS_OPENPCD 101 53 | #define STATUS_RESAMPLE 102 54 | #define STATUS_DOWNSAMPLE 103 55 | #define STATUS_KNNORMAL 104 56 | #define STATUS_RANORMAL 105 57 | #define STATUS_STATICRO 106 58 | #define STATUS_RGS 107 59 | #define STATUS_SAVECLUSTERS 108 60 | #define STATUS_OPENXYZ 109 61 | #define STATUS_SAVEASCII 110 62 | #define STATUS_SAVEBINARY 111 63 | #define STATUS_SAVENORMALS 112 64 | #define STATUS_SHOWPROCESS 113 65 | #define STATUS_TESTING 114 66 | #define STATUS_SHOWSFEATURE 115 67 | #define STATUS_TRIANGULATION 116 68 | #define STATUS_OPENCLUSTERS 117 69 | #define STATUS_SHEARPARA 118 70 | #define STATUS_SAVEPOLYGONMESH 119 71 | #define STATUS_OPENPOLYGONMESH 120 72 | #define STATUS_READNSHOWCLASSES 121 73 | #define STATUS_MULTISTATION 122 74 | #define STATUS_SAVEMESH 123 75 | #define STATUS_LAGRANGETENSOR 124 76 | #define STATUS_SAVETRACEMAP 125 77 | 78 | #define FEATURE_ROUGHNESS 1001 79 | #define FEATURE_AREA 1002 80 | #define FEATURE_CURVATURE 1003 81 | #define FEATURE_FRACTURE_CURVATURE 1004 82 | #define FEATURE_FRACTURE_FACES 1005 83 | 84 | #define FMAP_LOWER_BOUND 2001 85 | #define FMAP_CIRCULAR 2002 86 | #define FMAP_RECTANGULAR 2003 87 | 88 | #define A_L_MODEL_LINEAR 3001 89 | #define A_L_MODEL_SQRT 3002 90 | 91 | #define FRACTURE_FEATURE_STRIATION 4001 92 | #define FRACTURE_FEATURE_STEP 4002 93 | 94 | struct RGSpara{ 95 | double curvature; 96 | double smoothness; 97 | double residual; 98 | int number_of_neighbors; 99 | int min_number_of_Points; 100 | bool IsSmoothMode; 101 | }; 102 | 103 | struct TriangulationPara{ 104 | int knNeighbors; 105 | double searchRadius; 106 | double Mu; 107 | int maxNearestNeighbors; 108 | double maxSurfaceAngle; 109 | double minAngle; 110 | double maxAngle; 111 | bool normalConsistancy; 112 | }; 113 | 114 | struct FeaturePara{ 115 | int feature_type; 116 | float percent_out; 117 | }; 118 | 119 | struct Vector3f{ 120 | float x, y, z; 121 | }; 122 | 123 | struct Striation{ 124 | float ratio; 125 | Vector3f direction; 126 | }; 127 | 128 | struct Step{ 129 | float ratio; 130 | Vector3f facing_direc; 131 | }; 132 | 133 | struct Line{ 134 | Vector3f begin; 135 | Vector3f end; 136 | float r; 137 | float g; 138 | float b; 139 | std::string ID; 140 | double f_p_angle; 141 | }; 142 | 143 | struct WorkLine{ 144 | std::string command; 145 | std::vector parameters; 146 | }; -------------------------------------------------------------------------------- /gmsh_io.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | # include 4 | # include 5 | # include 6 | # include 7 | # include 8 | # include 9 | # include 10 | # include 11 | 12 | class gmsh_io 13 | { 14 | public: 15 | static char ch_cap ( char ch ); 16 | static bool ch_eqi ( char ch1, char ch2 ); 17 | static int ch_to_digit ( char ch ); 18 | static void gmsh_data_read ( std::string gmsh_filename, int node_dim, int node_num, double node_x[], int element_order, int element_num, int element_node[] ); 19 | static void gmsh_size_read ( std::string gmsh_filename, int &node_num, int &node_dim, int &element_num, int &element_order ); 20 | static int *gmsh_mesh2d_element_data_example ( int element_num, int element_order ); 21 | static void gmsh_mesh2d_element_size_example ( int &element_num, int &element_order ); 22 | static double *gmsh_mesh2d_node_data_example ( int node_num, int node_dim ); 23 | static void gmsh_mesh2d_node_size_example ( int &node_num, int &node_dim ); 24 | static void gmsh_mesh1d_write ( std::string gmsh_filename, int m, int node_num, double node_x[], int element_order, int element_num, int element_node[] ); 25 | static void gmsh_mesh2d_write ( std::string gmsh_filename, int m, int node_num, double node_x[], int element_order, int element_num, int element_node[] ); 26 | static void gmsh_mesh3d_write ( std::string gmsh_filename, int m, int node_num, double node_x[], int element_order, int element_num, int element_node[] ); 27 | static int *i4mat_copy_new ( int m, int n, int a1[] ); 28 | static void i4mat_transpose_print ( int m, int n, int a[], std::string title ); 29 | static void i4mat_transpose_print_some ( int m, int n, int a[], int ilo, int jlo, int ihi, int jhi, std::string title ); 30 | static void mesh_base_one ( int node_num, int element_order, int element_num, int element_node[] ); 31 | static double r8_max ( double x, double y ); 32 | static double r8_min ( double x, double y ); 33 | static double *r8mat_copy_new ( int m, int n, double a1[] ); 34 | static void r8mat_transpose_print ( int m, int n, double a[], std::string title ); 35 | static void r8mat_transpose_print_some ( int m, int n, double a[], int ilo, int jlo, int ihi, int jhi, std::string title ); 36 | static bool s_begin ( std::string s1, std::string s2 ); 37 | static int s_len_trim ( std::string s ); 38 | static int s_to_i4 ( std::string s, int &last, bool &error ); 39 | static double s_to_r8 ( std::string s, int &lchar, bool &error ); 40 | static void timestamp ( ); 41 | }; 42 | -------------------------------------------------------------------------------- /icon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EricAlex/structrock/754d8c481d22a48ea7eb4e055eb16c64c44055ab/icon.icns -------------------------------------------------------------------------------- /icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EricAlex/structrock/754d8c481d22a48ea7eb4e055eb16c64c44055ab/icon.ico -------------------------------------------------------------------------------- /knnormalWorker.cpp: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #include 41 | #include 42 | #include "geo_normal_3d.h" 43 | #include "geo_normal_3d_omp.h" 44 | #include "knnormalWorker.h" 45 | #include "dataLibrary.h" 46 | #include "globaldef.h" 47 | 48 | bool knnormalWorker::is_para_satisfying(QString &message) 49 | { 50 | if(dataLibrary::haveBaseData()) 51 | { 52 | this->setParaSize(1); 53 | if(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters.size()>=this->getParaSize()) 54 | { 55 | int k; 56 | std::stringstream ss(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters[0]); 57 | ss >> k; 58 | this->setK(k); 59 | 60 | this->setParaIndex(this->getParaSize()); 61 | return true; 62 | } 63 | else 64 | { 65 | message = QString("knnormal: Number of Neoghbor Points Not Given."); 66 | return false; 67 | } 68 | } 69 | else 70 | { 71 | message = QString("knnormal: You Do Not Have Any Point Cloud Data in Memery!"); 72 | return false; 73 | } 74 | } 75 | 76 | void knnormalWorker::prepare() 77 | { 78 | this->setShowCurvature(false); 79 | if(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters.size()>this->getParaIndex()) 80 | { 81 | if(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters[this->getParaIndex()] == "showcurvature") 82 | { 83 | this->setShowCurvature(true); 84 | this->setParaIndex(this->getParaIndex()+1); 85 | } 86 | } 87 | this->setUnmute(); 88 | this->setWriteLog(); 89 | this->check_mute_nolog(); 90 | } 91 | 92 | void knnormalWorker::doWork() 93 | { 94 | bool is_success(false); 95 | 96 | dataLibrary::checkupflow(); 97 | 98 | dataLibrary::Status = STATUS_KNNORMAL; 99 | 100 | this->timer_start(); 101 | 102 | //begin of processing 103 | GeoNormalEstimationOMP ne; 104 | ne.setInputCloud(dataLibrary::cloudxyz); 105 | pcl::search::KdTree::Ptr tree (new pcl::search::KdTree()); 106 | ne.setSearchMethod(tree); 107 | ne.setKSearch(this->getK()); 108 | if(!dataLibrary::normal->empty()) 109 | { 110 | dataLibrary::normal->clear(); 111 | } 112 | ne.compute(*dataLibrary::normal); 113 | 114 | if(!dataLibrary::pointnormals->empty()) 115 | { 116 | dataLibrary::pointnormals->clear(); 117 | } 118 | pcl::concatenateFields(*dataLibrary::cloudxyz, *dataLibrary::normal, *dataLibrary::pointnormals); 119 | 120 | is_success = true; 121 | //end of processing 122 | 123 | this->timer_stop(); 124 | 125 | if(this->getWriteLogMode()&&is_success) 126 | { 127 | std::string log_text = "\tComputing K Nearest Neighbor Normal costs: "; 128 | std::ostringstream strs; 129 | strs << this->getTimer_sec(); 130 | log_text += (strs.str() +" seconds."); 131 | dataLibrary::write_text_to_log_file(log_text); 132 | } 133 | 134 | if(!this->getMuteMode()&&is_success) 135 | { 136 | emit show(_show_curvature); 137 | } 138 | 139 | dataLibrary::Status = STATUS_READY; 140 | emit showReadyStatus(); 141 | if(this->getWorkFlowMode()&&is_success) 142 | { 143 | this->Sleep(1000); 144 | emit GoWorkFlow(); 145 | } 146 | } 147 | -------------------------------------------------------------------------------- /knnormalWorker.h: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #pragma once 41 | #include "Worker.h" 42 | class knnormalWorker : 43 | public Worker 44 | { 45 | Q_OBJECT 46 | 47 | private: 48 | int _k; 49 | 50 | public: 51 | knnormalWorker() : Worker() 52 | { 53 | _show_curvature = false; 54 | } 55 | 56 | void knnormal() 57 | { 58 | QMetaObject::invokeMethod(this, "doWork"); 59 | } 60 | 61 | void setShowCurvature(bool mode) 62 | { 63 | _show_curvature = mode; 64 | } 65 | bool getShowCurvature() 66 | { 67 | return _show_curvature; 68 | } 69 | void setK(int k) 70 | { 71 | _k = k; 72 | } 73 | int getK() 74 | { 75 | return _k; 76 | } 77 | virtual bool is_para_satisfying(QString &message); 78 | virtual void prepare(); 79 | 80 | private slots: 81 | void doWork(); 82 | 83 | signals: 84 | void show(bool _show_curvature); 85 | 86 | private: 87 | bool _show_curvature; 88 | }; -------------------------------------------------------------------------------- /main.cpp: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #include 41 | #include 42 | #include "globaldef.h" 43 | #include "structrock.h" 44 | 45 | 46 | void keyboardEventOccurred(const pcl::visualization::KeyboardEvent &event, void* structrock_void) 47 | { 48 | structrock* structrock_window = static_cast(structrock_void); 49 | if(event.getKeySym() == "f" && event.keyDown()) 50 | { 51 | structrock_window->MoveForwardPatch(); 52 | } 53 | else if(event.getKeySym() == "b" && event.keyDown()) 54 | { 55 | structrock_window->MoveBackPatch(); 56 | } 57 | else if(event.getKeySym() == "p" && event.keyDown()) 58 | { 59 | structrock_window->saveScreen(); 60 | } 61 | } 62 | 63 | void pointPickingEvent(const pcl::visualization::PointPickingEvent &event, void* structrock_void) 64 | { 65 | structrock* structrock_window = static_cast(structrock_void); 66 | float x, y, z; 67 | event.getPoint(x, y, z); 68 | structrock_window->CheckPatchesIfSelected(x, y, z); 69 | } 70 | 71 | void mouseEventOccured(const pcl::visualization::MouseEvent &event, void* structrock_void) 72 | { 73 | structrock* structrock_window = static_cast(structrock_void); 74 | if(event.getButton() == pcl::visualization::MouseEvent::RightButton && event.getType() == pcl::visualization::MouseEvent::MouseDblClick) 75 | { 76 | //in mouse select patches mode, if right button is clicked, show selected patches 77 | structrock_window->ShowSelectedPatches(); 78 | } 79 | } 80 | 81 | int main(int argc, char *argv[]) 82 | { 83 | if((argc>2)&&(strlen(argv[1])==2)&&(argv[1][0]=='-')&&(argv[1][1]=='f')) 84 | { 85 | QApplication a(argc, argv); 86 | structrock w; 87 | w.setWindowTitle("StructRock"); 88 | w.viewer->registerKeyboardCallback(keyboardEventOccurred, (void*)&w); 89 | w.viewer->registerPointPickingCallback(pointPickingEvent, (void*)&w); 90 | w.viewer->registerMouseCallback(mouseEventOccured, (void*)&w); 91 | 92 | w.setGeometry(QApplication::desktop()->availableGeometry()); 93 | 94 | w.show(); 95 | w.OpenWorkFlow(QString(argv[2])); 96 | return a.exec(); 97 | } 98 | else if((argc>2)&&(strlen(argv[1])==2)&&(argv[1][0]=='-')&&(argv[1][1]=='c')) 99 | { 100 | QApplication a(argc, argv); 101 | structrock w; 102 | w.setWindowTitle("StructRock"); 103 | w.viewer->registerKeyboardCallback(keyboardEventOccurred, (void*)&w); 104 | w.viewer->registerPointPickingCallback(pointPickingEvent, (void*)&w); 105 | w.viewer->registerMouseCallback(mouseEventOccured, (void*)&w); 106 | 107 | w.setGeometry(QApplication::desktop()->availableGeometry()); 108 | 109 | w.show(); 110 | w.OpenWorkFlow(std::string(argv[2])); 111 | return a.exec(); 112 | } 113 | else 114 | { 115 | QApplication a(argc, argv); 116 | structrock w; 117 | w.setWindowTitle("StructRock"); 118 | w.viewer->registerKeyboardCallback(keyboardEventOccurred, (void*)&w); 119 | w.viewer->registerPointPickingCallback(pointPickingEvent, (void*)&w); 120 | w.viewer->registerMouseCallback(mouseEventOccured, (void*)&w); 121 | 122 | w.setGeometry(QApplication::desktop()->availableGeometry()); 123 | 124 | w.show(); 125 | return a.exec(); 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /openClustersWorker.cpp: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include "openClustersWorker.h" 47 | #include "globaldef.h" 48 | #include "dataLibrary.h" 49 | 50 | using namespace std; 51 | 52 | bool openClustersWorker::is_para_satisfying(QString &message) 53 | { 54 | this->setParaSize(1); 55 | if(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters.size()>=this->getParaSize()) 56 | { 57 | this->setFileName(QString::fromUtf8(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters[0].c_str())); 58 | this->setParaIndex(this->getParaSize()); 59 | return true; 60 | } 61 | else 62 | { 63 | message = QString("openclusters: Location of Clusters (bin) File Not Provided."); 64 | return false; 65 | } 66 | } 67 | void openClustersWorker::prepare() 68 | { 69 | this->setUnmute(); 70 | this->setWriteLog(); 71 | this->check_mute_nolog(); 72 | } 73 | 74 | void openClustersWorker::doWork() 75 | { 76 | bool is_success(false); 77 | 78 | QByteArray ba = this->getFileName().toLocal8Bit(); 79 | string* strfilename = new std::string(ba.data()); 80 | 81 | dataLibrary::Status = STATUS_OPENCLUSTERS; 82 | 83 | this->timer_start(); 84 | 85 | //begin of processing 86 | stringstream ss; 87 | 88 | ifstream fbinaryin(strfilename->c_str(), ios::in|ios::binary); 89 | if(fbinaryin.is_open()) 90 | { 91 | if(!dataLibrary::cluster_patches.empty()) 92 | dataLibrary::cluster_patches.clear(); 93 | if(!dataLibrary::dips.empty()) 94 | dataLibrary::dips.clear(); 95 | if(!dataLibrary::dip_directions.empty()) 96 | dataLibrary::dip_directions.clear(); 97 | if(!dataLibrary::areas.empty()) 98 | dataLibrary::areas.clear(); 99 | if(!dataLibrary::patchIDs.empty()) 100 | dataLibrary::patchIDs.clear(); 101 | if(!dataLibrary::selectedPatches.empty()) 102 | dataLibrary::selectedPatches.clear(); 103 | 104 | int num_of_clusters, num_of_points; 105 | float x, y, z, rgb, dip, dip_direction, area; 106 | fbinaryin.read(reinterpret_cast(&num_of_clusters), sizeof(num_of_clusters)); 107 | Eigen::Vector4f centroid; 108 | float centor_x = 0.0; 109 | float centor_y = 0.0; 110 | float centor_z = 0.0; 111 | for(int i=0; i::Ptr cloud_patch (new pcl::PointCloud); 114 | fbinaryin.read(reinterpret_cast(&num_of_points), sizeof(num_of_points)); 115 | fbinaryin.read(reinterpret_cast(&rgb), sizeof(rgb)); 116 | for(int j=0; j(&x), sizeof(x)); 119 | fbinaryin.read(reinterpret_cast(&y), sizeof(y)); 120 | fbinaryin.read(reinterpret_cast(&z), sizeof(z)); 121 | pcl::PointXYZRGB point; 122 | point.x = x; 123 | point.y = y; 124 | point.z = z; 125 | point.rgb = rgb; 126 | cloud_patch->push_back(point); 127 | } 128 | fbinaryin.read(reinterpret_cast(&dip), sizeof(dip)); 129 | fbinaryin.read(reinterpret_cast(&dip_direction), sizeof(dip_direction)); 130 | fbinaryin.read(reinterpret_cast(&area), sizeof(area)); 131 | dataLibrary::cluster_patches.push_back(cloud_patch); 132 | dataLibrary::dips.push_back(dip); 133 | dataLibrary::dip_directions.push_back(dip_direction); 134 | dataLibrary::areas.push_back(area); 135 | 136 | ss << i; 137 | string patchID = *strfilename += ss.str(); 138 | dataLibrary::patchIDs.push_back(patchID); 139 | pcl::compute3DCentroid(*cloud_patch, centroid); 140 | centor_x += centroid[0]; 141 | centor_y += centroid[1]; 142 | centor_z += centroid[2]; 143 | } 144 | centor_x /= num_of_clusters; 145 | centor_y /= num_of_clusters; 146 | centor_z /= num_of_clusters; 147 | dataLibrary::cloud_centor.x=centor_x; 148 | dataLibrary::cloud_centor.y=centor_y; 149 | dataLibrary::cloud_centor.z=centor_z; 150 | fbinaryin.close(); 151 | if(!this->getMuteMode()) 152 | { 153 | emit show(); 154 | } 155 | is_success = true; 156 | } 157 | else 158 | { 159 | emit showErrors("openclusters: Can Not Open the File!"); 160 | } 161 | //end of processing 162 | 163 | this->timer_stop(); 164 | 165 | if(this->getWriteLogMode()&&is_success) 166 | { 167 | std::string string_filename = this->getFileName().toUtf8().constData(); 168 | std::string log_text = string_filename + "\n\tReading Clusters costs: "; 169 | std::ostringstream strs; 170 | strs << this->getTimer_sec(); 171 | log_text += (strs.str() +" seconds."); 172 | dataLibrary::write_text_to_log_file(log_text); 173 | } 174 | 175 | dataLibrary::Status = STATUS_READY; 176 | emit showReadyStatus(); 177 | delete strfilename; 178 | if(this->getWorkFlowMode()&&is_success) 179 | { 180 | this->Sleep(1000); 181 | emit GoWorkFlow(); 182 | } 183 | } -------------------------------------------------------------------------------- /openClustersWorker.h: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #pragma once 41 | #include "Worker.h" 42 | 43 | class openClustersWorker : public Worker 44 | { 45 | Q_OBJECT 46 | 47 | private: 48 | QString _filename; 49 | 50 | public: 51 | void openclusters() 52 | { 53 | QMetaObject::invokeMethod(this, "doWork"); 54 | } 55 | void setFileName(QString name) 56 | { 57 | _filename = name; 58 | } 59 | QString getFileName() 60 | { 61 | return _filename; 62 | } 63 | virtual bool is_para_satisfying(QString &message); 64 | virtual void prepare(); 65 | 66 | public slots: 67 | void doWork(); 68 | 69 | signals: 70 | void show(); 71 | }; -------------------------------------------------------------------------------- /plotwindow.cpp: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #include "plotwindow.h" 41 | #include "../build/ui_plotwindow.h" 42 | 43 | PlotWindow::PlotWindow(QWidget * parent) : QDialog(parent) 44 | { 45 | ui.setupUi(this); 46 | } 47 | 48 | PlotWindow::~PlotWindow(void) 49 | { 50 | 51 | } 52 | -------------------------------------------------------------------------------- /plotwindow.h: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #ifndef PLOTWINDOW_H 41 | #define PLOTWINDOW_H 42 | 43 | #include 44 | #include "../build/ui_plotwindow.h" 45 | 46 | class PlotWindow : public QDialog 47 | { 48 | public: 49 | PlotWindow(QWidget * parent=0); 50 | ~PlotWindow(void); 51 | 52 | public: 53 | Ui::PlotWindow ui; 54 | }; 55 | 56 | #endif // PLOTWINDOW_H 57 | -------------------------------------------------------------------------------- /plotwindow.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | PlotWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 800 10 | 800 11 | 12 | 13 | 14 | PlotWindow 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | QCustomPlot 26 | QWidget 27 |
qcustomplot.h
28 | 1 29 |
30 |
31 | 32 | 33 |
34 | -------------------------------------------------------------------------------- /ranormalWorker.cpp: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #include 41 | #include 42 | #include "geo_normal_3d.h" 43 | #include "geo_normal_3d_omp.h" 44 | #include "ranormalWorker.h" 45 | #include "dataLibrary.h" 46 | #include "globaldef.h" 47 | 48 | bool ranormalWorker::is_para_satisfying(QString &message) 49 | { 50 | if(dataLibrary::haveBaseData()) 51 | { 52 | this->setParaSize(1); 53 | if(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters.size()>=this->getParaSize()) 54 | { 55 | double radius; 56 | std::stringstream ss(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters[0]); 57 | ss >> radius; 58 | this->setRadius(radius); 59 | 60 | this->setParaIndex(this->getParaSize()); 61 | return true; 62 | } 63 | else 64 | { 65 | message = QString("ranormal: Search Radius Not Given."); 66 | return false; 67 | } 68 | } 69 | else 70 | { 71 | message = QString("ranormal: You Do Not Have Any Point Cloud Data in Memery!"); 72 | return false; 73 | } 74 | } 75 | 76 | void ranormalWorker::prepare() 77 | { 78 | this->setShowCurvature(false); 79 | if(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters.size()>this->getParaIndex()) 80 | { 81 | if(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters[this->getParaIndex()] == "showcurvature") 82 | { 83 | this->setShowCurvature(true); 84 | this->setParaIndex(this->getParaIndex()+1); 85 | } 86 | } 87 | this->setUnmute(); 88 | this->setWriteLog(); 89 | this->check_mute_nolog(); 90 | } 91 | 92 | void ranormalWorker::doWork() 93 | { 94 | bool is_success(false); 95 | 96 | dataLibrary::checkupflow(); 97 | 98 | dataLibrary::Status = STATUS_RANORMAL; 99 | 100 | this->timer_start(); 101 | 102 | //begin of processing 103 | GeoNormalEstimationOMP ne; 104 | ne.setInputCloud(dataLibrary::cloudxyz); 105 | pcl::search::KdTree::Ptr tree (new pcl::search::KdTree()); 106 | ne.setSearchMethod(tree); 107 | ne.setRadiusSearch(this->getRadius()); 108 | if(!dataLibrary::normal->empty()) 109 | { 110 | dataLibrary::normal->clear(); 111 | } 112 | ne.compute(*dataLibrary::normal); 113 | 114 | if(!dataLibrary::pointnormals->empty()) 115 | { 116 | dataLibrary::pointnormals->clear(); 117 | } 118 | pcl::concatenateFields(*dataLibrary::cloudxyz, *dataLibrary::normal, *dataLibrary::pointnormals); 119 | 120 | is_success = true; 121 | //end of processing 122 | 123 | this->timer_stop(); 124 | 125 | if(this->getWriteLogMode()&&is_success) 126 | { 127 | std::string log_text = "\tComputing Radius Normal costs: "; 128 | std::ostringstream strs; 129 | strs << this->getTimer_sec(); 130 | log_text += (strs.str() +" seconds."); 131 | dataLibrary::write_text_to_log_file(log_text); 132 | } 133 | 134 | if(!this->getMuteMode()&&is_success) 135 | { 136 | emit show(_show_curvature); 137 | } 138 | dataLibrary::Status = STATUS_READY; 139 | emit showReadyStatus(); 140 | if(this->getWorkFlowMode()&&is_success) 141 | { 142 | this->Sleep(1000); 143 | emit GoWorkFlow(); 144 | } 145 | } -------------------------------------------------------------------------------- /ranormalWorker.h: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #pragma once 41 | #include "Worker.h" 42 | class ranormalWorker : 43 | public Worker 44 | { 45 | Q_OBJECT 46 | 47 | private: 48 | double _radius; 49 | 50 | public: 51 | ranormalWorker() : Worker() 52 | { 53 | _show_curvature = false; 54 | } 55 | 56 | void ranormal() 57 | { 58 | QMetaObject::invokeMethod(this, "doWork"); 59 | } 60 | 61 | void setShowCurvature(bool mode) 62 | { 63 | _show_curvature = mode; 64 | } 65 | bool getShowCurvature() 66 | { 67 | return _show_curvature; 68 | } 69 | void setRadius(double radius) 70 | { 71 | _radius = radius; 72 | } 73 | double getRadius() 74 | { 75 | return _radius; 76 | } 77 | virtual bool is_para_satisfying(QString &message); 78 | virtual void prepare(); 79 | 80 | private slots: 81 | void doWork(); 82 | 83 | signals: 84 | void show(bool _show_curvature); 85 | 86 | private: 87 | bool _show_curvature; 88 | }; 89 | 90 | -------------------------------------------------------------------------------- /resampleWorker.cpp: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include "resampleWorker.h" 45 | #include "globaldef.h" 46 | #include "dataLibrary.h" 47 | 48 | bool resampleWorker::is_para_satisfying(QString &message) 49 | { 50 | if(dataLibrary::haveBaseData()) 51 | { 52 | this->setParaSize(1); 53 | if(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters.size()>=this->getParaSize()) 54 | { 55 | double radius; 56 | std::stringstream ss(dataLibrary::Workflow[dataLibrary::current_workline_index].parameters[0]); 57 | ss >> radius; 58 | this->setRadius(radius); 59 | 60 | this->setParaIndex(this->getParaSize()); 61 | return true; 62 | } 63 | else 64 | { 65 | message = QString("resample: Search Radius Not Given."); 66 | return false; 67 | } 68 | } 69 | else 70 | { 71 | message = QString("resample: You Do Not Have Any Point Cloud Data in Memery!"); 72 | return false; 73 | } 74 | } 75 | 76 | void resampleWorker::prepare() 77 | { 78 | this->setUnmute(); 79 | this->setWriteLog(); 80 | this->check_mute_nolog(); 81 | } 82 | 83 | void resampleWorker::doWork() 84 | { 85 | bool is_success(false); 86 | 87 | dataLibrary::checkupflow(); 88 | 89 | dataLibrary::Status = STATUS_RESAMPLE; 90 | 91 | this->timer_start(); 92 | 93 | //begin of processing 94 | // Create a KD-Tree 95 | pcl::search::KdTree::Ptr tree (new pcl::search::KdTree); 96 | 97 | // Init object (second point type is for the normals, even if unused) 98 | pcl::MovingLeastSquares mls; 99 | 100 | mls.setComputeNormals (false); 101 | 102 | // Set parameters 103 | mls.setInputCloud (dataLibrary::cloudxyz); 104 | mls.setPolynomialFit (true); 105 | mls.setSearchMethod (tree); 106 | mls.setSearchRadius (this->getRadius()); 107 | 108 | // Reconstruct 109 | if(!dataLibrary::mls_points->empty()) 110 | { 111 | dataLibrary::mls_points->clear(); 112 | } 113 | mls.process (*dataLibrary::mls_points); 114 | 115 | dataLibrary::temp_cloud->clear(); 116 | *dataLibrary::temp_cloud = *dataLibrary::mls_points; 117 | 118 | is_success = true; 119 | //end of processing 120 | 121 | this->timer_stop(); 122 | 123 | if(this->getWriteLogMode()&&is_success) 124 | { 125 | std::string log_text = "\tResampling costs: "; 126 | std::ostringstream strs; 127 | strs << this->getTimer_sec(); 128 | log_text += (strs.str() +" seconds."); 129 | dataLibrary::write_text_to_log_file(log_text); 130 | } 131 | 132 | if(!this->getMuteMode()&&is_success) 133 | { 134 | emit show(); 135 | } 136 | 137 | dataLibrary::Status = STATUS_READY; 138 | emit showReadyStatus(); 139 | if(this->getWorkFlowMode()&&is_success) 140 | { 141 | this->Sleep(1000); 142 | emit GoWorkFlow(); 143 | } 144 | } 145 | -------------------------------------------------------------------------------- /resampleWorker.h: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #pragma once 41 | #include "Worker.h" 42 | class resampleWorker : 43 | public Worker 44 | { 45 | Q_OBJECT 46 | 47 | private: 48 | double _radius; 49 | 50 | public: 51 | void resample() 52 | { 53 | QMetaObject::invokeMethod(this, "doWork"); 54 | } 55 | void setRadius(double radius) 56 | { 57 | _radius = radius; 58 | } 59 | double getRadius() 60 | { 61 | return _radius; 62 | } 63 | virtual bool is_para_satisfying(QString &message); 64 | virtual void prepare(); 65 | 66 | private slots: 67 | void doWork(); 68 | 69 | signals: 70 | void show(); 71 | }; 72 | 73 | -------------------------------------------------------------------------------- /structrock.h: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #ifndef STRUCTROCK_H 41 | #define STRUCTROCK_H 42 | 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | #include "ReadFileWorker.h" 55 | #include "checkstatusThread.h" 56 | #include "resampleWorker.h" 57 | #include "../build/ui_structrock.h" 58 | #include "MultiInputDialog.h" 59 | #include "globaldef.h" 60 | #include "ReadFileWorker.h" 61 | #include "checkstatusThread.h" 62 | #include "resampleWorker.h" 63 | #include "downsampleWorker.h" 64 | #include "knnormalWorker.h" 65 | #include "ranormalWorker.h" 66 | #include "StaticROWorker.h" 67 | #include "RGSWorker.h" 68 | #include "SaveClustersWorker.h" 69 | #include "ReadXYZWorker.h" 70 | #include "SavePcdASCIIWorker.h" 71 | #include "SavePcdBinaryWorker.h" 72 | #include "SaveNormalsWorker.h" 73 | #include "ShowProcessWorker.h" 74 | #include "ShowSFeatureWorker.h" 75 | #include "triangulationWorker.h" 76 | #include "openClustersWorker.h" 77 | #include "ShearParaWorker.h" 78 | #include "SavePolygonMeshWorker.h" 79 | #include "ReadPolygonMeshWorker.h" 80 | #include "ReadnShowClassesWorker.h" 81 | #include "MultiStationWorker.h" 82 | #include "SaveMeshWorker.h" 83 | #include "LagrangeTensorWorker.h" 84 | #include "SaveTraceMapWorker.h" 85 | #include "TestWorker.h" 86 | #include "TimingShutdown.h" 87 | 88 | class structrock : public QMainWindow 89 | { 90 | Q_OBJECT 91 | 92 | public: 93 | structrock(QWidget *parent = 0, Qt::WFlags flags = 0); 94 | ~structrock(); 95 | void OpenWorkFlow(QString filename); 96 | void OpenWorkFlow(std::string commands); 97 | 98 | private slots: 99 | void open(); 100 | void exit(); 101 | void saveasascii(); 102 | void saveasbinary(); 103 | void downsampling(); 104 | void ShowDownsample(); 105 | void resampling(); 106 | void ShowResample(); 107 | void k_neighbor(); 108 | void ShowNormal(bool showCurvature); 109 | void radius(); 110 | void StaticRemoveOutlier(); 111 | void ShowSRO(); 112 | void ConditionalRemoveOutlier(); 113 | void RadiusRemoveOutlier(); 114 | void SaveNormals(); 115 | void SaveClusters(); 116 | void ShowSavedClusters(); 117 | void Show_SaveTraceMap(QString filename); 118 | void Prepare_2_s_f(); 119 | void Show_f_n_SaveScreen(const QString &filename); 120 | void RegionGrowingSegmentation(); 121 | void ShowRGS(); 122 | void ShowTriangulation(); 123 | void ShowShearPara(); 124 | void ShowFractureShearFeatures(); 125 | void OpenClusters(); 126 | void ShowClusters(); 127 | void OpenXYZ(); 128 | void OpenWorkFlow(); 129 | void Testing(); 130 | void About(); 131 | void Stereonet(); 132 | void Stereonet(QString filename); 133 | void TestResult(int i); 134 | void ShowPCD(int i); 135 | void ShowReady(); 136 | void ShowStatus(int i); 137 | void command_parser(); 138 | void Show_Errors(const QString &errors); 139 | void Show_Process(QStringList Qcontents); 140 | void Show_SFeature(); 141 | void slotReboot() 142 | { 143 | QProcess *myProcess = new QProcess; 144 | myProcess->setWorkingDirectory(QApplication::applicationDirPath()); 145 | #if !defined(_WIN32)&&(defined(__unix__)||defined(__unix)||(defined(__APPLE__)&&defined(__MACH__))) 146 | myProcess->start("./structrock"); 147 | #elif defined(_WIN32)||defined(_WIN64) 148 | myProcess->start("structrock"); 149 | #endif 150 | 151 | TimingShutdown *shutdown(new TimingShutdown); 152 | connect(shutdown, SIGNAL(shutdown()), this, SLOT(exit())); 153 | shutdown->start(); 154 | } 155 | void NewWindow() 156 | { 157 | QProcess *myProcess = new QProcess; 158 | myProcess->setWorkingDirectory(QApplication::applicationDirPath()); 159 | #if !defined(_WIN32)&&(defined(__unix__)||defined(__unix)||(defined(__APPLE__)&&defined(__MACH__))) 160 | myProcess->start("./structrock"); 161 | #elif defined(_WIN32)||defined(_WIN64) 162 | myProcess->start("structrock"); 163 | #endif 164 | } 165 | 166 | private: 167 | Ui::structrock_ui ui; 168 | QAction *openAction; 169 | QAction *exitAction; 170 | QAction *SaveAsASCII; 171 | QAction *SaveAsBinary; 172 | QAction *DownSampling; 173 | QAction *normal_k_neighbor; 174 | QAction *normal_radius; 175 | QAction *ReSampling; 176 | QAction *Static_remove_outlier; 177 | QAction *Conditional_remove_outlier; 178 | QAction *Radius_remove_outlier; 179 | QAction *save_normals; 180 | QAction *save_clusters; 181 | QAction *region_growing_segmentation; 182 | QAction *open_clusters; 183 | QAction *open_xyz; 184 | QAction *open_workflow; 185 | QAction *testing; 186 | QAction *about; 187 | QAction *stereonet; 188 | QAction *Reboot; 189 | QAction *newWindow; 190 | 191 | public: 192 | pcl::visualization::PCLVisualizer *viewer; 193 | int v1; 194 | int v2; 195 | 196 | private: 197 | void NewWindow_current_command(); 198 | void NewWindow_next_command(); 199 | void Reboot_with_commands(std::string commands); 200 | void updatePatch(); 201 | void DrawLine(const Eigen::Vector3f begin, const Eigen::Vector3f end, float r, float g, float b, std::string id, int viewpot); 202 | void DrawLine(const Eigen::Vector3f begin, const Eigen::Vector3f end, float r, float g, float b, double lineWidth, std::string id, int viewpot); 203 | 204 | private: 205 | ReadFileWorker readfileworker; 206 | resampleWorker resampleworker; 207 | downsampleWorker downsampleworker; 208 | knnormalWorker knnormalworker; 209 | ranormalWorker ranormalworker; 210 | StaticROWorker staticroworker; 211 | RGSWorker rgsworker; 212 | SaveClustersWorker saveclustersworker; 213 | ReadXYZWorker readxyzworker; 214 | SavePcdASCIIWorker savepcdASCIIworker; 215 | SavePcdBinaryWorker savepcdBinaryworker; 216 | SaveNormalsWorker savenormalsworker; 217 | ShowProcessWorker showprocessworker; 218 | ShowSFeatureWorker showsfeatureworker; 219 | triangulationWorker triangulationworker; 220 | openClustersWorker openclustersworker; 221 | ShearParaWorker shearparaworker; 222 | SavePolygonMeshWorker savePolygonMeshworker; 223 | ReadPolygonMeshWorker readPolygonMeshworker; 224 | ReadnShowClassesWorker readnShowClassesworker; 225 | MultiStationWorker multiStationworker; 226 | SaveMeshWorker saveMeshworker; 227 | LagrangeTensorWorker lagrangeTensorWorker; 228 | SaveTraceMapWorker saveTraceMapWorker; 229 | TestWorker testworker; 230 | 231 | public: 232 | void MoveForwardPatch(); 233 | void MoveBackPatch(); 234 | void saveScreen(); 235 | void CheckPatchesIfSelected(float x, float y, float z); 236 | void ShowSelectedPatches(); 237 | }; 238 | 239 | #endif // STRUCTROCK_H 240 | -------------------------------------------------------------------------------- /structrock.rc: -------------------------------------------------------------------------------- 1 | IDI_ICON1 ICON DISCARDABLE "icon.ico" 2 | -------------------------------------------------------------------------------- /structrock.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | structrock_ui 4 | 5 | 6 | 7 | 0 8 | 0 9 | 1424 10 | 770 11 | 12 | 13 | 14 | 15 | 0 16 | 0 17 | 18 | 19 | 20 | 21 | 5000 22 | 5000 23 | 24 | 25 | 26 | structrock 27 | 28 | 29 | 30 | 31 | 0 32 | 0 33 | 34 | 35 | 36 | 37 | 38 | 39 | 0 40 | 0 41 | 1424 42 | 23 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 0 51 | 0 52 | 700 53 | 22 54 | 55 | 56 | 57 | Ready 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | QVTKWidget 66 | QWidget 67 |
QVTKWidget.h
68 |
69 |
70 | 71 | 72 | 73 | 74 |
75 | -------------------------------------------------------------------------------- /triangulationWorker.h: -------------------------------------------------------------------------------- 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 | * Email : ericrussell@zju.edu.cn 37 | * 38 | */ 39 | 40 | #pragma once 41 | 42 | #include "Worker.h" 43 | #include "globaldef.h" 44 | class triangulationWorker : public Worker 45 | { 46 | Q_OBJECT 47 | 48 | private: 49 | TriangulationPara _para; 50 | 51 | public: 52 | void triangulation() 53 | { 54 | QMetaObject::invokeMethod(this, "doWork"); 55 | } 56 | void setTriPara(TriangulationPara para) 57 | { 58 | _para.knNeighbors = para.knNeighbors; 59 | _para.maxAngle = para.maxAngle; 60 | _para.maxNearestNeighbors = para.maxNearestNeighbors; 61 | _para.maxSurfaceAngle = para.maxSurfaceAngle; 62 | _para.minAngle = para.minAngle; 63 | _para.Mu = para.Mu; 64 | _para.normalConsistancy = para.normalConsistancy; 65 | _para.searchRadius = para.searchRadius; 66 | } 67 | TriangulationPara getTriPara() 68 | { 69 | return _para; 70 | } 71 | virtual bool is_para_satisfying(QString &message); 72 | virtual void prepare(); 73 | 74 | private slots: 75 | void doWork(); 76 | signals: 77 | void show(); 78 | }; -------------------------------------------------------------------------------- /wiki/img/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EricAlex/structrock/754d8c481d22a48ea7eb4e055eb16c64c44055ab/wiki/img/Thumbs.db -------------------------------------------------------------------------------- /wiki/img/detailed_results.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EricAlex/structrock/754d8c481d22a48ea7eb4e055eb16c64c44055ab/wiki/img/detailed_results.jpg -------------------------------------------------------------------------------- /wiki/img/gui.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EricAlex/structrock/754d8c481d22a48ea7eb4e055eb16c64c44055ab/wiki/img/gui.jpg -------------------------------------------------------------------------------- /wiki/img/outcrop_results.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EricAlex/structrock/754d8c481d22a48ea7eb4e055eb16c64c44055ab/wiki/img/outcrop_results.jpg --------------------------------------------------------------------------------