diff --git a/Plugins/PluginList.cmake b/Plugins/PluginList.cmake index 548f9f33b4..60eb8fea9a 100644 --- a/Plugins/PluginList.cmake +++ b/Plugins/PluginList.cmake @@ -1,114 +1,115 @@ # Plug-ins must be ordered according to their dependencies set(MITK_PLUGINS org.blueberry.core.runtime:ON org.blueberry.core.expressions:OFF org.blueberry.core.commands:OFF org.blueberry.core.jobs:OFF org.blueberry.ui.qt:OFF org.blueberry.ui.qt.help:ON org.blueberry.ui.qt.log:ON org.blueberry.ui.qt.objectinspector:OFF #org.blueberry.test:ON #org.blueberry.uitest:ON #Testing/org.blueberry.core.runtime.tests:ON #Testing/org.blueberry.osgi.tests:ON org.mitk.core.services:ON org.mitk.gui.common:ON org.mitk.planarfigure:ON + org.mitk.annotations:OFF org.mitk.core.ext:OFF org.mitk.core.jobs:OFF org.mitk.gui.qt.application:ON org.mitk.gui.qt.coreapplication:OFF org.mitk.gui.qt.ext:OFF org.mitk.gui.qt.extapplication:OFF org.mitk.gui.qt.common:ON org.mitk.gui.qt.stdmultiwidgeteditor:ON org.mitk.gui.qt.common.legacy:OFF org.mitk.gui.qt.cmdlinemodules:OFF org.mitk.gui.qt.chartExample:OFF org.mitk.gui.qt.diffusionimagingapp:OFF org.mitk.gui.qt.datamanager:ON org.mitk.gui.qt.datamanagerlight:OFF org.mitk.gui.qt.datastorageviewertest:OFF org.mitk.gui.qt.properties:ON org.mitk.gui.qt.basicimageprocessing:OFF org.mitk.gui.qt.dicom:OFF org.mitk.gui.qt.dicominspector:OFF org.mitk.gui.qt.diffusionimaging:OFF org.mitk.gui.qt.diffusionimaging.connectomics:OFF org.mitk.gui.qt.diffusionimaging.denoising:OFF org.mitk.gui.qt.diffusionimaging.fiberfox:OFF org.mitk.gui.qt.diffusionimaging.fiberprocessing:OFF org.mitk.gui.qt.diffusionimaging.ivim:OFF org.mitk.gui.qt.diffusionimaging.odfpeaks:OFF org.mitk.gui.qt.diffusionimaging.partialvolume:OFF org.mitk.gui.qt.diffusionimaging.preprocessing:OFF org.mitk.gui.qt.diffusionimaging.reconstruction:OFF org.mitk.gui.qt.diffusionimaging.registration:OFF org.mitk.gui.qt.diffusionimaging.tractography:OFF org.mitk.gui.qt.diffusionimaging.python:OFF org.mitk.gui.qt.dosevisualization:OFF org.mitk.gui.qt.geometrytools:OFF org.mitk.gui.qt.igtexamples:OFF org.mitk.gui.qt.igttracking:OFF org.mitk.gui.qt.lasercontrol:OFF org.mitk.gui.qt.openigtlink:OFF org.mitk.gui.qt.imagecropper:OFF org.mitk.gui.qt.imagenavigator:ON org.mitk.gui.qt.viewnavigator:OFF org.mitk.gui.qt.materialeditor:OFF org.mitk.gui.qt.measurementtoolbox:OFF org.mitk.gui.qt.moviemaker:OFF org.mitk.gui.qt.pointsetinteraction:OFF org.mitk.gui.qt.pointsetinteractionmultispectrum:OFF org.mitk.gui.qt.python:OFF org.mitk.gui.qt.remeshing:OFF org.mitk.gui.qt.segmentation:OFF org.mitk.gui.qt.aicpregistration:OFF org.mitk.gui.qt.renderwindowmanager:OFF org.mitk.gui.qt.toftutorial:OFF org.mitk.gui.qt.tofutil:OFF org.mitk.gui.qt.tubegraph:OFF org.mitk.gui.qt.ugvisualization:OFF org.mitk.gui.qt.photoacoustics.pausviewer:OFF org.mitk.gui.qt.photoacoustics.pausmotioncompensation:OFF org.mitk.gui.qt.photoacoustics.imageprocessing:OFF org.mitk.gui.qt.photoacoustics.simulation:OFF org.mitk.gui.qt.photoacoustics.spectralunmixing:OFF org.mitk.gui.qt.ultrasound:OFF org.mitk.gui.qt.volumevisualization:OFF org.mitk.gui.qt.eventrecorder:OFF org.mitk.gui.qt.xnat:OFF org.mitk.gui.qt.igt.app.echotrack:OFF org.mitk.gui.qt.spectrocamrecorder:OFF org.mitk.gui.qt.classificationsegmentation:OFF org.mitk.gui.qt.overlaymanager:OFF org.mitk.gui.qt.igt.app.hummelprotocolmeasurements:OFF org.mitk.gui.qt.multilabelsegmentation:OFF org.mitk.matchpoint.core.helper:OFF org.mitk.gui.qt.matchpoint.algorithm.browser:OFF org.mitk.gui.qt.matchpoint.algorithm.control:OFF org.mitk.gui.qt.matchpoint.algorithm.batch:OFF org.mitk.gui.qt.matchpoint.mapper:OFF org.mitk.gui.qt.matchpoint.framereg:OFF org.mitk.gui.qt.matchpoint.visualizer:OFF org.mitk.gui.qt.matchpoint.evaluator:OFF org.mitk.gui.qt.matchpoint.manipulator:OFF org.mitk.gui.qt.preprocessing.resampling:OFF org.mitk.gui.qt.radiomics:OFF org.mitk.gui.qt.cest:OFF org.mitk.gui.qt.fit.demo:OFF org.mitk.gui.qt.fit.inspector:OFF org.mitk.gui.qt.fit.genericfitting:OFF org.mitk.gui.qt.pharmacokinetics.mri:OFF org.mitk.gui.qt.pharmacokinetics.pet:OFF org.mitk.gui.qt.pharmacokinetics.simulation:OFF org.mitk.gui.qt.pharmacokinetics.curvedescriptor:OFF org.mitk.gui.qt.pharmacokinetics.concentration.mri:OFF ) diff --git a/Plugins/org.mitk.annotations/CMakeLists.txt b/Plugins/org.mitk.annotations/CMakeLists.txt new file mode 100644 index 0000000000..c3dcd703aa --- /dev/null +++ b/Plugins/org.mitk.annotations/CMakeLists.txt @@ -0,0 +1,7 @@ +project(org_mitk_annotations) + +mitk_create_plugin( + EXPORT_DIRECTIVE ORG_MITK_ANNOTATIONS_EXPORT + EXPORTED_INCLUDE_SUFFIXES src + MODULE_DEPENDS MitkAnnotation + ) diff --git a/Plugins/org.mitk.annotations/documentation/doxygen/modules.dox b/Plugins/org.mitk.annotations/documentation/doxygen/modules.dox new file mode 100644 index 0000000000..c202b2bace --- /dev/null +++ b/Plugins/org.mitk.annotations/documentation/doxygen/modules.dox @@ -0,0 +1,19 @@ +/** + \defgroup org_mitk_annotations org.mitk.annotations + \ingroup MITKPlugins + + \brief This small plug-in is responsible for initializing the standard annotation set. + + It is started with an "eager" Bundle-ActivationPolicy, such that the plug-ins + activator is executed before any other (non-eager) plug-ins. + +*/ + +/** + \defgroup org_mitk_annotations_internal Internal + \ingroup org_mitk_annotations + + \brief This subcategory includes the internal classes of the org.mitk.annotations plugin. Other + plugins must not rely on these classes. They contain implementation details and their interface + may change at any time. We mean it. +*/ diff --git a/Plugins/org.mitk.annotations/files.cmake b/Plugins/org.mitk.annotations/files.cmake new file mode 100644 index 0000000000..e39dd3532a --- /dev/null +++ b/Plugins/org.mitk.annotations/files.cmake @@ -0,0 +1,30 @@ +set(MOC_H_FILES + src/internal/mitkAnnotationsActivator.h +) + +set(SRC_CPP_FILES + +) + +set(INTERNAL_CPP_FILES + mitkAnnotationsActivator.cpp +) + +set(CACHED_RESOURCE_FILES + resources/annotations.json +) + +set(QRC_FILES + resources/resources.qrc +) + +set(CPP_FILES ) + +foreach(file ${SRC_CPP_FILES}) + set(CPP_FILES ${CPP_FILES} src/${file}) +endforeach(file ${SRC_CPP_FILES}) + +foreach(file ${INTERNAL_CPP_FILES}) + set(CPP_FILES ${CPP_FILES} src/internal/${file}) +endforeach(file ${INTERNAL_CPP_FILES}) + diff --git a/Plugins/org.mitk.annotations/manifest_headers.cmake b/Plugins/org.mitk.annotations/manifest_headers.cmake new file mode 100644 index 0000000000..9d339be2a7 --- /dev/null +++ b/Plugins/org.mitk.annotations/manifest_headers.cmake @@ -0,0 +1,6 @@ +set(Plugin-Name "MITK Annotations") +set(Plugin-Version "0.1") +set(Plugin-Vendor "DKFZ, Medical and Biological Informatics") +set(Plugin-ContactAddress "http://www.mitk.org") +set(Require-Plugin org.mitk.gui.common) +set(Plugin-ActivationPolicy eager) diff --git a/Plugins/org.mitk.annotations/resources/annotations.json b/Plugins/org.mitk.annotations/resources/annotations.json new file mode 100644 index 0000000000..66dd7e5dc1 --- /dev/null +++ b/Plugins/org.mitk.annotations/resources/annotations.json @@ -0,0 +1,132 @@ +{ + "annotations" : { + "stdmulti.widget1" : { + "TopLeft": + [ + { + "name": "Slice Number", + "defaultValue": "Slice / MaxSlice", + "prefix": "Im: ", + "type": "property", + "provider": "DICOM.0020.0013" + }, + { + "name": "Sequence Number", + "defaultValue": "Sequence ?", + "prefix": "Se: ", + "type": "property", + "provider": "DICOM.0020.0011" + } + ], + "Top": [{ + "name": "A", + "type": "text" + }], + "TopRight": + [ + { + "name": "Patient Name", + "type": "property", + "provider": "DICOM.0010.0010" + }, + { + "name": "Patient ID", + "type": "property", + "provider": "DICOM.0010.0020" + }, + { + "name": "Patient Birth Date", + "type": "property", + "provider": "DICOM.0010.0030" + }, + { + "name": "Patient Sex", + "type": "property", + "provider": "DICOM.0010.0040" + }, + { + "name": "Institution Name", + "type": "property", + "provider": "DICOM.0008.0080" + }, + { + "name": "Study ID", + "type": "property", + "provider": "DICOM.0020.0010" + }, + { + "name": "Study Description", + "type": "property", + "provider": "DICOM.0008.1030" + }, + { + "name": "Series Description", + "type": "property", + "provider": "DICOM.0008.103E" + } + ], + "Left": [{ + "name": "R", + "type": "text" + }], + "Right":[{ + "name": "L", + "type": "text" + }], + "BottomLeft": + [ + { + "name": "Pixel(x,y,Val)", + "type": "text" + }, + { + "name": "Slice Thickness", + "defaultValue": "Unknown Thickness", + "prefix": "T: ", + "suffix": " mm", + "type": "property", + "provider": "DICOM.0018.0050" + }, + { + "name": "Image Z Position", + "prefix": "L: ", + "type": "property", + "provider": "DICOM.0020.0032" + } + ], + "BottomRight": + [ + { + "name": "FS: 1", + "type": "text" + }, + { + "name": "Repetition Time", + "prefix": "TR: ", + "type": "property", + "provider": "DICOM.0018.0080" + }, + { + "name": "Echo Time", + "prefix": "TE: ", + "type": "property", + "provider": "DICOM.0018.0081" + }, + { + "name": "Acquisition Date", + "type": "property", + "provider": "DICOM.0008.0022" + }, + { + "name": "Acquisition Time", + "type": "property", + "provider": "DICOM.0008.0032" + } + ], + "Bottom":[{ + "name": "P", + "type": "text" + }] + } + } +} \ No newline at end of file diff --git a/Plugins/org.mitk.annotations/resources/resources.qrc b/Plugins/org.mitk.annotations/resources/resources.qrc new file mode 100644 index 0000000000..b2874a7988 --- /dev/null +++ b/Plugins/org.mitk.annotations/resources/resources.qrc @@ -0,0 +1,5 @@ + + + annotations.json + + diff --git a/Plugins/org.mitk.annotations/src/internal/mitkAnnotationsActivator.cpp b/Plugins/org.mitk.annotations/src/internal/mitkAnnotationsActivator.cpp new file mode 100644 index 0000000000..38700858cf --- /dev/null +++ b/Plugins/org.mitk.annotations/src/internal/mitkAnnotationsActivator.cpp @@ -0,0 +1,76 @@ +/*=================================================================== + +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 "mitkAnnotationsActivator.h" + +#include "berryISelectionService.h" +#include "berryPlatformUI.h" +#include "mitkAnnotationFactory.h" +#include "mitkDataNodeSelection.h" + +void mitk::AnnotationsActivator::start(ctkPluginContext * /*context*/) +{ + m_AnnotationFactory = AnnotationFactory::New(); + + auto sliceNumberAction = [](const itk::Object *caller, const itk::EventObject &event, unsigned int slice) { + auto sliceEvent = dynamic_cast(&event); + if (sliceEvent) + { + return std::to_string(sliceEvent->GetPos()); + } + return std::string(); + }; + + AnnotationFactory::ActionFunctionMap actions{{"SliceNumberAction", sliceNumberAction}}; + AnnotationFactory::EventMap events{ + {"GeometrySliceEvent", SliceNavigationController::GeometrySliceEvent(nullptr, 0).MakeObject()}}; + + m_AnnotationFactory->CreateAnnotationsFromJson( + R"(D:\Arbeit\Programming\mitk_m\Plugins\org.mitk.annotations\resources\annotations.json)", actions, events); + + m_AnnotationFuture = std::async(std::launch::async, [this]() { + std::this_thread::sleep_for(std::chrono::seconds(10)); + //m_AnnotationFactory->Update(); leads to crash in vtk (maybe threading issue) + + auto windows = berry::PlatformUI::GetWorkbench()->GetWorkbenchWindows(); + auto activeWindow = berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow(); + auto selectionService = activeWindow->GetSelectionService(); + class NodeSelectionListener : public berry::ISelectionListener + { + public: + NodeSelectionListener(AnnotationFactory *factory) : m_Factory(factory){}; + void SelectionChanged(const berry::IWorkbenchPart::Pointer& part, + const berry::ISelection::ConstPointer& selection) override + { + const auto nodeSelection = dynamic_cast(selection.GetPointer()); + if (nodeSelection) + { + auto nodes = nodeSelection->GetSelectedDataNodes(); + if (!nodes.empty()) + { + m_Factory->SetPropertyProvider(nodes.front()->GetData()); + } + } + }; + AnnotationFactory *m_Factory; + }; + selectionService->AddPostSelectionListener(new NodeSelectionListener(m_AnnotationFactory)); + + //RenderingManager::GetInstance()->RequestUpdateAll(); + }); +} + +void mitk::AnnotationsActivator::stop(ctkPluginContext * /*context*/) {} diff --git a/Plugins/org.mitk.annotations/src/internal/mitkAnnotationsActivator.h b/Plugins/org.mitk.annotations/src/internal/mitkAnnotationsActivator.h new file mode 100644 index 0000000000..700db8f984 --- /dev/null +++ b/Plugins/org.mitk.annotations/src/internal/mitkAnnotationsActivator.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 MITKANNOTATIONSACTIVATOR_H_ +#define MITKANNOTATIONSACTIVATOR_H_ + +#include "mitkAnnotationFactory.h" +#include +#include +#include "mitkIRenderWindowPart.h" + +namespace mitk +{ + /** + * \ingroup org_mitk_annotations_internal + * + * \brief The plug-in activator for mitk annotations + */ + class AnnotationsActivator : public QObject, public ctkPluginActivator + { + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.mitk.annotations") + Q_INTERFACES(ctkPluginActivator) + + public: + void start(ctkPluginContext *context) override; + void stop(ctkPluginContext *context) override; + + private: + AnnotationFactory::Pointer m_AnnotationFactory; + std::future m_AnnotationFuture; + }; +} +#endif /* MITKANNOTATIONSACTIVATOR_H_ */