diff --git a/Modules/ExampleModule/CMakeLists.txt b/Modules/ExampleModule/CMakeLists.txt index e459b99..2beaf48 100644 --- a/Modules/ExampleModule/CMakeLists.txt +++ b/Modules/ExampleModule/CMakeLists.txt @@ -1,6 +1,6 @@ mitk_create_module(ExampleModule - DEPENDS PUBLIC MitkCore + DEPENDS PUBLIC MitkSegmentation PACKAGE_DEPENDS PRIVATE GuidelinesSupportLibrary ) add_subdirectory(cmdapps) diff --git a/Modules/ExampleModule/files.cmake b/Modules/ExampleModule/files.cmake index a2c16cb..374810f 100644 --- a/Modules/ExampleModule/files.cmake +++ b/Modules/ExampleModule/files.cmake @@ -1,9 +1,12 @@ set(CPP_FILES ExampleImageFilter.cpp ExampleImageInteractor.cpp + ExampleModule.cpp + ExampleSegTool2D.cpp ) set(RESOURCE_FILES Interactions/Paint.xml Interactions/PaintConfig.xml + ExampleIcon.svg ) diff --git a/Modules/ExampleModule/include/ExampleModule.h b/Modules/ExampleModule/include/ExampleModule.h new file mode 100644 index 0000000..93d008d --- /dev/null +++ b/Modules/ExampleModule/include/ExampleModule.h @@ -0,0 +1,27 @@ +/*=================================================================== + +The Medical Imaging Interaction Toolkit (MITK) + +Copyright (c) German Cancer Research Center, +Division of Medical and Biological Informatics. +All rights reserved. + +This software is distributed WITHOUT ANY WARRANTY; without +even the implied warranty of MERCHANTABILITY or FITNESS FOR +A PARTICULAR PURPOSE. + +See LICENSE.txt or http://www.mitk.org for details. + +===================================================================*/ + +#ifndef ExampleModule_h +#define ExampleModule_h + +#include + +namespace ExampleModule +{ + MITKEXAMPLEMODULE_EXPORT void ForceLinkage(); +} + +#endif diff --git a/Modules/ExampleModule/include/ExampleSegTool2D.h b/Modules/ExampleModule/include/ExampleSegTool2D.h new file mode 100644 index 0000000..445dfa5 --- /dev/null +++ b/Modules/ExampleModule/include/ExampleSegTool2D.h @@ -0,0 +1,47 @@ +/*=================================================================== + +The Medical Imaging Interaction Toolkit (MITK) + +Copyright (c) German Cancer Research Center, +Division of Medical and Biological Informatics. +All rights reserved. + +This software is distributed WITHOUT ANY WARRANTY; without +even the implied warranty of MERCHANTABILITY or FITNESS FOR +A PARTICULAR PURPOSE. + +See LICENSE.txt or http://www.mitk.org for details. + +===================================================================*/ + +#ifndef ExampleSegTool2D_h +#define ExampleSegTool2D_h + +#include +#include + +namespace us +{ + class ModuleResource; +} + +class MITKEXAMPLEMODULE_EXPORT ExampleSegTool2D : public mitk::SegTool2D +{ +public: + mitkClassMacro(ExampleSegTool2D, SegTool2D) + itkFactorylessNewMacro(Self) + + us::ModuleResource GetIconResource() const override; + const char *GetName() const override; + const char **GetXPM() const override; + + virtual void Paint(mitk::StateMachineAction* action, mitk::InteractionEvent* event); + +protected: + ExampleSegTool2D(); + ~ExampleSegTool2D() override; + + void ConnectActionsAndFunctions() override; +}; + +#endif diff --git a/Modules/ExampleModule/resource/ExampleIcon.svg b/Modules/ExampleModule/resource/ExampleIcon.svg new file mode 100644 index 0000000..494e911 --- /dev/null +++ b/Modules/ExampleModule/resource/ExampleIcon.svg @@ -0,0 +1,73 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/Modules/ExampleModule/src/ExampleModule.cpp b/Modules/ExampleModule/src/ExampleModule.cpp new file mode 100644 index 0000000..eeb9723 --- /dev/null +++ b/Modules/ExampleModule/src/ExampleModule.cpp @@ -0,0 +1,21 @@ +/*=================================================================== + +The Medical Imaging Interaction Toolkit (MITK) + +Copyright (c) German Cancer Research Center, +Division of Medical and Biological Informatics. +All rights reserved. + +This software is distributed WITHOUT ANY WARRANTY; without +even the implied warranty of MERCHANTABILITY or FITNESS FOR +A PARTICULAR PURPOSE. + +See LICENSE.txt or http://www.mitk.org for details. + +===================================================================*/ + +#include + +void ExampleModule::ForceLinkage() +{ +} diff --git a/Modules/ExampleModule/src/ExampleSegTool2D.cpp b/Modules/ExampleModule/src/ExampleSegTool2D.cpp new file mode 100644 index 0000000..1687470 --- /dev/null +++ b/Modules/ExampleModule/src/ExampleSegTool2D.cpp @@ -0,0 +1,59 @@ +/*=================================================================== + +The Medical Imaging Interaction Toolkit (MITK) + +Copyright (c) German Cancer Research Center, +Division of Medical and Biological Informatics. +All rights reserved. + +This software is distributed WITHOUT ANY WARRANTY; without +even the implied warranty of MERCHANTABILITY or FITNESS FOR +A PARTICULAR PURPOSE. + +See LICENSE.txt or http://www.mitk.org for details. + +===================================================================*/ + +#include + +#include +#include + +MITK_TOOL_MACRO(MITKEXAMPLEMODULE_EXPORT, ExampleSegTool2D, "Example tool"); + +ExampleSegTool2D::ExampleSegTool2D() + : SegTool2D("Paint", us::GetModuleContext()->GetModule()) +{ +} + +ExampleSegTool2D::~ExampleSegTool2D() +{ +} + +void ExampleSegTool2D::ConnectActionsAndFunctions() +{ + CONNECT_FUNCTION("paint", Paint) +} + +void ExampleSegTool2D::Paint(mitk::StateMachineAction*, mitk::InteractionEvent*) +{ + MITK_INFO << "Hello from the other side!"; +} + +us::ModuleResource ExampleSegTool2D::GetIconResource() const +{ + auto moduleContext = us::GetModuleContext(); + auto module = moduleContext->GetModule(); + auto resource = module->GetResource("ExampleIcon.svg"); + return resource; +} + +const char *ExampleSegTool2D::GetName() const +{ + return "Example"; +} + +const char **ExampleSegTool2D::GetXPM() const +{ + return nullptr; +} diff --git a/Plugins/PluginList.cmake b/Plugins/PluginList.cmake index 5b79ebb..29609a3 100644 --- a/Plugins/PluginList.cmake +++ b/Plugins/PluginList.cmake @@ -1,3 +1,4 @@ set(MITK_PLUGINS + org.mitk.exampleplugin.eageractivation:ON org.mitk.gui.qt.exampleplugin:ON ) diff --git a/Plugins/org.mitk.exampleplugin.eageractivation/CMakeLists.txt b/Plugins/org.mitk.exampleplugin.eageractivation/CMakeLists.txt new file mode 100644 index 0000000..af0294a --- /dev/null +++ b/Plugins/org.mitk.exampleplugin.eageractivation/CMakeLists.txt @@ -0,0 +1,8 @@ +project(org_mitk_exampleplugin_eageractivation) + +mitk_create_plugin( + EXPORT_DIRECTIVE EXAMPLE_EXPORT + EXPORTED_INCLUDE_SUFFIXES src + MODULE_DEPENDS PRIVATE MitkExampleModule + PACKAGE_DEPENDS PRIVATE CTK|CTKPluginFramework +) diff --git a/Plugins/org.mitk.exampleplugin.eageractivation/files.cmake b/Plugins/org.mitk.exampleplugin.eageractivation/files.cmake new file mode 100644 index 0000000..53ff068 --- /dev/null +++ b/Plugins/org.mitk.exampleplugin.eageractivation/files.cmake @@ -0,0 +1,7 @@ +set(CPP_FILES + src/internal/PluginActivator.cpp +) + +set(MOC_H_FILES + src/internal/PluginActivator.h +) diff --git a/Plugins/org.mitk.exampleplugin.eageractivation/manifest_headers.cmake b/Plugins/org.mitk.exampleplugin.eageractivation/manifest_headers.cmake new file mode 100644 index 0000000..3b7b14e --- /dev/null +++ b/Plugins/org.mitk.exampleplugin.eageractivation/manifest_headers.cmake @@ -0,0 +1,5 @@ +set(Plugin-Name "Eager Activation Example Plugin") +set(Plugin-Version "1.0") +set(Plugin-Vendor "CAMIC") +set(Plugin-ContactAddress "https://mitk.org") +set(Plugin-ActivationPolicy eager) diff --git a/Plugins/org.mitk.exampleplugin.eageractivation/src/internal/PluginActivator.cpp b/Plugins/org.mitk.exampleplugin.eageractivation/src/internal/PluginActivator.cpp new file mode 100644 index 0000000..feb721b --- /dev/null +++ b/Plugins/org.mitk.exampleplugin.eageractivation/src/internal/PluginActivator.cpp @@ -0,0 +1,27 @@ +/*=================================================================== + +The Medical Imaging Interaction Toolkit (MITK) + +Copyright (c) German Cancer Research Center, +Division of Medical and Biological Informatics. +All rights reserved. + +This software is distributed WITHOUT ANY WARRANTY; without +even the implied warranty of MERCHANTABILITY or FITNESS FOR +A PARTICULAR PURPOSE. + +See LICENSE.txt or http://www.mitk.org for details. + +===================================================================*/ + +#include "PluginActivator.h" +#include + +void PluginActivator::start(ctkPluginContext*) +{ + ExampleModule::ForceLinkage(); +} + +void PluginActivator::stop(ctkPluginContext*) +{ +} diff --git a/Plugins/org.mitk.exampleplugin.eageractivation/src/internal/PluginActivator.h b/Plugins/org.mitk.exampleplugin.eageractivation/src/internal/PluginActivator.h new file mode 100644 index 0000000..5530fce --- /dev/null +++ b/Plugins/org.mitk.exampleplugin.eageractivation/src/internal/PluginActivator.h @@ -0,0 +1,33 @@ +/*=================================================================== + +The Medical Imaging Interaction Toolkit (MITK) + +Copyright (c) German Cancer Research Center, +Division of Medical and Biological Informatics. +All rights reserved. + +This software is distributed WITHOUT ANY WARRANTY; without +even the implied warranty of MERCHANTABILITY or FITNESS FOR +A PARTICULAR PURPOSE. + +See LICENSE.txt or http://www.mitk.org for details. + +===================================================================*/ + +#ifndef PluginActivator_h +#define PluginActivator_h + +#include + +class PluginActivator : public QObject, public ctkPluginActivator +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org_mitk_exampleplugin_eageractivation") + Q_INTERFACES(ctkPluginActivator) + +public: + void start(ctkPluginContext* context); + void stop(ctkPluginContext* context); +}; + +#endif