Skip to content
Snippets Groups Projects
Commit 8db49c5f authored by Hauke Mönck's avatar Hauke Mönck
Browse files

Updated sample to current interface&util

parent b0128106
No related branches found
No related tags found
No related merge requests found
Showing
with 1008 additions and 306 deletions
cmake_minimum_required(VERSION 3.13)
file(READ VERSION PROJECT_VERSION)
project(biotracker-sample.bio_tracker)
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
option(PACKAGE_WINDOWS_MSI "Create .msi package" OFF)
endif()
option(PACKAGE_TXZ "Create .tar.xz package" OFF)
find_package(biotracker-utility 0.2 REQUIRED)
add_subdirectory(src)
include(cmake/Locate.cmake)
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
install(TARGETS ${target} DESTINATION .)
option(INSTALL_REQUIRED_SYSTEM_LIBRARIES "Install required system libraries" OFF)
if(INSTALL_REQUIRED_SYSTEM_LIBRARIES)
set(CMAKE_INSTALL_UCRT_LIBRARIES TRUE)
set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION .)
include(InstallRequiredSystemLibraries)
endif()
set(INSTALL_OPENCV_COMPONENTS "" CACHE STRING "OpenCV components to install")
locate_opencv(shared_libraries COMPONENTS ${INSTALL_OPENCV_COMPONENTS})
set(INSTALL_SHARED_LIBRARIES "" CACHE STRING "Additional shared libraries to install")
locate_shared_library(shared_libraries ${INSTALL_SHARED_LIBRARIES})
install(FILES ${shared_libraries} DESTINATION .)
endif()
set(CPACK_PACKAGE_NAME "BioTracker Plugin Sample")
set(CPACK_PACKAGE_VENDOR "Biorobotics Lab / FU Berlin")
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
if(PACKAGE_WINDOWS_MSI)
set(CPACK_GENERATOR "WIX")
set(CPACK_WIX_UPGRADE_GUID "7bcbbcaa-f016-4480-a667-307a902fd78a")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "RoboFish/Sample")
set(CPACK_WIX_PROGRAM_MENU_FOLDER "RoboFish")
set(CPACK_WIX_LICENSE_RTF ${CMAKE_SOURCE_DIR}/cmake/WIX/licence.rtf)
set(CPACK_WIX_TEMPLATE "${CMAKE_SOURCE_DIR}/cmake/WIX/WIX.template.in")
elseif(PACKAGE_TXZ)
set(CPACK_GENERATOR "TXZ")
endif()
include(CPack)
\ No newline at end of file
cmake_minimum_required(VERSION 2.6)
#(Minimal benötigte CMake-Version wenn z.B. bestimmte CMake-Kommandos benutzt werden)
cmake_policy (SET CMP0020 NEW)
# Der Projektname
project(Sampletracker)
set(CMAKE_CXX_FLAGS "-std=c++11" CACHE STRING "compile flags" FORCE)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
#Building for x64
IF(CMAKE_CL_64)
find_package(Qt5 REQUIRED Core Gui Xml Network Widgets OpenGL Multimedia MultimediaWidgets PATHS $ENV{QT_DIR_CMAKE64})
find_package(OpenCV REQUIRED PATHS $ENV{CV_DIR_CMAKE64})
set (QT_DIR_CMAKE $ENV{QT_DIR_CMAKE64})
ELSE()
#Building for x86
find_package(Qt5 REQUIRED Core Gui Xml Network Widgets OpenGL Multimedia MultimediaWidgets PATHS $ENV{QT_DIR_CMAKE32})
find_package(OpenCV REQUIRED PATHS $ENV{CV_DIR_CMAKE32})
set (QT_DIR_CMAKE $ENV{QT_DIR_CMAKE32})
ENDIF()
set(BTLibrary "Not Found" CACHE FILEPATH "")
if(CMAKE_SYSTEM MATCHES "Windows")
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
endif()
find_package(Boost REQUIRED system filesystem chrono thread timer program_options)
add_subdirectory(Sample)
##############################################################
#### Biotracker: Sampletracker
##############################################################
set(INCLUDE_DIRS
${INCLUDE_DIRS}
${BTLibrary}/include/
${BTLibrary}/include/Utils/
${CMAKE_SOURCE_DIR}/Plugin/Sample/
${PROJECT_BINARY_DIR}/Plugin/Sample/
${Boost_INCLUDE_DIRS}
${OpenCV_INCLUDE_DIRS}
${Qt5Core_INCLUDE_DIRS}
${Qt5Gui_INCLUDE_DIRS}
${Qt5Xml_INCLUDE_DIRS}
${Qt5Network_INCLUDE_DIRS}
${Qt5Widgets_INCLUDE_DIRS}
${Qt5Opengl_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}
)
set(QTLIBS
Qt5::Core
Qt5::Gui
Qt5::Xml
Qt5::Network
Qt5::Widgets
)
message(${BTLibrary})
set(LIBS
${BTLibrary}/bin/Biotracker_interfaces
${BTLibrary}/bin/Biotracker_utility
${OpenCV_LIBRARIES}
${Boost_LIBRARIES}
${QTLIBS}
)
add_definitions( -DBIOTRACKERPLUGIN_LIBRARY=1 )
# Visual studio out-of-source friendly source groups
set(_plugin_src_root_path ${CMAKE_CURRENT_SOURCE_DIR})
file(
GLOB_RECURSE _plugin_source_list
LIST_DIRECTORIES false
"${_plugin_src_root_path}/*.c*"
"${_plugin_src_root_path}/*.h*"
"${_plugin_src_root_path}/*.ui*"
)
foreach(_plugin_source IN ITEMS ${_plugin_source_list})
get_filename_component(_plugin_source_path "${_plugin_source}" PATH)
file(RELATIVE_PATH _plugin_source_path_rel "${_plugin_src_root_path}" "${_plugin_source_path}")
string(REPLACE "/" "\\" _plugin_group_path "${_plugin_source_path_rel}")
source_group("${_plugin_group_path}" FILES "${_plugin_source}")
endforeach()
set(CMAKE_INCLUDE_CURRENT_DIR OFF)
include_directories(${INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR})
message("Configuring Sample...")
set(EXE_NAME Sample.tracker)
add_library(${EXE_NAME} SHARED ${_plugin_source_list} )
target_link_libraries(${EXE_NAME} ${LIBS})
add_dependencies(${EXE_NAME} Biotracker_interfaces Biotracker_utility)
#pragma once
#include <iostream>
#include <vector>
namespace LUKASKANADE {
namespace CONFIGPARAM
{
// System config
const std::string CONFIG_INI_FILE = "./LKTrackerConfig.ini";
}
namespace APPLICATIONPARAM
{
// System config
const std::string APP_VERSION = "APPLICATIONPARAM/APP_VERSION";
}
namespace TRACKERPARAM
{
const std::string WNDSIZE = "TRACKERPARAM/WNDSIZE";
}
namespace GUIPARAM
{
// FPS label
const std::string ENABLE_LABEL_FPS = "GUIPARAM/ENABLE_LABEL_FPS";
// Fish id label
const std::string ENABLE_LABEL_FISH_ID = "GUIPARAM/ENABLE_LABEL_FISH_ID";
// Replica marker
const std::string ENABLE_LABEL_REPLICA = "GUIPARAM/ENABLE_LABEL_REPLICA";
// Fish position
const std::string ENABLE_LABEL_FISH_POS = "GUIPARAM/ENABLE_LABEL_FISH_POS";
// Fish orientation
const std::string ENABLE_LABEL_FISH_ORI = "GUIPARAM/ENABLE_LABEL_FISH_ORI";
// Fish history
const std::string ENABLE_LABEL_FISH_HISTORY = "GUIPARAM/ENABLE_LABEL_FISH_HISTORY";
// Blobs
const std::string ENABLE_SHOW_BLOBS = "GUIPARAM/ENABLE_SHOW_BLOBS";
// Swap fish id
const std::string ENABLE_SWAP_FISH_ID = "GUIPARAM/ENABLE_SWAP_FISH_ID";
// Core view of tracked components
const std::string ENABLE_CORE_COMPONENT_VIEW = "GUIPARAM/ENABLE_CORE_COMPONENT_VIEW";
// Move components in core view
const std::string ENABLE_CORE_COMPONENT_MOVE = "GUIPARAM/ENABLE_CORE_COMPONENT_MOVE";
// Remove components in core view
const std::string ENABLE_CORE_COMPONENT_REMOVE = "GUIPARAM/ENABLE_CORE_COMPONENT_REMOVE";
// Swap component id in core view
const std::string ENABLE_CORE_COMPONENT_ID_SWAP = "GUIPARAM/ENABLE_CORE_COMPONENT_ID_SWAP";
// Add component in core view
const std::string ENABLE_CORE_COMPONENT_ADD = "GUIPARAM/ENABLE_CORE_COMPONENT_ADD";
// Rotate component in core view
const std::string ENABLE_CORE_COMPONENT_ROTATE = "GUIPARAM/ENABLE_CORE_COMPONENT_ROTATE";
}
}
0.1.0
\ No newline at end of file
function(locate_shared_library VAR)
foreach(name ${ARGN})
set(_filename "${CMAKE_SHARED_LIBRARY_PREFIX}${name}${CMAKE_SHARED_LIBRARY_SUFFIX}")
message(STATUS "Locating ${_filename}")
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
execute_process(
COMMAND where.exe "${_filename}"
OUTPUT_VARIABLE _matches
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE _res
)
if(NOT "${_res}" STREQUAL "0")
message(FATAL_ERROR "Could not locate ${_filename}")
endif()
string(REGEX REPLACE "\n" ";" _matches "${_matches}")
list(GET _matches 0 _match)
string(REGEX REPLACE "\\\\" "/" _match "${_match}")
if(DEFINED ${VAR})
list(APPEND ${VAR} "${_match}")
set(${VAR} ${${VAR}} PARENT_SCOPE)
else()
set(${VAR} "${_match}" PARENT_SCOPE)
endif()
else()
message(FATAL_ERROR "Platform not supported")
endif()
endforeach()
endfunction()
function(locate_opencv VAR)
cmake_parse_arguments(ARG "" "" "COMPONENTS" ${ARGN})
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
set(suffix "${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}")
foreach(component ${ARG_COMPONENTS})
locate_shared_library(${VAR} "opencv_${component}${suffix}")
endforeach()
set(${VAR} ${${VAR}} PARENT_SCOPE)
else()
message(FATAL_ERROR "Platform not supported")
endif()
endfunction()
function(locate_cuda VAR)
cmake_parse_arguments(ARG "" "" "COMPONENTS" ${ARGN})
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
set(suffix "64_${CUDA_VERSION_MAJOR}${CUDA_VERSION_MINOR}")
else()
set(suffix "32_${CUDA_VERSION_MAJOR}${CUDA_VERSION_MINOR}")
endif()
foreach(component ${ARG_COMPONENTS})
locate_shared_library(${VAR} "${component}${suffix}")
endforeach()
set(${VAR} ${${VAR}} PARENT_SCOPE)
else()
message(FATAL_ERROR "Platform not supported")
endif()
endfunction()
function(locate_cudnn VAR)
cmake_parse_arguments(ARG "" "" "COMPONENTS" ${ARGN})
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
set(suffix "64_${version}")
else()
set(suffix "32_${version}")
endif()
locate_shared_library(${VAR} "cudnn${suffix}")
set(${VAR} ${${VAR}} PARENT_SCOPE)
else()
message(FATAL_ERROR "Platform not supported")
endif()
endfunction()
<?xml version="1.0" encoding="UTF-8"?>
<?include "cpack_variables.wxi"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
RequiredVersion="3.6.3303.0">
<Product Id="$(var.CPACK_WIX_PRODUCT_GUID)"
Name="$(var.CPACK_PACKAGE_NAME)"
Language="1033"
Version="$(var.CPACK_PACKAGE_VERSION)"
Manufacturer="$(var.CPACK_PACKAGE_VENDOR)"
UpgradeCode="$(var.CPACK_WIX_UPGRADE_GUID)">
<Package InstallerVersion="301" Compressed="yes"/>
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes"/>
<MajorUpgrade
Schedule="afterInstallInitialize"
AllowDowngrades="yes"/>
<WixVariable Id="WixUILicenseRtf" Value="$(var.CPACK_WIX_LICENSE_RTF)"/>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALL_ROOT"/>
<?ifdef CPACK_WIX_PRODUCT_ICON?>
<Property Id="ARPPRODUCTICON">ProductIcon.ico</Property>
<Icon Id="ProductIcon.ico" SourceFile="$(var.CPACK_WIX_PRODUCT_ICON)"/>
<?endif?>
<?ifdef CPACK_WIX_UI_BANNER?>
<WixVariable Id="WixUIBannerBmp" Value="$(var.CPACK_WIX_UI_BANNER)"/>
<?endif?>
<?ifdef CPACK_WIX_UI_DIALOG?>
<WixVariable Id="WixUIDialogBmp" Value="$(var.CPACK_WIX_UI_DIALOG)"/>
<?endif?>
<DirectoryRef Id="TARGETDIR">
<Component Id="CMakeRegistry">
<RegistryKey Root="HKLM" Key="Software\FUBioroboticsLab\Robofish\BioTracker\Plugins">
<RegistryValue Type="string" Name="backgroundsubtracktion_tracker"
Value="[INSTALL_ROOT]" KeyPath="yes"/>
</RegistryKey>
</Component>
</DirectoryRef>
<FeatureRef Id="ProductFeature">
<ComponentRef Id="CMakeRegistry"/>
</FeatureRef>
<UIRef Id="$(var.CPACK_WIX_UI_REF)" />
<?include "properties.wxi"?>
<?include "product_fragment.wxi"?>
</Product>
</Wix>
\ No newline at end of file
This diff is collapsed.
......@@ -4,11 +4,8 @@
#include "Controller/ControllerTrackingAlgorithm.h"
#include "Controller/ControllerTrackedComponent.h"
#include "util/singleton.h"
#include "settings/Settings.h"
#include "View/TrackedElementView.h"
#include "TrackedComponents/TrackedComponentFactory.h"
#include "Utility/TrackedComponents/TrackedComponentFactory.h"
BioTrackerPlugin::BioTrackerPlugin() {
}
......@@ -114,21 +111,7 @@ void BioTrackerPlugin::receiveSwapIds(IModelTrackedTrajectory * trajectory0, IMo
}
void BioTrackerPlugin::sendCorePermissions() {
// get plugin settings
BioTracker::Core::Settings *pluginSettings = BioTracker::Util::TypedSingleton<BioTracker::Core::Settings>::getInstance(LUKASKANADE::CONFIGPARAM::CONFIG_INI_FILE);
// signal permissions
bool enableView = pluginSettings->getValueOrDefault(LUKASKANADE::GUIPARAM::ENABLE_CORE_COMPONENT_VIEW, true);
Q_EMIT emitCorePermission(std::pair<ENUMS::COREPERMISSIONS, bool>(ENUMS::COREPERMISSIONS::COMPONENTVIEW, enableView));
bool enableMove = pluginSettings->getValueOrDefault(LUKASKANADE::GUIPARAM::ENABLE_CORE_COMPONENT_MOVE, true);
Q_EMIT emitCorePermission(std::pair<ENUMS::COREPERMISSIONS, bool>(ENUMS::COREPERMISSIONS::COMPONENTMOVE, enableMove));
bool enableRemove = pluginSettings->getValueOrDefault(LUKASKANADE::GUIPARAM::ENABLE_CORE_COMPONENT_REMOVE, true);
Q_EMIT emitCorePermission(std::pair<ENUMS::COREPERMISSIONS, bool>(ENUMS::COREPERMISSIONS::COMPONENTREMOVE, enableRemove));
bool enableSwap = pluginSettings->getValueOrDefault(LUKASKANADE::GUIPARAM::ENABLE_CORE_COMPONENT_ID_SWAP, true);
Q_EMIT emitCorePermission(std::pair<ENUMS::COREPERMISSIONS, bool>(ENUMS::COREPERMISSIONS::COMPONENTSWAP, enableSwap));
bool enableAdd = pluginSettings->getValueOrDefault(LUKASKANADE::GUIPARAM::ENABLE_CORE_COMPONENT_ADD, true);
Q_EMIT emitCorePermission(std::pair<ENUMS::COREPERMISSIONS, bool>(ENUMS::COREPERMISSIONS::COMPONENTADD, enableAdd));
//bool enableRotate = pluginSettings->getValueOrDefault(LUKASKANADE::GUIPARAM::ENABLE_CORE_COMPONENT_ROTATE, false);
//Q_EMIT emitCorePermission(std::pair<ENUMS::COREPERMISSIONS, bool>(ENUMS::COREPERMISSIONS::COMPONENTROTATE, enableRotate));
//TODO put desired permissions here
}
#ifndef BIOTRACKERPLUGIN_H
#define BIOTRACKERPLUGIN_H
#include "biotrackerplugin_global.h"
#include "opencv2/core/core.hpp"
#include "Interfaces/IBioTrackerContext.h"
#include "Interfaces/IBioTrackerPlugin.h"
#include "TrackedComponents/TrackedComponentFactory.h"
#include "QPointer"
#include "memory"
#include "QPoint"
class BIOTRACKERPLUGINSHARED_EXPORT BioTrackerPlugin : public IBioTrackerPlugin {
class Q_DECL_EXPORT BioTrackerPlugin : public IBioTrackerPlugin {
Q_OBJECT
Q_PLUGIN_METADATA(IID "de.fu-berlin.mi.biorobotics.BioTrackerPlugin" FILE "BioTrackerPlugin.json")
Q_INTERFACES(IBioTrackerPlugin)
Q_PLUGIN_METADATA(IID IBioTrackerPlugin_iid FILE "plugin.json")
Q_INTERFACES(IBioTrackerPlugin)
public:
......
##############################################################
#### Biotracker: Sampletracker
##############################################################
include(biotracker-utility/VSSugar)
VSSourceGroups(${CMAKE_CURRENT_LIST_DIR})
include(biotracker-utility/TrackerPlugin)
set(target biotracker-sample.bio_tracker)
add_behavior_plugin(${target}
"PluginContext.cpp"
"BioTrackerPlugin.cpp"
"View/TrackedElementView.cpp"
"View/TrackerParameterView.cpp"
"Model/null_Model.cpp"
"Model/BioTrackerTrackingAlgorithm.cpp"
"Model/TrackerParameter.cpp"
"Controller/ControllerTrackedComponent.cpp"
"Controller/ControllerTrackingAlgorithm.cpp"
"Controller/null_Controller.cpp"
)
install(TARGETS ${target} OPTIONAL DESTINATION .)
\ No newline at end of file
#include "ControllerTrackedComponent.h"
#include "TrackedComponents/TrackedElement.h"
#include "TrackedComponents/TrackedTrajectory.h"
#include "View/TrackedElementView.h"
#include "Utility/TrackedComponents/TrackedElement.h"
#include "Utility/TrackedComponents/TrackedTrajectory.h"
#include "../View/TrackedElementView.h"
#include "qdebug.h"
#include "qmath.h"
......
#include "ControllerTrackingAlgorithm.h"
#include "ControllerTrackedComponent.h"
#include "Model/TrackerParameter.h"
#include "View/TrackerParameterView.h"
#include "View/TrackedElementView.h"
#include "../Model/TrackerParameter.h"
#include "../View/TrackerParameterView.h"
#include "../View/TrackedElementView.h"
ControllerTrackingAlgorithm::ControllerTrackingAlgorithm(QObject *parent, IBioTrackerContext *context, ENUMS::CONTROLLERTYPE ctr) :
IController(parent, context, ctr)
......
......@@ -2,7 +2,7 @@
#define CONTROLLERTRACKINGALGORITHM_H
#include "Interfaces/IController/IController.h"
#include "Model/BioTrackerTrackingAlgorithm.h"
#include "../Model/BioTrackerTrackingAlgorithm.h"
#include "Interfaces/IBioTrackerContext.h"
#include "Interfaces/IModel/IModelDataExporter.h"
......
#include "BioTrackerTrackingAlgorithm.h"
#include "Utility/TrackedComponents/TrackedComponentFactory.h"
#include <future>
#include "TrackedComponents/TrackedComponentFactory.h"
#include <chrono>
#include "settings/Settings.h"
BioTrackerTrackingAlgorithm::BioTrackerTrackingAlgorithm(IModel *parameter, IModel *trajectory)
{
_TrackingParameter = (TrackerParameter*)parameter;
......
......@@ -9,8 +9,8 @@
#include <opencv2/opencv.hpp>
#include "Interfaces/IModel/IModelTrackingAlgorithm.h"
#include "Interfaces/IModel/IModelDataExporter.h"
#include "TrackedComponents/TrackedElement.h"
#include "TrackedComponents/TrackedTrajectory.h"
#include "Utility/TrackedComponents/TrackedElement.h"
#include "Utility/TrackedComponents/TrackedTrajectory.h"
#include "Interfaces/IModel/IModelAreaDescriptor.h"
#include <iostream>
......
#pragma once
#include <iostream>
#include <vector>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment