diff --git a/BioTrackerQt/Plugin/BioTrackerTrackingPlugin/BioTrackerTrackingPlugin.cpp b/BioTrackerQt/Plugin/BioTrackerTrackingPlugin/BioTrackerTrackingPlugin.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a4866cee56da6b8250a6a90e2a768be5cd211914 --- /dev/null +++ b/BioTrackerQt/Plugin/BioTrackerTrackingPlugin/BioTrackerTrackingPlugin.cpp @@ -0,0 +1,6 @@ +#include "BioTrackerTrackingPlugin.h" + + +BioTrackerTrackingPlugin::BioTrackerTrackingPlugin() +{ +} diff --git a/BioTrackerQt/Plugin/BioTrackerTrackingPlugin/BioTrackerTrackingPlugin.h b/BioTrackerQt/Plugin/BioTrackerTrackingPlugin/BioTrackerTrackingPlugin.h new file mode 100644 index 0000000000000000000000000000000000000000..03f2b87ff79029f71e12a0e8a4b01e37933add6a --- /dev/null +++ b/BioTrackerQt/Plugin/BioTrackerTrackingPlugin/BioTrackerTrackingPlugin.h @@ -0,0 +1,13 @@ +#ifndef BIOTRACKERTRACKINGPLUGIN_H +#define BIOTRACKERTRACKINGPLUGIN_H + +#include "biotrackertrackingplugin_global.h" + +class BIOTRACKERTRACKINGPLUGINSHARED_EXPORT BioTrackerTrackingPlugin +{ + +public: + BioTrackerTrackingPlugin(); +}; + +#endif // BIOTRACKERTRACKINGPLUGIN_H diff --git a/BioTrackerQt/Plugin/BioTrackerTrackingPlugin/BioTrackerTrackingPlugin.pro b/BioTrackerQt/Plugin/BioTrackerTrackingPlugin/BioTrackerTrackingPlugin.pro new file mode 100644 index 0000000000000000000000000000000000000000..0613eba25143da1b41b2a3158c5b6e86a76a365b --- /dev/null +++ b/BioTrackerQt/Plugin/BioTrackerTrackingPlugin/BioTrackerTrackingPlugin.pro @@ -0,0 +1,22 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2016-11-20T10:58:44 +# +#------------------------------------------------- + +QT += widgets + +TARGET = BioTrackerTrackingPlugin +TEMPLATE = lib + +DEFINES += BIOTRACKERTRACKINGPLUGIN_LIBRARY + +SOURCES += BioTrackerTrackingPlugin.cpp + +HEADERS += BioTrackerTrackingPlugin.h\ + biotrackertrackingplugin_global.h + +unix { + target.path = /usr/lib + INSTALLS += target +} diff --git a/BioTrackerQt/Plugin/BioTrackerTrackingPlugin/BioTrackerTrackingPlugin.pro.user b/BioTrackerQt/Plugin/BioTrackerTrackingPlugin/BioTrackerTrackingPlugin.pro.user new file mode 100644 index 0000000000000000000000000000000000000000..6c725173efe79eb7cd764b6871854b7bd630af90 --- /dev/null +++ b/BioTrackerQt/Plugin/BioTrackerTrackingPlugin/BioTrackerTrackingPlugin.pro.user @@ -0,0 +1,331 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE QtCreatorProject> +<!-- Written by QtCreator 3.6.1, 2016-11-20T21:39:45. --> +<qtcreator> + <data> + <variable>EnvironmentId</variable> + <value type="QByteArray">{0df10d7c-aabc-453e-9209-7a62b8a64353}</value> + </data> + <data> + <variable>ProjectExplorer.Project.ActiveTarget</variable> + <value type="int">0</value> + </data> + <data> + <variable>ProjectExplorer.Project.EditorSettings</variable> + <valuemap type="QVariantMap"> + <value type="bool" key="EditorConfiguration.AutoIndent">true</value> + <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value> + <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value> + <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0"> + <value type="QString" key="language">Cpp</value> + <valuemap type="QVariantMap" key="value"> + <value type="QByteArray" key="CurrentPreferences">CppGlobal</value> + </valuemap> + </valuemap> + <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1"> + <value type="QString" key="language">QmlJS</value> + <valuemap type="QVariantMap" key="value"> + <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value> + </valuemap> + </valuemap> + <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value> + <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value> + <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value> + <value type="int" key="EditorConfiguration.IndentSize">4</value> + <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value> + <value type="int" key="EditorConfiguration.MarginColumn">80</value> + <value type="bool" key="EditorConfiguration.MouseHiding">true</value> + <value type="bool" key="EditorConfiguration.MouseNavigation">true</value> + <value type="int" key="EditorConfiguration.PaddingMode">1</value> + <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value> + <value type="bool" key="EditorConfiguration.ShowMargin">false</value> + <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value> + <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value> + <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value> + <value type="int" key="EditorConfiguration.TabSize">8</value> + <value type="bool" key="EditorConfiguration.UseGlobal">true</value> + <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value> + <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value> + <value type="bool" key="EditorConfiguration.cleanIndentation">true</value> + <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value> + <value type="bool" key="EditorConfiguration.inEntireDocument">false</value> + </valuemap> + </data> + <data> + <variable>ProjectExplorer.Project.PluginSettings</variable> + <valuemap type="QVariantMap"/> + </data> + <data> + <variable>ProjectExplorer.Project.Target.0</variable> + <valuemap type="QVariantMap"> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">BioTracker</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">BioTracker</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{02fcf811-35b5-4d2d-93ff-1e8b4e15360d}</value> + <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> + <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> + <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> + <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/andreas/Desktop/BioTrackerQt/Plugin/build-BioTrackerTrackingPlugin-BioTracker-Debug</value> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value> + <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value> + </valuemap> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> + <value type="QString">-w</value> + <value type="QString">-r</value> + </valuelist> + <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> + </valuemap> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> + <value type="QString">-w</value> + <value type="QString">-r</value> + </valuelist> + <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> + <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> + <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> + <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value> + <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> + </valuemap> + <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1"> + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/andreas/Desktop/BioTrackerQt/Plugin/build-BioTrackerTrackingPlugin-BioTracker-Release</value> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> + <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value> + </valuemap> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> + <value type="QString">-w</value> + <value type="QString">-r</value> + </valuelist> + <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> + </valuemap> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> + <value type="QString">-w</value> + <value type="QString">-r</value> + </valuelist> + <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> + <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> + <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> + <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> + <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> + </valuemap> + <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2"> + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/andreas/Desktop/BioTrackerQt/Plugin/build-BioTrackerTrackingPlugin-BioTracker-Profile</value> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value> + <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">true</value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value> + </valuemap> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> + <value type="QString">-w</value> + <value type="QString">-r</value> + </valuelist> + <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> + </valuemap> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> + <value type="QString">-w</value> + <value type="QString">-r</value> + </valuelist> + <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> + <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> + <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Profile</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> + <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> + <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> + </valuemap> + <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value> + <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> + </valuemap> + <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> + <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> + <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> + <value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value> + <value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value> + <value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value> + <value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value> + <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> + <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> + <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> + <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> + <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> + <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> + <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> + <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> + <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> + <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> + <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> + <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> + <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> + <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> + <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> + <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> + <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> + <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> + <value type="int">0</value> + <value type="int">1</value> + <value type="int">2</value> + <value type="int">3</value> + <value type="int">4</value> + <value type="int">5</value> + <value type="int">6</value> + <value type="int">7</value> + <value type="int">8</value> + <value type="int">9</value> + <value type="int">10</value> + <value type="int">11</value> + <value type="int">12</value> + <value type="int">13</value> + <value type="int">14</value> + </valuelist> + <value type="int" key="PE.EnvironmentAspect.Base">2</value> + <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> + <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value> + <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable"></value> + <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">%{buildDir}</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Custom Executable</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value> + <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> + <value type="bool" key="RunConfiguration.UseCppDebugger">false</value> + <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value> + <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> + <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> + <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> + </valuemap> + <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> + </valuemap> + </data> + <data> + <variable>ProjectExplorer.Project.TargetCount</variable> + <value type="int">1</value> + </data> + <data> + <variable>ProjectExplorer.Project.Updater.FileVersion</variable> + <value type="int">18</value> + </data> + <data> + <variable>Version</variable> + <value type="int">18</value> + </data> +</qtcreator> diff --git a/BioTrackerQt/Plugin/BioTrackerTrackingPlugin/biotrackertrackingplugin_global.h b/BioTrackerQt/Plugin/BioTrackerTrackingPlugin/biotrackertrackingplugin_global.h new file mode 100644 index 0000000000000000000000000000000000000000..dc2bd12ba10d4f6a307300458d67095469a49555 --- /dev/null +++ b/BioTrackerQt/Plugin/BioTrackerTrackingPlugin/biotrackertrackingplugin_global.h @@ -0,0 +1,12 @@ +#ifndef BIOTRACKERTRACKINGPLUGIN_GLOBAL_H +#define BIOTRACKERTRACKINGPLUGIN_GLOBAL_H + +#include <QtCore/qglobal.h> + +#if defined(BIOTRACKERTRACKINGPLUGIN_LIBRARY) +# define BIOTRACKERTRACKINGPLUGINSHARED_EXPORT Q_DECL_EXPORT +#else +# define BIOTRACKERTRACKINGPLUGINSHARED_EXPORT Q_DECL_IMPORT +#endif + +#endif // BIOTRACKERTRACKINGPLUGIN_GLOBAL_H diff --git a/BioTrackerQt/Source/BioTrackerQt/BioTracker3App.cpp b/BioTrackerQt/Source/BioTrackerQt/BioTracker3App.cpp new file mode 100644 index 0000000000000000000000000000000000000000..852751beafc34bffb1143c7160c4c71a4cb1fd55 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/BioTracker3App.cpp @@ -0,0 +1,21 @@ +#include "BioTracker3App.h" + +BioTracker3App::BioTracker3App(QObject *parent) : QObject(parent) +{ + +} + +void BioTracker3App::runBioTracker() +{ + m_BioTrackerContext->createApplication(); +} + +void BioTracker3App::setBioTrackerContext(IBioTrackerContext *context) +{ + m_BioTrackerContext = context; +} + +IBioTrackerContext *BioTracker3App::getBioTrackerContext() +{ + return m_BioTrackerContext; +} diff --git a/BioTrackerQt/Source/BioTrackerQt/BioTracker3App.h b/BioTrackerQt/Source/BioTrackerQt/BioTracker3App.h new file mode 100644 index 0000000000000000000000000000000000000000..5156c84f05cfc898bb0a6a6e61ca464f7d8d65d9 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/BioTracker3App.h @@ -0,0 +1,28 @@ +#ifndef BIOTRACKER3APP_H +#define BIOTRACKER3APP_H + +#include <QObject> +#include "QString" +#include "Interfaces/IBioTrackerContext.h" +#include "QPointer" + +class BioTracker3App : public QObject +{ + Q_OBJECT +public: + explicit BioTracker3App(QObject *parent = 0); + + void runBioTracker(); + void setBioTrackerContext(IBioTrackerContext *context); + IBioTrackerContext *getBioTrackerContext(); + +Q_SIGNALS: + +public Q_SLOTS: + +private: + QPointer< IBioTrackerContext > m_BioTrackerContext; + +}; + +#endif // BIOTRACKER3APP_H diff --git a/BioTrackerQt/Source/BioTrackerQt/BioTrackerQt.pro b/BioTrackerQt/Source/BioTrackerQt/BioTrackerQt.pro new file mode 100644 index 0000000000000000000000000000000000000000..e6db67512a7455a3a63209346e2e57f7f8c97fb0 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/BioTrackerQt.pro @@ -0,0 +1,183 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2016-11-18T19:15:02 +# +#------------------------------------------------- + +QT += core gui + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets +QT += opengl +QT += multimedia +QT += multimediawidgets + + +TARGET = BioTrackerQt +TEMPLATE = app + +LIBS += -L/usr/include/boost -lboost_system +LIBS += -L/usr/include/boost -lboost_chrono +LIBS += -L/usr/include/boost -lboost_thread +LIBS += -L/usr/include/boost -lboost_timer +LIBS += -L/usr/include/boost -lboost_filesystem + +INCLUDEPATH += /usr/local/include/opencv +LIBS += -L/usr/local/lib \ +-lopencv_core \ +-lopencv_imgproc \ +-lopencv_highgui \ +-lopencv_ml \ +-lopencv_video \ +-lopencv_features2d \ +-lopencv_calib3d \ +-lopencv_objdetect \ +-lopencv_contrib \ +-lopencv_legacy \ +-lopencv_flann + + +SOURCES += main.cpp\ + BioTracker3App.cpp \ + Interfaces/IBioTrackerContext.cpp \ + GuiContext.cpp \ + Controller/ControllerContext.cpp \ + Controller/ControllerGraphicScene.cpp \ + Controller/ControllerMainWindow.cpp \ + Controller/ControllerPlayer.cpp \ + Controller/ControllerTextureObject.cpp \ + Controller/ControllerTrackedComponent.cpp \ + Controller/ControllerTrackingAlgorithm.cpp \ + Interfaces/IController/icontroller.cpp \ + Interfaces/IController/IControllerStrategy.cpp \ + Interfaces/IModel/imodel.cpp \ + Interfaces/IModel/IObject.cpp \ + Interfaces/IModel/ITrackedComponent.cpp \ + Interfaces/IModel/ITrackedComponentFactory.cpp \ + Interfaces/IModel/ITrackedTrajectory.cpp \ + Interfaces/IModel/ITrackingAlgorithm.cpp \ + Interfaces/IStates/IPlayerState.cpp \ + Interfaces/IView/IGraphicsPixmapItem.cpp \ + Interfaces/IView/IGraphicsView.cpp \ + Interfaces/IView/IView.cpp \ + Interfaces/IView/IViewGraphicsScene.cpp \ + Interfaces/IView/IViewMainWindow.cpp \ + Interfaces/IView/IViewOpenGLWidget.cpp \ + Interfaces/IView/IViewTrackedComponent.cpp \ + Interfaces/IView/IViewWidget.cpp \ + Model/PlayerStates/PStateInitial.cpp \ + Model/PlayerStates/PStateInitialStream.cpp \ + Model/PlayerStates/PStatePause.cpp \ + Model/PlayerStates/PStatePlay.cpp \ + Model/PlayerStates/PStateStepBack.cpp \ + Model/PlayerStates/PStateStepForw.cpp \ + Model/PlayerStates/PStateWait.cpp \ + Model/TrackedComponents/TrackedComponentFactory.cpp \ + Model/TrackedComponents/TrackedElement.cpp \ + Model/TrackedComponents/TrackedTrajectory.cpp \ + Model/BioTracker3ImageStream.cpp \ + Model/BioTracker3Player.cpp \ + Model/BioTracker3ProxyMat.cpp \ + Model/BioTracker3TextureObject.cpp \ + Model/BioTrackerTrackingAlgorithm.cpp \ + Model/null_Model.cpp \ + View/BioTracker3MainWindow.cpp \ + View/BioTracker3VideoControllWidget.cpp \ + View/BioTracker3VideoView.cpp \ + View/GraphicsScene.cpp \ + View/GraphicsView.cpp \ + View/TextureObjectView.cpp \ + View/TrackedElementView.cpp \ + View/TrackedImageView.cpp \ + src/settings/Settings.cpp \ + src/settings/StringTranslator.cpp \ + src/settings/SystemCompatibilityCheck.cpp \ + src/util/imagePreProcessor/ImagePreProcessor.cpp \ + src/util/CvHelper.cpp \ + src/util/stringTools.cpp \ + Model/PluginLoader.cpp \ + View/CameraDeviceSelect.cpp \ + View/CameraDevice.cpp \ + Controller/null_Controller.cpp + +HEADERS += BioTracker3App.h \ + Interfaces/IBioTrackerContext.h \ + GuiContext.h \ + Controller/ControllerContext.h \ + Controller/ControllerGraphicScene.h \ + Controller/ControllerMainWindow.h \ + Controller/ControllerPlayer.h \ + Controller/ControllerTextureObject.h \ + Controller/ControllerTrackedComponent.h \ + Controller/ControllerTrackingAlgorithm.h \ + Interfaces/IController/icontroller.h \ + Interfaces/IController/IControllerStrategy.h \ + Interfaces/IModel/imodel.h \ + Interfaces/IModel/IObject.h \ + Interfaces/IModel/ITrackedComponent.h \ + Interfaces/IModel/ITrackedComponentFactory.h \ + Interfaces/IModel/ITrackedTrajectory.h \ + Interfaces/IModel/ITrackingAlgorithm.h \ + Interfaces/IStates/IPlayerState.h \ + Interfaces/IView/IGraphicsPixmapItem.h \ + Interfaces/IView/IGraphicsView.h \ + Interfaces/IView/IView.h \ + Interfaces/IView/IViewGraphicsScene.h \ + Interfaces/IView/IViewMainWindow.h \ + Interfaces/IView/IViewOpenGLWidget.h \ + Interfaces/IView/IViewTrackedComponent.h \ + Interfaces/IView/IViewWidget.h \ + Interfaces/ENUMS.h \ + Model/PlayerStates/PStateInitial.h \ + Model/PlayerStates/PStateInitialStream.h \ + Model/PlayerStates/PStatePause.h \ + Model/PlayerStates/PStatePlay.h \ + Model/PlayerStates/PStateStepBack.h \ + Model/PlayerStates/PStateStepForw.h \ + Model/PlayerStates/PStateWait.h \ + Model/TrackedComponents/TrackedComponentFactory.h \ + Model/TrackedComponents/TrackedElement.h \ + Model/TrackedComponents/TrackedTrajectory.h \ + Model/BioTracker3ImageStream.h \ + Model/BioTracker3Player.h \ + Model/BioTracker3ProxyMat.h \ + Model/BioTracker3TextureObject.h \ + Model/BioTrackerTrackingAlgorithm.h \ + Model/null_Model.h \ + View/BioTracker3MainWindow.h \ + View/BioTracker3VideoControllWidget.h \ + View/BioTracker3VideoView.h \ + View/GraphicsScene.h \ + View/GraphicsView.h \ + View/TextureObjectView.h \ + View/TrackedElementView.h \ + View/TrackedImageView.h \ + settings/Messages.h \ + settings/ParamNames.h \ + settings/Settings.h \ + settings/StringTranslator.h \ + settings/SystemCompatibilityCheck.h \ + util/imagePreProcessor/IImageProcessor.h \ + util/imagePreProcessor/ImagePreProcessor.h \ + util/CvHelper.h \ + util/MutexWrapper.h \ + util/platform.h \ + util/QtRaiiWrapper.hpp \ + util/ScreenHelper.h \ + util/singleton.h \ + util/stdext.h \ + util/stringTools.h \ + Exceptions.h \ + PanZoomState.h \ + Model/PluginLoader.h \ + View/CameraDeviceSelect.h \ + View/CameraDevice.h \ + Controller/null_Controller.h + +FORMS += View/BioTracker3MainWindow.ui \ + View/BioTracker3VideoControllWidget.ui \ + View/CameraDeviceSelect.ui \ + View/CameraDevice.ui + +RESOURCES += \ + guiresources.qrc + diff --git a/BioTrackerQt/Source/BioTrackerQt/BioTrackerQt.pro.user b/BioTrackerQt/Source/BioTrackerQt/BioTrackerQt.pro.user new file mode 100644 index 0000000000000000000000000000000000000000..9843986f84424d590c0874d1cba89e2878e3dd86 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/BioTrackerQt.pro.user @@ -0,0 +1,334 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE QtCreatorProject> +<!-- Written by QtCreator 3.6.1, 2016-11-21T15:54:56. --> +<qtcreator> + <data> + <variable>EnvironmentId</variable> + <value type="QByteArray">{0df10d7c-aabc-453e-9209-7a62b8a64353}</value> + </data> + <data> + <variable>ProjectExplorer.Project.ActiveTarget</variable> + <value type="int">0</value> + </data> + <data> + <variable>ProjectExplorer.Project.EditorSettings</variable> + <valuemap type="QVariantMap"> + <value type="bool" key="EditorConfiguration.AutoIndent">true</value> + <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value> + <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value> + <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0"> + <value type="QString" key="language">Cpp</value> + <valuemap type="QVariantMap" key="value"> + <value type="QByteArray" key="CurrentPreferences">CppGlobal</value> + </valuemap> + </valuemap> + <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1"> + <value type="QString" key="language">QmlJS</value> + <valuemap type="QVariantMap" key="value"> + <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value> + </valuemap> + </valuemap> + <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value> + <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value> + <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value> + <value type="int" key="EditorConfiguration.IndentSize">4</value> + <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value> + <value type="int" key="EditorConfiguration.MarginColumn">80</value> + <value type="bool" key="EditorConfiguration.MouseHiding">true</value> + <value type="bool" key="EditorConfiguration.MouseNavigation">true</value> + <value type="int" key="EditorConfiguration.PaddingMode">1</value> + <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value> + <value type="bool" key="EditorConfiguration.ShowMargin">false</value> + <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value> + <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value> + <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value> + <value type="int" key="EditorConfiguration.TabSize">8</value> + <value type="bool" key="EditorConfiguration.UseGlobal">true</value> + <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value> + <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value> + <value type="bool" key="EditorConfiguration.cleanIndentation">true</value> + <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value> + <value type="bool" key="EditorConfiguration.inEntireDocument">false</value> + </valuemap> + </data> + <data> + <variable>ProjectExplorer.Project.PluginSettings</variable> + <valuemap type="QVariantMap"/> + </data> + <data> + <variable>ProjectExplorer.Project.Target.0</variable> + <valuemap type="QVariantMap"> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">BioTracker</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">BioTracker</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{02fcf811-35b5-4d2d-93ff-1e8b4e15360d}</value> + <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> + <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> + <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> + <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/andreas/Documents</value> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value> + <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value> + </valuemap> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> + <value type="QString">-w</value> + <value type="QString">-r</value> + </valuelist> + <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> + </valuemap> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> + <value type="QString">-w</value> + <value type="QString">-r</value> + </valuelist> + <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> + <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> + <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> + <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value> + <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> + </valuemap> + <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1"> + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/andreas/Desktop/BioTrackerQt/Source/build-BioTrackerQt-BioTracker-Release</value> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> + <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value> + </valuemap> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> + <value type="QString">-w</value> + <value type="QString">-r</value> + </valuelist> + <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> + </valuemap> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> + <value type="QString">-w</value> + <value type="QString">-r</value> + </valuelist> + <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> + <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> + <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> + <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> + <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> + </valuemap> + <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2"> + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/andreas/Desktop/BioTrackerQt/Source/build-BioTrackerQt-BioTracker-Profile</value> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value> + <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">true</value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value> + </valuemap> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> + <value type="QString">-w</value> + <value type="QString">-r</value> + </valuelist> + <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> + </valuemap> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> + <value type="QString">-w</value> + <value type="QString">-r</value> + </valuelist> + <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> + <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> + <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Profile</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> + <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> + <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> + </valuemap> + <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value> + <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> + </valuemap> + <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> + <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> + <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> + <value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value> + <value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value> + <value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value> + <value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value> + <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> + <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> + <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> + <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> + <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> + <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> + <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> + <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> + <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> + <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> + <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> + <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> + <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> + <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> + <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> + <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> + <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> + <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> + <value type="int">0</value> + <value type="int">1</value> + <value type="int">2</value> + <value type="int">3</value> + <value type="int">4</value> + <value type="int">5</value> + <value type="int">6</value> + <value type="int">7</value> + <value type="int">8</value> + <value type="int">9</value> + <value type="int">10</value> + <value type="int">11</value> + <value type="int">12</value> + <value type="int">13</value> + <value type="int">14</value> + </valuelist> + <value type="int" key="PE.EnvironmentAspect.Base">2</value> + <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">BioTrackerQt</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">BioTrackerQt2</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/andreas/Documents/biotracker_core/BioTrackerQt/Source/BioTrackerQt/BioTrackerQt.pro</value> + <value type="bool" key="QmakeProjectManager.QmakeRunConfiguration.UseLibrarySearchPath">true</value> + <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> + <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">BioTrackerQt.pro</value> + <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> + <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">false</value> + <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> + <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> + <value type="bool" key="RunConfiguration.UseCppDebugger">false</value> + <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value> + <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> + <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> + <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> + </valuemap> + <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> + </valuemap> + </data> + <data> + <variable>ProjectExplorer.Project.TargetCount</variable> + <value type="int">1</value> + </data> + <data> + <variable>ProjectExplorer.Project.Updater.FileVersion</variable> + <value type="int">18</value> + </data> + <data> + <variable>Version</variable> + <value type="int">18</value> + </data> +</qtcreator> diff --git a/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerContext.cpp b/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerContext.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e9a3e19a45a118b45d05467de6ac1a493287831e --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerContext.cpp @@ -0,0 +1,22 @@ +#include "ControllerContext.h" +#include "null_Controller.h" + +ControllerContext::ControllerContext() +{ + m_Controller = new null_Controller(); +} + +void ControllerContext::executeBioTarckerController() +{ + m_Controller->createComponents(); +} + +void ControllerContext::setBioTrackerController(IController *controller) +{ + m_Controller = controller; +} + +IController *ControllerContext::getBioTrackerController() +{ + return m_Controller.data(); +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerContext.h b/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerContext.h new file mode 100644 index 0000000000000000000000000000000000000000..9b3ca34cc4677311241b606a40cd90177c1f0421 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerContext.h @@ -0,0 +1,24 @@ +#ifndef CONTROLLERCONTEXT_H +#define CONTROLLERCONTEXT_H + +#include <QObject> + +#include "Interfaces/IController/icontroller.h" +#include "QPointer" + + +class ControllerContext +{ +public: + ControllerContext(); + + void executeBioTarckerController(); + + void setBioTrackerController(IController *controller); + IController *getBioTrackerController(); + +private: + QPointer<IController> m_Controller; +}; + +#endif // CONTROLLERCONTEXT_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerGraphicScene.cpp b/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerGraphicScene.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fa8335a94a0c4de762f62855a69a464a5d149a94 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerGraphicScene.cpp @@ -0,0 +1,48 @@ +#include "ControllerGraphicScene.h" +#include "Model/TrackedComponents/TrackedElement.h" +#include "View/GraphicsView.h" +#include "Model/null_Model.h" + +ControllerGraphicScene::ControllerGraphicScene(QObject *parent, IBioTrackerContext *context, ENUMS::CONTROLLERTYPE ctr) : + IController(parent, context, ctr) +{ + +} + +void ControllerGraphicScene::addGraphicsItem(QGraphicsItem *item) +{ + GraphicsView *gview = dynamic_cast <GraphicsView *> (m_View); + gview->addGraphicsItem(item); +} + +void ControllerGraphicScene::addTextureObject(QGraphicsItem *item) +{ + GraphicsView *gview = dynamic_cast <GraphicsView *> (m_View); + gview->addPixmapItem(item); +} + +void ControllerGraphicScene::createModel() +{ + m_Element = new TrackedElement(this, QString("myElement")); + m_NullModel = new null_Model(); +} + +void ControllerGraphicScene::createView() +{ + m_View = new GraphicsView(0, this, m_NullModel); + m_ElementView = new TrackedElementView(0, this, m_Element); + + addGraphicsItem(m_ElementView); +} + +void ControllerGraphicScene::connectModelController() +{ + +} + +void ControllerGraphicScene::connectController() +{ + QPointer< IController > ctrM = m_BioTrackerContext->requestController(ENUMS::CONTROLLERTYPE::MAINWINDOW); + QPointer< BioTracker3MainWindow > mainWin = dynamic_cast<BioTracker3MainWindow *>(ctrM->getView()); + mainWin->addVideoView(m_View); +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerGraphicScene.h b/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerGraphicScene.h new file mode 100644 index 0000000000000000000000000000000000000000..b399b9c203cad28f598157d40f7e21efce18ad17 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerGraphicScene.h @@ -0,0 +1,34 @@ +#ifndef CONTROLLERGRAPHICSCENE_H +#define CONTROLLERGRAPHICSCENE_H + +#include "Interfaces/IController/icontroller.h" +#include "QGraphicsObject" +#include "View/TrackedElementView.h" +#include "QPointer" + + +class ControllerGraphicScene : public IController +{ + Q_OBJECT +public: + ControllerGraphicScene(QObject *parent = 0, IBioTrackerContext *context = 0, ENUMS::CONTROLLERTYPE ctr = ENUMS::CONTROLLERTYPE::NO_CTR); + + void addGraphicsItem(QGraphicsItem *item); + void addTextureObject(QGraphicsItem *item); + + // IController interface +protected: + void createModel() override; + void createView() override; + void connectModelController() override; + void connectController() override; + +private: + QPointer< TrackedElementView > m_ElementView; + IView *m_GraphicsView; + + QPointer< IModel > m_Element; + QPointer< IModel > m_NullModel; +}; + +#endif // CONTROLLERGRAPHICSCENE_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerMainWindow.cpp b/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerMainWindow.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3d88d50afb0b3edd02775ecd50000138436066ce --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerMainWindow.cpp @@ -0,0 +1,52 @@ +#include "ControllerMainWindow.h" +#include "View/BioTracker3MainWindow.h" +#include "Model/null_Model.h" +//#include "Controller/ControllerStrategies/MainGUIApplication.h" +#include "Controller/ControllerPlayer.h" + + +ControllerMainWindow::ControllerMainWindow(QObject *parent, IBioTrackerContext *context, ENUMS::CONTROLLERTYPE ctr) : + IController(parent, context, ctr) +{ + +} + +void ControllerMainWindow::loadVideo(QString str) +{ + QPointer< IController > ctr = m_BioTrackerContext->requestController(ENUMS::CONTROLLERTYPE::PLAYER); + qobject_cast<ControllerPlayer *>(ctr)->loadVideoStream(str); +} + +void ControllerMainWindow::loadTracker(QString str) +{ + +} + +void ControllerMainWindow::loadPictures(std::vector<boost::filesystem::path> files) +{ + +} + +void ControllerMainWindow::createModel() +{ + // no model for MainWindow + m_Model = new null_Model(); +} + +void ControllerMainWindow::createView() +{ + m_View = dynamic_cast<IView *> (new BioTracker3MainWindow(0, this, m_Model)); + + + static_cast<BioTracker3MainWindow *>(m_View)->show(); +} + +void ControllerMainWindow::connectModelController() +{ + +} + +void ControllerMainWindow::connectController() +{ + +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerMainWindow.h b/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerMainWindow.h new file mode 100644 index 0000000000000000000000000000000000000000..d7129644f35236d71b3bd49279b7870a36f80b6e --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerMainWindow.h @@ -0,0 +1,26 @@ +#ifndef CONTROLLERMAINWINDOW_H +#define CONTROLLERMAINWINDOW_H + +#include "Interfaces/IController/icontroller.h" +#include "QPointer" + +class ControllerMainWindow : public IController +{ + Q_OBJECT +public: + ControllerMainWindow(QObject *parent = 0, IBioTrackerContext *context = 0, ENUMS::CONTROLLERTYPE ctr = ENUMS::CONTROLLERTYPE::NO_CTR); + + void loadVideo(QString str); + void loadTracker(QString str); + void loadPictures(std::vector<boost::filesystem::path> files); + + + // IController interface +protected: + void createModel() override; + void createView() override; + void connectModelController() override; + void connectController() override; +}; + +#endif // CONTROLLERMAINWINDOW_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerPlayer.cpp b/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerPlayer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9b0b6f9a6913ccee46f40c6a3f3f450a27d075e5 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerPlayer.cpp @@ -0,0 +1,127 @@ +#include "ControllerPlayer.h" +#include "View/BioTracker3VideoControllWidget.h" +#include "View/BioTracker3MainWindow.h" +#include "Controller/ControllerTextureObject.h" + +ControllerPlayer::ControllerPlayer(QObject *parent, IBioTrackerContext *context, ENUMS::CONTROLLERTYPE ctr) : + IController(parent, context, ctr) +{ + m_PlayerThread = new QThread(this); +} + +void ControllerPlayer::loadVideoStream(QString str) { + // Save the path to the video file in Settings + //m_Settings.setParam(CaptureParam::CAP_VIDEO_FILE, boost::filesystem::path(str.toStdString())); + + Q_EMIT emitLoadVideoStream(str); +} + +void ControllerPlayer::loadPictures(std::vector<boost::filesystem::path> files) +{ + Q_EMIT emitLoadPictures(files); +} + +void ControllerPlayer::nextFrame() { + Q_EMIT emitNextFrameCommand(); +} + +void ControllerPlayer::prevFrame() { + Q_EMIT emitPrevFrameCommand(); +} + +void ControllerPlayer::play() { + Q_EMIT emitPlayCommand(); +} + +void ControllerPlayer::stop() { + Q_EMIT emitStopCommand(); +} + +void ControllerPlayer::pause() { + Q_EMIT emitPauseCommand(); +} + +void ControllerPlayer::changeImageView(QString str) +{ + QPointer< IController > ctr = m_BioTrackerContext->requestController(ENUMS::CONTROLLERTYPE::TEXTUREOBJECT); + QPointer< ControllerTextureObject > ctrTextureObject = qobject_cast<ControllerTextureObject *>(ctr); + + ctrTextureObject->changeTextureModel(str); +} + +void ControllerPlayer::connectController() +{ + QPointer< IController > ctrM = m_BioTrackerContext->requestController(ENUMS::CONTROLLERTYPE::MAINWINDOW); + QPointer< BioTracker3MainWindow > mainWin = dynamic_cast<BioTracker3MainWindow *>(ctrM->getView()); + mainWin->addVideoControllWidget(m_View); +} + +void ControllerPlayer::createModel() +{ + m_Model = new BioTracker3Player( this ); + m_Model->moveToThread(m_PlayerThread); + m_PlayerThread->start(); +} + +void ControllerPlayer::createView() +{ + QPointer< IController > ctr = m_BioTrackerContext->requestController(ENUMS::CONTROLLERTYPE::MAINWINDOW); + QPointer< BioTracker3MainWindow > mainWindow = dynamic_cast<BioTracker3MainWindow *>(ctr->getView()); + + m_View = new BioTracker3VideoControllWidget(mainWindow, this, m_Model); +} + +void ControllerPlayer::connectModelController() +{ + QPointer< BioTracker3Player > player = qobject_cast<BioTracker3Player *>(m_Model); + + QObject::connect(player, &BioTracker3Player::emitPlayerOperationDone, this, &ControllerPlayer::handlePlayerResult); + + + QObject::connect(this, &ControllerPlayer::emitLoadVideoStream, player, &BioTracker3Player::receiveLoadVideoCommand); + QObject::connect(this, &ControllerPlayer::emitNextFrameCommand, player, &BioTracker3Player::receiveNextFramCommand); + QObject::connect(this, &ControllerPlayer::emitPauseCommand, player, &BioTracker3Player::receivePauseCommand); + QObject::connect(this, &ControllerPlayer::emitPlayCommand, player, &BioTracker3Player::receivePlayCommand); + QObject::connect(this, &ControllerPlayer::emitPrevFrameCommand, player, &BioTracker3Player::receivePrevFrameCommand); + QObject::connect(this, &ControllerPlayer::emitStopCommand, player, &BioTracker3Player::receiveStopCommand); + + + QObject::connect(player, &BioTracker3Player::emitCurrentFrameNumber, this, &ControllerPlayer::receiveCurrentFrameNumber); + QObject::connect(player, &BioTracker3Player::emitFPS, this, &ControllerPlayer::receiveFPS); + QObject::connect(player, &BioTracker3Player::emitTotalNumbFrames, this, &ControllerPlayer::receiveTotalNumbFrames); + QObject::connect(player, &BioTracker3Player::emitVideoControllsStates, this, &ControllerPlayer::receiveVideoControllsStates); +} + +void ControllerPlayer::handlePlayerResult() +{ + QPointer< BioTracker3Player > player = qobject_cast<BioTracker3Player *>(m_Model); + player->runPlayerOperation(); +} + +void ControllerPlayer::receiveCurrentFrameNumber(size_t num) +{ + QPointer< BioTracker3VideoControllWidget > widget = static_cast<BioTracker3VideoControllWidget *>(m_View); + + widget->setCurrentFrameNumber(num); +} + +void ControllerPlayer::receiveFPS(double fps) +{ + QPointer< BioTracker3VideoControllWidget > widget = static_cast<BioTracker3VideoControllWidget *>(m_View); + + widget->setFPS(fps); +} + +void ControllerPlayer::receiveTotalNumbFrames(size_t num) +{ + QPointer< BioTracker3VideoControllWidget > widget = static_cast<BioTracker3VideoControllWidget *>(m_View); + + widget->setTotalNumbFrames(num); +} + +void ControllerPlayer::receiveVideoControllsStates(QVector<bool> states) +{ + QPointer< BioTracker3VideoControllWidget > widget = static_cast<BioTracker3VideoControllWidget *>(m_View); + + widget->setVideoControllsStates(states); +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerPlayer.h b/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerPlayer.h new file mode 100644 index 0000000000000000000000000000000000000000..590967b503645d35981258f9a5d75b13c7c19777 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerPlayer.h @@ -0,0 +1,63 @@ +#ifndef CONTROLLERPLAYER_H +#define CONTROLLERPLAYER_H + +#include "QThread" +#include "Interfaces/IController/icontroller.h" +#include "Model/BioTracker3Player.h" +#include "QPointer" + + +class ControllerPlayer : public IController +{ + Q_OBJECT +public: + ControllerPlayer(QObject *parent = 0, IBioTrackerContext *context = 0, ENUMS::CONTROLLERTYPE ctr = ENUMS::CONTROLLERTYPE::NO_CTR); + + void loadVideoStream(QString str); + void loadPictures(std::vector<boost::filesystem::path> files); + + void nextFrame(); + void prevFrame(); + void play(); + void stop(); + void pause(); + + + void changeImageView(QString str); + + // IController interface +public: + void connectController() override; + +protected: + void createModel() override; + void createView() override; + void connectModelController() override; + +Q_SIGNALS: + void emitLoadVideoStream(QString str); + void emitLoadPictures(std::vector<boost::filesystem::path> files); + void emitNextFrameCommand(); + void emitPrevFrameCommand(); + void emitPlayCommand(); + void emitStopCommand(); + void emitPauseCommand(); + + void emitRunPlayerOperation(); + + +public Q_SLOTS: + void handlePlayerResult(); + + void receiveCurrentFrameNumber(size_t num); + void receiveFPS(double fps); + void receiveTotalNumbFrames(size_t num); + void receiveVideoControllsStates(QVector<bool> states); + +private: + QPointer< QThread > m_PlayerThread; + + QPointer< IModel > m_Player; +}; + +#endif // CONTROLLERPLAYER_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerTextureObject.cpp b/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerTextureObject.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3c28ccaba4bc88400ccd394403781b1a8fdb567f --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerTextureObject.cpp @@ -0,0 +1,118 @@ +#include "ControllerTextureObject.h" +#include "View/BioTracker3VideoView.h" +#include "View/BioTracker3MainWindow.h" +#include "Controller/ControllerGraphicScene.h" +#include "Controller/ControllerPlayer.h" +#include "Model/BioTracker3Player.h" +#include "View/TextureObjectView.h" + +ControllerTextureObject::ControllerTextureObject(QObject *parent, IBioTrackerContext *context, ENUMS::CONTROLLERTYPE ctr) : + IController(parent, context, ctr) +{ + m_TextureViewNamesModel= new QStringListModel(); + m_TextureViewNamesModel->setStringList(m_TextureViewNames); +} + +void ControllerTextureObject::changeTextureModel(QString name) +{ + if(name == QString("") ) + name = m_DefaultTextureName; + + checkIfTextureModelExists(name); + m_Model = m_TextureObjects.value(name); + + changeTextureView(m_Model); +} + +void ControllerTextureObject::addTextureElementView(IView *view) +{ + //dynamic_cast<BioTracker3VideoView *>(m_View)->addTrackedElementView(view); +} + +void ControllerTextureObject::connectController() +{ +// IController *ctrM = m_BioTrackerContext->requestController(ENUMS::CONTROLLERTYPE::MAINWINDOW); +// BioTracker3MainWindow *mainWin = dynamic_cast<BioTracker3MainWindow *>(ctrM->getView()); +// mainWin->addVideoView(m_View); + + + QPointer< IController > ctr = m_BioTrackerContext->requestController(ENUMS::CONTROLLERTYPE::PLAYER); + QPointer< ControllerPlayer > ctrPlayer = qobject_cast<ControllerPlayer *>(ctr); + + QPointer< BioTracker3Player > player = qobject_cast<BioTracker3Player *>(ctrPlayer->getModel()); + QObject::connect(player, &BioTracker3Player::emitCurrentFrame, this, &ControllerTextureObject::receiveCvMat); + + + QPointer< BioTracker3VideoControllWidget > videoView = dynamic_cast<BioTracker3VideoControllWidget *> (ctrPlayer->getView()); + videoView->setVideoViewComboboxModel(m_TextureViewNamesModel); + + + QPointer< IController > ctrG = m_BioTrackerContext->requestController(ENUMS::CONTROLLERTYPE::GRAPHICSVIEW); + QPointer< ControllerGraphicScene > ctrGraphics = qobject_cast<ControllerGraphicScene *>(ctrG); + QGraphicsPixmapItem *item = dynamic_cast<QGraphicsPixmapItem *>(m_View); + + ctrGraphics->addTextureObject(item); + + +} + +void ControllerTextureObject::receiveCvMat(cv::Mat mat, QString name) +{ + checkIfTextureModelExists(name); + + m_TextureObjects.value(name)->set(mat); + +} + +void ControllerTextureObject::createModel() +{ + createNewTextureObjectModel(m_DefaultTextureName); + + m_Model = m_TextureObjects.value(m_DefaultTextureName); +} + +void ControllerTextureObject::createView() +{ + m_View = new TextureObjectView(this, this, m_Model); + // this is the gl widget + // m_View = new BioTracker3VideoView(0, this, m_Model); +} + +void ControllerTextureObject::connectModelController() +{ + +} + +void ControllerTextureObject::checkIfTextureModelExists(QString name) +{ + if(name == QString("") ) + name = m_DefaultTextureName; + + + bool itemIsInList = false; + for (int i = 0 ; i < m_TextureViewNames.size(); ++i) { + + if (m_TextureViewNames.at(i) == name) { + itemIsInList = true; + } + } + + if (!itemIsInList) { + createNewTextureObjectModel(name); + } +} + +void ControllerTextureObject::createNewTextureObjectModel(QString name) +{ + BioTracker3TextureObject *newTextureModel = new BioTracker3TextureObject(this, name); + m_TextureObjects.insert(name, newTextureModel); + m_TextureViewNames.append(name); + m_TextureViewNamesModel->setStringList(m_TextureViewNames); + +} + +void ControllerTextureObject::changeTextureView(IModel *model) +{ + m_View->setNewModel(model); + +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerTextureObject.h b/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerTextureObject.h new file mode 100644 index 0000000000000000000000000000000000000000..5fe73b1d8d7a18b203ee3d7241ff33b5ce59a97f --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerTextureObject.h @@ -0,0 +1,54 @@ +#ifndef CONTROLLERTEXTUREOBJECT_H +#define CONTROLLERTEXTUREOBJECT_H + +#include "Interfaces/IController/icontroller.h" +#include "opencv2/core/core.hpp" +#include "QString" +#include "Model/BioTracker3TextureObject.h" + +#include "QStringList" +#include "QStringListModel" +#include "QPointer" + + +class ControllerTextureObject : public IController +{ + Q_OBJECT +public: + ControllerTextureObject(QObject *parent = 0, IBioTrackerContext *context = 0, ENUMS::CONTROLLERTYPE ctr = ENUMS::CONTROLLERTYPE::NO_CTR); + + void changeTextureModel(QString name); + + void addTextureElementView(IView *view); + + // IController interface +public: + void connectController() override; + +public Q_SLOTS: + void receiveCvMat(cv::Mat mat, QString name); + +Q_SIGNALS: + void emitNameOfTextureObject(QString name); + +protected: + void createModel() override; + void createView() override; + void connectModelController() override; + +private: + void checkIfTextureModelExists(QString name); + void createNewTextureObjectModel(QString name); + void changeTextureView(IModel *model); + +private: + QMap<QString, QPointer< BioTracker3TextureObject > > m_TextureObjects; + + QString m_DefaultTextureName = "No View"; + + QStringList m_TextureViewNames; + QPointer< QStringListModel > m_TextureViewNamesModel; + +}; + +#endif // CONTROLLERTEXTUREOBJECT_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerTrackedComponent.cpp b/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerTrackedComponent.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ef7ee8ba0b5c72bfba045761a8641cb580332534 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerTrackedComponent.cpp @@ -0,0 +1,37 @@ +#include "ControllerTrackedComponent.h" +#include "Model/TrackedComponents/TrackedElement.h" +#include "View/TrackedElementView.h" +#include "Controller/ControllerTextureObject.h" + +ControllerTrackedComponent::ControllerTrackedComponent(QObject *parent, IBioTrackerContext *context, ENUMS::CONTROLLERTYPE ctr) : + IController(parent, context, ctr) +{ + +} + +void ControllerTrackedComponent::createView() +{ + m_View = new TrackedElementView(0, this, m_Model); +} + +void ControllerTrackedComponent::connectModelController() +{ + +} + +void ControllerTrackedComponent::connectController() +{ + IController *ctrM = m_BioTrackerContext->requestController(ENUMS::CONTROLLERTYPE::TEXTUREOBJECT); + ControllerTextureObject *texture = dynamic_cast<ControllerTextureObject *>(ctrM); + texture->addTextureElementView(m_View); +} + +void ControllerTrackedComponent::createModel() +{ + TrackedElement *elem = new TrackedElement(this, "Hallo"); + elem->setX(70); + elem->setY(90); + + m_Model = elem; + +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerTrackedComponent.h b/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerTrackedComponent.h new file mode 100644 index 0000000000000000000000000000000000000000..98dd50053a82b838cf018b339a7319a206ce23f7 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerTrackedComponent.h @@ -0,0 +1,19 @@ +#ifndef CONTROLLERTRACKEDCOMPONENT_H +#define CONTROLLERTRACKEDCOMPONENT_H + +#include "Interfaces/IController/icontroller.h" + +class ControllerTrackedComponent : public IController +{ +public: + ControllerTrackedComponent(QObject *parent = 0, IBioTrackerContext *context = 0, ENUMS::CONTROLLERTYPE ctr = ENUMS::CONTROLLERTYPE::COMPONENT); + + // IController interface +protected: + void createModel() override; + void createView() override; + void connectModelController() override; + void connectController() override; +}; + +#endif // CONTROLLERTRACKEDCOMPONENT_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerTrackingAlgorithm.cpp b/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerTrackingAlgorithm.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a6000ba8f60d886efe02a7f5af0e102b3dc47e66 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerTrackingAlgorithm.cpp @@ -0,0 +1,47 @@ +#include "ControllerTrackingAlgorithm.h" +#include "ControllerTextureObject.h" +#include "ControllerPlayer.h" + +ControllerTrackingAlgorithm::ControllerTrackingAlgorithm(QObject *parent, IBioTrackerContext *context, ENUMS::CONTROLLERTYPE ctr) : + IController(parent, context, ctr) +{ + +} + +void ControllerTrackingAlgorithm::connectController() +{ + IController *ctrA = m_BioTrackerContext->requestController(ENUMS::CONTROLLERTYPE::TEXTUREOBJECT); + ControllerTextureObject *ctrTexture = dynamic_cast<ControllerTextureObject *>(ctrA); + QObject::connect(this, &ControllerTrackingAlgorithm::emitCvMatA, ctrTexture, &ControllerTextureObject::receiveCvMat); + + + IController *ctrB = m_BioTrackerContext->requestController(ENUMS::CONTROLLERTYPE::PLAYER); + ControllerPlayer *ctrPlayer = dynamic_cast<ControllerPlayer *>(ctrB); + IModel *model = ctrPlayer->getModel(); + BioTracker3Player *player = dynamic_cast<BioTracker3Player *>(model); + + BioTrackerTrackingAlgorithm *alg = qobject_cast<BioTrackerTrackingAlgorithm *>(m_Model); + QObject::connect(player, &BioTracker3Player::emitCurrentFrame, alg, &BioTrackerTrackingAlgorithm::doTracking); + + QObject::connect(alg, &BioTrackerTrackingAlgorithm::emitCvMatA, ctrTexture, &ControllerTextureObject::receiveCvMat); +} + +void ControllerTrackingAlgorithm::createModel() +{ + m_Model = new BioTrackerTrackingAlgorithm(); +} + +void ControllerTrackingAlgorithm::createView() +{ + +} + +void ControllerTrackingAlgorithm::connectModelController() +{ + +} + +void ControllerTrackingAlgorithm::receiveCvMatA(cv::Mat mat, QString name) +{ + Q_EMIT emitCvMatA(mat, name); +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerTrackingAlgorithm.h b/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerTrackingAlgorithm.h new file mode 100644 index 0000000000000000000000000000000000000000..5dc5faf8a1b13ff41123ad46ab1bf9f7d17484ef --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Controller/ControllerTrackingAlgorithm.h @@ -0,0 +1,29 @@ +#ifndef CONTROLLERTRACKINGALGORITHM_H +#define CONTROLLERTRACKINGALGORITHM_H + +#include "Interfaces/IController/icontroller.h" +#include "Model/BioTrackerTrackingAlgorithm.h" + +class ControllerTrackingAlgorithm : public IController +{ + Q_OBJECT +public: + ControllerTrackingAlgorithm(QObject *parent = 0, IBioTrackerContext *context = 0, ENUMS::CONTROLLERTYPE ctr = ENUMS::CONTROLLERTYPE::NO_CTR); + + // IController interface +public: + void connectController() override; + +protected: + void createModel() override; + void createView() override; + void connectModelController() override; + +Q_SIGNALS: + void emitCvMatA(cv::Mat mat, QString name); + +public Q_SLOTS: + void receiveCvMatA(cv::Mat mat, QString name); +}; + +#endif // CONTROLLERTRACKINGALGORITHM_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Controller/null_Controller.cpp b/BioTrackerQt/Source/BioTrackerQt/Controller/null_Controller.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5809c707a1a63ce931c183d3463ef25d6392e447 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Controller/null_Controller.cpp @@ -0,0 +1,26 @@ +#include "null_Controller.h" + +null_Controller::null_Controller() +{ + +} + +void null_Controller::createModel() +{ + +} + +void null_Controller::createView() +{ + +} + +void null_Controller::connectModelController() +{ + +} + +void null_Controller::connectController() +{ + +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Controller/null_Controller.h b/BioTrackerQt/Source/BioTrackerQt/Controller/null_Controller.h new file mode 100644 index 0000000000000000000000000000000000000000..cca1b86e21159bd149e76a8afcbd1bb0da58499b --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Controller/null_Controller.h @@ -0,0 +1,18 @@ +#ifndef NULL_CONTROLLER_H +#define NULL_CONTROLLER_H + +#include "Interfaces/IController/icontroller.h" +class null_Controller : public IController +{ +public: + null_Controller(); + + // IController interface +protected: + void createModel() override; + void createView() override; + void connectModelController() override; + void connectController() override; +}; + +#endif // NULL_CONTROLLER_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Exceptions.h b/BioTrackerQt/Source/BioTrackerQt/Exceptions.h new file mode 100644 index 0000000000000000000000000000000000000000..d31b8df8e656adebe5d0d6c3f565e9d8d812d213 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Exceptions.h @@ -0,0 +1,34 @@ +#pragma once + +#include <stdexcept> + + +namespace BioTracker { +namespace Core { + +struct video_open_error : std::invalid_argument { + using std::invalid_argument::invalid_argument; +}; + +struct file_not_found : std::invalid_argument { + using std::invalid_argument::invalid_argument; +}; + +struct directory_not_found : std::invalid_argument { + using std::invalid_argument::invalid_argument; +}; + +struct device_open_error : std::invalid_argument { + using std::invalid_argument::invalid_argument; +}; + +struct invalid_tracker_lib_error : std::invalid_argument { + using std::invalid_argument::invalid_argument; +}; + +struct path_creation_error : std::runtime_error { + using std::runtime_error::runtime_error; +}; + +} +} diff --git a/BioTrackerQt/Source/BioTrackerQt/GuiContext.cpp b/BioTrackerQt/Source/BioTrackerQt/GuiContext.cpp new file mode 100644 index 0000000000000000000000000000000000000000..302c6ba22cd35d29e41ef746083edee5f2c3c2c4 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/GuiContext.cpp @@ -0,0 +1,45 @@ +#include "GuiContext.h" +#include "Controller/ControllerMainWindow.h" +#include "Controller/ControllerPlayer.h" +#include "Controller/ControllerTextureObject.h" +#include "Controller/ControllerTrackingAlgorithm.h" +#include "Model/BioTracker3Player.h" +#include "Model/BioTracker3TextureObject.h" +#include "Controller/ControllerGraphicScene.h" +#include "Model/TrackedComponents/TrackedElement.h" +#include "QPointer" + +GuiContext::GuiContext(QObject *parent) : + IBioTrackerContext(parent) +{ + QPointer< IController > MainWindowController = new ControllerMainWindow(this, this, ENUMS::CONTROLLERTYPE::MAINWINDOW); + QPointer< IController > PlayerController = new ControllerPlayer(this, this, ENUMS::CONTROLLERTYPE::PLAYER); + QPointer< IController > TextureObjectController = new ControllerTextureObject(this, this, ENUMS::CONTROLLERTYPE::TEXTUREOBJECT); + QPointer< IController > TrackingAlgoController = new ControllerTrackingAlgorithm(this, this, ENUMS::CONTROLLERTYPE::TRACKING); + QPointer< IController > GraphicsViewController = new ControllerGraphicScene(this, this, ENUMS::CONTROLLERTYPE::GRAPHICSVIEW); + + m_ControllersMap.insert(ENUMS::CONTROLLERTYPE::MAINWINDOW, MainWindowController); + m_ControllersMap.insert(ENUMS::CONTROLLERTYPE::PLAYER, PlayerController); + m_ControllersMap.insert(ENUMS::CONTROLLERTYPE::TEXTUREOBJECT, TextureObjectController); + m_ControllersMap.insert(ENUMS::CONTROLLERTYPE::TRACKING, TrackingAlgoController); + m_ControllersMap.insert(ENUMS::CONTROLLERTYPE::GRAPHICSVIEW, GraphicsViewController); + +} + +void GuiContext::createAppController() +{ + QMap<ENUMS::CONTROLLERTYPE, IController *>::iterator i; + for (i = m_ControllersMap.begin(); i != m_ControllersMap.end(); ++i) + { + i.value()->createComponents(); + } +} + +void GuiContext::connectController() +{ + QMap<ENUMS::CONTROLLERTYPE, IController *>::iterator i; + for (i = m_ControllersMap.begin(); i != m_ControllersMap.end(); ++i) + { + i.value()->connectComponents(); + } +} diff --git a/BioTrackerQt/Source/BioTrackerQt/GuiContext.h b/BioTrackerQt/Source/BioTrackerQt/GuiContext.h new file mode 100644 index 0000000000000000000000000000000000000000..82ccc0f76a8ff128baace8635fa4c9b4a2fcf157 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/GuiContext.h @@ -0,0 +1,21 @@ +#ifndef GUICONTEXT_H +#define GUICONTEXT_H + +#include "Interfaces/IBioTrackerContext.h" +#include "Interfaces/IController/icontroller.h" + +class GuiContext : public IBioTrackerContext +{ + Q_OBJECT + +public: + GuiContext(QObject *parent = 0); + + // IBioTrackerContext interface +protected: + void createAppController() override; + void connectController() override; + +}; + +#endif // GUICONTEXT_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Interfaces/ENUMS.h b/BioTrackerQt/Source/BioTrackerQt/Interfaces/ENUMS.h new file mode 100644 index 0000000000000000000000000000000000000000..2526bf8b022ad8922be92df1057b3e3e50c234f7 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Interfaces/ENUMS.h @@ -0,0 +1,19 @@ +#ifndef ENUMS_H +#define ENUMS_H + +#include <QObject> + +class ENUMS : public QObject +{ + Q_OBJECT +public: + + + enum CONTROLLERTYPE {NO_CTR, MAINWINDOW, TEXTUREOBJECT, PLAYER, TRACKING, COMPONENT, GRAPHICSVIEW }; + Q_ENUM(CONTROLLERTYPE) + + explicit ENUMS(QObject *parent = 0); + +}; + +#endif // ENUMS_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Interfaces/IBioTrackerContext.cpp b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IBioTrackerContext.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e2f2ca7b9e52f7d93aa013364d3f84468c9fd911 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IBioTrackerContext.cpp @@ -0,0 +1,35 @@ +#include "IBioTrackerContext.h" +#include "Interfaces/IController/icontroller.h" + + +IBioTrackerContext::IBioTrackerContext(QObject *parent) : + QObject(parent) +{ + +} + +void IBioTrackerContext::createApplication() +{ + createAppController(); + connectController(); +} + +void IBioTrackerContext::createAppController() +{ + +} + +IController *IBioTrackerContext::requestController(ENUMS::CONTROLLERTYPE ctrtype) +{ + return m_ControllersMap.value(ctrtype); +} + +void IBioTrackerContext::connectController() +{ + +} + +void IBioTrackerContext::addController(IController *ctr) +{ + m_ControllersMap.insert(ctr->getControllerType(), ctr); +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Interfaces/IBioTrackerContext.h b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IBioTrackerContext.h new file mode 100644 index 0000000000000000000000000000000000000000..abdeb439a65f5086ca2c1aeeadb98433f5926652 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IBioTrackerContext.h @@ -0,0 +1,31 @@ +#ifndef IBIOTRACKERCONTEXT_H +#define IBIOTRACKERCONTEXT_H + +#include <QObject> +#include "QMap" +#include "QString" +#include "Interfaces/ENUMS.h" + +class IController; +class IBioTrackerContext : public QObject +{ + Q_OBJECT +public: + IBioTrackerContext(QObject *parent = 0); + + void createApplication(); + + IController * requestController(ENUMS::CONTROLLERTYPE ctrtype); + +protected: + virtual void createAppController(); + virtual void connectController(); + + void addController(IController * ctr); +protected: + QMap<ENUMS::CONTROLLERTYPE, IController *> m_ControllersMap; + + +}; + +#endif // IBIOTRACKERCONTEXT_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Interfaces/IController/IControllerStrategy.cpp b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IController/IControllerStrategy.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9fd7be5ba5b757f8902e20e573aadb95c164eb9b --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IController/IControllerStrategy.cpp @@ -0,0 +1,13 @@ +#include "IControllerStrategy.h" +#include "Interfaces/IController/icontroller.h" + + +IControllerStrategy::IControllerStrategy(QObject *parent, IController *controller) : QObject(parent) +{ + m_Controller = controller; +} + +void IControllerStrategy::execute() +{ + +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Interfaces/IController/IControllerStrategy.h b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IController/IControllerStrategy.h new file mode 100644 index 0000000000000000000000000000000000000000..8f75ca49ad9adddc11ad5766f507c4c4dbfc44de --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IController/IControllerStrategy.h @@ -0,0 +1,25 @@ +#ifndef ICONTROLLERSTRATEGY_H +#define ICONTROLLERSTRATEGY_H + +#include <QObject> +#include "Interfaces/IView/IView.h" +#include "Interfaces/IModel/imodel.h" + +class IController; +class IControllerStrategy : public QObject +{ + Q_OBJECT +public: + explicit IControllerStrategy(QObject *parent = 0, IController *controller = 0); + + virtual void execute() = 0; + +Q_SIGNALS: + +public Q_SLOTS: + +protected: + IController *m_Controller; +}; + +#endif // ICONTROLLERSTRATEGY_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Interfaces/IController/icontroller.cpp b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IController/icontroller.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bf7213d1e7fafb99d01728e6e8a28b9a93e4be10 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IController/icontroller.cpp @@ -0,0 +1,49 @@ +#include "icontroller.h" +#include "Interfaces/IController/icontroller.h" +#include "Interfaces/IBioTrackerContext.h" + + +IController::IController(QObject *parent, IBioTrackerContext *context, ENUMS::CONTROLLERTYPE ctr) : QObject(parent), + m_BioTrackerContext(context), + m_ControllerType(ctr) +{ + +} + +IBioTrackerContext *IController::getBioTrackerContext() +{ + return m_BioTrackerContext.data(); +} + +void IController::createComponents() +{ + createModel(); + createView(); + connectModelController(); +} + +void IController::connectComponents() +{ + connectController(); +} + +void IController::addView(IView *view) { + m_View = view; +} + +void IController::addModel(IModel *model) { + m_Model = model; +} + +IModel *IController::getModel() { + return m_Model.data(); +} + +IView *IController::getView() { + return m_View; +} + +ENUMS::CONTROLLERTYPE IController::getControllerType() +{ + return m_ControllerType; +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Interfaces/IController/icontroller.h b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IController/icontroller.h new file mode 100644 index 0000000000000000000000000000000000000000..830ab9d70fa4ac33c7afd03a50d3c3e573e19414 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IController/icontroller.h @@ -0,0 +1,45 @@ +#ifndef ICONTROLLER_H +#define ICONTROLLER_H + +#include <QObject> +#include "View/BioTracker3MainWindow.h" +#include "Interfaces/IView/IViewWidget.h" +#include "Interfaces/IModel/imodel.h" +#include "QMap" +#include "Interfaces/IBioTrackerContext.h" +#include "Interfaces/ENUMS.h" +#include "QPointer" + +class IController : public QObject { + Q_OBJECT + public: + explicit IController(QObject *parent = 0, IBioTrackerContext *context = 0, ENUMS::CONTROLLERTYPE ctr = ENUMS::CONTROLLERTYPE::NO_CTR); + + void createComponents(); + void connectComponents(); + + void addView(IView *view); + void addModel(IModel *model); + IModel *getModel(); + IView *getView(); + + ENUMS::CONTROLLERTYPE getControllerType(); + IBioTrackerContext *getBioTrackerContext(); + +protected: + virtual void createModel() = 0; + virtual void createView() = 0; + virtual void connectModelController() = 0; + virtual void connectController() = 0; + +protected: + QPointer< IBioTrackerContext > m_BioTrackerContext; + + IView *m_View; + QPointer< IModel > m_Model; + + ENUMS::CONTROLLERTYPE m_ControllerType; + +}; + +#endif // ICONTROLLER_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Interfaces/IModel/IObject.cpp b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IModel/IObject.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9f339496b7828d755360600b093e08f4302cc4f1 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IModel/IObject.cpp @@ -0,0 +1,6 @@ +#include "IObject.h" + +IObject::IObject() : + IModel(0) { + +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Interfaces/IModel/IObject.h b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IModel/IObject.h new file mode 100644 index 0000000000000000000000000000000000000000..e1b1ef61f50382e03e1a57f66deb8f9da9fd4e99 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IModel/IObject.h @@ -0,0 +1,17 @@ +#ifndef IOBJECT_H +#define IOBJECT_H + +#include "Interfaces/IModel/imodel.h" + +#include <cereal/cereal.hpp> +#include <cereal/access.hpp> + +// #include "biotracker/util/platform.h" + +class IObject : public IModel { + Q_OBJECT + public: + IObject(); +}; + +#endif // IOBJECT_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Interfaces/IModel/ITrackedComponent.cpp b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IModel/ITrackedComponent.cpp new file mode 100644 index 0000000000000000000000000000000000000000..cd0f2af8645a813e443d6bd0d8756001f4833fca --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IModel/ITrackedComponent.cpp @@ -0,0 +1,12 @@ +#include "ITrackedComponent.h" + +ITrackedComponent::ITrackedComponent(QObject *parent) : + IModel(parent) +{ + +} + +void ITrackedComponent::operate() +{ + +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Interfaces/IModel/ITrackedComponent.h b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IModel/ITrackedComponent.h new file mode 100644 index 0000000000000000000000000000000000000000..994071892c335b940ab13a27f47b2531d7515963 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IModel/ITrackedComponent.h @@ -0,0 +1,16 @@ +#ifndef ITRACKEDCOMPONENT_H +#define ITRACKEDCOMPONENT_H + +#include "imodel.h" + +class ITrackedComponent : public IModel +{ + Q_OBJECT + + public: + ITrackedComponent(QObject *parent = 0); + + virtual void operate(); +}; + +#endif // ITRACKEDCOMPONENT_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Interfaces/IModel/ITrackedComponentFactory.cpp b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IModel/ITrackedComponentFactory.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e09ee78b146b3d95007c0d690ae347eec07848a4 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IModel/ITrackedComponentFactory.cpp @@ -0,0 +1,20 @@ +#include "ITrackedComponentFactory.h" + +ITrackedComponentFactory::ITrackedComponentFactory() { + +} + +ITrackedComponentFactory::~ITrackedComponentFactory() +{ + +} + +ITrackedComponent *ITrackedComponentFactory::getNewTrackedElement() +{ + return createTrackedElement(); +} + +ITrackedComponent *ITrackedComponentFactory::getNewTrackedObject() +{ + return createTrackedObject(); +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Interfaces/IModel/ITrackedComponentFactory.h b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IModel/ITrackedComponentFactory.h new file mode 100644 index 0000000000000000000000000000000000000000..e7dcf52e5ec64b93a0692d719196c7021510a56c --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IModel/ITrackedComponentFactory.h @@ -0,0 +1,24 @@ +#ifndef ITRACKEDCOMPONENTFACTORY_H +#define ITRACKEDCOMPONENTFACTORY_H + +#include "Interfaces/IModel/imodel.h" +#include "Interfaces/IModel/ITrackedComponent.h" + +class ITrackedComponentFactory : public IModel +{ + Q_OBJECT + + public: + ITrackedComponentFactory(); + virtual ~ITrackedComponentFactory() = 0; + + ITrackedComponent *getNewTrackedElement(); + ITrackedComponent *getNewTrackedObject(); + +protected: + virtual ITrackedComponent *createTrackedElement() = 0; + virtual ITrackedComponent *createTrackedObject() = 0; + +}; + +#endif // ITRACKEDCOMPONENTFACTORY_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Interfaces/IModel/ITrackedTrajectory.cpp b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IModel/ITrackedTrajectory.cpp new file mode 100644 index 0000000000000000000000000000000000000000..cb93ac7026466b2cc708d7497afa7f92cae779b2 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IModel/ITrackedTrajectory.cpp @@ -0,0 +1,13 @@ +#include "ITrackedTrajectory.h" + +ITrackedTrajectory::ITrackedTrajectory(QObject *parent) : + ITrackedComponent(parent) +{ + +} + +void ITrackedTrajectory::operate() +{ + // please implement this methode in an TrackedObject class + +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Interfaces/IModel/ITrackedTrajectory.h b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IModel/ITrackedTrajectory.h new file mode 100644 index 0000000000000000000000000000000000000000..d9497b25a380d6de6a122d7c715d7948fb360584 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IModel/ITrackedTrajectory.h @@ -0,0 +1,22 @@ +#ifndef ITRACKEDOTRAJECTORY_H +#define ITRACKEDOTRAJECTORY_H + +#include "Interfaces/IModel/ITrackedComponent.h" + +class ITrackedTrajectory : public ITrackedComponent +{ + Q_OBJECT + +public: + ITrackedTrajectory(QObject *parent); + + virtual void add(ITrackedComponent *comp) = 0; + virtual void remove(ITrackedComponent *comp) = 0; + virtual ITrackedComponent* getChild(int index) = 0; + + // ITrackedComponent interface +public: + void operate(); +}; + +#endif // ITRACKEDOTRAJECTORY_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Interfaces/IModel/ITrackingAlgorithm.cpp b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IModel/ITrackingAlgorithm.cpp new file mode 100644 index 0000000000000000000000000000000000000000..da1222d3365ce0e07f079c808158a2916748c614 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IModel/ITrackingAlgorithm.cpp @@ -0,0 +1,27 @@ +#include "ITrackingAlgorithm.h" + +ITrackingAlgorithm::ITrackingAlgorithm(QObject *parent) : + IModel(parent) +{ + +} + +void ITrackingAlgorithm::setTrackedComponentFactory(ITrackedComponentFactory *factory) +{ + m_TrackedComponentFactory = factory; +} + +void ITrackingAlgorithm::setTrackedComponent(ITrackedComponent *trackedComponent) +{ + m_TrackedComponent = trackedComponent; +} + +ITrackedComponentFactory *ITrackingAlgorithm::getTrackedComponentFactory() +{ + return m_TrackedComponentFactory; +} + +ITrackedComponent *ITrackingAlgorithm::getTrackedComponent() +{ + return m_TrackedComponent; +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Interfaces/IModel/ITrackingAlgorithm.h b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IModel/ITrackingAlgorithm.h new file mode 100644 index 0000000000000000000000000000000000000000..8a17a0349bdeb475fcd62cc8dc1271f4cf226f1d --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IModel/ITrackingAlgorithm.h @@ -0,0 +1,28 @@ +#ifndef ITRACKINGALGORITHM_H +#define ITRACKINGALGORITHM_H + +#include "imodel.h" +#include "opencv2/core/core.hpp" + +#include "Interfaces/IModel/ITrackedComponentFactory.h" +#include "Interfaces/IModel/ITrackedComponent.h" + +class ITrackingAlgorithm :public IModel { + Q_OBJECT + public: + ITrackingAlgorithm(QObject *parent = 0); + + virtual void doTracking(cv::Mat image) = 0; + + void setTrackedComponentFactory(ITrackedComponentFactory *factory); + void setTrackedComponent(ITrackedComponent *trackedComponent); + + ITrackedComponentFactory *getTrackedComponentFactory(); + ITrackedComponent *getTrackedComponent(); + +protected: + ITrackedComponentFactory *m_TrackedComponentFactory; + ITrackedComponent *m_TrackedComponent; +}; + +#endif // ITRACKINGALGORITHM_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Interfaces/IModel/imodel.cpp b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IModel/imodel.cpp new file mode 100644 index 0000000000000000000000000000000000000000..31fc66e9e07b7de8ae478037e2b122eea7e80b29 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IModel/imodel.cpp @@ -0,0 +1,9 @@ +#include "imodel.h" + +IModel::IModel(QObject *parent) : QObject(parent) { + +} + +IModel::~IModel() { + +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Interfaces/IModel/imodel.h b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IModel/imodel.h new file mode 100644 index 0000000000000000000000000000000000000000..0242d36938ae417dc3a3ee0d2333bfd1e5b3c7b4 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IModel/imodel.h @@ -0,0 +1,19 @@ +#ifndef IMODEL_H +#define IMODEL_H + +#include <QObject> + +class IModel : public QObject { + Q_OBJECT + public: + explicit IModel(QObject *parent = 0); + ~IModel(); + + Q_SIGNALS: + + void notifyView(); + + public Q_SLOTS: +}; + +#endif // IMODEL_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Interfaces/IStates/IPlayerState.cpp b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IStates/IPlayerState.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fa9b4222ccde79a56388c038e3f0cdbf859c8c2f --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IStates/IPlayerState.cpp @@ -0,0 +1,51 @@ +#include "IPlayerState.h" + +#include "Model/BioTracker3Player.h" + +#include "opencv2/core/core.hpp" + +IPlayerState::IPlayerState(BioTracker3Player *player, std::shared_ptr<BioTracker::Core::BioTracker3ImageStream> imageStream) : + m_Player(player), + m_ImageStream(imageStream) { + +} + +bool IPlayerState::getStateForPlay() +{ + return m_Play; +} + +bool IPlayerState::getStateForForward() +{ + return m_Forw; +} + +bool IPlayerState::getStateForBackward() +{ + return m_Back; +} + +bool IPlayerState::getStateForStop() +{ + return m_Stop; +} + +bool IPlayerState::getStateForPause() +{ + return m_Paus; +} + +cv::Mat IPlayerState::getCurrentFrame() +{ + return m_Mat; +} + +size_t IPlayerState::getCurrentFrameNumber() +{ + return m_FrameNumber; +} + +void IPlayerState::changeImageStream(std::shared_ptr<BioTracker::Core::BioTracker3ImageStream> imageStream) { + m_ImageStream.reset(); + m_ImageStream = imageStream; +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Interfaces/IStates/IPlayerState.h b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IStates/IPlayerState.h new file mode 100644 index 0000000000000000000000000000000000000000..5eb8bb97ea91062000ff54852b21c513634f9b36 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IStates/IPlayerState.h @@ -0,0 +1,54 @@ +#ifndef IPLAYERSTATE_H +#define IPLAYERSTATE_H + +#include <QObject> + +#include "Interfaces/IModel/imodel.h" + +#include "Model/BioTracker3ImageStream.h" +#include "Model/BioTracker3TextureObject.h" + +class BioTracker3Player; +class IPlayerState : public IModel { + Q_OBJECT + public: + explicit IPlayerState(BioTracker3Player *player, std::shared_ptr<BioTracker::Core::BioTracker3ImageStream> imageStream); + enum PLAYER_STATES {STATE_INITIAL, STATE_INITIAL_STREAM, STATE_PLAY, STATE_STEP_FORW, + STATE_STEP_BACK, STATE_PAUSE, STATE_WAIT + }; + Q_ENUM(PLAYER_STATES) + + + public: + void changeImageStream(std::shared_ptr<BioTracker::Core::BioTracker3ImageStream> imageStream); + + virtual void operate() = 0; + + bool getStateForPlay(); + bool getStateForForward(); + bool getStateForBackward(); + bool getStateForStop(); + bool getStateForPause(); + cv::Mat getCurrentFrame(); + size_t getCurrentFrameNumber(); + +Q_SIGNALS: + void emitStateDone(); + + protected: + BioTracker3Player *m_Player; + std::shared_ptr<BioTracker::Core::BioTracker3ImageStream> m_ImageStream; + + bool m_Play; + bool m_Forw; + bool m_Back; + bool m_Stop; + bool m_Paus; + + cv::Mat m_Mat; + size_t m_FrameNumber; + + +}; + +#endif // IPLAYERSTATE_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IGraphicsPixmapItem.cpp b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IGraphicsPixmapItem.cpp new file mode 100644 index 0000000000000000000000000000000000000000..acd55652d3b79874af302ab3473a2ba4b58deaa0 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IGraphicsPixmapItem.cpp @@ -0,0 +1,24 @@ +#include "IGraphicsPixmapItem.h" + +IGraphicsPixmapItem::IGraphicsPixmapItem(QObject *parent, IController *controller, IModel *model) : + QObject(parent), + IView(controller, model) +{ + +} + +void IGraphicsPixmapItem::setNewModel(IModel *model) +{ + if (getModel() != nullptr) { + QObject::disconnect(getModel(), 0, this, 0); + } + + setModel(model); + + if (getModel() != nullptr) { + connectModelView(); + } + + update(); +} + diff --git a/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IGraphicsPixmapItem.h b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IGraphicsPixmapItem.h new file mode 100644 index 0000000000000000000000000000000000000000..47eaa3ad822a26f7eda3cfeaf6ef6967d8683941 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IGraphicsPixmapItem.h @@ -0,0 +1,22 @@ +#ifndef IGRAPHICSPIXMAPITEM_H +#define IGRAPHICSPIXMAPITEM_H + +#include "IView.h" +#include "QObject" +#include "QGraphicsPixmapItem" + +class IGraphicsPixmapItem : public QObject, public QGraphicsPixmapItem, public IView +{ + Q_OBJECT +public: + IGraphicsPixmapItem(QObject *parent = 0, IController *controller = 0, IModel *model = 0); + + // IView interface +public: + void setNewModel(IModel *model) override; + +public Q_SLOTS: + virtual void getNotified() = 0; +}; + +#endif // IGRAPHICSPIXMAPITEM_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IGraphicsView.cpp b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IGraphicsView.cpp new file mode 100644 index 0000000000000000000000000000000000000000..150b759d22f28f65051a2429d95feae851940122 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IGraphicsView.cpp @@ -0,0 +1,18 @@ +#include "IGraphicsView.h" + +IGraphicsView::IGraphicsView(QWidget *parent, IController *controller, IModel *model) : + QGraphicsView(parent), + IView(controller, model) +{ + +} + +void IGraphicsView::setNewModel(IModel *model) +{ + +} + +void IGraphicsView::connectModelView() +{ + QObject::connect(getModel(), &IModel::notifyView, this, &IGraphicsView::getNotified); +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IGraphicsView.h b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IGraphicsView.h new file mode 100644 index 0000000000000000000000000000000000000000..e5ba7763dbab9664b03096b3c9ed1264237c11a4 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IGraphicsView.h @@ -0,0 +1,24 @@ +#ifndef IGRAPHICSVIEW_H +#define IGRAPHICSVIEW_H + +#include "QGraphicsView" +#include "IView.h" + +class IGraphicsView : public QGraphicsView, public IView +{ + Q_OBJECT +public: + IGraphicsView(QWidget *parent = 0, IController *controller = 0, IModel *model = 0); + + // IView interface +public: + void setNewModel(IModel *model) override; + +protected: + void connectModelView() override; + +public Q_SLOTS: + virtual void getNotified() = 0; +}; + +#endif // IGRAPHICSVIEW_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IView.cpp b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IView.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b117c3f2db6f9cbf4f46b3b2e883c1d6316e8c84 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IView.cpp @@ -0,0 +1,25 @@ +#include "IView.h" +#include "Interfaces/IController/icontroller.h" + +IView::IView(IController *controller, IModel *model): + mController(controller), + mModel(model) +{ + +} + +void IView::setModel(IModel *model) { + mModel = model; +} + +IView::~IView() { + +} + +IController *IView::getController() { + return mController; +} + +IModel *IView::getModel() { + return mModel; +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IView.h b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IView.h new file mode 100644 index 0000000000000000000000000000000000000000..aa3f53329638fde3299869dee81a84db6122ce95 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IView.h @@ -0,0 +1,27 @@ +#ifndef IVIEW_H +#define IVIEW_H + +#include "Interfaces/IModel/imodel.h" + +class IController; +class IView { + + public: + IView(IController *controller = 0, IModel *model = 0); + virtual ~IView() = 0; + + virtual void setNewModel(IModel *model) = 0; + + protected: + virtual void connectModelView() = 0; + void setModel(IModel *model); + IController *getController(); + IModel *getModel(); + + private: + IController *mController; + IModel *mModel; + +}; + +#endif // IVIEW_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IViewGraphicsScene.cpp b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IViewGraphicsScene.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c1bf252da4e3bf31676c857945e4dfae294fafee --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IViewGraphicsScene.cpp @@ -0,0 +1,18 @@ +#include "IViewGraphicsScene.h" + +IViewGraphicsScene::IViewGraphicsScene(QObject *parent, IController *controller, IModel *model) : + QGraphicsScene(parent), + IView(controller, model) +{ + +} + +void IViewGraphicsScene::setNewModel(IModel *model) +{ + +} + +void IViewGraphicsScene::connectModelView() +{ + QObject::connect(getModel(), &IModel::notifyView, this, &IViewGraphicsScene::getNotified); +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IViewGraphicsScene.h b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IViewGraphicsScene.h new file mode 100644 index 0000000000000000000000000000000000000000..6b2e0db6b2a06ef92b3edaf219323ed58729fb3a --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IViewGraphicsScene.h @@ -0,0 +1,24 @@ +#ifndef IVIEWGRAPHICSSCENE_H +#define IVIEWGRAPHICSSCENE_H + +#include "QGraphicsScene" +#include "IView.h" + +class IViewGraphicsScene : public QGraphicsScene, public IView +{ + Q_OBJECT +public: + IViewGraphicsScene(QObject *parent = 0, IController *controller = 0, IModel *model = 0); + + // IView interface +public: + virtual void setNewModel(IModel *model) override; + +protected: + virtual void connectModelView() override; + +public Q_SLOTS: + virtual void getNotified() = 0; +}; + +#endif // IVIEWGRAPHICSSCENE_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IViewMainWindow.cpp b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IViewMainWindow.cpp new file mode 100644 index 0000000000000000000000000000000000000000..cea4f77e238b266269baf696b5d7f5b913832cd8 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IViewMainWindow.cpp @@ -0,0 +1,20 @@ +#include "IViewMainWindow.h" + +IViewMainWindow::IViewMainWindow(QWidget *parent, IController *controller, IModel *model) : + QMainWindow(parent), + IView(controller, model) { + +} + +IViewMainWindow::~IViewMainWindow() { + +} + +void IViewMainWindow::setNewModel(IModel *model) { + model = nullptr; + setModel(model); +} + +void IViewMainWindow::connectModelView() { + // this function is not used in MainWindow +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IViewMainWindow.h b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IViewMainWindow.h new file mode 100644 index 0000000000000000000000000000000000000000..e61939e7268f6ec79958ccd83e1fe81de5bf13fd --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IViewMainWindow.h @@ -0,0 +1,17 @@ +#ifndef IVIEWMAINWINDOW_H +#define IVIEWMAINWINDOW_H + +#include <QMainWindow> +#include "Interfaces/IView/IView.h" + +class IViewMainWindow : public QMainWindow, public IView { + public: + IViewMainWindow(QWidget *parent = 0, IController *controller = 0, IModel *model = 0); + ~IViewMainWindow(); + + private: + void setNewModel(IModel *model); + void connectModelView(); +}; + +#endif // IVIEWMAINWINDOW_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IViewOpenGLWidget.cpp b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IViewOpenGLWidget.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2b799f3c9bc50c21ba5c1452a95d208de04654c1 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IViewOpenGLWidget.cpp @@ -0,0 +1,33 @@ +#include "IViewOpenGLWidget.h" + +IViewOpenGLWidget::IViewOpenGLWidget(QWidget *parent, IController *controller, IModel *model) : + QOpenGLWidget(parent), + IView(controller) { + setNewModel(model); +} + +IViewOpenGLWidget::~IViewOpenGLWidget() { + +} + +void IViewOpenGLWidget::setNewModel(IModel *model) { + if (getModel() != nullptr) { + QObject::disconnect(getModel(), 0, this, 0); + } + + setModel(model); + + if (getModel() != nullptr) { + connectModelView(); + } + + update(); +} + +void IViewOpenGLWidget::connectModelView() { + QObject::connect(getModel(), &IModel::notifyView, this, &IViewOpenGLWidget::getNotified); +} + +void IViewOpenGLWidget::initializeGL() { + connectModelView(); +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IViewOpenGLWidget.h b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IViewOpenGLWidget.h new file mode 100644 index 0000000000000000000000000000000000000000..e3a23b47397b4d7348d1889cf873e7bbdf24f0d6 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IViewOpenGLWidget.h @@ -0,0 +1,25 @@ +#ifndef IVIEWOPENGLWIDGET_H +#define IVIEWOPENGLWIDGET_H + +#include "Interfaces/IView/IView.h" +#include <QOpenGLWidget> +#include <QOpenGLTexture> +#include <QOpenGLFunctions> + + +class IViewOpenGLWidget: public QOpenGLWidget, protected QOpenGLFunctions, public IView { + public: + IViewOpenGLWidget(QWidget *parent = 0, IController *controller = 0, IModel *model = 0); + ~IViewOpenGLWidget(); + + void setNewModel(IModel *model); + + public Q_SLOTS: + virtual void getNotified() = 0; + + protected: + void connectModelView(); + void initializeGL() override; +}; + +#endif // IVIEWOPENGLWIDGET_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IViewTrackedComponent.cpp b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IViewTrackedComponent.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ec38b2cc48a127f3ec998d0fa7e7a526e6f8e1dc --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IViewTrackedComponent.cpp @@ -0,0 +1,23 @@ +#include "IViewTrackedComponent.h" + +IViewTrackedComponent::IViewTrackedComponent(QGraphicsItem *parent, IController *controller, IModel *model) : + QGraphicsObject(parent), + IView(controller, model) +{ + +} + +IViewTrackedComponent::~IViewTrackedComponent() +{ + +} + +void IViewTrackedComponent::setNewModel(IModel *model) +{ + +} + +void IViewTrackedComponent::connectModelView() +{ + QObject::connect(getModel(), &IModel::notifyView, this, &IViewTrackedComponent::getNotified); +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IViewTrackedComponent.h b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IViewTrackedComponent.h new file mode 100644 index 0000000000000000000000000000000000000000..babf700fc50d300f256933e9cf154c34b09e7e8e --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IViewTrackedComponent.h @@ -0,0 +1,26 @@ +#ifndef IVIEWTRACKEDCOMPONENT_H +#define IVIEWTRACKEDCOMPONENT_H + +#include "IView.h" +#include "QGraphicsObject" + +class IViewTrackedComponent : public QGraphicsObject, public IView +{ + Q_OBJECT +public: + IViewTrackedComponent(QGraphicsItem *parent = 0, IController *controller = 0, IModel *model = 0); + ~IViewTrackedComponent(); + + // IView interface +public: + void setNewModel(IModel *model) override; + +protected: + void connectModelView() override; + +public Q_SLOTS: + virtual void getNotified() = 0; + +}; + +#endif // IVIEWTRACKEDCOMPONENT_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IViewWidget.cpp b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IViewWidget.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3b587fe058da93374e6999fed00cbe9210539ab3 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IViewWidget.cpp @@ -0,0 +1,19 @@ +#include "IViewWidget.h" + +IViewWidget::IViewWidget(QWidget *parent, IController *controller, IModel *model): + QWidget(parent), + IView(controller) { + setNewModel(model); +} + +void IViewWidget::setNewModel(IModel *model) { + setModel(model); + + if (getModel() != nullptr) { + connectModelView(); + } +} + +void IViewWidget::connectModelView() { + QObject::connect(getModel(), &IModel::notifyView, this, &IViewWidget::getNotified); +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IViewWidget.h b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IViewWidget.h new file mode 100644 index 0000000000000000000000000000000000000000..375ffd45756dd8e56cc44290f64bba84ec8da51f --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Interfaces/IView/IViewWidget.h @@ -0,0 +1,21 @@ +#ifndef IVIEWWIDGET_H +#define IVIEWWIDGET_H + +#include <QWidget> +#include "Interfaces/IView/IView.h" + +class IViewWidget : public QWidget, public IView { + Q_OBJECT + public: + explicit IViewWidget(QWidget *parent = 0, IController *controller = 0, IModel *model = 0); + + void setNewModel(IModel *model); + + public Q_SLOTS: + virtual void getNotified() = 0; + + private: + void connectModelView(); +}; + +#endif // IVIEWWIDGET_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Model/BioTracker3ImageStream.cpp b/BioTrackerQt/Source/BioTrackerQt/Model/BioTracker3ImageStream.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e26f8d7bfd91a59c38bfb2d98139159e84a82581 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Model/BioTracker3ImageStream.cpp @@ -0,0 +1,317 @@ +#include "BioTracker3ImageStream.h" + +#include "util/stdext.h" +#include <cassert> // assert +#include <stdexcept> // std::invalid_argument + +#include "Exceptions.h" + +namespace BioTracker { +namespace Core { + +BioTracker3ImageStream::BioTracker3ImageStream(QObject *parent) : QObject(parent), + m_current_frame(cv::Size(0,0), CV_8UC3), + m_current_frame_number(0) { + +} + +size_t BioTracker3ImageStream::currentFrameNumber() const { + return m_current_frame_number; +} + +const cv::Mat &BioTracker3ImageStream::currentFrame() const { + return m_current_frame; +} + +bool BioTracker3ImageStream::setFrameNumber(size_t frame_number) { + // valid new frame number + if (frame_number < this->numFrames()) { + // skip update if frame number doesn't change + if (frame_number == this->currentFrameNumber()) { + return true; + } else { + const bool success = this->setFrameNumber_impl(frame_number); + m_current_frame_number = frame_number; + return success; + } + } + // invalid new frame number + else { + this->clearImage(); + return false; + } +} + +bool BioTracker3ImageStream::lastFrame() const { + return this->currentFrameNumber() + 1 == this->numFrames(); +} + +bool BioTracker3ImageStream::end() const { + return this->currentFrameNumber() >= this->numFrames(); +} + +bool BioTracker3ImageStream::currentFrameIsEmpty() const { + return this->currentFrame().empty(); +} + +bool BioTracker3ImageStream::nextFrame() { + const size_t new_frame_number = this->currentFrameNumber() + 1; + if (new_frame_number < this->numFrames()) { + const bool success = this->nextFrame_impl(); + m_current_frame_number = new_frame_number; + return success; + } else { + this->clearImage(); + return false; + } +} + +bool BioTracker3ImageStream::previousFrame() { + if (this->currentFrameNumber() > 0) { + const size_t new_frame_numer = this->currentFrameNumber() - 1; + const bool success = this->previousFrame_impl(); + m_current_frame_number = new_frame_numer; + return success; + } else { + this->clearImage(); + return false; + } +} + +void BioTracker3ImageStream::set_current_frame(const cv::Mat &img) { + m_current_frame = img; +} + +void BioTracker3ImageStream::clearImage() { + m_current_frame.release(); + m_current_frame_number = this->numFrames(); +} + +bool BioTracker3ImageStream::nextFrame_impl() { + assert(this->currentFrameNumber() + 1 < this->numFrames()); + const size_t new_frame_number = this->currentFrameNumber() + 1; + return this->setFrameNumber_impl(new_frame_number); +} + +bool BioTracker3ImageStream::previousFrame_impl() { + assert(this->currentFrameNumber() > 0); + const size_t new_frame_number = this->currentFrameNumber() - 1; + return this->setFrameNumber_impl(new_frame_number); +} + +BioTracker3ImageStream::~BioTracker3ImageStream() = default; + + +/*********************************************************/ + + +class ImageStream3NoMedia : public BioTracker3ImageStream { + public: + explicit ImageStream3NoMedia() = default; + virtual GuiParam::MediaType type() const override { + return GuiParam::MediaType::NoMedia; + } + virtual size_t numFrames() const override { + return 0; + } + virtual double fps() const override { + return 1.0; + } + virtual std::string currentFilename() const override { + return "No Media"; // TODO make this nicer.. + } + + private: + virtual bool setFrameNumber_impl(size_t) override { + return false; + } +}; + + +/*********************************************************/ + + +class ImageStream3Pictures : public BioTracker3ImageStream { + public: + explicit ImageStream3Pictures(std::vector<boost::filesystem::path> picture_files) + : m_picture_files(std::move(picture_files)) { + // load first image + if (this->numFrames() > 0) { + this->setFrameNumber_impl(0); + } + } + virtual GuiParam::MediaType type() const override { + return GuiParam::MediaType::Images; + } + virtual size_t numFrames() const override { + return m_picture_files.size(); + } + virtual double fps() const override { + return 1.0; + } + virtual std::string currentFilename() const override { + assert(currentFrameNumber() < m_picture_files.size()); + return m_picture_files[currentFrameNumber()].string(); + } + + private: + virtual bool setFrameNumber_impl(size_t frame_number) override { + const std::string &filename = m_picture_files[frame_number].string(); + const cv::Mat new_frame = cv::imread(filename); + this->set_current_frame(new_frame); + return ! new_frame.empty(); + } + std::vector<boost::filesystem::path> m_picture_files; +}; + + +/*********************************************************/ + + +class ImageStream3Video : public BioTracker3ImageStream { + public: + /** + * @throw file_not_found when the file does not exists + * @throw video_open_error when there is an error with the video + * @brief ImageStreamVideo + * @param filename path to the file + */ + explicit ImageStream3Video(const boost::filesystem::path &filename) + : m_capture(filename.string()) + , m_num_frames(static_cast<size_t>(m_capture.get(CV_CAP_PROP_FRAME_COUNT))) + , m_fps(m_capture.get(CV_CAP_PROP_FPS)) + , m_fileName(filename.string()) { + if (!boost::filesystem::exists(filename)) { + throw file_not_found("Could not find file " + filename.string()); + } + if (! m_capture.isOpened()) { + throw video_open_error(":("); + } + // load first image + if (this->numFrames() > 0) { + this->nextFrame_impl(); + } + } + virtual GuiParam::MediaType type() const override { + return GuiParam::MediaType::Video; + } + virtual size_t numFrames() const override { + return m_num_frames; + } + virtual double fps() const override { + return m_fps; + } + virtual std::string currentFilename() const override { + return m_fileName; + } + + private: + virtual bool nextFrame_impl() override { + cv::Mat new_frame; + m_capture >> new_frame; + this->set_current_frame(new_frame); + return ! new_frame.empty(); + } + + virtual bool setFrameNumber_impl(size_t frame_number) override { + // new frame is next frame --> use next frame function + if (this->currentFrameNumber() + 1 == frame_number) { + return this->nextFrame_impl(); + } else { + // adjust frame position ("0-based index of the frame to be decoded/captured next.") + m_capture.set(CV_CAP_PROP_POS_FRAMES, static_cast<double>(frame_number)); + return this->nextFrame_impl(); + } + } + + cv::VideoCapture m_capture; + const size_t m_num_frames; + const double m_fps; + const std::string m_fileName; +}; + + +/*********************************************************/ + +class ImageStream3Camera : public BioTracker3ImageStream { + public: + /** + * @throw file_not_found when device does not exists + * @throw device_open_error when there is an error with the device + * @brief ImageStreamCamera + * @param device_id according to the VideoCapture class of OpenCV + */ + explicit ImageStream3Camera(int device_id) + : m_capture(device_id) + , m_fps(m_capture.get(CV_CAP_PROP_FPS)) { + if (! m_capture.isOpened()) { + throw device_open_error(":("); + } + // load first image + if (this->numFrames() > 0) { + this->nextFrame_impl(); + } + } + virtual GuiParam::MediaType type() const override { + return GuiParam::MediaType::Camera; + } + virtual size_t numFrames() const override { + return 10000; + } + virtual double fps() const override { + return m_fps; + } + virtual std::string currentFilename() const override { + return "Camera"; // TODO be more specific! + } + + private: + virtual bool nextFrame_impl() override { + cv::Mat new_frame; + m_capture.grab(); + m_capture.retrieve(new_frame); + this->set_current_frame(new_frame); + return ! new_frame.empty(); + } + + virtual bool setFrameNumber_impl(size_t) override { +// throw std::runtime_error("setFrameNumber not available for ImageStreamCamera"); + this->nextFrame_impl(); + return true; + } + + cv::VideoCapture m_capture; + const double m_fps; +}; + +/*********************************************************/ + + +std::shared_ptr<BioTracker3ImageStream> make_ImageStream3NoMedia() { + return std::make_shared<ImageStream3NoMedia>(); +} + +std::shared_ptr<BioTracker3ImageStream> make_ImageStream3Pictures( + std::vector<boost::filesystem::path> filenames) { + return std::make_shared<ImageStream3Pictures>(std::move(filenames)); +} + +std::shared_ptr<BioTracker3ImageStream> make_ImageStream3Video(const boost::filesystem::path + &filename) { + try { + return std::make_shared<ImageStream3Video>(filename); + } catch (const video_open_error &) { + return make_ImageStream3NoMedia(); + } +} + +std::shared_ptr<BioTracker3ImageStream> make_ImageStream3Camera(int device) { + try { + return std::make_shared<ImageStream3Camera>(device); + } catch (const device_open_error &) { + return make_ImageStream3NoMedia(); + } +} + +} +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Model/BioTracker3ImageStream.h b/BioTrackerQt/Source/BioTrackerQt/Model/BioTracker3ImageStream.h new file mode 100644 index 0000000000000000000000000000000000000000..e68929067e9c8b445bdb80bb77a8974fc1b0d6e7 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Model/BioTracker3ImageStream.h @@ -0,0 +1,137 @@ +#ifndef BIOTRACKER3IMAGESTREAM_H +#define BIOTRACKER3IMAGESTREAM_H + +#include <memory> // std::unique_ptr +#include <opencv2/opencv.hpp> // cv::Mat +#include <vector> // std::vector +#include <string> // std::string +#include <boost/filesystem.hpp> +#include <QObject> + +#include "settings/ParamNames.h" // GUIPARAM::MediaType + +namespace BioTracker { +namespace Core { + +class BioTracker3ImageStream : public QObject { + Q_OBJECT + public: + explicit BioTracker3ImageStream(QObject *parent = 0); + + /** + * @return the stream's MediaType i.e. "Video", "Images", "NoMedia" + */ + virtual GuiParam::MediaType type() const = 0; + + /** + * @return the total number of frames + */ + virtual size_t numFrames() const = 0; + + /** + * @return the current frame number + */ + size_t currentFrameNumber() const; + + /** + * @return true, if the current frame is the last frame + */ + bool lastFrame() const; + + /** + * @return true, if the stream's end is reached; i.e. current frame points behind it's last frame + */ + bool end() const; + + /** + * @return true, if currentFrame().empty(); + */ + bool currentFrameIsEmpty() const; + + /** + * @return the media's fps rate + */ + virtual double fps() const = 0; + + /** + * @return the filename of the current file defined through the frameNumber + */ + virtual std::string currentFilename() const = 0; + + /** + * returns the current frame. + * - if the current frame position is invalid or an error occurred, an empty image is returned. + */ + const cv::Mat ¤tFrame() const; + + /** + * sets the current frame number and updates the current frame. + * - if frame_number is invalid, the current frame is invalidated. + * @return true if the operation was successful, i.e. the frame number is valid and no error occurred. + */ + bool setFrameNumber(size_t frame_number); + + /** + * advances the current frame frame. + * - if this function is called on the media's last frame, the current frame is invalidated. + * @return true if the operation was successful, i.e. the current frame isn't the last frame and no error occurred. + */ + bool nextFrame(); + + /** + * sets the current frame position to the previous frame. + * - if this function is called on the media's first frame, the current frame is invalidated. + * @return true if the operation was successful, i.e. the current frame isn't the first one and no error occurred. + */ + bool previousFrame(); + + virtual ~BioTracker3ImageStream(); + + protected: + /** + * sets the image returned by this->currentFrame(); + */ + void set_current_frame(const cv::Mat &img); + + private: + /** + * empties m_current_frame & sets m_current_frame_number to this->numFrames(); + */ + void clearImage(); + /** + * - called by ImageStreamImpl::setFrameNumber + * if frame_number < numFrames() && frame_number != this->currentFrameNumber(); + * - m_current_frame_number is updated afterwards + */ + virtual bool setFrameNumber_impl(size_t frame_number) = 0; + /** + * - called by ImageStreamImpl::nextFrame() + * if currentFrameNumber() + 1 < numFrames(); + * - m_current_frame_number is updated afterwards + */ + virtual bool nextFrame_impl(); + /** + * - called by ImageStreamImpl::previousFrame() + * if currentFrameNumber() > 0; + * - m_current_frame_number is updated afterwards + */ + virtual bool previousFrame_impl(); + + cv::Mat m_current_frame; + size_t m_current_frame_number; +}; + +std::shared_ptr<BioTracker3ImageStream> make_ImageStream3NoMedia(); + +std::shared_ptr<BioTracker3ImageStream> make_ImageStream3Pictures( + std::vector<boost::filesystem::path> filenames); + +std::shared_ptr<BioTracker3ImageStream> make_ImageStream3Video(const boost::filesystem::path + &filename); + +std::shared_ptr<BioTracker3ImageStream> make_ImageStream3Camera(int device); + +} +} + +#endif // BIOTRACKER3IMAGESTREAM_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Model/BioTracker3Player.cpp b/BioTrackerQt/Source/BioTrackerQt/Model/BioTracker3Player.cpp new file mode 100644 index 0000000000000000000000000000000000000000..88e4e6d20343314f69e921e47db86fa6ca436265 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Model/BioTracker3Player.cpp @@ -0,0 +1,130 @@ +#include "BioTracker3Player.h" + +#include "PlayerStates/PStatePlay.h" +#include "PlayerStates/PStateInitialStream.h" +#include "PlayerStates/PStateStepForw.h" +#include "PlayerStates/PStateInitial.h" +#include "PlayerStates/PStatePause.h" +#include "PlayerStates/PStateStepBack.h" +#include "PlayerStates/PStateWait.h" + +BioTracker3Player::BioTracker3Player(QObject *parent) : + IModel(parent), + m_ImageStream(BioTracker::Core::make_ImageStream3NoMedia()) { + + m_States.insert(IPlayerState::PLAYER_STATES::STATE_INITIAL, (new PStateInitial(this, m_ImageStream))); + m_States.insert(IPlayerState::PLAYER_STATES::STATE_INITIAL_STREAM, (new PStateInitialStream(this, m_ImageStream))); + m_States.insert(IPlayerState::PLAYER_STATES::STATE_STEP_FORW, (new PStateStepForw(this, m_ImageStream))); + m_States.insert(IPlayerState::PLAYER_STATES::STATE_PLAY, (new PStatePlay(this, m_ImageStream))); + m_States.insert(IPlayerState::PLAYER_STATES::STATE_PAUSE, (new PStatePause(this,m_ImageStream))); + m_States.insert(IPlayerState::PLAYER_STATES::STATE_STEP_BACK, (new PStateStepBack(this, m_ImageStream))); + m_States.insert(IPlayerState::PLAYER_STATES::STATE_WAIT, (new PStateWait(this, m_ImageStream))); + + QMap<IPlayerState::PLAYER_STATES, IPlayerState *>::iterator i; + for (i = m_States.begin(); i != m_States.end(); ++i) + QObject::connect(i.value(), &IPlayerState::emitStateDone, this, &BioTracker3Player::receiveStateDone); + + setNextState(IPlayerState::PLAYER_STATES::STATE_INITIAL); +} + +void BioTracker3Player::runPlayerOperation() { + + m_CurrentPlayerState->operate(); + + updatePlayerParameter(); + + emitSignals(); +} + +void BioTracker3Player::receiveLoadVideoCommand(QString fileDir) +{ + std::string filenameStr = fileDir.toStdString(); + + boost::filesystem::path filename {filenameStr}; + + std::shared_ptr<BioTracker::Core::BioTracker3ImageStream> stream(BioTracker::Core::make_ImageStream3Video(filename)); + + QMap<IPlayerState::PLAYER_STATES, IPlayerState *>::iterator i; + for (i = m_States.begin(); i != m_States.end(); i++) { + i.value()->changeImageStream(stream); + } + + setNextState(IPlayerState::STATE_INITIAL_STREAM); +} + +void BioTracker3Player::receivePrevFrameCommand() +{ + setNextState(IPlayerState::STATE_STEP_BACK); +} + +void BioTracker3Player::receiveNextFramCommand() +{ + setNextState(IPlayerState::STATE_STEP_FORW); +} + +void BioTracker3Player::receivePauseCommand() +{ + setNextState(IPlayerState::STATE_PAUSE); +} + +void BioTracker3Player::receiveStopCommand() +{ + setNextState(IPlayerState::STATE_INITIAL_STREAM); +} + +void BioTracker3Player::receivePlayCommand() +{ + setNextState(IPlayerState::STATE_PLAY); +} + +void BioTracker3Player::receiveStateDone() +{ +} + + +void BioTracker3Player::updatePlayerParameter() +{ + m_MediaType = m_ImageStream->type(); + m_TotalNumbFrames = m_ImageStream->numFrames(); + m_fps = m_ImageStream->fps(); + m_CurrentFilename = QString::fromStdString( m_ImageStream->currentFilename() ); + + m_Back = m_CurrentPlayerState->getStateForBackward(); + m_Forw = m_CurrentPlayerState->getStateForForward(); + m_Paus = m_CurrentPlayerState->getStateForPause(); + m_Play = m_CurrentPlayerState->getStateForPlay(); + m_Stop = m_CurrentPlayerState->getStateForStop(); + m_CurrentFrame = m_CurrentPlayerState->getCurrentFrame(); + m_CurrentFrameNumber = m_CurrentPlayerState->getCurrentFrameNumber(); + + m_VideoControllsStates.clear(); + m_VideoControllsStates.append(m_Back); + m_VideoControllsStates.append(m_Forw); + m_VideoControllsStates.append(m_Paus); + m_VideoControllsStates.append(m_Play); + m_VideoControllsStates.append(m_Stop); + +} + +void BioTracker3Player::emitSignals() +{ + + Q_EMIT emitVideoControllsStates(m_VideoControllsStates); + Q_EMIT emitMediaType(m_MediaType); + Q_EMIT emitTotalNumbFrames(m_TotalNumbFrames); + Q_EMIT emitCurrentFileName(m_CurrentFilename); + Q_EMIT emitCurrentFrame(m_CurrentFrame, m_NameOfCvMat); + Q_EMIT emitCurrentFrameNumber(m_CurrentFrameNumber); + Q_EMIT emitFPS(m_fps); + + Q_EMIT notifyView(); +} + +void BioTracker3Player::setNextState(IPlayerState::PLAYER_STATES state) { + m_CurrentPlayerState = m_States.value(state); + + Q_EMIT emitPlayerOperationDone(); + +} + + diff --git a/BioTrackerQt/Source/BioTrackerQt/Model/BioTracker3Player.h b/BioTrackerQt/Source/BioTrackerQt/Model/BioTracker3Player.h new file mode 100644 index 0000000000000000000000000000000000000000..8322374a180a22f9d9d81e11987160cb3e00c96e --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Model/BioTracker3Player.h @@ -0,0 +1,82 @@ +#ifndef BIOTRACKER3PLAYER_H +#define BIOTRACKER3PLAYER_H + +#include <QObject> +#include "Interfaces/IModel/imodel.h" +#include "Interfaces/IModel/imodel.h" + +#include "BioTracker3ImageStream.h" +#include <memory> +#include "QString" +#include "QMap" +#include "QThread" +#include "opencv2/core/core.hpp" + +#include "View/BioTracker3VideoControllWidget.h" +#include "View/BioTracker3VideoView.h" + +#include "Interfaces/IStates/IPlayerState.h" + + +class BioTracker3Player : public IModel { + Q_OBJECT + public: + explicit BioTracker3Player(QObject *parent = 0); + + void runPlayerOperation(); + + + void setNextState(IPlayerState::PLAYER_STATES state); + + public Q_SLOTS: + void receiveLoadVideoCommand(QString fileDir); + void receivePrevFrameCommand(); + void receiveNextFramCommand(); + void receivePauseCommand(); + void receiveStopCommand(); + void receivePlayCommand(); + + void receiveStateDone(); + + + Q_SIGNALS: + void emitMediaType(GuiParam::MediaType type); + void emitTotalNumbFrames(size_t num); + void emitCurrentFrameNumber(size_t num); + void emitFPS(double fps); + void emitCurrentFileName(QString name); + void emitCurrentFrame(cv::Mat mat, QString name); + void emitVideoControllsStates(QVector<bool> states); + + void emitPlayerOperationDone(); + + private: + void updatePlayerParameter(); + void emitSignals(); + + + private: + IPlayerState *m_CurrentPlayerState; + QThread m_StateThread; + QMap<IPlayerState::PLAYER_STATES, IPlayerState *> m_States; + std::shared_ptr<BioTracker::Core::BioTracker3ImageStream> m_ImageStream; + + GuiParam::MediaType m_MediaType; + size_t m_TotalNumbFrames; + size_t m_CurrentFrameNumber; + double m_fps; + QString m_CurrentFilename; + cv::Mat m_CurrentFrame; + QVector<bool> m_VideoControllsStates; + + bool m_Play; + bool m_Forw; + bool m_Back; + bool m_Stop; + bool m_Paus; + + QString m_NameOfCvMat = "Original"; +}; + + +#endif // BIOTRACKER3PLAYER_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Model/BioTracker3ProxyMat.cpp b/BioTrackerQt/Source/BioTrackerQt/Model/BioTracker3ProxyMat.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3b17de714975609c1e5001a035f070d923889ebf --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Model/BioTracker3ProxyMat.cpp @@ -0,0 +1,2 @@ +#include "BioTracker3ProxyMat.h" + diff --git a/BioTrackerQt/Source/BioTrackerQt/Model/BioTracker3ProxyMat.h b/BioTrackerQt/Source/BioTrackerQt/Model/BioTracker3ProxyMat.h new file mode 100644 index 0000000000000000000000000000000000000000..d0ca7a537d63db0d18ce5b64ec869b7e1328dee3 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Model/BioTracker3ProxyMat.h @@ -0,0 +1,39 @@ +#ifndef BIOTRACKER3PROXYMAT_H +#define BIOTRACKER3PROXYMAT_H + +#include "Interfaces/IModel/imodel.h" + +#include <boost/optional.hpp> + +#include <opencv2/opencv.hpp> + +class BioTracker3ProxyMat { + public: + BioTracker3ProxyMat(cv::Mat const &mat) + : m_originalMat(mat) { + } + + BioTracker3ProxyMat(const BioTracker3ProxyMat &) = delete; + BioTracker3ProxyMat &operator=(const BioTracker3ProxyMat &) = delete; + + cv::Mat &getMat() { + if (!isModified()) { + m_modifiedMat = m_originalMat.clone(); + } + return m_modifiedMat.get(); + } + + void setMat(cv::Mat mat) { + m_modifiedMat = mat; + } + + bool isModified() const { + return m_modifiedMat.is_initialized(); + } + + private: + cv::Mat const &m_originalMat; + boost::optional<cv::Mat> m_modifiedMat; +}; + +#endif // BIOTRACKER3PROXYMAT_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Model/BioTracker3TextureObject.cpp b/BioTrackerQt/Source/BioTrackerQt/Model/BioTracker3TextureObject.cpp new file mode 100644 index 0000000000000000000000000000000000000000..83a3fff1231296ccf9ac4501331fa14fad17f2ea --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Model/BioTracker3TextureObject.cpp @@ -0,0 +1,55 @@ +#include "BioTracker3TextureObject.h" + +BioTracker3TextureObject::BioTracker3TextureObject(QObject *parent, QString name) : + IModel(parent), + m_Name(name) +{ + // OpenCV's coordinate system originates in the upper left corner. + // OpenGL originates in the lower left. Thus the image has to be flipped vertically + m_texture = QImage(1, 1, QImage::Format_RGB888); +} + +void BioTracker3TextureObject::set(const cv::Mat &img) { + if (img.channels() == 3) { + img.convertTo(img, CV_8UC3); + cv::cvtColor(img, m_img, CV_BGR2RGB); + } else if (img.channels() == 1) { + // convert grayscale to "color" + cv::Mat img8U; + + // we assume that the 1d image has more than 8bit per pixel + // (usually 64F) so we need to map a [HUGE range] to -> [0 .. 255] + double min, max; + cv::minMaxLoc(img, &min, &max); + if (min >= 0 && min < 255 && max > 0 && max <= 255) { + // do not refit if the range is actually inbetween [0 ... 255] + img.convertTo(img8U, CV_8U); + } else if (max > min) { + // otherwise: the range is outside of native [0 ... 255] so we + // actually need to do some refitting + + // mapping 1-step out from [0 .. 255] range 1-step in the [min .. max] range + const double sizeRatio = 256.0/abs(static_cast<int>(max - min)); + const double convertedMin = abs(static_cast<int>(min * sizeRatio)); + img.convertTo(img8U, CV_8U, sizeRatio, convertedMin); + } + cv::cvtColor(img8U, m_img, CV_GRAY2RGB); + } else { + m_img = img; + } + + m_texture = QImage( + m_img.data, + m_img.cols, + m_img.rows, + static_cast<int>(m_img.step), + QImage::Format_RGB888 + ); + + Q_EMIT notifyView(); +} + +QString BioTracker3TextureObject::getName() +{ + return m_Name; +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Model/BioTracker3TextureObject.h b/BioTrackerQt/Source/BioTrackerQt/Model/BioTracker3TextureObject.h new file mode 100644 index 0000000000000000000000000000000000000000..511ce401b8172f8db513d18597d9fe0602111548 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Model/BioTracker3TextureObject.h @@ -0,0 +1,34 @@ +#ifndef BIOTRACKER3TEXTUREOBJECT_H +#define BIOTRACKER3TEXTUREOBJECT_H + +#include "Interfaces/IModel/imodel.h" + +#include <opencv2/opencv.hpp> +#include "QImage" +#include "QString" + +class BioTracker3TextureObject : public IModel { + Q_OBJECT + public: + explicit BioTracker3TextureObject(QObject *parent = 0, QString name = "NoName"); + + void set(cv::Mat const &img); + QString getName(); + + QImage const &get() const { + return m_texture; + } + int width() const { + return m_texture.width(); + } + int height() const { + return m_texture.height(); + } + + private: + QString m_Name; + cv::Mat m_img; + QImage m_texture; +}; + +#endif // BIOTRACKER3TEXTUREOBJECT_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Model/BioTrackerTrackingAlgorithm.cpp b/BioTrackerQt/Source/BioTrackerQt/Model/BioTrackerTrackingAlgorithm.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bef4b8d90950c20e5de309773b988893728e6443 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Model/BioTrackerTrackingAlgorithm.cpp @@ -0,0 +1,26 @@ +#include "BioTrackerTrackingAlgorithm.h" + +BioTrackerTrackingAlgorithm::BioTrackerTrackingAlgorithm(QObject *parent, ITrackedComponentFactory *factory) : + ITrackingAlgorithm(parent) +{ + setTrackedComponentFactory(factory); +} + +void BioTrackerTrackingAlgorithm::doTracking(cv::Mat image) +{ + cv::Mat mat; + cv::applyColorMap(image, mat, cv::COLORMAP_JET); + + Q_EMIT emitCvMatA(mat, QString("tracker")); + +// QString str; +// str.resize(6); +// for (int s = 0; s < 6 ; ++s) { +// str[s] = QChar('A' + char(qrand() % ('Z' - 'A'))); +// } + +// m_TrackedElement = dynamic_cast<TrackedElement *>(m_TrackedComponentFactory->getNewTrackedElement()); +// m_TrackedElement->setObjectName(str); + + +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Model/BioTrackerTrackingAlgorithm.h b/BioTrackerQt/Source/BioTrackerQt/Model/BioTrackerTrackingAlgorithm.h new file mode 100644 index 0000000000000000000000000000000000000000..e312cf9a8b9a3104594890365c9cbb8108cbc982 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Model/BioTrackerTrackingAlgorithm.h @@ -0,0 +1,34 @@ +#ifndef BIOTRACKERTRACKINGALGORITHM_H +#define BIOTRACKERTRACKINGALGORITHM_H +#include "Interfaces/IModel/imodel.h" + +#include "BioTracker3TextureObject.h" + +#include "Interfaces/IModel/ITrackingAlgorithm.h" +#include "Model/TrackedComponents/TrackedElement.h" +#include "Model/TrackedComponents/TrackedTrajectory.h" + +#include <boost/optional.hpp> + +#include <opencv2/opencv.hpp> + + +class BioTrackerTrackingAlgorithm : public ITrackingAlgorithm +{ + Q_OBJECT + public: + BioTrackerTrackingAlgorithm(QObject *parent = 0, ITrackedComponentFactory *factory = 0); + +Q_SIGNALS: + void emitCvMatA(cv::Mat image, QString name); + + // ITrackingAlgorithm interface + public Q_SLOTS: + void doTracking(cv::Mat image) override; + + +private: + TrackedElement *m_TrackedElement; +}; + +#endif // BIOTRACKERTRACKINGALGORITHM_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStateInitial.cpp b/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStateInitial.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3dfd756816e31788acfca63aa7ccc409a9c24239 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStateInitial.cpp @@ -0,0 +1,24 @@ +#include "PStateInitial.h" +#include "Model/BioTracker3Player.h" + +PStateInitial::PStateInitial(BioTracker3Player *player, + std::shared_ptr<BioTracker::Core::BioTracker3ImageStream> imageStream) : + IPlayerState(player, imageStream) { + operate(); +} + +void PStateInitial::operate() { + + m_Play = false; + m_Forw = false; + m_Back = false; + m_Stop = false; + m_Paus = false; + + m_Mat = cv::Mat(320, 240, CV_8UC3, cv::Scalar(0,0,0)); + m_FrameNumber = 0; + + // Q_EMIT emitStateDone(); + + // m_Player->setNextState(IPlayerState::STATE_WAIT); +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStateInitial.h b/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStateInitial.h new file mode 100644 index 0000000000000000000000000000000000000000..01614850308572cfd8f3ddce75f889ea96bf9a06 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStateInitial.h @@ -0,0 +1,15 @@ +#ifndef PSTATEINITIAL_H +#define PSTATEINITIAL_H + +#include "Interfaces/IStates/IPlayerState.h" + +class PStateInitial : public IPlayerState { + public: + PStateInitial(BioTracker3Player *player, std::shared_ptr<BioTracker::Core::BioTracker3ImageStream> imageStream); + + // IPlayerState interface + public Q_SLOTS: + void operate() override; +}; + +#endif // PSTATEINITIAL_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStateInitialStream.cpp b/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStateInitialStream.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b5789f8a05dd18942451dc1ad538e0166038e54c --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStateInitialStream.cpp @@ -0,0 +1,29 @@ +#include "PStateInitialStream.h" +#include "Model/BioTracker3Player.h" + +PStateInitialStream::PStateInitialStream(BioTracker3Player *player, + std::shared_ptr<BioTracker::Core::BioTracker3ImageStream> imageStream) : + IPlayerState(player, imageStream) { + +} + +void PStateInitialStream::operate() { + + m_Play = true; + m_Forw = true; + m_Back = false; + m_Stop = false; + m_Paus = false; + + bool xval = false; + xval = m_ImageStream->setFrameNumber(0); + + if (xval) { + m_Mat = m_ImageStream->currentFrame(); + m_FrameNumber = m_ImageStream->currentFrameNumber(); + } + + //Q_EMIT emitStateDone(); + +// m_Player->setNextState(IPlayerState::STATE_WAIT); +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStateInitialStream.h b/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStateInitialStream.h new file mode 100644 index 0000000000000000000000000000000000000000..128303dec56f59b7f2b02191889995d98714cfce --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStateInitialStream.h @@ -0,0 +1,15 @@ +#ifndef PSTATEINITIALSTREAM_H +#define PSTATEINITIALSTREAM_H + +#include "Interfaces/IStates/IPlayerState.h" + +class PStateInitialStream : public IPlayerState { + public: + PStateInitialStream(BioTracker3Player *player, std::shared_ptr<BioTracker::Core::BioTracker3ImageStream> imageStream); + + // IPlayerState interface + public Q_SLOTS: + void operate() override; +}; + +#endif // INITIALVIDEOSTATE_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStatePause.cpp b/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStatePause.cpp new file mode 100644 index 0000000000000000000000000000000000000000..03ca945f4a7229c34e575d1641149232a0a00fa9 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStatePause.cpp @@ -0,0 +1,24 @@ +#include "PStatePause.h" +#include "Model/BioTracker3Player.h" + +PStatePause::PStatePause(BioTracker3Player *player, + std::shared_ptr<BioTracker::Core::BioTracker3ImageStream> imageStream) : + IPlayerState(player, imageStream) { + +} + +void PStatePause::operate() { + + m_Play = true; + m_Forw = true; + m_Back = true; + m_Stop = true; + m_Paus = false; + + m_Mat = m_ImageStream->currentFrame(); + m_FrameNumber = m_ImageStream->currentFrameNumber(); + + // Q_EMIT emitStateDone(); + +// m_Player->setNextState(IPlayerState::STATE_WAIT); +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStatePause.h b/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStatePause.h new file mode 100644 index 0000000000000000000000000000000000000000..43f3be00ad486bab6af60ebcc3cb216b775b4174 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStatePause.h @@ -0,0 +1,17 @@ +#ifndef PSTATEPAUSE_H +#define PSTATEPAUSE_H + +#include "Interfaces/IStates/IPlayerState.h" + + +class PStatePause : public IPlayerState { + public: + PStatePause(BioTracker3Player *player, std::shared_ptr<BioTracker::Core::BioTracker3ImageStream> imageStream); + + // IPlayerState interface + public Q_SLOTS: + void operate() override; + +}; + +#endif // PSTATEPAUSE_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStatePlay.cpp b/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStatePlay.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5c53f94fddc715d3b9d1c49de8abb13e80842b06 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStatePlay.cpp @@ -0,0 +1,43 @@ +#include "PStatePlay.h" +#include "Model/BioTracker3Player.h" +#include "QTimer" + +PStatePlay::PStatePlay(BioTracker3Player *player, + std::shared_ptr<BioTracker::Core::BioTracker3ImageStream> imageStream) : + IPlayerState(player, imageStream) { + +} + +void PStatePlay::operate() { + +// QTimer *timer = new QTimer(this); + +// timer->start(1000); + +// while(timer->isActive()); + + + m_Play = true; + m_Forw = false; + m_Back = false; + m_Stop = true; + m_Paus = true; + + bool isLastFrame = m_ImageStream->lastFrame(); + IPlayerState::PLAYER_STATES nextState = IPlayerState::STATE_INITIAL; + + if (!isLastFrame) { + m_ImageStream->nextFrame(); + m_Mat = m_ImageStream->currentFrame(); + m_FrameNumber = m_ImageStream->currentFrameNumber(); + nextState = IPlayerState::STATE_PLAY; + } + else { + nextState = IPlayerState::STATE_INITIAL_STREAM; + } + + + m_Player->setNextState(nextState); + +// Q_EMIT emitStateDone(); +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStatePlay.h b/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStatePlay.h new file mode 100644 index 0000000000000000000000000000000000000000..048efcb37a5257a2ce80c3e65b9f57816f035305 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStatePlay.h @@ -0,0 +1,16 @@ +#ifndef PSTATEPLAY_H +#define PSTATEPLAY_H + +#include "Interfaces/IStates/IPlayerState.h" + + +class PStatePlay : public IPlayerState { + public: + PStatePlay(BioTracker3Player *player, std::shared_ptr<BioTracker::Core::BioTracker3ImageStream> imageStream); + + // IPlayerState interface + public Q_SLOTS: + void operate() override; +}; + +#endif // PSTATEPLAY_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStateStepBack.cpp b/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStateStepBack.cpp new file mode 100644 index 0000000000000000000000000000000000000000..91b261afe2263ce7d2e6997bcb1be61e00e427ff --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStateStepBack.cpp @@ -0,0 +1,36 @@ +#include "PStateStepBack.h" +#include "Model/BioTracker3Player.h" + +PStateStepBack::PStateStepBack(BioTracker3Player *player, + std::shared_ptr<BioTracker::Core::BioTracker3ImageStream> imageStream) : + IPlayerState(player, imageStream) { + +} + +void PStateStepBack::operate() { + + m_Play = true; + m_Forw = true; + m_Stop = true; + m_Paus = false; + + + if (m_ImageStream->previousFrame()) { + m_Mat = m_ImageStream->currentFrame(); + m_FrameNumber = m_ImageStream->currentFrameNumber(); + } + + bool stateBack = false; + if (m_FrameNumber <= 0) { + stateBack = false; + } else { + stateBack = true; + } + + m_Back = stateBack; + +// Q_EMIT emitStateDone(); + +// m_Player->setNextState(IPlayerState::STATE_WAIT); + +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStateStepBack.h b/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStateStepBack.h new file mode 100644 index 0000000000000000000000000000000000000000..39ae053f80e389aa55470d06051ad1a2b94cf3e6 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStateStepBack.h @@ -0,0 +1,16 @@ +#ifndef PSTATESTEPBACK_H +#define PSTATESTEPBACK_H + +#include "Interfaces/IStates/IPlayerState.h" + + +class PStateStepBack : public IPlayerState { + public: + PStateStepBack(BioTracker3Player *player, std::shared_ptr<BioTracker::Core::BioTracker3ImageStream> imageStream); + + // IPlayerState interface + public Q_SLOTS: + void operate() override; +}; + +#endif // PSTATESTEPBACK_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStateStepForw.cpp b/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStateStepForw.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bc7f65bb3f719c444e239c32ced8a3d028a1d655 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStateStepForw.cpp @@ -0,0 +1,35 @@ +#include "PStateStepForw.h" +#include "Model/BioTracker3Player.h" + +PStateStepForw::PStateStepForw(BioTracker3Player *player, + std::shared_ptr<BioTracker::Core::BioTracker3ImageStream> imageStream) : + IPlayerState(player, imageStream) { + +} + +void PStateStepForw::operate() { + + m_Play = true; + m_Back = true; + m_Stop = true; + m_Paus = false; + + + if (m_ImageStream->nextFrame()) { + m_Mat = m_ImageStream->currentFrame(); + m_FrameNumber = m_ImageStream->currentFrameNumber(); + } + + bool stateFw = false; + if (m_ImageStream->lastFrame()) { + stateFw = false; + } else { + stateFw = true; + } + + m_Forw = true; + +// Q_EMIT emitStateDone(); + +// m_Player->setNextState(IPlayerState::STATE_WAIT); +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStateStepForw.h b/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStateStepForw.h new file mode 100644 index 0000000000000000000000000000000000000000..df85fd0774b1effa77720cb20d9e72a4aa19ebf1 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStateStepForw.h @@ -0,0 +1,15 @@ +#ifndef PSTATESTEPFORW_H +#define PSTATESTEPFORW_H + +#include "Interfaces/IStates/IPlayerState.h" + +class PStateStepForw : public IPlayerState { + public: + PStateStepForw(BioTracker3Player *player, std::shared_ptr<BioTracker::Core::BioTracker3ImageStream> imageStream); + + // IPlayerState interface + public Q_SLOTS: + void operate() override; +}; + +#endif // PSTATESTEPFORW_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStateWait.cpp b/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStateWait.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fef4f7f243d946422aa7efa6fd6fe591a4657787 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStateWait.cpp @@ -0,0 +1,16 @@ +#include "PStateWait.h" +#include "Model/BioTracker3Player.h" + + +PStateWait::PStateWait(BioTracker3Player *player, + std::shared_ptr<BioTracker::Core::BioTracker3ImageStream> imageStream) : + IPlayerState(player, imageStream) { + +} + +void PStateWait::operate() { + + // Q_EMIT emitStateDone(); + + // Just Wait +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStateWait.h b/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStateWait.h new file mode 100644 index 0000000000000000000000000000000000000000..7317301d68b6c0ad110d3800bd73cc51adcb6d04 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStateWait.h @@ -0,0 +1,16 @@ +#ifndef PSTATEWAIT_H +#define PSTATEWAIT_H + +#include "Interfaces/IStates/IPlayerState.h" + + +class PStateWait : public IPlayerState { + public: + PStateWait(BioTracker3Player *player, std::shared_ptr<BioTracker::Core::BioTracker3ImageStream> imageStream); + + // IPlayerState interface + public Q_SLOTS: + void operate() override; +}; + +#endif // PSTATEWAIT_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStateWaite.cpp.autosave b/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStateWaite.cpp.autosave new file mode 100644 index 0000000000000000000000000000000000000000..257aedaf04d34f8c637f5e5d5274325e151617e7 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStateWaite.cpp.autosave @@ -0,0 +1,13 @@ +#include "PStateWaite.h" + +PStateWait::PStateWait(BioTracker3Player *player, IModel *textureObject, + std::shared_ptr<BioTracker::Core::BioTracker3ImageStream> imageStream) : +IPlayerState(player, textureObject, imageStream) +{ + +} + +void PStateWait::operate() +{ + Q_EMIT operationDone(); +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStateWaite.h.autosave b/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStateWaite.h.autosave new file mode 100644 index 0000000000000000000000000000000000000000..8367f3404e5e88c67384b51a229c9124d3d72205 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Model/PlayerStates/PStateWaite.h.autosave @@ -0,0 +1,17 @@ +#ifndef PSTATEWAITE_H +#define PSTATEWAITE_H + +#include "Interfaces/IPlayerState.h" + + +class PStateWait : public IPlayerState +{ +public: + PStateWait(BioTracker3Player *player, IModel *textureObject, std::shared_ptr<BioTracker::Core::BioTracker3ImageStream> imageStream); + + // IPlayerState interface +public Q_SLOTS: + void operate() override; +}; + +#endif // PSTATEWAITE_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Model/PluginLoader.cpp b/BioTrackerQt/Source/BioTrackerQt/Model/PluginLoader.cpp new file mode 100644 index 0000000000000000000000000000000000000000..997923131151b1415688c5e87be23bcbc3e345af --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Model/PluginLoader.cpp @@ -0,0 +1,13 @@ +#include "PluginLoader.h" + +PluginLoader::PluginLoader(QObject *parent = Q_NULLPTR) : + QPluginLoader(parent) +{ + m_PluginLoader = new QPluginLoader(this); +} + +bool PluginLoader::loadPlugin(QString str) +{ + //m_PluginLoader->load(); + return false; +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Model/PluginLoader.h b/BioTrackerQt/Source/BioTrackerQt/Model/PluginLoader.h new file mode 100644 index 0000000000000000000000000000000000000000..28819230fbb4905db585436309d2fea260204c3f --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Model/PluginLoader.h @@ -0,0 +1,18 @@ +#ifndef PLUGINLOADER_H +#define PLUGINLOADER_H + +#include "QPluginLoader" +#include "QPointer" + +class PluginLoader : public QPluginLoader +{ +public: + PluginLoader(QObject *parent); + + bool loadPlugin(QString str); + +private: + QPointer<QPluginLoader> m_PluginLoader; +}; + +#endif // PLUGINLOADER_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Model/TrackedComponents/TrackedComponentFactory.cpp b/BioTrackerQt/Source/BioTrackerQt/Model/TrackedComponents/TrackedComponentFactory.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0a8c905930161b80a6398d296aaf78730c4762b8 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Model/TrackedComponents/TrackedComponentFactory.cpp @@ -0,0 +1,24 @@ +#include "TrackedComponentFactory.h" + +#include "TrackedTrajectory.h" +#include "TrackedElement.h" + +TrackedComponentFactory::TrackedComponentFactory() +{ + +} + +TrackedComponentFactory::~TrackedComponentFactory() +{ + +} + +ITrackedComponent *TrackedComponentFactory::createTrackedElement() +{ + return new TrackedElement(this, "n.a."); +} + +ITrackedComponent *TrackedComponentFactory::createTrackedObject() +{ + return new TrackedTrajectory(); +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Model/TrackedComponents/TrackedComponentFactory.h b/BioTrackerQt/Source/BioTrackerQt/Model/TrackedComponents/TrackedComponentFactory.h new file mode 100644 index 0000000000000000000000000000000000000000..b44534ef370bfe7000c4f89c08f8b2f1471294e5 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Model/TrackedComponents/TrackedComponentFactory.h @@ -0,0 +1,19 @@ +#ifndef TRACKEDCOMPONENTFACTORY_H +#define TRACKEDCOMPONENTFACTORY_H + +#include "Interfaces/IModel/ITrackedComponentFactory.h" + +class TrackedComponentFactory : public ITrackedComponentFactory +{ + Q_OBJECT +public: + TrackedComponentFactory(); + ~TrackedComponentFactory(); + + // ITrackedComponentFactory interface +protected: + ITrackedComponent *createTrackedElement() override; + ITrackedComponent *createTrackedObject() override; +}; + +#endif // TRACKEDOBJECTFACTORY_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Model/TrackedComponents/TrackedElement.cpp b/BioTrackerQt/Source/BioTrackerQt/Model/TrackedComponents/TrackedElement.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1a60ca6c9e860b0d255fa9bf192fcd007952d96e --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Model/TrackedComponents/TrackedElement.cpp @@ -0,0 +1,66 @@ +#include "TrackedElement.h" +#include "QDebug" +#include "QRect" +#include "QBrush" +#include "QPainter" + +TrackedElement::TrackedElement(QObject *parent, QString name) : + ITrackedComponent(parent), + name(name) +{ + x = 100; + y = 80; + mPressed = false; +} + +QString TrackedElement::getName() +{ + return name; +} + +void TrackedElement::setX(int val) +{ + x = val; + Q_EMIT notifyView(); + +} + +void TrackedElement::setY(int val) +{ + y = val; + Q_EMIT notifyView(); + +} + +void TrackedElement::pressed() +{ + mPressed = true; + Q_EMIT notifyView(); + +} + +void TrackedElement::notPressed() +{ + mPressed = false; + Q_EMIT notifyView(); +} + +int TrackedElement::getX() +{ + return x; +} + +int TrackedElement::getY() +{ + return y; +} + +bool TrackedElement::getPressedStatus() +{ + return mPressed; +} + +void TrackedElement::operate() +{ + qDebug() << "I am TrackedElement " << name; +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Model/TrackedComponents/TrackedElement.h b/BioTrackerQt/Source/BioTrackerQt/Model/TrackedComponents/TrackedElement.h new file mode 100644 index 0000000000000000000000000000000000000000..4a7f962ad391844355901b3f13799818a1de6643 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Model/TrackedComponents/TrackedElement.h @@ -0,0 +1,38 @@ +#ifndef TRACKEDELEMENT_H +#define TRACKEDELEMENT_H + +#include "QGraphicsItem" +#include "Interfaces/IModel/ITrackedComponent.h" +#include "QString" + +class TrackedElement : public ITrackedComponent +{ + Q_OBJECT + + public: + TrackedElement(QObject *parent = 0, QString name = "n.a."); + + QString getName(); + + void setX(int val); + void setY(int val); + void pressed(); + void notPressed(); + + int getX(); + int getY(); + bool getPressedStatus(); + + // ITrackedComponent interface +public: + void operate(); + +private: + QString name; + int x; + int y; + + bool mPressed; +}; + +#endif // TRACKEDELEMENT_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Model/TrackedComponents/TrackedTrajectory.cpp b/BioTrackerQt/Source/BioTrackerQt/Model/TrackedComponents/TrackedTrajectory.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e5a5997309c9a03fc6788102f930e8864d49c9aa --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Model/TrackedComponents/TrackedTrajectory.cpp @@ -0,0 +1,40 @@ +#include "TrackedTrajectory.h" +#include "QDebug" +#include "TrackedElement.h" + +TrackedTrajectory::TrackedTrajectory(QObject *parent, QString name) : + ITrackedTrajectory(parent), + name(name) +{ + +} + +void TrackedTrajectory::operate() +{ + qDebug() << "Printing all TrackedElements in TrackedObject " << name; + qDebug() << "========================= Begin =========================="; + for (int i = 0; i < m_TrackedComponents.size(); ++i) { + dynamic_cast<TrackedElement *>(m_TrackedComponents.at(i))->operate(); + } + qDebug() << "======================== End ========================="; +} + +void TrackedTrajectory::add(ITrackedComponent *comp) +{ + m_TrackedComponents.append(comp); +} + +void TrackedTrajectory::remove(ITrackedComponent *comp) +{ + m_TrackedComponents.removeOne(comp); +} + +ITrackedComponent* TrackedTrajectory::getChild(int index) +{ + return m_TrackedComponents.at(index); +} + +int TrackedTrajectory::numberOfChildrean() +{ + return m_TrackedComponents.size(); +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Model/TrackedComponents/TrackedTrajectory.h b/BioTrackerQt/Source/BioTrackerQt/Model/TrackedComponents/TrackedTrajectory.h new file mode 100644 index 0000000000000000000000000000000000000000..7eac50b088ad263c949829ac36d36aa82bc9253c --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Model/TrackedComponents/TrackedTrajectory.h @@ -0,0 +1,32 @@ +#ifndef TRACKEDOTRAJECTORY_H +#define TRACKEDOTRAJECTORY_H + +#include "Interfaces/IModel/ITrackedTrajectory.h" +#include "QList" +#include "QString" + + +class TrackedTrajectory : public ITrackedTrajectory { + Q_OBJECT + + public: + TrackedTrajectory(QObject *parent = 0, QString name = "n.a."); + + // ITrackedComponent interface +public: + void operate(); + + // ITrackedObject interface +public: + void add(ITrackedComponent *comp) override; + void remove(ITrackedComponent *comp) override; + ITrackedComponent *getChild(int index) override; + int numberOfChildrean(); + +private: + QList<ITrackedComponent*> m_TrackedComponents; + + QString name; +}; + +#endif // TRACKEDOTRAJECTORY_H diff --git a/BioTrackerQt/Source/BioTrackerQt/Model/null_Model.cpp b/BioTrackerQt/Source/BioTrackerQt/Model/null_Model.cpp new file mode 100644 index 0000000000000000000000000000000000000000..db2793d0195a5d1ce8905db2a5496bf564288d16 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Model/null_Model.cpp @@ -0,0 +1,6 @@ +#include "null_Model.h" + +null_Model::null_Model() +{ + +} diff --git a/BioTrackerQt/Source/BioTrackerQt/Model/null_Model.h b/BioTrackerQt/Source/BioTrackerQt/Model/null_Model.h new file mode 100644 index 0000000000000000000000000000000000000000..eae7c4312175077999502feb601607e6e3424c76 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/Model/null_Model.h @@ -0,0 +1,13 @@ +#ifndef NULL_MODEL_H +#define NULL_MODEL_H + +#include "Interfaces/IModel/imodel.h" + +class null_Model : public IModel +{ + Q_OBJECT +public: + null_Model(); +}; + +#endif // NULL_MODEL_H diff --git a/BioTrackerQt/Source/BioTrackerQt/PanZoomState.h b/BioTrackerQt/Source/BioTrackerQt/PanZoomState.h new file mode 100644 index 0000000000000000000000000000000000000000..e273fc3d47ba76471b361dde2147939993fc66b7 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/PanZoomState.h @@ -0,0 +1,32 @@ +#pragma once + +#include "boost/optional.hpp" + +namespace BioTracker { +namespace Core { + +/** +* @brief Used to store mouse cursor offsets while panning. +*/ +struct CurrentPanState { + QPointF lastPos; + + CurrentPanState(const QPointF lastPos) + : lastPos(lastPos) { + } +}; + +/** + * @brief Stores the current zoom and pan offsets. While panning, panState stores the last mouse cursor position. + */ +struct PanZoomState { + float zoomFactor = 0.f; + float panX = 0.f; + float panY = 0.f; + bool isChanged = false; + + boost::optional<CurrentPanState> panState; +}; + +} +} diff --git a/BioTrackerQt/Source/BioTrackerQt/View/BioTracker3MainWindow.cpp b/BioTrackerQt/Source/BioTrackerQt/View/BioTracker3MainWindow.cpp new file mode 100644 index 0000000000000000000000000000000000000000..809bc6adb13af512932d2064948e6ba10025b661 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/View/BioTracker3MainWindow.cpp @@ -0,0 +1,103 @@ +#include "BioTracker3MainWindow.h" +#include "ui_BioTracker3MainWindow.h" + +#include "Controller/ControllerMainWindow.h" +#include "BioTracker3VideoControllWidget.h" +#include "qfiledialog.h" +#include "QLayout" + +#include "View/GraphicsView.h" + + + + +BioTracker3MainWindow::BioTracker3MainWindow(QWidget *parent, IController *controller, IModel *model) : + IViewMainWindow(parent, controller, model), + ui(new Ui::BioTracker3MainWindow) +{ + ui->setupUi(this); +} + +BioTracker3MainWindow::~BioTracker3MainWindow() +{ + delete ui; +} + +void BioTracker3MainWindow::addVideoControllWidget(IView *widget) +{ + QLayout *layout = new QGridLayout(this); + layout->addWidget(dynamic_cast<QWidget *>(widget)); + ui->videoControls->setLayout(layout); +} + +void BioTracker3MainWindow::addVideoView(IView *videoView) +{ + GraphicsView *graphView = dynamic_cast<GraphicsView *>(videoView); + graphView->setParent(ui->trackingArea); + ui->videoViewLayout->addWidget(graphView); + // gl widget + //dynamic_cast<BioTracker3VideoView *>(videoView)->setParent(ui->trackingArea); + //ui->videoViewLayout->addWidget(dynamic_cast<BioTracker3VideoView *>(videoView)); +} + +void BioTracker3MainWindow::on_actionOpen_Video_triggered() +{ + static const QString videoFilter("Video files (*.avi *.wmv *.mp4 *.mkv *.mov)"); + + QString filename = QFileDialog::getOpenFileName(this, + "Open video", "", videoFilter); + + if (!filename.isEmpty()) { + dynamic_cast<ControllerMainWindow *> (getController())->loadVideo(filename); + } +} + +void BioTracker3MainWindow::on_actionLoad_Tracker_triggered() +{ + static const QString pluginFilter("BioTracker Tracking Plugin files (*.so *.dll *.dylib)"); + + QString filename = QFileDialog::getOpenFileName(this, + "Open BioTracker Tracking Plugin", "", pluginFilter); + + if (!filename.isEmpty()) { + qobject_cast<ControllerMainWindow *> (getController())->loadVideo(filename); + } +} + +void BioTracker3MainWindow::on_actionOpen_Picture_triggered() +{ + static const QString imageFilter( + "image files (*.png *.jpg *.jpeg *.gif *.bmp *.jpe *.ppm *.tiff *.tif *.sr *.ras *.pbm *.pgm *.jp2 *.dib)"); + + std::vector<boost::filesystem::path> files; + for (QString const &path : QFileDialog::getOpenFileNames(this, + "Open image files", "", imageFilter)) { + files.push_back(boost::filesystem::path(path.toStdString())); + } + + if (!files.empty()) { + qobject_cast<ControllerMainWindow *> (getController())->loadPictures(files); + } +} + +void BioTracker3MainWindow::on_actionLoad_tracking_data_triggered() +{ + +} + +void BioTracker3MainWindow::on_actionSave_tracking_data_triggered() +{ + +} + +void BioTracker3MainWindow::on_actionQuit_triggered() +{ + +} + +void BioTracker3MainWindow::on_actionOpen_Camera_triggered() +{ + m_CameraDevice = new CameraDevice(); + + m_CameraDevice->show(); +} diff --git a/BioTrackerQt/Source/BioTrackerQt/View/BioTracker3MainWindow.h b/BioTrackerQt/Source/BioTrackerQt/View/BioTracker3MainWindow.h new file mode 100644 index 0000000000000000000000000000000000000000..2bbf540d151ae4d00e98f7d21242699d015a1c50 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/View/BioTracker3MainWindow.h @@ -0,0 +1,50 @@ +#ifndef BIOTRACKER3MAINWINDOW_H +#define BIOTRACKER3MAINWINDOW_H + +#include <boost/filesystem.hpp> +#include "Interfaces/IView/IViewMainWindow.h" + +// delete +#include "BioTracker3VideoView.h" +#include "CameraDevice.h" +#include "QPointer" + +namespace Ui { +class BioTracker3MainWindow; +} + +class IController; +class BioTracker3MainWindow : public IViewMainWindow +{ + Q_OBJECT + +public: + explicit BioTracker3MainWindow(QWidget *parent = 0, IController *controller = 0, IModel *model = 0); + ~BioTracker3MainWindow(); + + void addVideoControllWidget(IView *widget); + void addVideoView(IView *videoView); + +private Q_SLOTS: + void on_actionOpen_Video_triggered(); + + void on_actionLoad_Tracker_triggered(); + + void on_actionOpen_Picture_triggered(); + + void on_actionLoad_tracking_data_triggered(); + + void on_actionSave_tracking_data_triggered(); + + void on_actionQuit_triggered(); + + void on_actionOpen_Camera_triggered(); + +private: + Ui::BioTracker3MainWindow *ui; + + + QPointer< CameraDevice > m_CameraDevice; +}; + +#endif // BIOTRACKER3MAINWINDOW_H diff --git a/BioTrackerQt/Source/BioTrackerQt/View/BioTracker3MainWindow.ui b/BioTrackerQt/Source/BioTrackerQt/View/BioTracker3MainWindow.ui new file mode 100644 index 0000000000000000000000000000000000000000..69ba96443f67da0bc352278a3ae612061777c583 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/View/BioTracker3MainWindow.ui @@ -0,0 +1,375 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>BioTracker3MainWindow</class> + <widget class="QMainWindow" name="BioTracker3MainWindow"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>982</width> + <height>818</height> + </rect> + </property> + <property name="windowTitle"> + <string>BioTracker</string> + </property> + <property name="dockNestingEnabled"> + <bool>true</bool> + </property> + <property name="unifiedTitleAndToolBarOnMac"> + <bool>false</bool> + </property> + <widget class="QWidget" name="centralWidget"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_5"> + <property name="spacing"> + <number>0</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QWidget" name="widget_2" native="true"> + <layout class="QHBoxLayout" name="horizontalLayout_6" stretch="0"> + <property name="spacing"> + <number>3</number> + </property> + <property name="leftMargin"> + <number>3</number> + </property> + <property name="topMargin"> + <number>3</number> + </property> + <property name="rightMargin"> + <number>3</number> + </property> + <property name="bottomMargin"> + <number>3</number> + </property> + <item> + <widget class="QWidget" name="videoAreaWidget" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="spacing"> + <number>3</number> + </property> + <property name="leftMargin"> + <number>3</number> + </property> + <property name="topMargin"> + <number>3</number> + </property> + <property name="rightMargin"> + <number>3</number> + </property> + <property name="bottomMargin"> + <number>3</number> + </property> + <item> + <widget class="QFrame" name="trackingArea"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>150</height> + </size> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>0</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <layout class="QVBoxLayout" name="videoViewLayout"/> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QWidget" name="videoControls" native="true"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <widget class="QMenuBar" name="menuBar"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>982</width> + <height>23</height> + </rect> + </property> + <widget class="QMenu" name="menuFile"> + <property name="title"> + <string>&File</string> + </property> + <addaction name="actionOpen_Video"/> + <addaction name="actionOpen_Picture"/> + <addaction name="actionOpen_Camera"/> + <addaction name="separator"/> + <addaction name="actionLoad_Tracker"/> + <addaction name="separator"/> + <addaction name="actionLoad_tracking_data"/> + <addaction name="actionSave_tracking_data"/> + <addaction name="separator"/> + <addaction name="actionQuit"/> + </widget> + <addaction name="menuFile"/> + </widget> + <widget class="QDockWidget" name="dockWidgetAlgorithm"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>200</width> + <height>207</height> + </size> + </property> + <property name="sizeIncrement"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="baseSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="windowTitle"> + <string>A&lgorithm</string> + </property> + <attribute name="dockWidgetArea"> + <number>2</number> + </attribute> + <widget class="QWidget" name="dockWidgetAlgorithmContents"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <property name="spacing"> + <number>2</number> + </property> + <property name="leftMargin"> + <number>3</number> + </property> + <property name="topMargin"> + <number>3</number> + </property> + <property name="rightMargin"> + <number>3</number> + </property> + <property name="bottomMargin"> + <number>3</number> + </property> + <item> + <widget class="QWidget" name="widget_alg" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_tools"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Tools</string> + </property> + <property name="flat"> + <bool>false</bool> + </property> + <layout class="QVBoxLayout" name="verticalLayout_4"> + <property name="spacing"> + <number>3</number> + </property> + <property name="leftMargin"> + <number>3</number> + </property> + <property name="topMargin"> + <number>3</number> + </property> + <property name="rightMargin"> + <number>3</number> + </property> + <property name="bottomMargin"> + <number>3</number> + </property> + <item> + <widget class="QScrollArea" name="scrollArea"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShadow"> + <enum>QFrame::Plain</enum> + </property> + <property name="lineWidth"> + <number>0</number> + </property> + <property name="verticalScrollBarPolicy"> + <enum>Qt::ScrollBarAsNeeded</enum> + </property> + <property name="horizontalScrollBarPolicy"> + <enum>Qt::ScrollBarAlwaysOff</enum> + </property> + <property name="widgetResizable"> + <bool>true</bool> + </property> + <widget class="QWidget" name="groupBoxContents"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>178</width> + <height>594</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + </widget> + <widget class="QDockWidget" name="dockWidgetNotification"> + <property name="floating"> + <bool>false</bool> + </property> + <property name="windowTitle"> + <string>&Notifications</string> + </property> + <attribute name="dockWidgetArea"> + <number>2</number> + </attribute> + <widget class="QWidget" name="dockWidgetNotificationContents"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </widget> + <action name="actionOpen_Video"> + <property name="text"> + <string>Open &Video...</string> + </property> + </action> + <action name="actionOpen_Picture"> + <property name="text"> + <string>Open &Picture...</string> + </property> + </action> + <action name="actionLoad_tracking_data"> + <property name="text"> + <string>&Load tracking data...</string> + </property> + </action> + <action name="actionSave_tracking_data"> + <property name="text"> + <string>&Save tracking data...</string> + </property> + </action> + <action name="actionQuit"> + <property name="text"> + <string>E&xit</string> + </property> + </action> + <action name="actionLoad_Tracker"> + <property name="text"> + <string>L&oad Tracker...</string> + </property> + </action> + <action name="actionOpen_Camera"> + <property name="text"> + <string>Open &Camera...</string> + </property> + </action> + </widget> + <layoutdefault spacing="6" margin="11"/> + <resources/> + <connections/> +</ui> diff --git a/BioTrackerQt/Source/BioTrackerQt/View/BioTracker3VideoControllWidget.cpp b/BioTrackerQt/Source/BioTrackerQt/View/BioTracker3VideoControllWidget.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ad75e6c868275eb4fea5dd0b87c7bd5516cd622a --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/View/BioTracker3VideoControllWidget.cpp @@ -0,0 +1,132 @@ +#include "BioTracker3VideoControllWidget.h" +#include "ui_BioTracker3VideoControllWidget.h" +#include "Controller/ControllerPlayer.h" + +#include "Interfaces/IStates/IPlayerState.h" + +BioTracker3VideoControllWidget::BioTracker3VideoControllWidget(QWidget *parent, IController *controller, IModel *model) : + IViewWidget(parent, controller, model), + ui(new Ui::BioTracker3VideoControllWidget) +{ + ui->setupUi(this); + + m_iconPause.addFile(QStringLiteral(":/BioTracker/resources/pause-sign.png"), + QSize(), QIcon::Normal, QIcon::Off); + m_iconPlay.addFile(QStringLiteral(":/BioTracker/resources/arrow-forward1.png"), + QSize(), QIcon::Normal, QIcon::Off); +} + +BioTracker3VideoControllWidget::~BioTracker3VideoControllWidget() +{ + delete ui; +} + +void BioTracker3VideoControllWidget::setSelectedView(QString str) +{ + if (!ui->comboBoxSelectedView->findText(str)) { + ui->comboBoxSelectedView->addItem(str); + } + ui->comboBoxSelectedView->setCurrentText(str); +} + +void BioTracker3VideoControllWidget::setVideoViewComboboxModel(QStringListModel *comboboxModel) +{ + ui->comboBoxSelectedView->setModel(comboboxModel); +} + +void BioTracker3VideoControllWidget::getNotified() +{ + ui->button_nextFrame->setEnabled(m_Forw); + ui->button_playPause->setEnabled(m_Play); + ui->button_previousFrame->setEnabled(m_Back); + ui->button_stop->setEnabled(m_Stop); + + + if (m_Paus) { + ui->button_playPause->setIcon(m_iconPause); + } + else { + ui->button_playPause->setIcon(m_iconPlay); + } +} + +void BioTracker3VideoControllWidget::setTotalNumbFrames(size_t numb) +{ + m_TotalNumbFrames = numb; +} + +void BioTracker3VideoControllWidget::setCurrentFrameNumber(size_t numb) +{ + m_CurrentFrameNumber = numb; + ui->frame_num_edit->setText(QString::number(m_CurrentFrameNumber)); +} + +void BioTracker3VideoControllWidget::setFPS(double fps) +{ + ui->fps_label->setText(QString::number(fps)); +} + +void BioTracker3VideoControllWidget::setVideoControllsStates(QVector<bool> states) +{ + + m_Back = states.at(0); + m_Forw = states.at(1); + m_Paus = states.at(2); + m_Play = states.at(3); + m_Stop = states.at(4); + +} + +void BioTracker3VideoControllWidget::on_button_nextFrame_clicked() +{ + ControllerPlayer *controller = dynamic_cast<ControllerPlayer *>(getController()); + controller->nextFrame(); +} + +void BioTracker3VideoControllWidget::on_button_playPause_clicked() +{ + ControllerPlayer *controller = dynamic_cast<ControllerPlayer *>(getController()); + + if (m_Paus) { + controller->pause(); + } + else { + controller->play(); + } +} + +void BioTracker3VideoControllWidget::on_button_stop_clicked() +{ + ControllerPlayer *controller = dynamic_cast<ControllerPlayer *>(getController()); + controller->stop(); +} + +void BioTracker3VideoControllWidget::on_button_previousFrame_clicked() +{ + ControllerPlayer *controller = dynamic_cast<ControllerPlayer *>(getController()); + controller->prevFrame(); +} + +void BioTracker3VideoControllWidget::on_sld_video_sliderMoved(int position) +{ + +} + +void BioTracker3VideoControllWidget::on_DurationChanged(int position) +{ + +} + +void BioTracker3VideoControllWidget::on_PositionChanged(int position) +{ + +} + + +void BioTracker3VideoControllWidget::on_comboBoxSelectedView_currentTextChanged(const QString &arg1) +{ + QString name = arg1; + ControllerPlayer *controller = dynamic_cast<ControllerPlayer *>(getController()); + + controller->changeImageView(name); +} diff --git a/BioTrackerQt/Source/BioTrackerQt/View/BioTracker3VideoControllWidget.h b/BioTrackerQt/Source/BioTrackerQt/View/BioTracker3VideoControllWidget.h new file mode 100644 index 0000000000000000000000000000000000000000..f5586c5f0677a39fc85034566a11555603d18019 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/View/BioTracker3VideoControllWidget.h @@ -0,0 +1,69 @@ +#ifndef BIOTRACKER3VIDEOCONTROLLWIDGET_H +#define BIOTRACKER3VIDEOCONTROLLWIDGET_H + +#include <QWidget> +#include "QIcon" +#include "Interfaces/IView/IViewWidget.h" +#include "QMap" +#include "QMetaEnum" +#include "QStringListModel" + + +namespace Ui { +class BioTracker3VideoControllWidget; +} + +class BioTracker3VideoControllWidget : public IViewWidget +{ + Q_OBJECT + +public: + explicit BioTracker3VideoControllWidget(QWidget *parent = 0, IController *controller = 0, IModel *model = 0); + ~BioTracker3VideoControllWidget(); + + void setSelectedView(QString str); + + void setVideoViewComboboxModel(QStringListModel *comboboxModel); + + void setTotalNumbFrames(size_t numb); + void setCurrentFrameNumber(size_t numb); + void setFPS(double fps); + void setVideoControllsStates(QVector<bool> states); + + +public Q_SLOTS: + void getNotified(); + +private Q_SLOTS: + void on_sld_video_sliderMoved(int position); + void on_DurationChanged(int position); + void on_PositionChanged(int position); + void on_button_nextFrame_clicked(); + void on_button_playPause_clicked(); + + void on_button_stop_clicked(); + + void on_button_previousFrame_clicked(); + + + void on_comboBoxSelectedView_currentTextChanged(const QString &arg1); + + +private: + Ui::BioTracker3VideoControllWidget *ui; + + QIcon m_iconPause; + QIcon m_iconPlay; + + bool m_Play; + bool m_Forw; + bool m_Back; + bool m_Stop; + bool m_Paus; + + size_t m_TotalNumbFrames; + size_t m_CurrentFrameNumber; + double m_fps; +}; + +#endif // BIOTRACKER3VIDEOCONTROLLWIDGET_H diff --git a/BioTrackerQt/Source/BioTrackerQt/View/BioTracker3VideoControllWidget.ui b/BioTrackerQt/Source/BioTrackerQt/View/BioTracker3VideoControllWidget.ui new file mode 100644 index 0000000000000000000000000000000000000000..d530605ffc4b40946ef321a89be2906ec63b783f --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/View/BioTracker3VideoControllWidget.ui @@ -0,0 +1,521 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>BioTracker3VideoControllWidget</class> + <widget class="QWidget" name="BioTracker3VideoControllWidget"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>775</width> + <height>193</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QSlider" name="sld_video"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="maximum"> + <number>2500</number> + </property> + <property name="pageStep"> + <number>25</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="invertedAppearance"> + <bool>false</bool> + </property> + <property name="invertedControls"> + <bool>false</bool> + </property> + <property name="tickPosition"> + <enum>QSlider::TicksAbove</enum> + </property> + <property name="tickInterval"> + <number>25</number> + </property> + </widget> + </item> + <item> + <widget class="QGroupBox" name="playback"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Video Controls</string> + </property> + <property name="flat"> + <bool>false</bool> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_4"> + <property name="spacing"> + <number>3</number> + </property> + <property name="leftMargin"> + <number>3</number> + </property> + <property name="topMargin"> + <number>3</number> + </property> + <property name="rightMargin"> + <number>3</number> + </property> + <property name="bottomMargin"> + <number>3</number> + </property> + <item> + <widget class="QPushButton" name="button_previousFrame"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Previous Frame</string> + </property> + <property name="styleSheet"> + <string notr="true">background-image: url(:/Images/resources/arrows-skip-back.png); +image: url(:/Images/resources/arrows-skip-back.png);</string> + </property> + <property name="text"> + <string/> + </property> + <property name="icon"> + <iconset> + <normaloff>:/BioTracker/resources/arrows-skip-back.png</normaloff>:/BioTracker/resources/arrows-skip-back.png</iconset> + </property> + <property name="iconSize"> + <size> + <width>32</width> + <height>32</height> + </size> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="button_playPause"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Play</string> + </property> + <property name="styleSheet"> + <string notr="true">image: url(:/Images/resources/arrow-forward1.png); +background-image: url(:/Images/resources/arrow-forward1.png);</string> + </property> + <property name="text"> + <string/> + </property> + <property name="icon"> + <iconset> + <normaloff>:/BioTracker/resources/arrow-forward1.png</normaloff>:/BioTracker/resources/arrow-forward1.png</iconset> + </property> + <property name="iconSize"> + <size> + <width>32</width> + <height>32</height> + </size> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="button_stop"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Stop</string> + </property> + <property name="statusTip"> + <string/> + </property> + <property name="styleSheet"> + <string notr="true">background-image: url(:/Images/resources/stop.png); +image: url(:/Images/resources/stop.png);</string> + </property> + <property name="text"> + <string/> + </property> + <property name="icon"> + <iconset> + <normaloff>:/BioTracker/resources/stop.png</normaloff>:/BioTracker/resources/stop.png</iconset> + </property> + <property name="iconSize"> + <size> + <width>32</width> + <height>32</height> + </size> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="button_nextFrame"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Next Frame</string> + </property> + <property name="statusTip"> + <string/> + </property> + <property name="styleSheet"> + <string notr="true">background-image: url(:/Images/resources/arrows-skip-forward.png); +image: url(:/Images/resources/arrows-skip-forward.png);</string> + </property> + <property name="text"> + <string/> + </property> + <property name="icon"> + <iconset> + <normaloff>:/BioTracker/resources/arrows-skip-forward.png</normaloff>:/BioTracker/resources/arrows-skip-forward.png</iconset> + </property> + <property name="iconSize"> + <size> + <width>32</width> + <height>32</height> + </size> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="button_screenshot"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="font"> + <font> + <pointsize>16</pointsize> + <weight>75</weight> + <italic>false</italic> + <bold>true</bold> + </font> + </property> + <property name="toolTip"> + <string>Screenshot</string> + </property> + <property name="statusTip"> + <string/> + </property> + <property name="styleSheet"> + <string notr="true">background-image: url(:/Images/resources/screenshot.png); +image: url(:/Images/resources/screenshot.png);</string> + </property> + <property name="text"> + <string/> + </property> + <property name="icon"> + <iconset> + <normaloff>:/BioTracker/resources/screenshot.png</normaloff>:/BioTracker/resources/screenshot.png</iconset> + </property> + <property name="iconSize"> + <size> + <width>30</width> + <height>30</height> + </size> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="lbl_frame"> + <property name="text"> + <string>Current frame:</string> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="frame_num_edit"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>60</width> + <height>30</height> + </size> + </property> + <property name="text"> + <string>0</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::MinimumExpanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="labelView"> + <property name="text"> + <string>View:</string> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="comboBoxSelectedView"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="baseSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <item> + <property name="text"> + <string>Original</string> + </property> + </item> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Minimum</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="button_panZoom"> + <property name="font"> + <font> + <pointsize>16</pointsize> + <weight>75</weight> + <italic>false</italic> + <bold>true</bold> + </font> + </property> + <property name="toolTip"> + <string>Pan/Zoom Mode</string> + </property> + <property name="styleSheet"> + <string notr="true">image: url(:/Images/resources/panZoom.png); +background-image: url(:/Images/resources/panZoom.png);</string> + </property> + <property name="text"> + <string/> + </property> + <property name="icon"> + <iconset> + <normaloff>:/BioTracker/resources/panZoom.png</normaloff>:/BioTracker/resources/panZoom.png</iconset> + </property> + <property name="iconSize"> + <size> + <width>30</width> + <height>30</height> + </size> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="speed"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="title"> + <string>Playback Speed</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="spacing"> + <number>5</number> + </property> + <item> + <widget class="QLabel" name="label_3"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>slow</string> + </property> + </widget> + </item> + <item> + <widget class="QSlider" name="sld_speed"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimum"> + <number>1</number> + </property> + <property name="maximum"> + <number>61</number> + </property> + <property name="value"> + <number>30</number> + </property> + <property name="sliderPosition"> + <number>30</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string>fast</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string>target fps: </string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="fps_label"> + <property name="text"> + <string>30</string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_4"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Preferred</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>measured fps:</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="fps_edit"> + <property name="minimumSize"> + <size> + <width>60</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/BioTrackerQt/Source/BioTrackerQt/View/BioTracker3VideoView.cpp b/BioTrackerQt/Source/BioTrackerQt/View/BioTracker3VideoView.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6ea50183abdda956d0a08b0a2da01952dcaac1e2 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/View/BioTracker3VideoView.cpp @@ -0,0 +1,58 @@ +#include "BioTracker3VideoView.h" + +#include <util/ScreenHelper.h> +#include "Interfaces/IController/icontroller.h" + +#include "Model/BioTracker3TextureObject.h" + + +BioTracker3VideoView::BioTracker3VideoView(QWidget *parent, IController *controller, IModel *model): + IViewOpenGLWidget(parent, controller, model) +{ +} + +BioTracker3VideoView::~BioTracker3VideoView() +{ + +} + +void BioTracker3VideoView::paintGL() +{ + BioTracker3TextureObject *textureObject = dynamic_cast<BioTracker3TextureObject *>(getModel()); + QImage img = textureObject->get(); + + + QPainter painter(this); + + painter.setBrush(QColor(0, 0, 0)); + painter.drawRect(QRect(0, 0, this->width(), this->height())); + painter.setBrush(QColor(0, 0, 0, 0)); + + QRect window; + QRect viewport; + const float viewport_skew = BioTracker::Core::ScreenHelper::calculate_viewport( + textureObject->width(), + textureObject->height(), + this->width(), + this->height(), + window, + viewport + ); + + painter.setWindow(window); + painter.setViewport(viewport); + + QRectF target(0, 0 , textureObject->width(), textureObject->height()); + QRectF source(0, 0, textureObject->width(), textureObject->height()); + + + + painter.drawImage(target, img, source); + QPainter p(this); + +} + +void BioTracker3VideoView::getNotified() +{ + this->update(); +} diff --git a/BioTrackerQt/Source/BioTrackerQt/View/BioTracker3VideoView.h b/BioTrackerQt/Source/BioTrackerQt/View/BioTracker3VideoView.h new file mode 100644 index 0000000000000000000000000000000000000000..8a5f16b469c3f949e976958637995b033b963632 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/View/BioTracker3VideoView.h @@ -0,0 +1,26 @@ +#ifndef BIOTRACKER3VIDEOVIEW_H +#define BIOTRACKER3VIDEOVIEW_H + +#include "Interfaces/IView/IViewOpenGLWidget.h" + +#include "QPainter" +#include "Interfaces/IView/IViewWidget.h" +#include "Model/BioTracker3TextureObject.h" + +class BioTracker3VideoView: public IViewOpenGLWidget +{ +public: + BioTracker3VideoView(QWidget *parent, IController *controller = 0, IModel *model = 0); + ~BioTracker3VideoView(); + +private: + void paintGL() override; + + +public Q_SLOTS: + void getNotified(); + + +}; + +#endif // BIOTRACKER3VIDEOVIEW_H diff --git a/BioTrackerQt/Source/BioTrackerQt/View/CameraDevice.cpp b/BioTrackerQt/Source/BioTrackerQt/View/CameraDevice.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7c27abbb28d944d8661965de1fa4a3f41d3f11b5 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/View/CameraDevice.cpp @@ -0,0 +1,63 @@ +#include "CameraDevice.h" +#include "ui_CameraDevice.h" + +#include "QCameraInfo" + +CameraDevice::CameraDevice(QWidget *parent) : + QWidget(parent), + ui(new Ui::CameraDevice) +{ + ui->setupUi(this); + + listAllCameras(); +} + +CameraDevice::~CameraDevice() +{ + delete ui; +} + +void CameraDevice::on_buttonBox_accepted() +{ + int i = ui->comboBox->currentIndex(); + + this->close(); +} + +void CameraDevice::on_comboBox_currentIndexChanged(int index) +{ + startCamera(index); +} + +void CameraDevice::listAllCameras() +{ + //QCameraInfo cameraInfo(*camera); + cameras = QCameraInfo::availableCameras(); + foreach (const QCameraInfo &cameraInfo, cameras) { + + ui->comboBox->addItem(cameraInfo.deviceName()); + } + + startCamera(0); +} + +void CameraDevice::startCamera(int i) +{ + if(!cameras.empty()) { + + camera = new QCamera(cameras.at(i), this); + camera->setParent(this); + + viewfinder = new QCameraViewfinder(this); + viewfinder->setSizePolicy(QSizePolicy::Maximum,QSizePolicy::Maximum); + + + QPointer< QGridLayout > layout = new QGridLayout(this); + ui->widget->setLayout(layout); + layout->addWidget(viewfinder); + + camera->setViewfinder(viewfinder); + camera->start(); + } + +} diff --git a/BioTrackerQt/Source/BioTrackerQt/View/CameraDevice.h b/BioTrackerQt/Source/BioTrackerQt/View/CameraDevice.h new file mode 100644 index 0000000000000000000000000000000000000000..9688c2453484bc141ccec5b7ac07ec2022982776 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/View/CameraDevice.h @@ -0,0 +1,40 @@ +#ifndef CAMERADEVICE_H +#define CAMERADEVICE_H + +#include <QWidget> + +#include "QCamera" +#include "QCameraViewfinder" +#include "QPointer" + +namespace Ui { +class CameraDevice; +} + +class CameraDevice : public QWidget +{ + Q_OBJECT + +public: + explicit CameraDevice(QWidget *parent = 0); + ~CameraDevice(); + +private slots: + void on_buttonBox_accepted(); + + void on_comboBox_currentIndexChanged(int index); + +private: + void listAllCameras(); + void startCamera(int i); + +private: + Ui::CameraDevice *ui; + + QPointer< QCamera > camera; + QPointer< QCameraViewfinder > viewfinder; + + QList<QCameraInfo> cameras; +}; + +#endif // CAMERADEVICE_H diff --git a/BioTrackerQt/Source/BioTrackerQt/View/CameraDevice.ui b/BioTrackerQt/Source/BioTrackerQt/View/CameraDevice.ui new file mode 100644 index 0000000000000000000000000000000000000000..5fb28ade64a04e8094ce81ed82490d41278aaec2 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/View/CameraDevice.ui @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>CameraDevice</class> + <widget class="QWidget" name="CameraDevice"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>493</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <widget class="QWidget" name="layoutWidget"> + <property name="geometry"> + <rect> + <x>19</x> + <y>250</y> + <width>461</width> + <height>31</height> + </rect> + </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Select Camera Device</string> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="comboBox"/> + </item> + <item> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="widget" native="true"> + <property name="geometry"> + <rect> + <x>10</x> + <y>9</y> + <width>471</width> + <height>231</height> + </rect> + </property> + </widget> + </widget> + <resources/> + <connections/> +</ui> diff --git a/BioTrackerQt/Source/BioTrackerQt/View/CameraDeviceSelect.cpp b/BioTrackerQt/Source/BioTrackerQt/View/CameraDeviceSelect.cpp new file mode 100644 index 0000000000000000000000000000000000000000..00355e6773a1cc20de7ad4861474db5131542786 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/View/CameraDeviceSelect.cpp @@ -0,0 +1,23 @@ +#include "CameraDeviceSelect.h" +#include "ui_CameraDeviceSelect.h" + +CameraDeviceSelect::CameraDeviceSelect(QWidget *parent) : + QDialog(parent), + ui(new Ui::CameraDeviceSelect) +{ + ui->setupUi(this); + + + + +} + +CameraDeviceSelect::~CameraDeviceSelect() +{ + delete ui; +} + +void CameraDeviceSelect::on_buttonBox_accepted() +{ + int i = ui->comboBox_VideoDevice->currentIndex(); +} diff --git a/BioTrackerQt/Source/BioTrackerQt/View/CameraDeviceSelect.h b/BioTrackerQt/Source/BioTrackerQt/View/CameraDeviceSelect.h new file mode 100644 index 0000000000000000000000000000000000000000..2b4f3af5d7b46048e47d59f6272008ecc299e265 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/View/CameraDeviceSelect.h @@ -0,0 +1,25 @@ +#ifndef CAMERADEVICESELECT_H +#define CAMERADEVICESELECT_H + +#include <QDialog> + +namespace Ui { +class CameraDeviceSelect; +} + +class CameraDeviceSelect : public QDialog +{ + Q_OBJECT + +public: + explicit CameraDeviceSelect(QWidget *parent = 0); + ~CameraDeviceSelect(); + +private slots: + void on_buttonBox_accepted(); + +private: + Ui::CameraDeviceSelect *ui; +}; + +#endif // CAMERADEVICESELECT_H diff --git a/BioTrackerQt/Source/BioTrackerQt/View/CameraDeviceSelect.ui b/BioTrackerQt/Source/BioTrackerQt/View/CameraDeviceSelect.ui new file mode 100644 index 0000000000000000000000000000000000000000..2f256997553cfe10e66ee338706a99ccc8200bc4 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/View/CameraDeviceSelect.ui @@ -0,0 +1,90 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>CameraDeviceSelect</class> + <widget class="QDialog" name="CameraDeviceSelect"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle"> + <string>Dialog</string> + </property> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="geometry"> + <rect> + <x>30</x> + <y>240</y> + <width>341</width> + <height>32</height> + </rect> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + <widget class="QWidget" name=""> + <property name="geometry"> + <rect> + <x>11</x> + <y>11</y> + <width>371</width> + <height>27</height> + </rect> + </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Select Camera Device</string> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="comboBox_VideoDevice"/> + </item> + </layout> + </widget> + </widget> + <resources/> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>CameraDeviceSelect</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>248</x> + <y>254</y> + </hint> + <hint type="destinationlabel"> + <x>157</x> + <y>274</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>CameraDeviceSelect</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>316</x> + <y>260</y> + </hint> + <hint type="destinationlabel"> + <x>286</x> + <y>274</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/BioTrackerQt/Source/BioTrackerQt/View/GraphicsScene.cpp b/BioTrackerQt/Source/BioTrackerQt/View/GraphicsScene.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4584e2e39b54b4f4b61642db804246bfc67d322d --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/View/GraphicsScene.cpp @@ -0,0 +1,12 @@ +#include "GraphicsScene.h" + +GraphicsScene::GraphicsScene(QObject *parent, IController *controller, IModel *model) : + IViewGraphicsScene(parent, controller, model) +{ + +} + +void GraphicsScene::getNotified() +{ + +} diff --git a/BioTrackerQt/Source/BioTrackerQt/View/GraphicsScene.h b/BioTrackerQt/Source/BioTrackerQt/View/GraphicsScene.h new file mode 100644 index 0000000000000000000000000000000000000000..d590051a97e2c67a6de69af9a4e695dbcf8b2908 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/View/GraphicsScene.h @@ -0,0 +1,16 @@ +#ifndef GRAPHICSSCENE_H +#define GRAPHICSSCENE_H + +#include "Interfaces/IView/IViewGraphicsScene.h" + +class GraphicsScene : public IViewGraphicsScene +{ +public: + GraphicsScene(QObject *parent = 0, IController *controller = 0, IModel *model = 0); + + // IViewGraphicsScene interface +public Q_SLOTS: + void getNotified() override; +}; + +#endif // GRAPHICSSCENEVIEW_H diff --git a/BioTrackerQt/Source/BioTrackerQt/View/GraphicsView.cpp b/BioTrackerQt/Source/BioTrackerQt/View/GraphicsView.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b9820c0611ebbf5b56829a2983ab3765343ed7a3 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/View/GraphicsView.cpp @@ -0,0 +1,53 @@ +#include "GraphicsView.h" +#include "QTimeLine" +#include "QWheelEvent" + +GraphicsView::GraphicsView(QWidget *parent, IController *controller, IModel *model) : + IGraphicsView(parent, controller, model) +{ + m_GraphicsScene = new QGraphicsScene(); + this->setScene(m_GraphicsScene); + + this->show(); + +} + +void GraphicsView::addGraphicsItem(QGraphicsItem *item) +{ + m_GraphicsScene->addItem(item); + + update(); +} + +void GraphicsView::addPixmapItem(QGraphicsItem *item) +{ + m_GraphicsScene->addItem(item); + + update(); +} + +void GraphicsView::getNotified() +{ + +} + +void GraphicsView::wheelEvent(QWheelEvent *event) +{ + //if ctrl pressed, use original functionality + if(event->modifiers() & Qt::ControlModifier) + { + QGraphicsView::wheelEvent(event); + } + //otherwise, do yours + else + { + if(event->delta() > 0) + { + scale(1.1,1.1); + } + else + { + scale(0.9,0.9); + } + } +} diff --git a/BioTrackerQt/Source/BioTrackerQt/View/GraphicsView.h b/BioTrackerQt/Source/BioTrackerQt/View/GraphicsView.h new file mode 100644 index 0000000000000000000000000000000000000000..546db2d2a5e69ea82a3e978984fb0ea04c1d709f --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/View/GraphicsView.h @@ -0,0 +1,28 @@ +#ifndef GRAPHICSVIEW_H +#define GRAPHICSVIEW_H + +#include "Interfaces/IView/IGraphicsView.h" +#include "QGraphicsScene" + +class GraphicsView : public IGraphicsView +{ + Q_OBJECT +public: + GraphicsView(QWidget *parent = 0, IController *controller = 0, IModel *model = 0); + + void addGraphicsItem(QGraphicsItem *item); + void addPixmapItem(QGraphicsItem *item); + + // IGraphicsView interface +public Q_SLOTS: + void getNotified() override; + +private: + QGraphicsScene *m_GraphicsScene; + + // QWidget interface +protected: + void wheelEvent(QWheelEvent *event) override; +}; + +#endif // GRAPHICSVIEW_H diff --git a/BioTrackerQt/Source/BioTrackerQt/View/TextureObjectView.cpp b/BioTrackerQt/Source/BioTrackerQt/View/TextureObjectView.cpp new file mode 100644 index 0000000000000000000000000000000000000000..70e7678b274b036738ffb36deb35a7125a2cf189 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/View/TextureObjectView.cpp @@ -0,0 +1,26 @@ +#include "TextureObjectView.h" +#include "Model/BioTracker3TextureObject.h" + + +TextureObjectView::TextureObjectView(QObject *parent, IController *controller, IModel *model) : + IGraphicsPixmapItem(parent, controller, model) +{ + setZValue(-1); +} + +void TextureObjectView::getNotified() +{ + BioTracker3TextureObject *texture = dynamic_cast<BioTracker3TextureObject *>(getModel()); + QPixmap *pmap = new QPixmap; + pmap->convertFromImage(texture->get()); + setPixmap(*pmap); + + update(); +} + +void TextureObjectView::connectModelView() +{ + QObject::connect(getModel(), &IModel::notifyView, this, &TextureObjectView::getNotified); + + getNotified(); +} diff --git a/BioTrackerQt/Source/BioTrackerQt/View/TextureObjectView.h b/BioTrackerQt/Source/BioTrackerQt/View/TextureObjectView.h new file mode 100644 index 0000000000000000000000000000000000000000..b6524668afc126b728fdb36342de907fb1959b5a --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/View/TextureObjectView.h @@ -0,0 +1,21 @@ +#ifndef TEXTUREOBJECTVIEW_H +#define TEXTUREOBJECTVIEW_H + +#include "Interfaces/IView/IGraphicsPixmapItem.h" + +class TextureObjectView : public IGraphicsPixmapItem +{ + Q_OBJECT +public: + TextureObjectView(QObject *parent = 0, IController *controller = 0, IModel *model = 0); + + // IGraphicsPixmapItem interface +public Q_SLOTS: + void getNotified() override; + + // IView interface +protected: + void connectModelView() override; +}; + +#endif // TEXTUREOBJECTVIEW_H diff --git a/BioTrackerQt/Source/BioTrackerQt/View/TrackedElementView.cpp b/BioTrackerQt/Source/BioTrackerQt/View/TrackedElementView.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f4e74c3d7a3a55cb3e6163f12a66c980106c4333 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/View/TrackedElementView.cpp @@ -0,0 +1,66 @@ +#include "TrackedElementView.h" +#include "Model/TrackedComponents/TrackedElement.h" +#include "QBrush" +#include "QPainter" + +TrackedElementView::TrackedElementView(QGraphicsItem *parent, IController *controller, IModel *model) : + IViewTrackedComponent(parent, controller, model) +{ + TrackedElement *elem = dynamic_cast<TrackedElement *>(getModel()); + m_boundingRect = QRectF(0,0, 100, 100); + + setAcceptHoverEvents(true); +} + +QRectF TrackedElementView::boundingRect() const +{ + + return m_boundingRect; +} + +void TrackedElementView::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) +{ + TrackedElement *elem = dynamic_cast<TrackedElement *>(getModel()); + + QRectF rec = boundingRect(); + + QBrush brush(Qt::blue); + + if(elem->getPressedStatus()) + { + brush.setColor(Qt::red); + } + else + { + brush.setColor(Qt::green); + } + + painter->fillRect(rec,brush); + painter->drawRect(rec); + +} + +void TrackedElementView::getNotified() +{ + update(); +} + +void TrackedElementView::hoverEnterEvent(QGraphicsSceneHoverEvent *event) +{ + TrackedElement *elem = dynamic_cast<TrackedElement *>(getModel()); + + elem->pressed(); + update(); + + QGraphicsObject::hoverEnterEvent(event); +} + +void TrackedElementView::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) +{ + TrackedElement *elem = dynamic_cast<TrackedElement *>(getModel()); + + elem->notPressed(); + update(); + + QGraphicsObject::hoverLeaveEvent(event); +} diff --git a/BioTrackerQt/Source/BioTrackerQt/View/TrackedElementView.h b/BioTrackerQt/Source/BioTrackerQt/View/TrackedElementView.h new file mode 100644 index 0000000000000000000000000000000000000000..db7cff723e4e37cfbe289fb64b6ac88c9200047d --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/View/TrackedElementView.h @@ -0,0 +1,32 @@ +#ifndef TRACKEDELEMENTVIEW_H +#define TRACKEDELEMENTVIEW_H + +#include "Interfaces/IView/IViewTrackedComponent.h" + +class TrackedElementView : public IViewTrackedComponent +{ + Q_OBJECT +public: + TrackedElementView(QGraphicsItem *parent = 0, IController *controller = 0, IModel *model = 0); + + // QGraphicsItem interface +public: + QRectF boundingRect() const override; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; + + // IViewTrackedComponent interface +public Q_SLOTS: + void getNotified() override; + +private: + QRectF m_boundingRect; + + + + // QGraphicsItem interface +protected: + void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override; + void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override; +}; + +#endif // TRACKEDELEMENTVIEW_H diff --git a/BioTrackerQt/Source/BioTrackerQt/View/TrackedImageView.cpp b/BioTrackerQt/Source/BioTrackerQt/View/TrackedImageView.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6e094b0e0a5a5cf38bd9bbe42f144bbbe956f4ee --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/View/TrackedImageView.cpp @@ -0,0 +1,57 @@ +#include "TrackedImageView.h" + +#include <util/ScreenHelper.h> +#include "Interfaces/IController/icontroller.h" + +#include "Model/BioTracker3TextureObject.h" + +TrackedImageView::TrackedImageView(QWidget *parent, IController *controller, IModel *model): + IViewOpenGLWidget(parent, controller, model) +{ + +} + +TrackedImageView::~TrackedImageView() +{ + +} + +void TrackedImageView::paintGL() +{ + BioTracker3TextureObject *textureObject = dynamic_cast<BioTracker3TextureObject *>(getModel()); + QImage img = textureObject->get(); + + + QPainter painter(this); + + painter.setBrush(QColor(0, 0, 0)); + painter.drawRect(QRect(0, 0, this->width(), this->height())); + painter.setBrush(QColor(0, 0, 0, 0)); + + QRect window; + QRect viewport; + const float viewport_skew = BioTracker::Core::ScreenHelper::calculate_viewport( + textureObject->width(), + textureObject->height(), + this->width(), + this->height(), + window, + viewport + ); + + painter.setWindow(window); + painter.setViewport(viewport); + + QRectF target(0, 0 , textureObject->width(), textureObject->height()); + QRectF source(0, 0, textureObject->width(), textureObject->height()); + + + + painter.drawImage(target, img, source); + QPainter p(this); +} + +void TrackedImageView::getNotified() +{ + this->update(); +} diff --git a/BioTrackerQt/Source/BioTrackerQt/View/TrackedImageView.h b/BioTrackerQt/Source/BioTrackerQt/View/TrackedImageView.h new file mode 100644 index 0000000000000000000000000000000000000000..0bdfb7494666a7aeeaee1c5bc18f063d5e581a6b --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/View/TrackedImageView.h @@ -0,0 +1,24 @@ +#ifndef TRACKEDIMAGEVIEW_H +#define TRACKEDIMAGEVIEW_H + +#include "Interfaces/IView/IViewOpenGLWidget.h" + +#include "QPainter" +#include "Interfaces/IView/IViewWidget.h" + +class TrackedImageView : public IViewOpenGLWidget +{ +public: + TrackedImageView(QWidget *parent, IController *controller, IModel *model); + ~TrackedImageView(); + + // QOpenGLWidget interface +protected: + void paintGL() override; + + // IViewOpenGLWidget interface +public Q_SLOTS: + void getNotified() override; +}; + +#endif // TRACKEDIMAGEVIEW_H diff --git a/BioTrackerQt/Source/BioTrackerQt/guiresources.qrc b/BioTrackerQt/Source/BioTrackerQt/guiresources.qrc new file mode 100644 index 0000000000000000000000000000000000000000..b80fc16911b5333e7b494dfd96a817d50e4a81a2 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/guiresources.qrc @@ -0,0 +1,13 @@ +<RCC> + <qresource prefix="/Images"> + <file>resources/arrow-back.png</file> + <file>resources/arrow-forward1.png</file> + <file>resources/arrows-skip-back.png</file> + <file>resources/arrows-skip-forward.png</file> + <file>resources/fullscreen.png</file> + <file>resources/panZoom.png</file> + <file>resources/pause-sign.png</file> + <file>resources/screenshot.png</file> + <file>resources/stop.png</file> + </qresource> +</RCC> diff --git a/BioTrackerQt/Source/BioTrackerQt/main.cpp b/BioTrackerQt/Source/BioTrackerQt/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a773dc3b8cfb7f9bc7a2e5fdb5f07a837fd49057 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/main.cpp @@ -0,0 +1,24 @@ +#include <QApplication> +#include "BioTracker3App.h" +#include "GuiContext.h" + +int main(int argc, char *argv[]) { + QApplication app(argc, argv); + + /// NOTE edit by Andi + + qRegisterMetaType<cv::Mat>("cv::Mat"); + qRegisterMetaType<std::size_t>("std::size_t"); + qRegisterMetaType<size_t>("size_t"); + + + + //BioTrackerController mController; + + BioTracker3App bioTracker3(&app); + GuiContext context(&bioTracker3); + bioTracker3.setBioTrackerContext(&context); + bioTracker3.runBioTracker(); + + app.exec(); +} diff --git a/BioTrackerQt/Source/BioTrackerQt/resources/arrow-back.png b/BioTrackerQt/Source/BioTrackerQt/resources/arrow-back.png new file mode 100644 index 0000000000000000000000000000000000000000..5f49166cef5781ad86868b42b7116fa789446fb0 Binary files /dev/null and b/BioTrackerQt/Source/BioTrackerQt/resources/arrow-back.png differ diff --git a/BioTrackerQt/Source/BioTrackerQt/resources/arrow-forward1.png b/BioTrackerQt/Source/BioTrackerQt/resources/arrow-forward1.png new file mode 100644 index 0000000000000000000000000000000000000000..2667ca4ed39da9268416d24785bbb1ba38abe0c1 Binary files /dev/null and b/BioTrackerQt/Source/BioTrackerQt/resources/arrow-forward1.png differ diff --git a/BioTrackerQt/Source/BioTrackerQt/resources/arrows-skip-back.png b/BioTrackerQt/Source/BioTrackerQt/resources/arrows-skip-back.png new file mode 100644 index 0000000000000000000000000000000000000000..9c01414fe638a50dee612621ddf669767880310d Binary files /dev/null and b/BioTrackerQt/Source/BioTrackerQt/resources/arrows-skip-back.png differ diff --git a/BioTrackerQt/Source/BioTrackerQt/resources/arrows-skip-forward.png b/BioTrackerQt/Source/BioTrackerQt/resources/arrows-skip-forward.png new file mode 100644 index 0000000000000000000000000000000000000000..949ddbf21ec919ee3715de188c742de9204c7a1a Binary files /dev/null and b/BioTrackerQt/Source/BioTrackerQt/resources/arrows-skip-forward.png differ diff --git a/BioTrackerQt/Source/BioTrackerQt/resources/fullscreen.png b/BioTrackerQt/Source/BioTrackerQt/resources/fullscreen.png new file mode 100644 index 0000000000000000000000000000000000000000..46d6dead3615a1eec0c545f66b9ae57b3040efc4 Binary files /dev/null and b/BioTrackerQt/Source/BioTrackerQt/resources/fullscreen.png differ diff --git a/BioTrackerQt/Source/BioTrackerQt/resources/panZoom.png b/BioTrackerQt/Source/BioTrackerQt/resources/panZoom.png new file mode 100644 index 0000000000000000000000000000000000000000..63cca15413a4f4ea22c7255912f0d6a860c42feb Binary files /dev/null and b/BioTrackerQt/Source/BioTrackerQt/resources/panZoom.png differ diff --git a/BioTrackerQt/Source/BioTrackerQt/resources/pause-sign.png b/BioTrackerQt/Source/BioTrackerQt/resources/pause-sign.png new file mode 100644 index 0000000000000000000000000000000000000000..4fa9ebee0c903c6d547ec6f6c85fa5beef205c26 Binary files /dev/null and b/BioTrackerQt/Source/BioTrackerQt/resources/pause-sign.png differ diff --git a/BioTrackerQt/Source/BioTrackerQt/resources/screenshot.png b/BioTrackerQt/Source/BioTrackerQt/resources/screenshot.png new file mode 100644 index 0000000000000000000000000000000000000000..6e82d6032bc77e00bacb93b6d0865284fa2f411e Binary files /dev/null and b/BioTrackerQt/Source/BioTrackerQt/resources/screenshot.png differ diff --git a/BioTrackerQt/Source/BioTrackerQt/resources/stop.png b/BioTrackerQt/Source/BioTrackerQt/resources/stop.png new file mode 100644 index 0000000000000000000000000000000000000000..d776627d52de908eadbadc484022795d18b4a63b Binary files /dev/null and b/BioTrackerQt/Source/BioTrackerQt/resources/stop.png differ diff --git a/BioTrackerQt/Source/BioTrackerQt/settings/Messages.h b/BioTrackerQt/Source/BioTrackerQt/settings/Messages.h new file mode 100644 index 0000000000000000000000000000000000000000..53e9b117f05b48757cf47e5f92120649d9e67e3b --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/settings/Messages.h @@ -0,0 +1,35 @@ +#pragma once + +namespace BioTracker { +namespace Core { + +namespace Messages { +namespace System { + +static const std::string APPLICATION_CANNOT_START = + "Application cannot start"; +static const std::string NO_OPENGL = + "This system has no OpenGL support!"; +static const std::string MISSING_CONFIGURATION_FILE = + "Configuration file is missing! Using default parameters."; + +} + +enum class MessageType : size_t { + NOTIFICATION = 0, + WARNING, + FAIL, + FILE_OPEN +}; + +inline MessageType fromInt(const size_t v) { + return static_cast<MessageType>(v); +} + +} + +using Messages::MessageType; + +} +} + diff --git a/BioTrackerQt/Source/BioTrackerQt/settings/ParamNames.h b/BioTrackerQt/Source/BioTrackerQt/settings/ParamNames.h new file mode 100644 index 0000000000000000000000000000000000000000..72b2d583ae6611823406520fe1528c455c297474 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/settings/ParamNames.h @@ -0,0 +1,92 @@ +#pragma once + +#include <string> // std::string + +#include <boost/filesystem.hpp> + +#include <QDir> +#include <QStandardPaths> + +namespace ConfigParam { +static const boost::filesystem::path CONFIG_PATH = boost::filesystem::path( + QDir::toNativeSeparators( + QStandardPaths::writableLocation(QStandardPaths::ConfigLocation)).toStdString()); +static const boost::filesystem::path BASE_PATH = CONFIG_PATH / "BioTracker"; +static const boost::filesystem::path CONFIGURATION_FILE = BASE_PATH / "config.json"; +static const boost::filesystem::path GEOMETRY_FILE = BASE_PATH / "geometry.cfg"; +static const boost::filesystem::path STATE_FILE = BASE_PATH / "state.cfg"; +static const boost::filesystem::path MODULE_PATH = BASE_PATH / "modules"; +} + +namespace TrackerParam { +static const std::string TRACKING_ENABLED = "TRACKERPARAM.TRACKING_ENABLED"; + +static const std::string SELECTED_TRACKER = "TRACKERPARAM.SELECTED_TRACKER"; +} + +namespace GuiParam { +enum class MediaType : uint8_t { + NoMedia = 0, + Video, + Images, + Camera +}; + +enum class VideoMode : uint8_t { + Playing = 0, + Paused, + Stopped, + Init +}; + + +static const std::string MEDIA_TYPE = "GUIPARAM.MEDIA_TYPE"; +static const std::string SHORTCUT_PLAY = "GUIPARAM.SHORTCUT_PLAY"; +static const std::string SHORTCUT_NEXT = "GUIPARAM.SHORTCUT_NEXT"; +static const std::string SHORTCUT_PREV = "GUIPARAM.SHORTCUT_PREV"; +static const std::string SHORTCUT_ZOOM = "GUIPARAM.SHORTCUT_ZOOM"; +static const std::string SHORTCUT_TRACKING = "GUIPARAM.SHORTCUT_TRACKING"; + +static const std::string PAUSED_AT_FRAME = "GUIPARAM.PAUSED_AT_FRAME"; +} + +namespace PictureParam { +//path to picture +static const std::string PICTURE_FILES = "PICTUREPARAM.PICTURE_FILES"; +} + +namespace CaptureParam { +// Video path +static const std::string CAP_VIDEO_FILE = "CAPTUREPARAM.CAP_VIDEO_FILE"; +static const std::string CAP_SCREENSHOT_PATH = + "CAPTUREPARAM.CAP_SCREENSHOT_PATH"; +static const std::string CAP_CAMERA_ID = "CAPTUREPARAM.CAP_CAMERA_ID"; + +// Video paths +static const std::string ENABLE_RECORD_RAW = + "CAPTUREPARAM.ENABLE_RECORD_RAW"; +static const std::string ENABLE_RECORD_TRACKING = + "CAPTUREPARAM.ENABLE_RECORD_TRACKING"; +static const std::string ENABLE_RECORD_TRACK_INFO = + "CAPTUREPARAM.ENABLE_RECORD_TRACK_INFO"; + +static const std::string RECORDING_TRACKING_PATH = + "CAPTUREPARAM.RECORDING_TRACKING_PATH"; +static const std::string RECORDING_RAW_PATH = + "CAPTUREPARAM.RECORDING_RAW_PATH"; +static const std::string TRACKING_INFO_OUTPUT_PATH = + "CAPTUREPARAM.TRACKING_INFO_OUTPUT_PATH"; + +enum CAP_TYPE_ENUM { + CAP_FROM_CAM = 0, + CAP_FROM_FILE = 1 +}; + +enum CAP_STATE_ENUM { + CAP_FINISHED = 0, + CAP_PAUSE = 1, + CAP_AVAILABLE = 2, + CAP_EXITED = 3 +}; +} + diff --git a/BioTrackerQt/Source/BioTrackerQt/settings/Settings.h b/BioTrackerQt/Source/BioTrackerQt/settings/Settings.h new file mode 100644 index 0000000000000000000000000000000000000000..045e845d61b3bdfadd6c9e6f6be0d882fba30a3c --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/settings/Settings.h @@ -0,0 +1,180 @@ +#pragma once + +#include <type_traits> +#include <boost/filesystem.hpp> + +#include <boost/lexical_cast.hpp> +#include <boost/property_tree/json_parser.hpp> +#include <boost/property_tree/ptree.hpp> + +#include "../util/stringTools.h" // (un)escape_non_ascii +#include "StringTranslator.h" +#include "ParamNames.h" + +namespace { +template<typename Test, template<typename...> class Ref> +struct is_specialization : std::false_type {}; + +template<template<typename...> class Ref, typename... Args> +struct is_specialization<Ref<Args...>, Ref>: std::true_type {}; +} + +namespace BioTracker { +namespace Core { + +class Settings { + public: + /** + * The default constructor. + */ + explicit Settings(); + + /** + * destructor. + */ + ~Settings() = default; + + /** + * Sets the parameter. + * @param paramName name of the parameter, + * @param paramValue value of the parameter, + */ + template <typename T> + void setParam(std::string const ¶mName, T &¶mValue) { + _ptree.put(paramName, preprocess_value(std::forward<T>(paramValue))); + boost::property_tree::write_json(ConfigParam::CONFIGURATION_FILE.string(), _ptree); + } + + /** + * Sets the vector of values of a parameter. + * @param paramName name of the parameter, + * @param paramVector vector of values of the parameter, + */ + template <typename T> + void setParam(std::string const ¶mName, std::vector<T> &¶mVector) { + boost::property_tree::ptree subtree; + for (T &value : paramVector) { + boost::property_tree::ptree valuetree; + valuetree.put("", value); + subtree.push_back(std::make_pair("", valuetree)); + } + _ptree.put_child(paramName, subtree); + boost::property_tree::write_json(ConfigParam::CONFIGURATION_FILE.string(), _ptree); + } + + /** + * Gets the parameter value provided by parameter name. + * @param paramName the parameter name, + * @return the value of the parameter as the specified type. + */ + template <typename T> + typename std::enable_if<!is_specialization<T, std::vector>::value, T>::type + getValueOfParam(const std::string ¶mName) const { + return postprocess_value(_ptree.get<T>(paramName)); + } + + /** + * Gets the vector of values provided by parameter name. + * + * Throws an boost exception if parameter does not exist. + * + * @param paramName the parameter name, + * @return the vector of values of the parameter with the specified type. + */ + template <typename T> + typename std::enable_if<is_specialization<T, std::vector>::value, T>::type + getValueOfParam(const std::string ¶mName) const { + T result; + for (auto &item : _ptree.get_child(paramName)) { + result.push_back(postprocess_value( + item.second.get_value<typename T::value_type>())); + } + return result; + } + + /** + * Gets either the parameter value provided by parameter name, if it + * exists, or a empty boost::optional<T> otherwise. + * @param paramName the parameter name, + * @return the value of the parameter wrapped in a boost::optional. + */ + template <typename T> + boost::optional<T> maybeGetValueOfParam(const std::string ¶mName) const { + return _ptree.get_optional<T>(paramName); + } + + /** + * Gets the parameter value provided by parameter name. + * If the parameter is not set yet, set to default value and return it. + * @param paramName the parameter name, + * @param defaultValue the default parameter value, + * @return the value of the parameter as the specified type. + */ + template <typename T> + T getValueOrDefault(const std::string ¶mName, const T &defaultValue) { + boost::optional<T> value = maybeGetValueOfParam<T>(paramName); + if (value) { + return value.get(); + } else { + setParam(paramName, defaultValue); + return defaultValue; + } + } + + private: + boost::property_tree::ptree _ptree; + + static const boost::property_tree::ptree getDefaultParams(); + + /** + * preprocesses paramValue before it's stored in the boost config tree + * + * default implementation: forward value + * + */ + template<typename T> + static T preprocess_value(T &¶mValue) { + return std::forward<T>(paramValue); + } + + /** + * postprocesses paramValue after it's extracted from the boost config tree + * + * default implementation: forward value + * + */ + template<typename T> + static T postprocess_value(T &¶mValue) { + return std::forward<T>(paramValue); + } + +}; + +/** + * std::string specialisation as a workaround for a bug in boost's config tree + * + * this function escapes every non-ASCII character + * + * (the tree correctly escapes non-ASCII characters and stores them + * as "\u00XX" where XX is the character's hex value, but it can't read these + * values correctly) + * + */ +template<> +inline std::string Settings::preprocess_value(std::string &¶mValue) { + return Util::escape_non_ascii(paramValue); +} + +/** + * std::string specialisation as a workaround for a bug in boost's config tree + * + * (the tree converts escaped non-ASCII characters ("\u00XX") to "\xFF") + * + */ +template<> +inline std::string Settings::postprocess_value(std::string &¶mValue) { + return Util::unescape_non_ascii(paramValue); +} + +} +} diff --git a/BioTrackerQt/Source/BioTrackerQt/settings/StringTranslator.h b/BioTrackerQt/Source/BioTrackerQt/settings/StringTranslator.h new file mode 100644 index 0000000000000000000000000000000000000000..7a64c7096b5fcaa6a03c3439c6ab8e3505bac3f3 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/settings/StringTranslator.h @@ -0,0 +1,53 @@ +#pragma once + +#include <boost/assign.hpp> +#include <boost/bimap.hpp> +#include <boost/optional.hpp> +#include <boost/property_tree/ptree.hpp> + +#include "ParamNames.h" + +namespace StringTranslator { + +template<typename external_type> +struct BiMapContainer { + typedef boost::bimap<external_type, std::string> bm_type; + typename bm_type::relation bm_relation; + static const bm_type value; +}; + +// enables conversion from/to an arbitrary type and an std::string by using +// a boost::bimap. Requires a template specialization of BiMapContainer with +// external_type. +template <typename external_type> +struct StringTranslator { + typedef std::string internal_type; + typename BiMapContainer<external_type>::bm_type bm_type; + + const boost::bimap<external_type, std::string> bimap = + BiMapContainer<external_type>::value; + + boost::optional<external_type> get_value(const internal_type &internal) { + return boost::optional<external_type>(bimap.right.at(internal)); + } + + boost::optional<internal_type> put_value(const external_type &external) { + return boost::optional<internal_type>(bimap.left.at(external)); + } +}; + +} + +namespace boost { +namespace property_tree { + +// template specialization for EnumTranslator for GUIPARAM::MediaType +// this allows boost::property_tree to store a string representation of +// MediaType in the settings file +template<> +struct translator_between<std::string, GuiParam::MediaType> { + typedef StringTranslator::StringTranslator<GuiParam::MediaType> type; +}; + +} +} diff --git a/BioTrackerQt/Source/BioTrackerQt/settings/SystemCompatibilityCheck.h b/BioTrackerQt/Source/BioTrackerQt/settings/SystemCompatibilityCheck.h new file mode 100644 index 0000000000000000000000000000000000000000..829f1af1dc2c0b9fce9ec203414218dbc3f2283c --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/settings/SystemCompatibilityCheck.h @@ -0,0 +1,12 @@ +#pragma once + +#include "util/platform.h" + +namespace SystemCompatibilityCheck { +/** + * Check the system supports openGL. + * @return true, system supports openGL, false otherwise. + */ +bool BIOTRACKER_DLLEXPORT checkOpenGLSupport(); +} + diff --git a/BioTrackerQt/Source/BioTrackerQt/src/settings/Settings.cpp b/BioTrackerQt/Source/BioTrackerQt/src/settings/Settings.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ac78d2ae012e5ccb022f61fea07abab62e877faa --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/src/settings/Settings.cpp @@ -0,0 +1,46 @@ +#include "settings/Settings.h" + +#include <boost/filesystem.hpp> + +#include <QFile> +#include <QMessageBox> + +#include "Exceptions.h" +#include "settings/Messages.h" + +namespace BioTracker { +namespace Core { + +Settings::Settings() { + if (!boost::filesystem::is_directory(ConfigParam::BASE_PATH)) { + if (!boost::filesystem::create_directory(ConfigParam::BASE_PATH)) { + throw BioTracker::Core::path_creation_error("Unable to create config dir"); + } + } + if (!boost::filesystem::is_directory(ConfigParam::MODULE_PATH)) { + if (!boost::filesystem::create_directory(ConfigParam::MODULE_PATH)) { + throw BioTracker::Core::path_creation_error("Unable to create module dir"); + } + } + if (!QFile::exists(QString::fromStdString(ConfigParam::CONFIGURATION_FILE.string()))) { + QMessageBox::warning(nullptr, "No configuration file", + QString::fromStdString(Messages::System::MISSING_CONFIGURATION_FILE)); + _ptree = getDefaultParams(); + boost::property_tree::write_json(ConfigParam::CONFIGURATION_FILE.string(), _ptree); + } else { + boost::property_tree::ptree pt; + boost::property_tree::read_json(ConfigParam::CONFIGURATION_FILE.string(), pt); + _ptree = pt; + } +} + +const boost::property_tree::ptree Settings::getDefaultParams() { + boost::property_tree::ptree pt; + + pt.put(TrackerParam::TRACKING_ENABLED, false); + + return pt; +} + +} +} diff --git a/BioTrackerQt/Source/BioTrackerQt/src/settings/StringTranslator.cpp b/BioTrackerQt/Source/BioTrackerQt/src/settings/StringTranslator.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7b91e3e3e01af3fde2bde8110eea10c31a6587d6 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/src/settings/StringTranslator.cpp @@ -0,0 +1,14 @@ +#include "settings/StringTranslator.h" + +namespace { +typedef GuiParam::MediaType EnumType; +} + +namespace StringTranslator { +template<> +const BiMapContainer<EnumType>::bm_type BiMapContainer<EnumType>::value = + boost::assign::list_of<BiMapContainer<EnumType>::bm_type::relation> + (EnumType::NoMedia, "NoMedia") + (EnumType::Images, "Images") + (EnumType::Video, "Video"); +} diff --git a/BioTrackerQt/Source/BioTrackerQt/src/settings/SystemCompatibilityCheck.cpp b/BioTrackerQt/Source/BioTrackerQt/src/settings/SystemCompatibilityCheck.cpp new file mode 100644 index 0000000000000000000000000000000000000000..40bc6204347957bc86cb212204e2b233fe6cede7 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/src/settings/SystemCompatibilityCheck.cpp @@ -0,0 +1,7 @@ +#include "settings/SystemCompatibilityCheck.h" + +#include <QGLFormat> + +bool SystemCompatibilityCheck::checkOpenGLSupport() { + return QGLFormat::hasOpenGL(); +} diff --git a/BioTrackerQt/Source/BioTrackerQt/src/util/CvHelper.cpp b/BioTrackerQt/Source/BioTrackerQt/src/util/CvHelper.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bc0146bc0cff52f5996d231e35db3fc9f2104808 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/src/util/CvHelper.cpp @@ -0,0 +1,51 @@ +/* + * CvHelper.cpp + * + * Created on: May 12, 2015 + * Author: tobias + */ + +#include "util/CvHelper.h" + +namespace BioTracker { +namespace Core { +namespace CvHelper { + +std::string cvDataType2str(int type) { + const int depth = CV_MAT_DEPTH(type); + const int cn = CV_MAT_CN(type); + std::string result = "CV_"; + + switch (depth) { + case CV_8U: + result += "8U"; + break; + case CV_8S: + result += "8S"; + break; + case CV_16U: + result += "16U"; + break; + case CV_16S: + result += "16S"; + break; + case CV_32S: + result += "32S"; + break; + case CV_32F: + result += "32F"; + break; + case CV_64F: + result += "64F"; + break; + default: + result += "UNKOWN"; + break; + } + result += "C" + std::to_string(cn); + return result; +} + +} +} +} diff --git a/BioTrackerQt/Source/BioTrackerQt/src/util/imagePreProcessor/ImagePreProcessor.cpp b/BioTrackerQt/Source/BioTrackerQt/src/util/imagePreProcessor/ImagePreProcessor.cpp new file mode 100644 index 0000000000000000000000000000000000000000..98d892ef2ac0db2bdef3e6fc09b23c858f43ce67 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/src/util/imagePreProcessor/ImagePreProcessor.cpp @@ -0,0 +1,217 @@ +#include "util/imagePreProcessor/ImagePreProcessor.h" + +#include <QReadWriteLock> + +#include "settings/Settings.h" +#include "settings/ParamNames.h" + +namespace { +QReadWriteLock lock; +} + +namespace BioTracker { +namespace Core { + +ImagePreProcessor::ImagePreProcessor(Settings &settings) : + _settings(settings) { + init(); +} + +void ImagePreProcessor::init() { + /* + _pMOG = std::make_unique<cv::BackgroundSubtractorMOG2>( + _settings.getValueOfParam<int>(PREPROCESSORPARAM::BG_MOG2_HISTORY), + _settings.getValueOfParam<float>(PREPROCESSORPARAM::BG_MOG2_VAR_THRESHOLD), + _settings.getValueOfParam<bool>(PREPROCESSORPARAM::BG_MOG2_SHADOW_DETECTION)); + */ +} + +cv::Mat ImagePreProcessor::binarize(cv::Mat image) { + //cv::Mat grayImage; + //cv::cvtColor( image, grayImage, CV_BGR2GRAY ); + cv::Mat binarizedImage; + if (image.data) { + cv::threshold(image, binarizedImage, + _settings.getValueOfParam<int>(PREPROCESSORPARAM::THRESHOLD_BINARIZING), 255, + cv::THRESH_BINARY); + } + return binarizedImage; +} + +cv::Mat ImagePreProcessor::erode(cv::Mat image) { + cv::Mat erodedImage; + cv::Mat erodeKernel; + if (_settings.getValueOfParam<int>(PREPROCESSORPARAM::SIZE_ERODE) > 0) { + erodeKernel = cv::getStructuringElement(cv::MORPH_CROSS, + cv::Size(_settings.getValueOfParam<int>(PREPROCESSORPARAM::SIZE_ERODE), + _settings.getValueOfParam<int>(PREPROCESSORPARAM::SIZE_ERODE))); + } else { + return image; + } + if (image.data) { + cv::erode(image, erodedImage, erodeKernel); + } + return erodedImage; +} + +cv::Mat ImagePreProcessor::dilate(cv::Mat image) { + cv::Mat dilatedImage; + cv::Mat dilateKernel; + if (_settings.getValueOfParam<int>(PREPROCESSORPARAM::SIZE_DILATE) > 0) { + dilateKernel = cv::getStructuringElement( + cv::MORPH_RECT, + cv::Size(_settings.getValueOfParam<int>(PREPROCESSORPARAM::SIZE_DILATE), + _settings.getValueOfParam<int>(PREPROCESSORPARAM::SIZE_DILATE))); + } else { + return image; + } + if (image.data) { + cv::dilate(image, dilatedImage, dilateKernel); + } + return dilatedImage; +} + +cv::Mat ImagePreProcessor::backgroundSubtraction(cv::Mat image) { + cv::Mat fgMaskMOG; + //_pMOG->set("backgroundRatio",_systemProperty.getValueOfParam<double>(TRACKERPARAM::BG_MOG2_BACKGROUND_RATIO)); + //_pMOG->operator()(image,fgMaskMOG); //fg mask generated by MOG method + //return fgMaskMOG; + + if (!_backgroundImage.data) { + image.copyTo(_backgroundImage); + } + + // calculate the image difference + fgMaskMOG = (_backgroundImage - image); + + // weight the background image + double alpha = _settings.getValueOfParam<double> + (PREPROCESSORPARAM::BG_MOG2_BACKGROUND_RATIO); + _backgroundImage = (1.0 - alpha) * _backgroundImage + alpha * image; + + cv::cvtColor(fgMaskMOG,fgMaskMOG,CV_BGR2GRAY); + return fgMaskMOG; +} + +void ImagePreProcessor::preProcess(cv::Mat image) { + lock.lockForWrite(); + image.copyTo(_original); + lock.unlock(); + image.copyTo(_proceededImage); + + if (_settings.getValueOfParam<bool> + (PREPROCESSORPARAM::ENABLE_BG_SUBTRACTION)) { // 1. step: do the background subtraction + _fgMaskMOG = backgroundSubtraction(_proceededImage); + _fgMaskMOG.copyTo(_proceededImage); + } + + ////TODO:: An exception was thrown here. Maybe one shall use local variable instead of using a call on a data file to get the variable. + //if(_systemProperty.getValueOfParam<bool>(TRACKERPARAM::ENABLE_BG_SUBTRACTION) && _backgroundEnabled) // 1.1 step: gets the over time background image + //{ + // _pMOG->getBackgroundImage(_backgroundImage); + //} + + if (_settings.getValueOfParam<bool> + (PREPROCESSORPARAM::ENABLE_BINARIZING)) { // 2. step: binarize the image + _binarizedImage = binarize(_proceededImage); + _binarizedImage.copyTo(_proceededImage); + } + + if (_settings.getValueOfParam<bool> + (PREPROCESSORPARAM::ENABLE_ERODE)) { // 3. step: erode the image + _erodedImage = erode(_proceededImage); + _erodedImage.copyTo(_proceededImage); + } + + if (_settings.getValueOfParam<bool> + (PREPROCESSORPARAM::ENABLE_DILATE)) { // 4. step: dilate the image + _dilatedImage = dilate(_proceededImage); + _dilatedImage.copyTo(_proceededImage); + } +} + +void ImagePreProcessor::setEnable(std::string enableProcess, bool enabled) { + if (enableProcess.compare(PREPROCESSORPARAM::ENABLE_BG_SUBTRACTION) == 0) { + _backgroundSubtractionEnabled = enabled; + return; + } + + if (enableProcess.compare(PREPROCESSORPARAM::ENABLE_BG_IMAGE) == 0) { + _backgroundEnabled = enabled; + return; + } + + if (enableProcess.compare(PREPROCESSORPARAM::ENABLE_BINARIZING) == 0) { + _binarizeEnabled = enabled; + return; + } + + if (enableProcess.compare(PREPROCESSORPARAM::ENABLE_ERODE) == 0) { + _erodeEnabled = enabled; + return; + } + + if (enableProcess.compare(PREPROCESSORPARAM::ENABLE_DILATE) == 0) { + _dilateEnabled = enabled; + return; + } +} + +cv::Mat ImagePreProcessor::imageDisplayType( + PREPROCESSORPARAM::IMAGE_DISPLAY_TYPE imageDisplayType) { + switch (imageDisplayType) { + case PREPROCESSORPARAM::IMAGE_DISPLAY_TYPE::IMAGE_BI: + if (_settings.getValueOfParam<bool>(PREPROCESSORPARAM::ENABLE_BINARIZING)) { + return _binarizedImage; + } + break; + case PREPROCESSORPARAM::IMAGE_DISPLAY_TYPE::IMAGE_ER: + if (_settings.getValueOfParam<bool>(PREPROCESSORPARAM::ENABLE_ERODE)) { + return _erodedImage; + } + break; + case PREPROCESSORPARAM::IMAGE_DISPLAY_TYPE::IMAGE_DI: + if (_settings.getValueOfParam<bool>(PREPROCESSORPARAM::ENABLE_DILATE)) { + return _dilatedImage; + } + break; + case PREPROCESSORPARAM::IMAGE_DISPLAY_TYPE::IMAGE_FG: + if (_settings.getValueOfParam<bool>(PREPROCESSORPARAM::ENABLE_BG_SUBTRACTION)) { + return _fgMaskMOG; + } + break; + case PREPROCESSORPARAM::IMAGE_DISPLAY_TYPE::IMAGE_BG: + if (_settings.getValueOfParam<bool>(PREPROCESSORPARAM::ENABLE_BG_SUBTRACTION) + && _backgroundEnabled) { + return _backgroundImage; + } + break; + case PREPROCESSORPARAM::IMAGE_DISPLAY_TYPE::IMAGE_PP: + return _proceededImage; + default: + return _original; + } + if (_original.data) { + return _original; + } + return cv::Mat(); +} + +void ImagePreProcessor::resetBackgroundImage() { + try { + /*cv::Mat bgMat; + _pMOG->getBackgroundImage(bgMat); + _pMOG->initialize(bgMat.size(), bgMat.type());*/ + lock.lockForRead(); + _original.copyTo(_backgroundImage); + lock.unlock(); + } catch (cv::Exception) { + + } + +} + +} +} + + diff --git a/BioTrackerQt/Source/BioTrackerQt/src/util/stringTools.cpp b/BioTrackerQt/Source/BioTrackerQt/src/util/stringTools.cpp new file mode 100644 index 0000000000000000000000000000000000000000..711a8e8089c69cc88406df9710df583d8fb96158 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/src/util/stringTools.cpp @@ -0,0 +1,89 @@ +#include <climits> +#include <boost/filesystem/path.hpp> + +#include <string> // std::string +#include <stdexcept> // std::invalid_argument + +#include "util/platform.h" + +namespace BioTracker { +namespace Util { + +std::string BIOTRACKER_DLLEXPORT escape_non_ascii(const std::string &s) { + std::string result; + for (const auto c : s) { + // MSB is set --> not a valid ASCII character --> escape + if (c & (1 << (CHAR_BIT - 1))) { + static const char hex_map [] = "0123456789abcdef"; + const unsigned char uc = static_cast<unsigned char>(c); + result += "\\x"; + result += hex_map[uc >> 4]; + result += hex_map[uc & 0xf]; + } + // escape backslashes since this character initiates escape sequences + else if (c == '\\') { + result += "\\\\"; + } else { + result += c; + } + } + return result; +} + + +std::string BIOTRACKER_DLLEXPORT unescape_non_ascii(const std::string &s) { + + const auto advance = [&s](std::string::const_iterator &it) { + if (++it == s.cend()) { + throw std::invalid_argument("unexpected end of string"); + } + }; + + const auto from_hex = [](char c) -> unsigned char { + if ('0' <= c && c <= '9') { + return static_cast<unsigned char>(c - '0'); + } + if ('a' <= c && c <= 'f') { + return static_cast<unsigned char>(c - 'a' + 10); + } + throw std::invalid_argument("unexpected non-hex character in escape sequence"); + }; + + std::string result; + for (auto it = s.cbegin(); it != s.cend(); ++it) { + if (*it & (1 << (CHAR_BIT - 1))) { + throw std::invalid_argument("string contains a non-ASCII character"); + } + // begin of escape sequence + if (*it == '\\') { + advance(it); + // this is an escaped backslash + if (*it == '\\') { + result += '\\'; + } + // the following two chars encode one char + else if (*it == 'x') { + advance(it); + unsigned char c = from_hex(*it); + advance(it); + c = static_cast<char>(c << 4 | from_hex(*it)); + result += c; + } else { + throw std::invalid_argument("unexpected character in escape sequence"); + } + } + // regular ASCII char + else { + result += *it; + } + } + return result; +} + +std::string BIOTRACKER_DLLEXPORT stem_filename(const std::string &s) { + boost::filesystem::path p(s); + return p.stem().string(); +} + +} +} diff --git a/BioTrackerQt/Source/BioTrackerQt/util/CvHelper.h b/BioTrackerQt/Source/BioTrackerQt/util/CvHelper.h new file mode 100644 index 0000000000000000000000000000000000000000..606e9984c3bd736e365ca3e89937368da8ba5923 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/util/CvHelper.h @@ -0,0 +1,71 @@ +#pragma once + +#include <opencv2/opencv.hpp> // cv::Point, cv::Rect +#include <QRect> // QRect +#include <QPoint> // QPoint +#include <string> // std::string; std::to_string(int) + +/** + * Computer vision helper functions + */ +namespace BioTracker { +namespace Core { +namespace CvHelper { +struct cv_point_compare_less_x { + template<typename CV_POINT> + bool operator()(const CV_POINT &lhs, const CV_POINT &rhs) const { + return lhs.x < rhs.x; + } +}; + +struct cv_point_compare_less_y { + template<typename CV_POINT> + bool operator()(const CV_POINT &lhs, const CV_POINT &rhs) const { + return lhs.y < rhs.y; + } +}; + +inline cv::Rect toCv(const QRect &rect) { + return cv::Rect(rect.x(), rect.y(), rect.width(), rect.height()); +} + +inline QRect toQt(const cv::Rect &rect) { + return QRect(rect.x,rect.y,rect.width,rect.height); +} + +inline QPoint toQt(const cv::Point &point) { + return QPoint(point.x, point.y); +} + +/** + * @see: http://en.cppreference.com/w/cpp/algorithm/lexicographical_compare + */ +struct cv_vec_compare_less_lexicographically { + template<typename CV_VEC> + bool operator()(const CV_VEC &lhs, const CV_VEC &rhs) const { + for (int i = 0; i < CV_VEC::channels; ++i) { + if (lhs[i] < rhs[i]) { + return true; + } + if (rhs[i] < lhs[i]) { + return false; + } + } + return false; + } +}; + +/** + * converts an opencv data type value (int) to the name of the corresponding macro i.e. "CV_\d+[UFS]C\d" + * + * @see: cv::DataType<T>::type + * + * @example: + * CvHelper::cvDataType2str( CV_8UC3 ) --> std::string( "CV_8UC3" ) + * + */ +std::string cvDataType2str(int type); + +} +} +} diff --git a/BioTrackerQt/Source/BioTrackerQt/util/MutexWrapper.h b/BioTrackerQt/Source/BioTrackerQt/util/MutexWrapper.h new file mode 100644 index 0000000000000000000000000000000000000000..760626cd94c377d7621137692ceac71903d4d33d --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/util/MutexWrapper.h @@ -0,0 +1,199 @@ +#ifndef THREAD_SAFETY_ANALYSIS_MUTEX_H +#define THREAD_SAFETY_ANALYSIS_MUTEX_H + +#include <mutex> + +// Enable thread safety attributes only with clang. +// The attributes can be safely erased when compiling with other compilers. +#if defined(__clang__) && (!defined(SWIG)) +#define THREAD_ANNOTATION_ATTRIBUTE__(x) __attribute__((x)) +#else +#define THREAD_ANNOTATION_ATTRIBUTE__(x) // no-op +#endif + +#define CAPABILITY(x) \ + THREAD_ANNOTATION_ATTRIBUTE__(capability(x)) + +#define SCOPED_CAPABILITY \ + THREAD_ANNOTATION_ATTRIBUTE__(scoped_lockable) + +#define GUARDED_BY(x) \ + THREAD_ANNOTATION_ATTRIBUTE__(guarded_by(x)) + +#define PT_GUARDED_BY(x) \ + THREAD_ANNOTATION_ATTRIBUTE__(pt_guarded_by(x)) + +#define ACQUIRED_BEFORE(...) \ + THREAD_ANNOTATION_ATTRIBUTE__(acquired_before(__VA_ARGS__)) + +#define ACQUIRED_AFTER(...) \ + THREAD_ANNOTATION_ATTRIBUTE__(acquired_after(__VA_ARGS__)) + +#define REQUIRES(...) \ + THREAD_ANNOTATION_ATTRIBUTE__(requires_capability(__VA_ARGS__)) + +#define REQUIRES_SHARED(...) \ + THREAD_ANNOTATION_ATTRIBUTE__(requires_shared_capability(__VA_ARGS__)) + +#define ACQUIRE(...) \ + THREAD_ANNOTATION_ATTRIBUTE__(acquire_capability(__VA_ARGS__)) + +#define ACQUIRE_SHARED(...) \ + THREAD_ANNOTATION_ATTRIBUTE__(acquire_shared_capability(__VA_ARGS__)) + +#define RELEASE(...) \ + THREAD_ANNOTATION_ATTRIBUTE__(release_capability(__VA_ARGS__)) + +#define RELEASE_SHARED(...) \ + THREAD_ANNOTATION_ATTRIBUTE__(release_shared_capability(__VA_ARGS__)) + +#define TRY_ACQUIRE(...) \ + THREAD_ANNOTATION_ATTRIBUTE__(try_acquire_capability(__VA_ARGS__)) + +#define TRY_ACQUIRE_SHARED(...) \ + THREAD_ANNOTATION_ATTRIBUTE__(try_acquire_shared_capability(__VA_ARGS__)) + +#define EXCLUDES(...) \ + THREAD_ANNOTATION_ATTRIBUTE__(locks_excluded(__VA_ARGS__)) + +#define ASSERT_CAPABILITY(x) \ + THREAD_ANNOTATION_ATTRIBUTE__(assert_capability(x)) + +#define ASSERT_SHARED_CAPABILITY(x) \ + THREAD_ANNOTATION_ATTRIBUTE__(assert_shared_capability(x)) + +#define RETURN_CAPABILITY(x) \ + THREAD_ANNOTATION_ATTRIBUTE__(lock_returned(x)) + +#define NO_THREAD_SAFETY_ANALYSIS \ + THREAD_ANNOTATION_ATTRIBUTE__(no_thread_safety_analysis) + + +// Defines an annotated interface for mutexes. +// These methods can be implemented to use any internal mutex implementation. +class CAPABILITY("mutex") Mutex { + public: + // Acquire/lock this mutex exclusively. Only one thread can have exclusive + // access at any one time. Write operations to guarded data require an + // exclusive lock. + void Lock() ACQUIRE() { + mutex.lock(); + } + + // Acquire/lock this mutex for read operations, which require only a shared + // lock. This assumes a multiple-reader, single writer semantics. Multiple + // threads may acquire the mutex simultaneously as readers, but a writer + // must wait for all of them to release the mutex before it can acquire it + // exclusively. + void ReaderLock() ACQUIRE_SHARED(); + + // Release/unlock an exclusive mutex. + void Unlock() RELEASE() { + mutex.unlock(); + } + + // Release/unlock a shared mutex. + void ReaderUnlock() RELEASE_SHARED(); + + // Try to acquire the mutex. Returns true on success, and false on failure. + bool TryLock() TRY_ACQUIRE(true) { + return mutex.try_lock(); + } + + // Try to acquire the mutex for read operations. + bool ReaderTryLock() TRY_ACQUIRE_SHARED(true); + + // Assert that this mutex is currently held by the calling thread. + void AssertHeld() ASSERT_CAPABILITY(this); + + // Assert that is mutex is currently held for read operations. + void AssertReaderHeld() ASSERT_SHARED_CAPABILITY(this); + private: + std::mutex mutex; +}; + + +// MutexLocker is an RAII class that acquires a mutex in its constructor, and +// releases it in its destructor. +class SCOPED_CAPABILITY MutexLocker { + private: + Mutex &mutex; + + public: + MutexLocker(Mutex &mu) ACQUIRE(mu) : mutex(mu) { + mutex.Lock(); + } + ~MutexLocker() RELEASE() { + mutex.Unlock(); + } +}; + + +#ifdef USE_LOCK_STYLE_THREAD_SAFETY_ATTRIBUTES +// The original version of thread safety analysis the following attribute +// definitions. These use a lock-based terminology. They are still in use +// by existing thread safety code, and will continue to be supported. + +// Deprecated. +#define PT_GUARDED_VAR \ + THREAD_ANNOTATION_ATTRIBUTE__(pt_guarded) + +// Deprecated. +#define GUARDED_VAR \ + THREAD_ANNOTATION_ATTRIBUTE__(guarded) + +// Replaced by REQUIRES +#define EXCLUSIVE_LOCKS_REQUIRED(...) \ + THREAD_ANNOTATION_ATTRIBUTE__(exclusive_locks_required(__VA_ARGS__)) + +// Replaced by REQUIRES_SHARED +#define SHARED_LOCKS_REQUIRED(...) \ + THREAD_ANNOTATION_ATTRIBUTE__(shared_locks_required(__VA_ARGS__)) + +// Replaced by CAPABILITY +#define LOCKABLE \ + THREAD_ANNOTATION_ATTRIBUTE__(lockable) + +// Replaced by SCOPED_CAPABILITY +#define SCOPED_LOCKABLE \ + THREAD_ANNOTATION_ATTRIBUTE__(scoped_lockable) + +// Replaced by ACQUIRE +#define EXCLUSIVE_LOCK_FUNCTION(...) \ + THREAD_ANNOTATION_ATTRIBUTE__(exclusive_lock_function(__VA_ARGS__)) + +// Replaced by ACQUIRE_SHARED +#define SHARED_LOCK_FUNCTION(...) \ + THREAD_ANNOTATION_ATTRIBUTE__(shared_lock_function(__VA_ARGS__)) + +// Replaced by RELEASE and RELEASE_SHARED +#define UNLOCK_FUNCTION(...) \ + THREAD_ANNOTATION_ATTRIBUTE__(unlock_function(__VA_ARGS__)) + +// Replaced by TRY_ACQUIRE +#define EXCLUSIVE_TRYLOCK_FUNCTION(...) \ + THREAD_ANNOTATION_ATTRIBUTE__(exclusive_trylock_function(__VA_ARGS__)) + +// Replaced by TRY_ACQUIRE_SHARED +#define SHARED_TRYLOCK_FUNCTION(...) \ + THREAD_ANNOTATION_ATTRIBUTE__(shared_trylock_function(__VA_ARGS__)) + +// Replaced by ASSERT_CAPABILITY +#define ASSERT_EXCLUSIVE_LOCK(...) \ + THREAD_ANNOTATION_ATTRIBUTE__(assert_exclusive_lock(__VA_ARGS__)) + +// Replaced by ASSERT_SHARED_CAPABILITY +#define ASSERT_SHARED_LOCK(...) \ + THREAD_ANNOTATION_ATTRIBUTE__(assert_shared_lock(__VA_ARGS__)) + +// Replaced by EXCLUDE_CAPABILITY. +#define LOCKS_EXCLUDED(...) \ + THREAD_ANNOTATION_ATTRIBUTE__(locks_excluded(__VA_ARGS__)) + +// Replaced by RETURN_CAPABILITY +#define LOCK_RETURNED(x) \ + THREAD_ANNOTATION_ATTRIBUTE__(lock_returned(x)) + +#endif // USE_LOCK_STYLE_THREAD_SAFETY_ATTRIBUTES + +#endif // THREAD_SAFETY_ANALYSIS_MUTEX_H diff --git a/BioTrackerQt/Source/BioTrackerQt/util/QtRaiiWrapper.hpp b/BioTrackerQt/Source/BioTrackerQt/util/QtRaiiWrapper.hpp new file mode 100644 index 0000000000000000000000000000000000000000..cc4b626fa03ff6074fc561b0a3d03ecea31166cc --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/util/QtRaiiWrapper.hpp @@ -0,0 +1,19 @@ +#pragma once + +namespace BioTracker { +namespace Util { + +/** + * source: http://stackoverflow.com/a/28125217 + */ +template<typename UiClass, typename ParentClass> class QtRaiiWrapper : public UiClass +{ +public: + QtRaiiWrapper(ParentClass *parent) + { + this->setupUi(parent); + } +}; + +} +} diff --git a/BioTrackerQt/Source/BioTrackerQt/util/ScreenHelper.h b/BioTrackerQt/Source/BioTrackerQt/util/ScreenHelper.h new file mode 100644 index 0000000000000000000000000000000000000000..ee8496ad065eb10162421bf66b7ea35079acff97 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/util/ScreenHelper.h @@ -0,0 +1,208 @@ +#pragma once + +#include <QRect> // QRect +#include <QPoint> // QPoint +#include "PanZoomState.h" +#include "math.h" + +/** + * Screen helper functions + */ +namespace BioTracker { +namespace Core { +namespace ScreenHelper { + +/** + * @brief calculate_viewport + * @param im_w width of the image + * @param im_h height of the image + * @param w width of the videoview + * @param h height of the videoview + * @param window OUT parameter + * @param viewport OUT parameter + */ +inline float calculate_viewport( + const int im_w, const int im_h, + const int w, const int h, + QRect &window, QRect &viewport) { + + // We use setWindow and setViewport to fit the video into the + // given video widget frame (with width "w" and height "h") + // we later need to adjust an offset caused the use of different + // dimensions for window and viewport. + const float im_wf = static_cast<float>(im_w); + const float im_hf = static_cast<float>(im_h); + const float w_f = static_cast<float>(w); + const float h_f = static_cast<float>(h); + + float ratio = 0; + int offset_top = 0; + int offset_left = 0; + + if ((im_wf/im_hf) > (w_f/h_f)) { + // image ratio is bigger (wider image than window) + ratio = im_wf / w_f; + const float px = w_f / im_wf; + const float px_im_hf = px * im_hf; + offset_top = h/2 - static_cast<int>(px_im_hf / 2); + } else { + // window ratio is bigger (narrow image) + ratio = im_hf / h_f; + const float px = h_f / im_hf; + const float px_im_wf = px * im_wf; + offset_left = w/2 - static_cast<int>(px_im_wf / 2); + } + + const int screen_w = static_cast<int>(im_wf * ratio); + const int screen_h = static_cast<int>(im_hf * ratio); + + window.setX(0); + window.setY(0); + window.setWidth(screen_w); + window.setHeight(screen_h); + + viewport.setX(offset_left); + viewport.setY(offset_top); + viewport.setWidth(im_w); + viewport.setHeight(im_h); + + // adjust the panning as the viewport is potentially scewed + // and mouse movements given by the window are not translated + // one-to-one anymore + return screen_w / im_wf; +} + +/** + * @brief getImDimsInScreenCoords + * Calculates the actual dimension of the image with all zoom, pan and + * viewport transformations applied + * @return a rectangle that represents the position and dimension of the + * image in the videoview element + */ +inline QRect getImDimsInScreenCoords( + const PanZoomState zoomState, + const int im_w, const int im_h, + const int w, const int h) { + + QRect viewport, window; + const float viewportRatio = calculate_viewport(im_w, im_h, w, h, window, viewport); + const float zoom = 1 + zoomState.zoomFactor; + // back-translate the pan to non-zoomed coordinate space + float realPanX = -zoomState.panX; + float realPanY = -zoomState.panY; + realPanX += (viewport.x()); + realPanY += (viewport.y()); + + // The image in screen coords + QRect actualIm( + static_cast<int>(realPanX), static_cast<int>(realPanY), + static_cast<int>((im_w / viewportRatio) * zoom), + static_cast<int>((im_h / viewportRatio) * zoom) + ); + return actualIm; +} + +/** + * @brief imageToScreenCoords + */ +inline QPoint imageToScreenCoords( + const PanZoomState zoomState, + const int im_w, const int im_h, + const int w, const int h, + const QPoint poi) { + QPoint result; + const QRect actualIm = getImDimsInScreenCoords(zoomState, im_w, im_h, w, h); + const float one_step_x = actualIm.width() / static_cast<float>(im_w); + const float one_step_y = actualIm.height() / static_cast<float>(im_h); + const int actualPosXInIm = static_cast<int>(round(poi.x() * one_step_x)); + const int actualPosYInIm = static_cast<int>(round(poi.y() * one_step_y)); + result.setX(actualPosXInIm + actualIm.x()); + result.setY(actualPosYInIm + actualIm.y()); + return result; +} + +/** + * @brief screenToImageCoords + * Translate the window coordinates to the actual image coords + * @param im_w image width + * @param im_h image height + * @param w width of the videoview + * @param h height of the videoview + * @param poi Point in Screen Coords + */ +inline QPoint screenToImageCoords( + const BioTracker::Core::PanZoomState zoomState, + const int im_w, const int im_h, + const int w, const int h, + QPoint poi) { + QPoint result(0, 0); + + // The image in screen coords + QRect actualIm = getImDimsInScreenCoords(zoomState, im_w, im_h, w, h); + + const float im_wf = static_cast<float>(im_w); + const float im_hf = static_cast<float>(im_h); + const float one_step_x = im_wf / actualIm.width(); + const float one_step_y = im_hf / actualIm.height(); + + const float transformedX = (-actualIm.x() + poi.x()) * one_step_x; + const float transformedY = (-actualIm.y() + poi.y()) * one_step_y; + + result.setX(static_cast<int>(round(transformedX))); + result.setY(static_cast<int>(round(transformedY))); + + return result; +} + +/** + * @brief zoomTo + * Modifies the panzoomstate so that the cursor (zoomCenter) will point to the same + * location in the image as prior to the zoom + * @param im_w width of the image (in px) + * @param im_h height of the image (in px) + * @param w width of the videoview element + * @param h height of the videoview element + */ +inline PanZoomState zoomTo( + PanZoomState state, + const int im_w, + const int im_h, + const int w, + const int h, + const float deltaZoom, + const QPoint zoomCenter) { + + const QPoint imPos = screenToImageCoords(state, im_w, im_h, w, h, zoomCenter); + + const float oldZoomFactor = state.zoomFactor; + const float newZoomFactor = state.zoomFactor - (deltaZoom/2000); + + if (newZoomFactor <= -1.0f) { + // MAX VALUE + return state; + } + + const float zoom = 1 + newZoomFactor; + + const float oldPanX = state.panX / (1 + oldZoomFactor); + const float oldPanY = state.panY / (1 + oldZoomFactor); + + // zoom with origin in (0/0) + state.panX = oldPanX * zoom; + state.panY = oldPanY * zoom; + state.zoomFactor = newZoomFactor; + + // As we do not want to zoom to (0/0) but rather keep the focus on the chosen + // image position (zoomCenter) we now have to "back-translate" to our initial + // position + const QPoint translatedZoomCenter = imageToScreenCoords(state, im_w, im_h, w, h, imPos); + const QPoint translate = translatedZoomCenter - zoomCenter; + state.panX += translate.x(); + state.panY += translate.y(); + state.isChanged = true; + return state; +} + +} +} +} diff --git a/BioTrackerQt/Source/BioTrackerQt/util/imagePreProcessor/IImageProcessor.h b/BioTrackerQt/Source/BioTrackerQt/util/imagePreProcessor/IImageProcessor.h new file mode 100644 index 0000000000000000000000000000000000000000..6845a96325a72a9ab24821193ecd2f37797c5ed5 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/util/imagePreProcessor/IImageProcessor.h @@ -0,0 +1,29 @@ +#pragma once + +#include <cv.h> + +class Rectification; +class Settings; + + +class IImageProcessor { + public: + IImageProcessor(Rectification &rectification, Settings &settings) : + _rectification(rectification), + _settings(settings) { + } + + virtual ~IImageProcessor(void) {} + + /** + * This method processed the image and detects the found object. + * @param image, the image to process, + * @return void. + */ + virtual void process(cv::Mat image) = 0; + + protected: + const Rectification &_rectification; + Settings &_settings; +}; + diff --git a/BioTrackerQt/Source/BioTrackerQt/util/imagePreProcessor/ImagePreProcessor.h b/BioTrackerQt/Source/BioTrackerQt/util/imagePreProcessor/ImagePreProcessor.h new file mode 100644 index 0000000000000000000000000000000000000000..25718b69e3599b13b64b05fb449b9a7db57b78a2 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/util/imagePreProcessor/ImagePreProcessor.h @@ -0,0 +1,181 @@ +#pragma once + +#include <opencv2/opencv.hpp> + +#include "util/stdext.h" + +namespace BioTracker { +namespace Core { + +namespace PREPROCESSORPARAM { +// Parameter for the opencv BackgroundSubtractorMOG2 class +static const std::string BG_MOG2_HISTORY = + "TRACKERPARAM.BG_MOG2_HISTORY"; +static const std::string BG_MOG2_VAR_THRESHOLD = + "TRACKERPARAM.BG_MOG2_VAR_THRESHOLD"; +static const std::string BG_MOG2_SHADOW_DETECTION = + "TRACKERPARAM.BG_MOG2_SHADOW_DETECTION"; +static const std::string BG_MOG2_BACKGROUND_RATIO = + "TRACKERPARAM.BG_MOG2_BACKGROUND_RATIO"; + +// Parameters for enabling methods +static const std::string ENABLE_BG_SUBTRACTION = + "TRACKERPARAM.ENABLE_BG_SUBTRACTION"; +static const std::string ENABLE_BG_IMAGE = + "TRACKERPARAM.ENABLE_BG_IMAGE"; +static const std::string ENABLE_BINARIZING = + "TRACKERPARAM.ENABLE_BINARIZING"; +static const std::string ENABLE_ERODE = + "TRACKERPARAM.ENABLE_ERODE"; +static const std::string ENABLE_DILATE = + "TRACKERPARAM.ENABLE_DILATE"; +static const std::string IMAGE_VIEW_TYPE = + "TRACKERPARAM.IMAGE_VIEW_TYPE"; + +// Mapping issue +static const std::string MAX_MAPPED_DISTANCE_PX = + "TRACKERPARAM.MAX_MAPPED_DISTANCE_PX"; +static const std::string MAX_MAPPED_DISTANCE_CM = + "TRACKERPARAM.MAX_MAPPED_DISTANCE_CM"; + +// Blob dectection issue +static const std::string MAX_BLOB_SIZE = + "TRACKERPARAM.MAX_BLOB_SIZE"; +static const std::string MIN_BLOB_SIZE = + "TRACKERPARAM.MIN_BLOB_SIZE"; + +// Parameters for image pre-processing step +static const std::string SIZE_ERODE = "TRACKERPARAM.SIZE_ERODE"; +static const std::string SIZE_DILATE = + "TRACKERPARAM.SIZE_DILATE"; +static const std::string THRESHOLD_BINARIZING = + "TRACKERPARAM.THRESHOLD_BINARIZING"; + +// Image processing type +enum IMAGE_DISPLAY_TYPE { + IMAGE_OR = 0, + IMAGE_BI = 1, + IMAGE_ER = 2, + IMAGE_DI = 3, + IMAGE_FG = 4, + IMAGE_BG = 5, + IMAGE_PP = 6, +}; +} + +class Settings; + +class ImagePreProcessor { + public: + + /** + * The constructor with provided parameters. + * @param settings reference to the biotracker settings object + */ + ImagePreProcessor(Settings &settings); + + /** + * Init function. Sets the property for the imge pre-processing. + */ + void init(); + + /** + * A computer vision method to binarize an image. + * @param image image to binarize, + * @return a binarized image. + */ + cv::Mat binarize(cv::Mat image); + + /** + * Sets the threshold value for a parameter + * @param paramName the parameter name, + * @param threshValue threshold value, + */ + void setThreshold(std::string paramName, std::string threshValue); + + /** + * A mathematical morphology operation using in computer vision to erode an image. + * Erode image with 3x3 4-connectivity. + * @param image image to erode, + * @return an eroded image. + */ + cv::Mat erode(cv::Mat image); + + /** + * A mathematical morphology operation using in computer vision to dilate an image. + * Dilate image with 6x6 8-connectivity. + * @param image image to dilate, + * @return a dilated image. + */ + cv::Mat dilate(cv::Mat image); + + /** + * A computer vision methode to calculate the image difference. + * Background image subtracts the foreground image. + * @param image image to background subtract, + * @return the background subtracted image. + */ + cv::Mat backgroundSubtraction(cv::Mat image); + + /** + * Pre-process an image, if all methods enabled, this function: + * - does the background subtraction + * - erodes the image + * - dilates the image + * @param image image to process, + */ + void preProcess(cv::Mat image); + + /** + * The method updates the image background. + */ + void resetBackgroundImage(); + + /** + * Method to enable image pre-processing methods + * @param enableProcess specifies the process to enable or disable, + * @param enable true to enable, false to disable. + */ + void setEnable(std::string enableProcess, bool enable = true); + + /** + * Gets displayed image type for displaying it. + * @param imageDisplayType kind of image need to retrieve. + * Hint: IMAGE_BI, binarized image, + * IMAGE_ER, eroded image, + * IMAGE_DI, dilated image, + * IMAGE_FG, foreground mask image, + * IMAGE_BG, background image, + * IMAGE_PP, final proceedied image, + * @return type of image. + */ + cv::Mat imageDisplayType(PREPROCESSORPARAM::IMAGE_DISPLAY_TYPE + imageDisplayType); + + private: + // System properties + Settings &_settings; + + // variable of the various processing image + cv::Mat _original; + cv::Mat _proceededImage; + cv::Mat _fgMaskMOG; + cv::Mat _backgroundImage; + cv::Mat _binarizedImage; + cv::Mat _erodedImage; + cv::Mat _dilatedImage; + + // background subtraction + std::unique_ptr<cv::BackgroundSubtractorMOG2> _pMOG; + + //parameters for image pre-processing + bool _backgroundSubtractionEnabled; + bool _backgroundEnabled; + bool _binarizeEnabled; + bool _erodeEnabled; + bool _dilateEnabled; +}; + +} +} + diff --git a/BioTrackerQt/Source/BioTrackerQt/util/platform.h b/BioTrackerQt/Source/BioTrackerQt/util/platform.h new file mode 100644 index 0000000000000000000000000000000000000000..53dd43b0fd692703cb45f62c720db9521ee951c4 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/util/platform.h @@ -0,0 +1,16 @@ +#pragma once + +/* +This macro must be used to mark all symbols that should be exported to a DLL. +*/ +#ifdef _MSC_VER +#ifdef BUILD_BIOTRACKER_DLL +#define BIOTRACKER_DLLEXPORT __declspec(dllexport) +#define BIOTRACKER_EXPIMP_TEMPLATE +#else +#define BIOTRACKER_DLLEXPORT __declspec(dllimport) +#define BIOTRACKER_EXPIMP_TEMPLATE extern +#endif +#else +#define BIOTRACKER_DLLEXPORT +#endif diff --git a/BioTrackerQt/Source/BioTrackerQt/util/singleton.h b/BioTrackerQt/Source/BioTrackerQt/util/singleton.h new file mode 100644 index 0000000000000000000000000000000000000000..ef28cf05feafbca51cb89622a84c570236d7716f --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/util/singleton.h @@ -0,0 +1,27 @@ +#pragma once + +namespace BioTracker { +namespace Util { + +template<class T> +class Singleton { + + protected: + Singleton() {} + ~Singleton() {} + Singleton(const Singleton &) = delete; + Singleton &operator=(const Singleton &) = delete; + + public: + static T &getInstance(); + +}; + +template<class T> +T &Singleton<T>::getInstance() { + static T instance; + return instance; +} + +} +} diff --git a/BioTrackerQt/Source/BioTrackerQt/util/stdext.h b/BioTrackerQt/Source/BioTrackerQt/util/stdext.h new file mode 100644 index 0000000000000000000000000000000000000000..ada7c5d7f27682698f12fe572325be30cf39a096 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/util/stdext.h @@ -0,0 +1,47 @@ +#ifndef STDEXT_H +#define STDEXT_H + +/* implementation of std::make_unique for c++<14 + * implementation according to N3656 + * see: http://isocpp.org/files/papers/N3656.txt + */ + +#include <memory> +#if (!defined(_MSC_VER) && __cplusplus <= 201103L) || (defined(_MSC_VER) && _MSC_VER < 1800) +#include <cstddef> +#include <type_traits> +#include <utility> + +namespace std { +template<class T> struct _Unique_if { + typedef unique_ptr<T> _Single_object; +}; + +template<class T> struct _Unique_if<T[]> { + typedef unique_ptr<T[]> _Unknown_bound; +}; + +template<class T, size_t N> struct _Unique_if<T[N]> { + typedef void _Known_bound; +}; + +template<class T, class... Args> +typename _Unique_if<T>::_Single_object +make_unique(Args &&... args) { + return unique_ptr<T>(new T(std::forward<Args>(args)...)); +} + +template<class T> +typename _Unique_if<T>::_Unknown_bound +make_unique(size_t n) { + typedef typename remove_extent<T>::type U; + return unique_ptr<T>(new U[n]()); +} + +template<class T, class... Args> +typename _Unique_if<T>::_Known_bound +make_unique(Args &&...) = delete; +} +#endif + +#endif diff --git a/BioTrackerQt/Source/BioTrackerQt/util/stringTools.h b/BioTrackerQt/Source/BioTrackerQt/util/stringTools.h new file mode 100644 index 0000000000000000000000000000000000000000..2334a24d6890338018a3bb5596dc077c14a01961 --- /dev/null +++ b/BioTrackerQt/Source/BioTrackerQt/util/stringTools.h @@ -0,0 +1,47 @@ +#pragma once + +#include <string> + +namespace BioTracker { +namespace Util { + +/** + * replaces every non-ASCII character in s with an escape sequence containing the hexadecimal representation of it's value. + * + * Additionally backslashes are escaped too, since this character is used to initiate an escape sequence. + * + * The value of a valid ASCII is [0, 127]. + * + * replacement map: + * ---------------- + * "\" --> "\\" + * non-ASCII --> "\x{2 digit hex value}" + * ASCII --> ASCII + * + */ +std::string escape_non_ascii(const std::string &s); + + +/** + * unescapes escaped (non-)ASCII characters. + * + * replacement map: + * ---------------- + * "\\" --> "\" + * "\x{2 hex digits}" --> character + * ASCII --> ASCII + * everything else --> exception + * + * @see escape_non_ascii + * + */ +std::string unescape_non_ascii(const std::string &s); + +/** + * @brief stem_filename + * stems the filename from a path + */ +std::string stem_filename(const std::string &s); + +} +} diff --git a/ui_BioTracker3MainWindow.h b/ui_BioTracker3MainWindow.h new file mode 100644 index 0000000000000000000000000000000000000000..e06f93e719d51ca411b4ff2bf251a7b8e9ff17f5 --- /dev/null +++ b/ui_BioTracker3MainWindow.h @@ -0,0 +1,275 @@ +/******************************************************************************** +** Form generated from reading UI file 'BioTracker3MainWindow.ui' +** +** Created by: Qt User Interface Compiler version 5.6.1 +** +** WARNING! All changes made in this file will be lost when recompiling UI file! +********************************************************************************/ + +#ifndef UI_BIOTRACKER3MAINWINDOW_H +#define UI_BIOTRACKER3MAINWINDOW_H + +#include <QtCore/QVariant> +#include <QtWidgets/QAction> +#include <QtWidgets/QApplication> +#include <QtWidgets/QButtonGroup> +#include <QtWidgets/QDockWidget> +#include <QtWidgets/QFrame> +#include <QtWidgets/QGroupBox> +#include <QtWidgets/QHBoxLayout> +#include <QtWidgets/QHeaderView> +#include <QtWidgets/QMainWindow> +#include <QtWidgets/QMenu> +#include <QtWidgets/QMenuBar> +#include <QtWidgets/QScrollArea> +#include <QtWidgets/QVBoxLayout> +#include <QtWidgets/QWidget> + +QT_BEGIN_NAMESPACE + +class Ui_BioTracker3MainWindow +{ +public: + QAction *actionOpen_Video; + QAction *actionOpen_Picture; + QAction *actionLoad_tracking_data; + QAction *actionSave_tracking_data; + QAction *actionQuit; + QAction *actionLoad_Tracker; + QAction *actionOpen_Camera; + QWidget *centralWidget; + QHBoxLayout *horizontalLayout_5; + QWidget *widget_2; + QHBoxLayout *horizontalLayout_6; + QWidget *videoAreaWidget; + QVBoxLayout *verticalLayout_2; + QFrame *trackingArea; + QVBoxLayout *verticalLayout; + QVBoxLayout *videoViewLayout; + QWidget *videoControls; + QMenuBar *menuBar; + QMenu *menuFile; + QDockWidget *dockWidgetAlgorithm; + QWidget *dockWidgetAlgorithmContents; + QVBoxLayout *verticalLayout_3; + QWidget *widget_alg; + QGroupBox *groupBox_tools; + QVBoxLayout *verticalLayout_4; + QScrollArea *scrollArea; + QWidget *groupBoxContents; + QDockWidget *dockWidgetNotification; + QWidget *dockWidgetNotificationContents; + + void setupUi(QMainWindow *BioTracker3MainWindow) + { + if (BioTracker3MainWindow->objectName().isEmpty()) + BioTracker3MainWindow->setObjectName(QStringLiteral("BioTracker3MainWindow")); + BioTracker3MainWindow->resize(982, 818); + BioTracker3MainWindow->setDockNestingEnabled(true); + BioTracker3MainWindow->setUnifiedTitleAndToolBarOnMac(false); + actionOpen_Video = new QAction(BioTracker3MainWindow); + actionOpen_Video->setObjectName(QStringLiteral("actionOpen_Video")); + actionOpen_Picture = new QAction(BioTracker3MainWindow); + actionOpen_Picture->setObjectName(QStringLiteral("actionOpen_Picture")); + actionLoad_tracking_data = new QAction(BioTracker3MainWindow); + actionLoad_tracking_data->setObjectName(QStringLiteral("actionLoad_tracking_data")); + actionSave_tracking_data = new QAction(BioTracker3MainWindow); + actionSave_tracking_data->setObjectName(QStringLiteral("actionSave_tracking_data")); + actionQuit = new QAction(BioTracker3MainWindow); + actionQuit->setObjectName(QStringLiteral("actionQuit")); + actionLoad_Tracker = new QAction(BioTracker3MainWindow); + actionLoad_Tracker->setObjectName(QStringLiteral("actionLoad_Tracker")); + actionOpen_Camera = new QAction(BioTracker3MainWindow); + actionOpen_Camera->setObjectName(QStringLiteral("actionOpen_Camera")); + centralWidget = new QWidget(BioTracker3MainWindow); + centralWidget->setObjectName(QStringLiteral("centralWidget")); + QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth(centralWidget->sizePolicy().hasHeightForWidth()); + centralWidget->setSizePolicy(sizePolicy); + horizontalLayout_5 = new QHBoxLayout(centralWidget); + horizontalLayout_5->setSpacing(0); + horizontalLayout_5->setContentsMargins(11, 11, 11, 11); + horizontalLayout_5->setObjectName(QStringLiteral("horizontalLayout_5")); + horizontalLayout_5->setContentsMargins(0, 0, 0, 0); + widget_2 = new QWidget(centralWidget); + widget_2->setObjectName(QStringLiteral("widget_2")); + horizontalLayout_6 = new QHBoxLayout(widget_2); + horizontalLayout_6->setSpacing(3); + horizontalLayout_6->setContentsMargins(11, 11, 11, 11); + horizontalLayout_6->setObjectName(QStringLiteral("horizontalLayout_6")); + horizontalLayout_6->setContentsMargins(3, 3, 3, 3); + videoAreaWidget = new QWidget(widget_2); + videoAreaWidget->setObjectName(QStringLiteral("videoAreaWidget")); + QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::Expanding); + sizePolicy1.setHorizontalStretch(0); + sizePolicy1.setVerticalStretch(0); + sizePolicy1.setHeightForWidth(videoAreaWidget->sizePolicy().hasHeightForWidth()); + videoAreaWidget->setSizePolicy(sizePolicy1); + verticalLayout_2 = new QVBoxLayout(videoAreaWidget); + verticalLayout_2->setSpacing(3); + verticalLayout_2->setContentsMargins(11, 11, 11, 11); + verticalLayout_2->setObjectName(QStringLiteral("verticalLayout_2")); + verticalLayout_2->setContentsMargins(3, 3, 3, 3); + trackingArea = new QFrame(videoAreaWidget); + trackingArea->setObjectName(QStringLiteral("trackingArea")); + sizePolicy1.setHeightForWidth(trackingArea->sizePolicy().hasHeightForWidth()); + trackingArea->setSizePolicy(sizePolicy1); + trackingArea->setMinimumSize(QSize(0, 150)); + verticalLayout = new QVBoxLayout(trackingArea); + verticalLayout->setSpacing(0); + verticalLayout->setContentsMargins(11, 11, 11, 11); + verticalLayout->setObjectName(QStringLiteral("verticalLayout")); + verticalLayout->setContentsMargins(0, 0, 0, 0); + videoViewLayout = new QVBoxLayout(); + videoViewLayout->setSpacing(6); + videoViewLayout->setObjectName(QStringLiteral("videoViewLayout")); + + verticalLayout->addLayout(videoViewLayout); + + + verticalLayout_2->addWidget(trackingArea); + + videoControls = new QWidget(videoAreaWidget); + videoControls->setObjectName(QStringLiteral("videoControls")); + videoControls->setEnabled(true); + QSizePolicy sizePolicy2(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); + sizePolicy2.setHorizontalStretch(0); + sizePolicy2.setVerticalStretch(0); + sizePolicy2.setHeightForWidth(videoControls->sizePolicy().hasHeightForWidth()); + videoControls->setSizePolicy(sizePolicy2); + videoControls->setMinimumSize(QSize(0, 0)); + + verticalLayout_2->addWidget(videoControls); + + + horizontalLayout_6->addWidget(videoAreaWidget); + + + horizontalLayout_5->addWidget(widget_2); + + BioTracker3MainWindow->setCentralWidget(centralWidget); + menuBar = new QMenuBar(BioTracker3MainWindow); + menuBar->setObjectName(QStringLiteral("menuBar")); + menuBar->setGeometry(QRect(0, 0, 982, 23)); + menuFile = new QMenu(menuBar); + menuFile->setObjectName(QStringLiteral("menuFile")); + BioTracker3MainWindow->setMenuBar(menuBar); + dockWidgetAlgorithm = new QDockWidget(BioTracker3MainWindow); + dockWidgetAlgorithm->setObjectName(QStringLiteral("dockWidgetAlgorithm")); + QSizePolicy sizePolicy3(QSizePolicy::Expanding, QSizePolicy::Preferred); + sizePolicy3.setHorizontalStretch(0); + sizePolicy3.setVerticalStretch(0); + sizePolicy3.setHeightForWidth(dockWidgetAlgorithm->sizePolicy().hasHeightForWidth()); + dockWidgetAlgorithm->setSizePolicy(sizePolicy3); + dockWidgetAlgorithm->setMinimumSize(QSize(200, 207)); + dockWidgetAlgorithm->setSizeIncrement(QSize(0, 0)); + dockWidgetAlgorithm->setBaseSize(QSize(0, 0)); + dockWidgetAlgorithmContents = new QWidget(); + dockWidgetAlgorithmContents->setObjectName(QStringLiteral("dockWidgetAlgorithmContents")); + sizePolicy3.setHeightForWidth(dockWidgetAlgorithmContents->sizePolicy().hasHeightForWidth()); + dockWidgetAlgorithmContents->setSizePolicy(sizePolicy3); + verticalLayout_3 = new QVBoxLayout(dockWidgetAlgorithmContents); + verticalLayout_3->setSpacing(2); + verticalLayout_3->setContentsMargins(11, 11, 11, 11); + verticalLayout_3->setObjectName(QStringLiteral("verticalLayout_3")); + verticalLayout_3->setContentsMargins(3, 3, 3, 3); + widget_alg = new QWidget(dockWidgetAlgorithmContents); + widget_alg->setObjectName(QStringLiteral("widget_alg")); + QSizePolicy sizePolicy4(QSizePolicy::Preferred, QSizePolicy::Minimum); + sizePolicy4.setHorizontalStretch(0); + sizePolicy4.setVerticalStretch(0); + sizePolicy4.setHeightForWidth(widget_alg->sizePolicy().hasHeightForWidth()); + widget_alg->setSizePolicy(sizePolicy4); + + verticalLayout_3->addWidget(widget_alg); + + groupBox_tools = new QGroupBox(dockWidgetAlgorithmContents); + groupBox_tools->setObjectName(QStringLiteral("groupBox_tools")); + QSizePolicy sizePolicy5(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding); + sizePolicy5.setHorizontalStretch(0); + sizePolicy5.setVerticalStretch(0); + sizePolicy5.setHeightForWidth(groupBox_tools->sizePolicy().hasHeightForWidth()); + groupBox_tools->setSizePolicy(sizePolicy5); + groupBox_tools->setFlat(false); + verticalLayout_4 = new QVBoxLayout(groupBox_tools); + verticalLayout_4->setSpacing(3); + verticalLayout_4->setContentsMargins(11, 11, 11, 11); + verticalLayout_4->setObjectName(QStringLiteral("verticalLayout_4")); + verticalLayout_4->setContentsMargins(3, 3, 3, 3); + scrollArea = new QScrollArea(groupBox_tools); + scrollArea->setObjectName(QStringLiteral("scrollArea")); + sizePolicy5.setHeightForWidth(scrollArea->sizePolicy().hasHeightForWidth()); + scrollArea->setSizePolicy(sizePolicy5); + scrollArea->setFrameShadow(QFrame::Plain); + scrollArea->setLineWidth(0); + scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); + scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + scrollArea->setWidgetResizable(true); + groupBoxContents = new QWidget(); + groupBoxContents->setObjectName(QStringLiteral("groupBoxContents")); + groupBoxContents->setGeometry(QRect(0, 0, 178, 594)); + sizePolicy5.setHeightForWidth(groupBoxContents->sizePolicy().hasHeightForWidth()); + groupBoxContents->setSizePolicy(sizePolicy5); + scrollArea->setWidget(groupBoxContents); + + verticalLayout_4->addWidget(scrollArea); + + + verticalLayout_3->addWidget(groupBox_tools); + + dockWidgetAlgorithm->setWidget(dockWidgetAlgorithmContents); + BioTracker3MainWindow->addDockWidget(static_cast<Qt::DockWidgetArea>(2), dockWidgetAlgorithm); + dockWidgetNotification = new QDockWidget(BioTracker3MainWindow); + dockWidgetNotification->setObjectName(QStringLiteral("dockWidgetNotification")); + dockWidgetNotification->setFloating(false); + dockWidgetNotificationContents = new QWidget(); + dockWidgetNotificationContents->setObjectName(QStringLiteral("dockWidgetNotificationContents")); + sizePolicy1.setHeightForWidth(dockWidgetNotificationContents->sizePolicy().hasHeightForWidth()); + dockWidgetNotificationContents->setSizePolicy(sizePolicy1); + dockWidgetNotification->setWidget(dockWidgetNotificationContents); + BioTracker3MainWindow->addDockWidget(static_cast<Qt::DockWidgetArea>(2), dockWidgetNotification); + + menuBar->addAction(menuFile->menuAction()); + menuFile->addAction(actionOpen_Video); + menuFile->addAction(actionOpen_Picture); + menuFile->addAction(actionOpen_Camera); + menuFile->addSeparator(); + menuFile->addAction(actionLoad_Tracker); + menuFile->addSeparator(); + menuFile->addAction(actionLoad_tracking_data); + menuFile->addAction(actionSave_tracking_data); + menuFile->addSeparator(); + menuFile->addAction(actionQuit); + + retranslateUi(BioTracker3MainWindow); + + QMetaObject::connectSlotsByName(BioTracker3MainWindow); + } // setupUi + + void retranslateUi(QMainWindow *BioTracker3MainWindow) + { + BioTracker3MainWindow->setWindowTitle(QApplication::translate("BioTracker3MainWindow", "BioTracker", 0)); + actionOpen_Video->setText(QApplication::translate("BioTracker3MainWindow", "Open &Video...", 0)); + actionOpen_Picture->setText(QApplication::translate("BioTracker3MainWindow", "Open &Picture...", 0)); + actionLoad_tracking_data->setText(QApplication::translate("BioTracker3MainWindow", "&Load tracking data...", 0)); + actionSave_tracking_data->setText(QApplication::translate("BioTracker3MainWindow", "&Save tracking data...", 0)); + actionQuit->setText(QApplication::translate("BioTracker3MainWindow", "E&xit", 0)); + actionLoad_Tracker->setText(QApplication::translate("BioTracker3MainWindow", "L&oad Tracker...", 0)); + actionOpen_Camera->setText(QApplication::translate("BioTracker3MainWindow", "Open &Camera...", 0)); + menuFile->setTitle(QApplication::translate("BioTracker3MainWindow", "&File", 0)); + dockWidgetAlgorithm->setWindowTitle(QApplication::translate("BioTracker3MainWindow", "A&lgorithm", 0)); + groupBox_tools->setTitle(QApplication::translate("BioTracker3MainWindow", "Tools", 0)); + dockWidgetNotification->setWindowTitle(QApplication::translate("BioTracker3MainWindow", "&Notifications", 0)); + } // retranslateUi + +}; + +namespace Ui { + class BioTracker3MainWindow: public Ui_BioTracker3MainWindow {}; +} // namespace Ui + +QT_END_NAMESPACE + +#endif // UI_BIOTRACKER3MAINWINDOW_H diff --git a/ui_BioTracker3VideoControllWidget.h b/ui_BioTracker3VideoControllWidget.h new file mode 100644 index 0000000000000000000000000000000000000000..41c424b27cb67c0f0515e6b35599771fe1e82034 --- /dev/null +++ b/ui_BioTracker3VideoControllWidget.h @@ -0,0 +1,367 @@ +/******************************************************************************** +** Form generated from reading UI file 'BioTracker3VideoControllWidget.ui' +** +** Created by: Qt User Interface Compiler version 5.6.1 +** +** WARNING! All changes made in this file will be lost when recompiling UI file! +********************************************************************************/ + +#ifndef UI_BIOTRACKER3VIDEOCONTROLLWIDGET_H +#define UI_BIOTRACKER3VIDEOCONTROLLWIDGET_H + +#include <QtCore/QVariant> +#include <QtWidgets/QAction> +#include <QtWidgets/QApplication> +#include <QtWidgets/QButtonGroup> +#include <QtWidgets/QComboBox> +#include <QtWidgets/QGroupBox> +#include <QtWidgets/QHBoxLayout> +#include <QtWidgets/QHeaderView> +#include <QtWidgets/QLabel> +#include <QtWidgets/QLineEdit> +#include <QtWidgets/QPushButton> +#include <QtWidgets/QSlider> +#include <QtWidgets/QSpacerItem> +#include <QtWidgets/QVBoxLayout> +#include <QtWidgets/QWidget> + +QT_BEGIN_NAMESPACE + +class Ui_BioTracker3VideoControllWidget +{ +public: + QVBoxLayout *verticalLayout; + QSlider *sld_video; + QGroupBox *playback; + QHBoxLayout *horizontalLayout_4; + QPushButton *button_previousFrame; + QPushButton *button_playPause; + QPushButton *button_stop; + QPushButton *button_nextFrame; + QPushButton *button_screenshot; + QLabel *lbl_frame; + QLineEdit *frame_num_edit; + QSpacerItem *horizontalSpacer; + QLabel *labelView; + QComboBox *comboBoxSelectedView; + QSpacerItem *horizontalSpacer_3; + QPushButton *button_panZoom; + QGroupBox *speed; + QHBoxLayout *horizontalLayout_3; + QHBoxLayout *horizontalLayout; + QLabel *label_3; + QSlider *sld_speed; + QLabel *label_4; + QSpacerItem *horizontalSpacer_2; + QLabel *label_5; + QLabel *fps_label; + QSpacerItem *horizontalSpacer_4; + QLabel *label; + QLabel *fps_edit; + + void setupUi(QWidget *BioTracker3VideoControllWidget) + { + if (BioTracker3VideoControllWidget->objectName().isEmpty()) + BioTracker3VideoControllWidget->setObjectName(QStringLiteral("BioTracker3VideoControllWidget")); + BioTracker3VideoControllWidget->resize(775, 193); + QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth(BioTracker3VideoControllWidget->sizePolicy().hasHeightForWidth()); + BioTracker3VideoControllWidget->setSizePolicy(sizePolicy); + verticalLayout = new QVBoxLayout(BioTracker3VideoControllWidget); + verticalLayout->setObjectName(QStringLiteral("verticalLayout")); + sld_video = new QSlider(BioTracker3VideoControllWidget); + sld_video->setObjectName(QStringLiteral("sld_video")); + sld_video->setEnabled(false); + QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::Fixed); + sizePolicy1.setHorizontalStretch(0); + sizePolicy1.setVerticalStretch(0); + sizePolicy1.setHeightForWidth(sld_video->sizePolicy().hasHeightForWidth()); + sld_video->setSizePolicy(sizePolicy1); + sld_video->setAutoFillBackground(false); + sld_video->setMaximum(2500); + sld_video->setPageStep(25); + sld_video->setOrientation(Qt::Horizontal); + sld_video->setInvertedAppearance(false); + sld_video->setInvertedControls(false); + sld_video->setTickPosition(QSlider::TicksAbove); + sld_video->setTickInterval(25); + + verticalLayout->addWidget(sld_video); + + playback = new QGroupBox(BioTracker3VideoControllWidget); + playback->setObjectName(QStringLiteral("playback")); + sizePolicy.setHeightForWidth(playback->sizePolicy().hasHeightForWidth()); + playback->setSizePolicy(sizePolicy); + playback->setFlat(false); + horizontalLayout_4 = new QHBoxLayout(playback); + horizontalLayout_4->setSpacing(3); + horizontalLayout_4->setObjectName(QStringLiteral("horizontalLayout_4")); + horizontalLayout_4->setContentsMargins(3, 3, 3, 3); + button_previousFrame = new QPushButton(playback); + button_previousFrame->setObjectName(QStringLiteral("button_previousFrame")); + button_previousFrame->setEnabled(false); + button_previousFrame->setStyleSheet(QLatin1String("background-image: url(:/Images/resources/arrows-skip-back.png);\n" +"image: url(:/Images/resources/arrows-skip-back.png);")); + QIcon icon; + icon.addFile(QStringLiteral(":/BioTracker/resources/arrows-skip-back.png"), QSize(), QIcon::Normal, QIcon::Off); + button_previousFrame->setIcon(icon); + button_previousFrame->setIconSize(QSize(32, 32)); + + horizontalLayout_4->addWidget(button_previousFrame); + + button_playPause = new QPushButton(playback); + button_playPause->setObjectName(QStringLiteral("button_playPause")); + button_playPause->setEnabled(false); + button_playPause->setStyleSheet(QLatin1String("image: url(:/Images/resources/arrow-forward1.png);\n" +"background-image: url(:/Images/resources/arrow-forward1.png);")); + QIcon icon1; + icon1.addFile(QStringLiteral(":/BioTracker/resources/arrow-forward1.png"), QSize(), QIcon::Normal, QIcon::Off); + button_playPause->setIcon(icon1); + button_playPause->setIconSize(QSize(32, 32)); + + horizontalLayout_4->addWidget(button_playPause); + + button_stop = new QPushButton(playback); + button_stop->setObjectName(QStringLiteral("button_stop")); + button_stop->setEnabled(false); + button_stop->setStyleSheet(QLatin1String("background-image: url(:/Images/resources/stop.png);\n" +"image: url(:/Images/resources/stop.png);")); + QIcon icon2; + icon2.addFile(QStringLiteral(":/BioTracker/resources/stop.png"), QSize(), QIcon::Normal, QIcon::Off); + button_stop->setIcon(icon2); + button_stop->setIconSize(QSize(32, 32)); + + horizontalLayout_4->addWidget(button_stop); + + button_nextFrame = new QPushButton(playback); + button_nextFrame->setObjectName(QStringLiteral("button_nextFrame")); + button_nextFrame->setEnabled(false); + button_nextFrame->setStyleSheet(QLatin1String("background-image: url(:/Images/resources/arrows-skip-forward.png);\n" +"image: url(:/Images/resources/arrows-skip-forward.png);")); + QIcon icon3; + icon3.addFile(QStringLiteral(":/BioTracker/resources/arrows-skip-forward.png"), QSize(), QIcon::Normal, QIcon::Off); + button_nextFrame->setIcon(icon3); + button_nextFrame->setIconSize(QSize(32, 32)); + + horizontalLayout_4->addWidget(button_nextFrame); + + button_screenshot = new QPushButton(playback); + button_screenshot->setObjectName(QStringLiteral("button_screenshot")); + button_screenshot->setEnabled(true); + QFont font; + font.setPointSize(16); + font.setBold(true); + font.setItalic(false); + font.setWeight(75); + button_screenshot->setFont(font); + button_screenshot->setStyleSheet(QLatin1String("background-image: url(:/Images/resources/screenshot.png);\n" +"image: url(:/Images/resources/screenshot.png);")); + QIcon icon4; + icon4.addFile(QStringLiteral(":/BioTracker/resources/screenshot.png"), QSize(), QIcon::Normal, QIcon::Off); + button_screenshot->setIcon(icon4); + button_screenshot->setIconSize(QSize(30, 30)); + + horizontalLayout_4->addWidget(button_screenshot); + + lbl_frame = new QLabel(playback); + lbl_frame->setObjectName(QStringLiteral("lbl_frame")); + + horizontalLayout_4->addWidget(lbl_frame); + + frame_num_edit = new QLineEdit(playback); + frame_num_edit->setObjectName(QStringLiteral("frame_num_edit")); + frame_num_edit->setEnabled(false); + QSizePolicy sizePolicy2(QSizePolicy::Preferred, QSizePolicy::Preferred); + sizePolicy2.setHorizontalStretch(0); + sizePolicy2.setVerticalStretch(0); + sizePolicy2.setHeightForWidth(frame_num_edit->sizePolicy().hasHeightForWidth()); + frame_num_edit->setSizePolicy(sizePolicy2); + frame_num_edit->setMaximumSize(QSize(60, 30)); + + horizontalLayout_4->addWidget(frame_num_edit); + + horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::MinimumExpanding, QSizePolicy::Minimum); + + horizontalLayout_4->addItem(horizontalSpacer); + + labelView = new QLabel(playback); + labelView->setObjectName(QStringLiteral("labelView")); + + horizontalLayout_4->addWidget(labelView); + + comboBoxSelectedView = new QComboBox(playback); + comboBoxSelectedView->setObjectName(QStringLiteral("comboBoxSelectedView")); + QSizePolicy sizePolicy3(QSizePolicy::Preferred, QSizePolicy::Fixed); + sizePolicy3.setHorizontalStretch(0); + sizePolicy3.setVerticalStretch(0); + sizePolicy3.setHeightForWidth(comboBoxSelectedView->sizePolicy().hasHeightForWidth()); + comboBoxSelectedView->setSizePolicy(sizePolicy3); + comboBoxSelectedView->setMinimumSize(QSize(100, 0)); + comboBoxSelectedView->setBaseSize(QSize(0, 0)); + + horizontalLayout_4->addWidget(comboBoxSelectedView); + + horizontalSpacer_3 = new QSpacerItem(40, 20, QSizePolicy::Minimum, QSizePolicy::Minimum); + + horizontalLayout_4->addItem(horizontalSpacer_3); + + button_panZoom = new QPushButton(playback); + button_panZoom->setObjectName(QStringLiteral("button_panZoom")); + button_panZoom->setFont(font); + button_panZoom->setStyleSheet(QLatin1String("image: url(:/Images/resources/panZoom.png);\n" +"background-image: url(:/Images/resources/panZoom.png);")); + QIcon icon5; + icon5.addFile(QStringLiteral(":/BioTracker/resources/panZoom.png"), QSize(), QIcon::Normal, QIcon::Off); + button_panZoom->setIcon(icon5); + button_panZoom->setIconSize(QSize(30, 30)); + button_panZoom->setCheckable(true); + + horizontalLayout_4->addWidget(button_panZoom); + + + verticalLayout->addWidget(playback); + + speed = new QGroupBox(BioTracker3VideoControllWidget); + speed->setObjectName(QStringLiteral("speed")); + sizePolicy.setHeightForWidth(speed->sizePolicy().hasHeightForWidth()); + speed->setSizePolicy(sizePolicy); + speed->setMinimumSize(QSize(0, 0)); + horizontalLayout_3 = new QHBoxLayout(speed); + horizontalLayout_3->setObjectName(QStringLiteral("horizontalLayout_3")); + horizontalLayout = new QHBoxLayout(); + horizontalLayout->setSpacing(5); + horizontalLayout->setObjectName(QStringLiteral("horizontalLayout")); + label_3 = new QLabel(speed); + label_3->setObjectName(QStringLiteral("label_3")); + label_3->setEnabled(true); + + horizontalLayout->addWidget(label_3); + + sld_speed = new QSlider(speed); + sld_speed->setObjectName(QStringLiteral("sld_speed")); + QSizePolicy sizePolicy4(QSizePolicy::Expanding, QSizePolicy::Fixed); + sizePolicy4.setHorizontalStretch(0); + sizePolicy4.setVerticalStretch(0); + sizePolicy4.setHeightForWidth(sld_speed->sizePolicy().hasHeightForWidth()); + sld_speed->setSizePolicy(sizePolicy4); + sld_speed->setMinimum(1); + sld_speed->setMaximum(61); + sld_speed->setValue(30); + sld_speed->setSliderPosition(30); + sld_speed->setOrientation(Qt::Horizontal); + + horizontalLayout->addWidget(sld_speed); + + label_4 = new QLabel(speed); + label_4->setObjectName(QStringLiteral("label_4")); + + horizontalLayout->addWidget(label_4); + + + horizontalLayout_3->addLayout(horizontalLayout); + + horizontalSpacer_2 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); + + horizontalLayout_3->addItem(horizontalSpacer_2); + + label_5 = new QLabel(speed); + label_5->setObjectName(QStringLiteral("label_5")); + + horizontalLayout_3->addWidget(label_5); + + fps_label = new QLabel(speed); + fps_label->setObjectName(QStringLiteral("fps_label")); + fps_label->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter); + + horizontalLayout_3->addWidget(fps_label); + + horizontalSpacer_4 = new QSpacerItem(40, 20, QSizePolicy::Preferred, QSizePolicy::Minimum); + + horizontalLayout_3->addItem(horizontalSpacer_4); + + label = new QLabel(speed); + label->setObjectName(QStringLiteral("label")); + sizePolicy2.setHeightForWidth(label->sizePolicy().hasHeightForWidth()); + label->setSizePolicy(sizePolicy2); + + horizontalLayout_3->addWidget(label); + + fps_edit = new QLabel(speed); + fps_edit->setObjectName(QStringLiteral("fps_edit")); + fps_edit->setMinimumSize(QSize(60, 0)); + + horizontalLayout_3->addWidget(fps_edit); + + + verticalLayout->addWidget(speed); + + + retranslateUi(BioTracker3VideoControllWidget); + + QMetaObject::connectSlotsByName(BioTracker3VideoControllWidget); + } // setupUi + + void retranslateUi(QWidget *BioTracker3VideoControllWidget) + { + BioTracker3VideoControllWidget->setWindowTitle(QApplication::translate("BioTracker3VideoControllWidget", "Form", 0)); + playback->setTitle(QApplication::translate("BioTracker3VideoControllWidget", "Video Controls", 0)); +#ifndef QT_NO_TOOLTIP + button_previousFrame->setToolTip(QApplication::translate("BioTracker3VideoControllWidget", "Previous Frame", 0)); +#endif // QT_NO_TOOLTIP + button_previousFrame->setText(QString()); +#ifndef QT_NO_TOOLTIP + button_playPause->setToolTip(QApplication::translate("BioTracker3VideoControllWidget", "Play", 0)); +#endif // QT_NO_TOOLTIP + button_playPause->setText(QString()); +#ifndef QT_NO_TOOLTIP + button_stop->setToolTip(QApplication::translate("BioTracker3VideoControllWidget", "Stop", 0)); +#endif // QT_NO_TOOLTIP +#ifndef QT_NO_STATUSTIP + button_stop->setStatusTip(QString()); +#endif // QT_NO_STATUSTIP + button_stop->setText(QString()); +#ifndef QT_NO_TOOLTIP + button_nextFrame->setToolTip(QApplication::translate("BioTracker3VideoControllWidget", "Next Frame", 0)); +#endif // QT_NO_TOOLTIP +#ifndef QT_NO_STATUSTIP + button_nextFrame->setStatusTip(QString()); +#endif // QT_NO_STATUSTIP + button_nextFrame->setText(QString()); +#ifndef QT_NO_TOOLTIP + button_screenshot->setToolTip(QApplication::translate("BioTracker3VideoControllWidget", "Screenshot", 0)); +#endif // QT_NO_TOOLTIP +#ifndef QT_NO_STATUSTIP + button_screenshot->setStatusTip(QString()); +#endif // QT_NO_STATUSTIP + button_screenshot->setText(QString()); + lbl_frame->setText(QApplication::translate("BioTracker3VideoControllWidget", "Current frame:", 0)); + frame_num_edit->setText(QApplication::translate("BioTracker3VideoControllWidget", "0", 0)); + labelView->setText(QApplication::translate("BioTracker3VideoControllWidget", "View:", 0)); + comboBoxSelectedView->clear(); + comboBoxSelectedView->insertItems(0, QStringList() + << QApplication::translate("BioTracker3VideoControllWidget", "Original", 0) + ); +#ifndef QT_NO_TOOLTIP + button_panZoom->setToolTip(QApplication::translate("BioTracker3VideoControllWidget", "Pan/Zoom Mode", 0)); +#endif // QT_NO_TOOLTIP + button_panZoom->setText(QString()); + speed->setTitle(QApplication::translate("BioTracker3VideoControllWidget", "Playback Speed", 0)); + label_3->setText(QApplication::translate("BioTracker3VideoControllWidget", "slow", 0)); + label_4->setText(QApplication::translate("BioTracker3VideoControllWidget", "fast", 0)); + label_5->setText(QApplication::translate("BioTracker3VideoControllWidget", "target fps: ", 0)); + fps_label->setText(QApplication::translate("BioTracker3VideoControllWidget", "30", 0)); + label->setText(QApplication::translate("BioTracker3VideoControllWidget", "measured fps:", 0)); + fps_edit->setText(QString()); + } // retranslateUi + +}; + +namespace Ui { + class BioTracker3VideoControllWidget: public Ui_BioTracker3VideoControllWidget {}; +} // namespace Ui + +QT_END_NAMESPACE + +#endif // UI_BIOTRACKER3VIDEOCONTROLLWIDGET_H diff --git a/ui_CameraDevice.h b/ui_CameraDevice.h new file mode 100644 index 0000000000000000000000000000000000000000..134ad41a44733bffc277b15432bbdf9f242d391a --- /dev/null +++ b/ui_CameraDevice.h @@ -0,0 +1,85 @@ +/******************************************************************************** +** Form generated from reading UI file 'CameraDevice.ui' +** +** Created by: Qt User Interface Compiler version 5.6.1 +** +** WARNING! All changes made in this file will be lost when recompiling UI file! +********************************************************************************/ + +#ifndef UI_CAMERADEVICE_H +#define UI_CAMERADEVICE_H + +#include <QtCore/QVariant> +#include <QtWidgets/QAction> +#include <QtWidgets/QApplication> +#include <QtWidgets/QButtonGroup> +#include <QtWidgets/QComboBox> +#include <QtWidgets/QDialogButtonBox> +#include <QtWidgets/QHBoxLayout> +#include <QtWidgets/QHeaderView> +#include <QtWidgets/QLabel> +#include <QtWidgets/QWidget> + +QT_BEGIN_NAMESPACE + +class Ui_CameraDevice +{ +public: + QWidget *layoutWidget; + QHBoxLayout *horizontalLayout; + QLabel *label; + QComboBox *comboBox; + QDialogButtonBox *buttonBox; + QWidget *widget; + + void setupUi(QWidget *CameraDevice) + { + if (CameraDevice->objectName().isEmpty()) + CameraDevice->setObjectName(QStringLiteral("CameraDevice")); + CameraDevice->resize(493, 300); + layoutWidget = new QWidget(CameraDevice); + layoutWidget->setObjectName(QStringLiteral("layoutWidget")); + layoutWidget->setGeometry(QRect(19, 250, 461, 31)); + horizontalLayout = new QHBoxLayout(layoutWidget); + horizontalLayout->setObjectName(QStringLiteral("horizontalLayout")); + horizontalLayout->setContentsMargins(0, 0, 0, 0); + label = new QLabel(layoutWidget); + label->setObjectName(QStringLiteral("label")); + + horizontalLayout->addWidget(label); + + comboBox = new QComboBox(layoutWidget); + comboBox->setObjectName(QStringLiteral("comboBox")); + + horizontalLayout->addWidget(comboBox); + + buttonBox = new QDialogButtonBox(layoutWidget); + buttonBox->setObjectName(QStringLiteral("buttonBox")); + buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok); + + horizontalLayout->addWidget(buttonBox); + + widget = new QWidget(CameraDevice); + widget->setObjectName(QStringLiteral("widget")); + widget->setGeometry(QRect(10, 9, 471, 231)); + + retranslateUi(CameraDevice); + + QMetaObject::connectSlotsByName(CameraDevice); + } // setupUi + + void retranslateUi(QWidget *CameraDevice) + { + CameraDevice->setWindowTitle(QApplication::translate("CameraDevice", "Form", 0)); + label->setText(QApplication::translate("CameraDevice", "Select Camera Device", 0)); + } // retranslateUi + +}; + +namespace Ui { + class CameraDevice: public Ui_CameraDevice {}; +} // namespace Ui + +QT_END_NAMESPACE + +#endif // UI_CAMERADEVICE_H diff --git a/ui_CameraDeviceSelect.h b/ui_CameraDeviceSelect.h new file mode 100644 index 0000000000000000000000000000000000000000..0b9e35b9c54c35b1c36c8aa88035063a4721ec41 --- /dev/null +++ b/ui_CameraDeviceSelect.h @@ -0,0 +1,83 @@ +/******************************************************************************** +** Form generated from reading UI file 'CameraDeviceSelect.ui' +** +** Created by: Qt User Interface Compiler version 5.6.1 +** +** WARNING! All changes made in this file will be lost when recompiling UI file! +********************************************************************************/ + +#ifndef UI_CAMERADEVICESELECT_H +#define UI_CAMERADEVICESELECT_H + +#include <QtCore/QVariant> +#include <QtWidgets/QAction> +#include <QtWidgets/QApplication> +#include <QtWidgets/QButtonGroup> +#include <QtWidgets/QComboBox> +#include <QtWidgets/QDialog> +#include <QtWidgets/QDialogButtonBox> +#include <QtWidgets/QHBoxLayout> +#include <QtWidgets/QHeaderView> +#include <QtWidgets/QLabel> +#include <QtWidgets/QWidget> + +QT_BEGIN_NAMESPACE + +class Ui_CameraDeviceSelect +{ +public: + QDialogButtonBox *buttonBox; + QWidget *widget; + QHBoxLayout *horizontalLayout; + QLabel *label; + QComboBox *comboBox_VideoDevice; + + void setupUi(QDialog *CameraDeviceSelect) + { + if (CameraDeviceSelect->objectName().isEmpty()) + CameraDeviceSelect->setObjectName(QStringLiteral("CameraDeviceSelect")); + CameraDeviceSelect->resize(400, 300); + buttonBox = new QDialogButtonBox(CameraDeviceSelect); + buttonBox->setObjectName(QStringLiteral("buttonBox")); + buttonBox->setGeometry(QRect(30, 240, 341, 32)); + buttonBox->setOrientation(Qt::Horizontal); + buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok); + widget = new QWidget(CameraDeviceSelect); + widget->setObjectName(QStringLiteral("widget")); + widget->setGeometry(QRect(11, 11, 371, 27)); + horizontalLayout = new QHBoxLayout(widget); + horizontalLayout->setObjectName(QStringLiteral("horizontalLayout")); + horizontalLayout->setContentsMargins(0, 0, 0, 0); + label = new QLabel(widget); + label->setObjectName(QStringLiteral("label")); + + horizontalLayout->addWidget(label); + + comboBox_VideoDevice = new QComboBox(widget); + comboBox_VideoDevice->setObjectName(QStringLiteral("comboBox_VideoDevice")); + + horizontalLayout->addWidget(comboBox_VideoDevice); + + + retranslateUi(CameraDeviceSelect); + QObject::connect(buttonBox, SIGNAL(accepted()), CameraDeviceSelect, SLOT(accept())); + QObject::connect(buttonBox, SIGNAL(rejected()), CameraDeviceSelect, SLOT(reject())); + + QMetaObject::connectSlotsByName(CameraDeviceSelect); + } // setupUi + + void retranslateUi(QDialog *CameraDeviceSelect) + { + CameraDeviceSelect->setWindowTitle(QApplication::translate("CameraDeviceSelect", "Dialog", 0)); + label->setText(QApplication::translate("CameraDeviceSelect", "Select Camera Device", 0)); + } // retranslateUi + +}; + +namespace Ui { + class CameraDeviceSelect: public Ui_CameraDeviceSelect {}; +} // namespace Ui + +QT_END_NAMESPACE + +#endif // UI_CAMERADEVICESELECT_H