Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions CMake/cvutilInstallTargets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,17 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows")

elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
# Install the RhizoVisionExplorer executable
install(TARGETS RhizoVisionExplorer rv
CONFIGURATIONS Debug Release
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
if(Qt6_FOUND)
install(TARGETS RhizoVisionExplorer rv
CONFIGURATIONS Debug Release
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
else()
install(TARGETS rv
CONFIGURATIONS Debug Release
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()

# Install additional files.
install(FILES README.md COPYING CONFIGURATIONS Debug Release DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/RhizoVisionExplorer)
Expand Down
95 changes: 50 additions & 45 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,22 @@ endif()
find_package(OpenCV REQUIRED)

# Find Qt6
find_package(Qt6 REQUIRED COMPONENTS Core Widgets Charts Gui OpenGL)
qt_standard_project_setup()
find_package(Qt6 COMPONENTS Core Widgets Charts Gui OpenGL)

if(Qt6_found)
qt_standard_project_setup()
add_compile_definitions(BUILD_GUI)
else()
message(WARNING "qt6 not found, building without GUI support.")
endif()

# Find cvutil
find_package(cvutil REQUIRED)

if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
find_package(X11 REQUIRED)
if(Qt6_FOUND)
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
find_package(X11 REQUIRED)
endif()
endif()

get_cmake_property(_variableNames VARIABLES)
Expand All @@ -116,7 +124,6 @@ set(CMAKE_AUTOUIC ON) # Enable automatic UIC

# Define the source files for RoiManager
set(SOURCES
RhizoVisionExplorer/MainUI.cpp
RhizoVisionExplorer/feature_extraction.cpp
RhizoVisionExplorer/rootsegmentprop.cpp
RhizoVisionExplorer/roottopology.cpp
Expand All @@ -128,8 +135,6 @@ set(HEADERS
RhizoVisionExplorer/feature_extraction.h
RhizoVisionExplorer/feature_config.h
RhizoVisionExplorer/common_types.h
RhizoVisionExplorer/demo.h
RhizoVisionExplorer/MainUI.h
RhizoVisionExplorer/resource.h
RhizoVisionExplorer/rootsegmentprop.h
RhizoVisionExplorer/roottopology.h
Expand All @@ -140,61 +145,61 @@ if(WIN32)
list(APPEND SOURCES RhizoVisionExplorer/RhizoVisionExplorer.rc)
endif()

# Define the target as an executable.
add_executable(RhizoVisionExplorer WIN32
RhizoVisionExplorer/main.cpp
${SOURCES}
${HEADERS})
add_executable(rv
if(Qt6_found)
list(APPEND SOURCES RhizoVisionExplorer/MainUI.cpp)
list(APPEND HEADERS RhizoVisionExplorer/demo.h RhizoVisionExplorer/MainUI.h)
endif()

if(Qt6_found)
# Define the target as an executable.
add_executable(RhizoVisionExplorer WIN32
RhizoVisionExplorer/main.cpp
${SOURCES}
${HEADERS})
set_target_properties(RhizoVisionExplorer PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
# Add the generated resource .cpp file to the target
target_sources(RhizoVisionExplorer PRIVATE ${RESOURCES})

# Include directories (Qt and OpenCV paths are already handled at the solution level)
target_include_directories(RhizoVisionExplorer
PRIVATE
#${CMAKE_BINARY_DIR}/library/include
${OpenCV_INCLUDE_DIRS}
)
# Link libraries (cvutil depends on PluginManager and RoiManager)
target_link_libraries(RhizoVisionExplorer
PRIVATE
${OpenCV_LIBS}
Qt6::Core
Qt6::Widgets
Qt6::Charts
Qt6::Gui
Qt6::OpenGL
cvutil::cvutil
cvutil::PluginManager
cvutil::RoiManager
)
endif()

add_executable(rv
RhizoVisionExplorer/rv.cpp
RhizoVisionExplorer/indicators/indicators.hpp
${SOURCES}
${HEADERS})

set_target_properties(RhizoVisionExplorer PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
set_target_properties(rv PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})

# Add the generated resource .cpp file to the target
target_sources(RhizoVisionExplorer PRIVATE ${RESOURCES})

# Include directories (Qt and OpenCV paths are already handled at the solution level)
target_include_directories(RhizoVisionExplorer
PRIVATE
#${CMAKE_BINARY_DIR}/library/include
${OpenCV_INCLUDE_DIRS}
)
set_target_properties(rv PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})

target_include_directories(rv
PRIVATE
#${CMAKE_BINARY_DIR}/library/include
${OpenCV_INCLUDE_DIRS}
)

# Link libraries (cvutil depends on PluginManager and RoiManager)
target_link_libraries(RhizoVisionExplorer
PRIVATE
${OpenCV_LIBS}
Qt6::Core
Qt6::Widgets
Qt6::Charts
Qt6::Gui
Qt6::OpenGL
cvutil::cvutil
cvutil::PluginManager
cvutil::RoiManager
)

target_link_libraries(rv
PRIVATE
${OpenCV_LIBS}
Qt6::Core
Qt6::Widgets
Qt6::Charts
Qt6::Gui
Qt6::OpenGL
cvutil::cvutil
cvutil::PluginManager
cvutil::RoiManager
)

set(CPACK_PROPERTIES_FILE "${CMAKE_BINARY_DIR}/RhizoVisionCPackProperties-$<CONFIG>.cmake")
Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
# ![RhiZoVision Explorer Logo](./RVElogoclearback-80.png) RhizoVision Explorer
# Information about this fork

Modified source code to remove dependencies on Qt6. Needs an appropriate
[cvutil](https://github.com/sotlampr/cvutil).

TODO:
- Better replace Q* clases with std equivalents
- Use RoiManager (uses QtGraphicsRectItem for calculations)

## ![RhiZoVision Explorer Logo](./RVElogoclearback-80.png) RhizoVision Explorer

RhizoVision Explorer is free and open-source software developed for estimating root traits from images acquired from a flatbed scanner or camera. Root images are expected to have a high contrast of roots with the background, homogenous lighting, and minimal overlapping of roots. The software is built in C++ for speed and stability, using QT for the graphical user interface and OpenCV for image processing. Traits extracted by RhizoVision Explorer have been extensively validated using a physical copper wire ground truth image set, thousands of simulated roots, and comparisons with other image analysis software. The default “Broken Roots” mode is meant for roots washed out from soil cores or pots that are disconnected and provides length, volume, branching frequency, among other features, with the ability to bin measurements based on diameter thresholds. The “Whole Root” mode extracts additional root system architecture features of more intact root systems, especially excavated root crowns or rhizoboxes, such as the convex hull, angles, and holes. The software supports multiple regions of interest, batch mode, and user-defined export of processed images with overlaid features for use in reports.

Expand Down
5 changes: 5 additions & 0 deletions RhizoVisionExplorer/feature_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ If not, see <https://www.gnu.org/licenses/>.
#include <opencv2/opencv.hpp>
#include <vector>

#ifdef BUILD_GUI
#include <QtCore/QString>
#else
#include <string>
typedef std::string QString;
#endif

#define RHIZOVISION_EXPLORER_VERSION "2.5.0 Beta"

Expand Down
2 changes: 2 additions & 0 deletions RhizoVisionExplorer/feature_extraction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -868,8 +868,10 @@ static bool checkProgress(feature_config *config, QString str)
{
if (!config->consolemode)
{
#ifdef BUILD_GUI
config->ui->updateProgress(str);
QApplication::processEvents();
#endif
return config->abortprocess;
}
// else
Expand Down
4 changes: 4 additions & 0 deletions RhizoVisionExplorer/feature_extraction.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ If not, see <https://www.gnu.org/licenses/>.
//using namespace cv;
using namespace std;

#ifdef BUILD_GUI
#include "MainUI.h"
#else
#include "feature_config.h"
#endif

void feature_extractor(feature_config *config);

Expand Down
7 changes: 5 additions & 2 deletions RhizoVisionExplorer/rootsegmentprop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,12 @@ void getrootlength_new(Mat skeleton, ListofListsRef<Point> segments, PointList o
for (int i = 0; i < segsize; i++)
{
simplified = doughlas_peucker(segments[i], 0.71, false); // We took the 0.71 as threshold to make sure we identify straight lines.
segmentsize = simplified.size() - 1;
segmentsize = simplified.size();

for (int j = 0; j < segmentsize; j++)
if (segmentsize == 0)
continue;

for (int j = 0; j < segmentsize-1; j++)
{
diff = simplified[j] - simplified[j + 1];
rootlen += norm(diff);
Expand Down
5 changes: 5 additions & 0 deletions RhizoVisionExplorer/roottopology.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,11 @@ void getroottopology(Mat &_skeleton, Mat dist,
}
}
}

if (segment != nullptr) {
delete segment;
segment = nullptr;
}

//window("new1", skeleton.rowRange(3729 - 50, 3729 + 50).colRange(3400 - 50, 3400 + 50));

Expand Down
Loading