diff --git a/Modules/Annotation/src/mitkDataProvider.cpp b/Modules/Annotation/src/mitkDataProvider.cpp index 1479e35380..1855c497a9 100644 --- a/Modules/Annotation/src/mitkDataProvider.cpp +++ b/Modules/Annotation/src/mitkDataProvider.cpp @@ -1,125 +1,127 @@ /*=================================================================== 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 "mitkDataProvider.h" #include "mitkProviderRegistry.h" mitk::DataProvider::DataProvider(std::string name, itk::Object::Pointer object, const itk::EventObject *event, OnEventAction action, AdditionalInfoMap info) : DataProvider(name, object, event, [action](const auto *caller, const auto &event, auto noDependencies) { return action(caller, event); }, {}, info) { } mitk::DataProvider::DataProvider(std::string name, Object::Pointer object, const itk::EventObject *event, DependentOnEventAction action, std::vector dependencies, AdditionalInfoMap info) : m_Name(std::move(name)), m_DataChangedEvent(event), m_DataRetrievalAction(action) { m_UnknownDependencies.insert(std::begin(dependencies), std::end(dependencies)); m_DependencyResults.insert(std::begin(info), std::end(info)); m_DependencyResults["Self"] = this; FetchAndObserveDependencies(); SetProviderObject(object); } void mitk::DataProvider::SetProviderObject(itk::Object::Pointer providerObject) { if (m_Object == providerObject) return; if (m_Object.IsNotNull()) { m_Object->RemoveObserver(m_ProviderTag); m_ProviderTag = -1; } m_Object = providerObject; if (m_Object.IsNull()) return; auto itkAction = itk::MemberCommand::New(); itkAction->SetCallbackFunction(this, &DataProvider::OnEventTriggered); m_ProviderTag = m_Object->AddObserver(*m_DataChangedEvent, itkAction); auto itkActionConst = itk::MemberCommand::New(); itkActionConst->SetCallbackFunction(this, &DataProvider::OnEventTriggeredConstCaller); //TODO don't override provider tag m_ProviderTag = m_Object->AddObserver(*m_DataChangedEvent, itkActionConst); } std::string mitk::DataProvider::GetName() const { return m_Name; } boost::any mitk::DataProvider::GetValue() const { return m_Result; } void mitk::DataProvider::OnEventTriggeredConstCaller(const itk::Object *caller, const itk::EventObject &event) { FetchAndObserveDependencies(); m_Result = m_DataRetrievalAction(caller, event, m_DependencyResults); this->Modified(); } void mitk::DataProvider::OnEventTriggered(itk::Object* caller, const itk::EventObject& event) { this->OnEventTriggeredConstCaller(const_cast(caller), event); } void mitk::DataProvider::OnDependencyModified(const itk::Object *caller, const itk::EventObject &event) { auto provider = dynamic_cast(caller); if (provider) { - m_DependencyResults[provider->GetName()] = provider->GetValue(); + auto providerName = provider->GetName(); + auto providerValue = provider->GetValue(); + m_DependencyResults.insert_or_assign(providerName, providerValue); OnEventTriggered(m_Object,* m_DataChangedEvent); } } void mitk::DataProvider::FetchAndObserveDependencies() { if (m_UnknownDependencies.empty()) return; auto registry = ProviderRegistry::GetInstance(); auto knownProviders = registry->FetchDataProviders(m_UnknownDependencies); for (const auto &provider : knownProviders) { auto itkAction = itk::MemberCommand::New(); itkAction->SetCallbackFunction(this, &DataProvider::OnDependencyModified); m_DependencyTags[provider->GetName()] = provider->AddObserver(itk::ModifiedEvent(), itkAction); m_UnknownDependencies.erase(provider->GetName()); } } diff --git a/Modules/Annotation/test/mitkAnnotationFactoryTest.cpp b/Modules/Annotation/test/mitkAnnotationFactoryTest.cpp index f67fe29c1b..1b6cf2e0eb 100644 --- a/Modules/Annotation/test/mitkAnnotationFactoryTest.cpp +++ b/Modules/Annotation/test/mitkAnnotationFactoryTest.cpp @@ -1,135 +1,137 @@ /*=================================================================== 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 "mitkAnnotationFactory.h" +#include "mitkAnnotationJsonReaderWriter.h" #include "mitkDynamicAnnotation.h" #include "mitkTestFixture.h" #include "mitkTestingMacros.h" #include "mitkTextAnnotation2D.h" +#include "mitkStdAnnotationDataProviders.h" class mitkAnnotationFactoryTestSuite : public mitk::TestFixture { CPPUNIT_TEST_SUITE(mitkAnnotationFactoryTestSuite); MITK_TEST(ReadJsonConfiguration); MITK_TEST(SaveJsonConfiguration); MITK_TEST(ReactToPropertyChangedEvent); CPPUNIT_TEST_SUITE_END(); // TODO get rid of absolute path std::string m_AnnotationTestDataDir = R"(D:\Arbeit\Programming\mitk_m\Plugins\org.mitk.annotations\resources\)"; - std::string m_ValidJsonFile = "annotations.json"; - std::string m_SaveFile = "annotationsSaved.json"; + std::string m_ValidJsonFile = "annotationsTest.json"; + std::string m_SaveFile = "annotationsTestSaved.json"; mitk::AnnotationFactory::Pointer m_Factory; public: - void setUp() override - { - m_Factory = mitk::AnnotationFactory::GetServiceInstance(); - CPPUNIT_ASSERT_EQUAL(static_cast(0), m_Factory->GetAmountOfPendingAnnotations()); - CPPUNIT_ASSERT_EQUAL(static_cast(0), m_Factory->GetManagedAnnotationIds().size()); - }; - void tearDown() override { m_Factory->Reset(); }; + void setUp() override{}; + void tearDown() override{}; void ReadJsonConfiguration() { - // TODO get rid of hardcoded magic number (26 amount of annotations in the json file) - m_Factory->CreateAnnotationsFromJson(m_AnnotationTestDataDir + m_ValidJsonFile); - const auto amountOfRegisteredAnnotations = m_Factory->GetManagedAnnotationIds().size(); - const auto amountOfPendingAnnotations = m_Factory->GetAmountOfPendingAnnotations(); - CPPUNIT_ASSERT_EQUAL_MESSAGE("The amount of created annotations seems incorrect", - static_cast(26), - amountOfRegisteredAnnotations + amountOfPendingAnnotations); + auto configurations = + mitk::AnnotationJsonReaderWriter::ReadAnnotationsFromJsonFile(m_AnnotationTestDataDir + m_ValidJsonFile); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "The amount of created annotations seems incorrect", static_cast(26), configurations.size()); }; void SaveJsonConfiguration() { // read the json file and store the amount of annotations contained - m_Factory->CreateAnnotationsFromJson(m_AnnotationTestDataDir + m_ValidJsonFile); - auto amountOfAnnotations = m_Factory->GetManagedAnnotationIds().size() + m_Factory->GetAmountOfPendingAnnotations(); + auto configurations = + mitk::AnnotationJsonReaderWriter::ReadAnnotationsFromJsonFile(m_AnnotationTestDataDir + m_ValidJsonFile); // save the actual configuration to json - // (this might not produce the exact same file as optional parameters were filled with their defaults!) - m_Factory->SaveConfigurationToJsonFile(m_AnnotationTestDataDir + m_SaveFile); - - // clear all managed annotations - m_Factory->Reset(); + mitk::AnnotationJsonReaderWriter::WriteAnnotationsToJsonFile(m_AnnotationTestDataDir + m_SaveFile, configurations); // read the file that was just written to disk - m_Factory->CreateAnnotationsFromJson(m_AnnotationTestDataDir + m_SaveFile); - - // check whether the amount of annotations stayed the same - auto amountOfAnnotations2 = - m_Factory->GetManagedAnnotationIds().size() + m_Factory->GetAmountOfPendingAnnotations(); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Saving and reloading the configuration changed the number of total annotations", - amountOfAnnotations, - amountOfAnnotations2); - - // note that this is a very weak check as it doesn't guarantee, that the annotations stayed the same - // especially regarding provider information etc. - // this test should be extended to actually check either the json files directly (dealing with differences in - // optional values) or by comparing two vectors of loaded configurations of these files + auto configurationsReloaded = + mitk::AnnotationJsonReaderWriter::ReadAnnotationsFromJsonFile(m_AnnotationTestDataDir + m_SaveFile); + + // check that the same amount of configurations were produced + CPPUNIT_ASSERT_EQUAL_MESSAGE("Saving and reloading didn't produce equal amounts of configuration maps", + configurations.size(), + configurationsReloaded.size()); + + // check whether at least all of the information was saved (and reloaded), doesn't check for additional information + for (auto i = 0; i < configurations.size(); ++i) + { + const auto &config = configurations[i]; + const auto &configReloaded = configurationsReloaded[i]; + for (const auto &pair : config) + { + // check that key exists + auto reloadedIter = configReloaded.find(pair.first); + CPPUNIT_ASSERT(reloadedIter != std::end(configReloaded)); + + // check for value equality + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "Config values don't match after saving and reloading", pair.second, reloadedIter->second); + } + } } void ReactToPropertyChangedEvent() { // create annotation wrapper auto annotation = mitk::DynamicAnnotation{}; // create specific annotation annotation.ptr = mitk::TextAnnotation2D::New(); // configure the dynamic annotation auto customProviderName = "customPropertyProvider"; annotation.config = {{mitk::AnnotationConstants::PROVIDER, customProviderName}, {mitk::AnnotationConstants::TYPE, "property"}}; // specify the necessary provider information annotation.providerInfo.dataChangedEvent = itk::ModifiedEvent().MakeObject(); annotation.providerInfo.dataRetrievalAction = [](const itk::Object *caller, const itk::EventObject &, unsigned, unsigned) { auto prop = dynamic_cast(caller); return prop ? prop->GetValueAsString() : "ERROR"; }; // register annotation with the system mitk::LayoutAnnotationRenderer::AddAnnotation(annotation.ptr, "stdmulti.widget1"); // let the factory take over the management m_Factory->AddSingleAnnotation(annotation); // create the actual data provider auto prop = mitk::StringProperty::New(); prop->SetValue("first"); // set the provider for the key specified in the annotation's config // this should retrieve the dynamic data for the first time m_Factory->SetProvider(customProviderName, prop.GetPointer()); CPPUNIT_ASSERT_EQUAL(std::string("first"), annotation.ptr->GetText()); // change the provider's data // this should trigger the specified OnEventAction and update the annotation's text accordingly prop->SetValue("second"); CPPUNIT_ASSERT_EQUAL(std::string("second"), annotation.ptr->GetText()); }; void ReactToSliceNumberChangedEvent( // TODO implement test + auto provider = mitk::AnnotationDataProviderFactory::DefaultSliceNumberProvider(); ); }; MITK_TEST_SUITE_REGISTRATION(mitkAnnotationFactory) \ No newline at end of file diff --git a/Plugins/org.mitk.annotations/CMakeLists.txt b/Plugins/org.mitk.annotations/CMakeLists.txt index c3dcd703aa..d864eefccc 100644 --- a/Plugins/org.mitk.annotations/CMakeLists.txt +++ b/Plugins/org.mitk.annotations/CMakeLists.txt @@ -1,7 +1,7 @@ project(org_mitk_annotations) mitk_create_plugin( EXPORT_DIRECTIVE ORG_MITK_ANNOTATIONS_EXPORT EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDS MitkAnnotation + MODULE_DEPENDS MitkQtWidgetsExt MitkAnnotation ) diff --git a/Plugins/org.mitk.annotations/files.cmake b/Plugins/org.mitk.annotations/files.cmake index 7a3448f727..58a2be2709 100644 --- a/Plugins/org.mitk.annotations/files.cmake +++ b/Plugins/org.mitk.annotations/files.cmake @@ -1,35 +1,40 @@ set(MOC_H_FILES src/internal/mitkAnnotationsActivator.h src/internal/mitkAnnotationNodeSelectionListener.h src/internal/mitkAnnotationPresetLoader.h ) +set(UI_FILES + src/internal/QmitkAnnotationPresetLoaderViewControls.ui +) + set(SRC_CPP_FILES ) set(INTERNAL_CPP_FILES mitkAnnotationsActivator.cpp mitkAnnotationNodeSelectionListener.cpp mitkAnnotationPresetLoader.cpp ) set(CACHED_RESOURCE_FILES +resources/logoOverlay.png resources/annotations.json plugin.xml ) 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 index 50afacd5c8..11fc209932 100644 --- a/Plugins/org.mitk.annotations/manifest_headers.cmake +++ b/Plugins/org.mitk.annotations/manifest_headers.cmake @@ -1,6 +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(Require-Plugin org.mitk.gui.qt.common) #set(Plugin-ActivationPolicy eager) diff --git a/Plugins/org.mitk.annotations/plugin.xml b/Plugins/org.mitk.annotations/plugin.xml index ff04491689..208becde6e 100644 --- a/Plugins/org.mitk.annotations/plugin.xml +++ b/Plugins/org.mitk.annotations/plugin.xml @@ -1,12 +1,10 @@ - - - diff --git a/Plugins/org.mitk.annotations/resources/annotationsReduced.json b/Plugins/org.mitk.annotations/resources/annotationsReduced.json index ce773bf24e..c230768f1c 100644 --- a/Plugins/org.mitk.annotations/resources/annotationsReduced.json +++ b/Plugins/org.mitk.annotations/resources/annotationsReduced.json @@ -1,23 +1,43 @@ { "annotations" : { "stdmulti.widget1" : { + "Top": + [ + { + "name": "TopText", + "type": "text" + } + ], "TopLeft": [ { "name": "Slice Number", "defaultValue": "Slice / MaxSlice", "prefix": "Im: ", "type": "dicomProperty", "provider": "DICOM.0020.0013" }, { "name": "Sequence Number", "defaultValue": "Sequence ?", "prefix": "Se: ", "type": "dicomProperty", "provider": "DICOM.0020.0011" } ] + }, + "stdmulti.widget3" : { + "Right": + [ + { + "name": "colorBar", + "type": "colorBar" + }, + { + "name": "scaleLegend", + "type": "scaleLegend" + } + ] } } } \ No newline at end of file diff --git a/Plugins/org.mitk.annotations/src/internal/mitkAnnotationPresetLoader.cpp b/Plugins/org.mitk.annotations/src/internal/mitkAnnotationPresetLoader.cpp index 3a057bf437..23ba836cd8 100644 --- a/Plugins/org.mitk.annotations/src/internal/mitkAnnotationPresetLoader.cpp +++ b/Plugins/org.mitk.annotations/src/internal/mitkAnnotationPresetLoader.cpp @@ -1,87 +1,116 @@ /*=================================================================== 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 "mitkAnnotationPresetLoader.h" #include "mitkAnnotationFactory.h" #include "mitkAnnotationJsonReaderWriter.h" #include "mitkProviderRegistry.h" #include "mitkStdAnnotationDataProviders.h" +#include -auto mitk::AnnotationPresetLoader::SelectionChangeAction() +auto AnnotationPresetLoader::SelectionChangeAction() { return [](const itk::Object *caller, const itk::EventObject &event) { const auto dataNodeProvider = dynamic_cast(caller); if (dataNodeProvider) { return dataNodeProvider->GetSelectedDataNode(); } return itk::SmartPointer(nullptr); }; } -void mitk::AnnotationPresetLoader::SetupDefaultProviders() +void AnnotationPresetLoader::SetupDefaultProviders() { - auto providers = ProviderRegistry::GetInstance(); - providers->AddDataProviders( - {AnnotationDataProviderFactory::DefaultSliceNumberProvider(), - AnnotationDataProviderFactory::DefaultTimeStepProvider(), - AnnotationDataProviderFactory::DefaultDataNodeProvider("DataNodeProvider", - AnnotationNodeSelectionListener::New(), - itk::ModifiedEvent().MakeObject(), - SelectionChangeAction())}); + auto providers = mitk::ProviderRegistry::GetInstance(); + if (providers->FetchDataProviders({"SliceNumberProviderAxial", "TimeStepProvider", "DataNodeProvider"}).empty()) + { + providers->AddDataProviders( + {mitk::AnnotationDataProviderFactory::DefaultSliceNumberProvider("SliceNumberProviderAxial"), + mitk::AnnotationDataProviderFactory::DefaultTimeStepProvider("TimeStepProvider"), + mitk::AnnotationDataProviderFactory::DefaultDataNodeProvider("DataNodeProvider", + mitk::AnnotationNodeSelectionListener::New(), + itk::ModifiedEvent().MakeObject(), + SelectionChangeAction())}); + } } -void mitk::AnnotationPresetLoader::SaveCurrentConfiguration(const std::string &fileName) +void AnnotationPresetLoader::SaveCurrentConfiguration(const std::string &fileName) { try { - AnnotationJsonReaderWriter::WriteAnnotationsToJsonFile(fileName, m_ManagedAnnotations); + mitk::AnnotationJsonReaderWriter::WriteAnnotationsToJsonFile(fileName, m_ManagedAnnotations); } catch (const std::exception &e) { MITK_ERROR << "Exception while saving json configuration. The save file probably wasn't written or updated"; MITK_ERROR << e.what(); } } -void mitk::AnnotationPresetLoader::LoadPreset(const std::string &fileName) +void AnnotationPresetLoader::LoadPreset(const std::string &fileName) { SetupDefaultProviders(); - // TODO move propertyProviders to StdAnnotationDataProvidersClass // TODO move this logic to a seperate class // TODO move data node change listener to seperate class // TODO fix issue with viewless plugin // TODO add cpp file to reader writer // TODO move all default action and event functions to a seperate class // TODO make the tests great again // TODO fix workbench closing crash (hint: destructing DataNodeProvider twice?) - auto annotationConfigurations = std::vector{}; + auto annotationConfigurations = std::vector{}; try { - annotationConfigurations = AnnotationJsonReaderWriter::ReadAnnotationsFromJsonFile(fileName); + annotationConfigurations = mitk::AnnotationJsonReaderWriter::ReadAnnotationsFromJsonFile(fileName); } catch (const std::exception &e) { MITK_ERROR << "Exception while loading json configuration"; MITK_ERROR << e.what(); } - m_ManagedAnnotations = AnnotationFactory::CreateAnnotationsFromConfiguration(annotationConfigurations); + m_ManagedAnnotations = mitk::AnnotationFactory::CreateAnnotationsFromConfiguration(annotationConfigurations); + + mitk::AnnotationFactory::RegisterAnnotations(m_ManagedAnnotations); +} + +void AnnotationPresetLoader::SetFocus() {} + +void AnnotationPresetLoader::CreateQtPartControl(QWidget *parent) +{ + m_Controls.setupUi(parent); - AnnotationFactory::RegisterAnnotations(m_ManagedAnnotations); + connect(m_Controls.btn_load, &QPushButton::pressed, this, &AnnotationPresetLoader::OnLoadConfigurationPressed); +} + +void AnnotationPresetLoader::RenderWindowPartActivated(mitk::IRenderWindowPart *renderWindowPart) {} + +void AnnotationPresetLoader::RenderWindowPartDeactivated(mitk::IRenderWindowPart *renderWindowPart) {} + +void AnnotationPresetLoader::OnLoadConfigurationPressed() +{ + QFileDialog prompt{nullptr, "Select a json annotation layout", "", "*.json"}; + prompt.exec(); + auto selectedFiles = prompt.selectedFiles(); + if (!selectedFiles.empty()) + { + auto fileName = selectedFiles.front(); + m_Controls.lbl_path->setText(fileName); + this->LoadPreset(fileName.toStdString()); + } } diff --git a/Plugins/org.mitk.annotations/src/internal/mitkAnnotationPresetLoader.h b/Plugins/org.mitk.annotations/src/internal/mitkAnnotationPresetLoader.h index efdc612746..bce8180061 100644 --- a/Plugins/org.mitk.annotations/src/internal/mitkAnnotationPresetLoader.h +++ b/Plugins/org.mitk.annotations/src/internal/mitkAnnotationPresetLoader.h @@ -1,38 +1,52 @@ /*=================================================================== 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 MITKANNOTATIONPRESETLOADER_H #define MITKANNOTATIONPRESETLOADER_H #include "mitkAnnotationNodeSelectionListener.h" #include "mitkDynamicAnnotation.h" +#include #include -namespace mitk +#include "mitkIRenderWindowPartListener.h" +#include "ui_QmitkAnnotationPresetLoaderViewControls.h" + +class AnnotationPresetLoader : public QmitkAbstractView, public mitk::IRenderWindowPartListener { - class AnnotationPresetLoader - { - public: - static auto SelectionChangeAction(); - void SetupDefaultProviders(); - void SaveCurrentConfiguration(const std::string &fileName); - void LoadPreset(const std::string &fileName); - - private: - std::unique_ptr m_NodeSelectionListener; - std::vector m_ManagedAnnotations; - }; -} // namespace mitk + Q_OBJECT +public: + static auto SelectionChangeAction(); + void SetupDefaultProviders(); + void SaveCurrentConfiguration(const std::string &fileName); + void LoadPreset(const std::string &fileName); + + void SetFocus() override; + +protected: + void CreateQtPartControl(QWidget *parent) override; + +public: + void RenderWindowPartActivated(mitk::IRenderWindowPart *renderWindowPart) override; + void RenderWindowPartDeactivated(mitk::IRenderWindowPart *renderWindowPart) override; +public slots: + void OnLoadConfigurationPressed(); + +private: + std::unique_ptr m_NodeSelectionListener; + std::vector m_ManagedAnnotations; + Ui::AnnotationPresetLoaderControls m_Controls; +}; #endif // MITKANNOTATIONPRESETLOADER_H diff --git a/Plugins/org.mitk.annotations/src/internal/mitkAnnotationsActivator.cpp b/Plugins/org.mitk.annotations/src/internal/mitkAnnotationsActivator.cpp index fef102465a..3323c2c561 100644 --- a/Plugins/org.mitk.annotations/src/internal/mitkAnnotationsActivator.cpp +++ b/Plugins/org.mitk.annotations/src/internal/mitkAnnotationsActivator.cpp @@ -1,30 +1,31 @@ /*=================================================================== 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 "mitkAnnotationPresetLoader.h" void mitk::AnnotationsActivator::start(ctkPluginContext *context) { + BERRY_REGISTER_EXTENSION_CLASS(AnnotationPresetLoader, context) // TODO remove hardcoded string - auto fileName = + /* auto fileName = std::string{R"(D:\Arbeit\Programming\mitk_m\Plugins\org.mitk.annotations\resources\annotations.json)"}; m_AnnotationPresetLoader = std::make_unique(); - m_AnnotationPresetLoader->LoadPreset(fileName); + m_AnnotationPresetLoader->LoadPreset(fileName);*/ } void mitk::AnnotationsActivator::stop(ctkPluginContext * /*context*/) {} diff --git a/Plugins/org.mitk.annotations/src/internal/qmitkannotationpresetloaderviewcontrols.ui b/Plugins/org.mitk.annotations/src/internal/qmitkannotationpresetloaderviewcontrols.ui new file mode 100644 index 0000000000..107c9e2973 --- /dev/null +++ b/Plugins/org.mitk.annotations/src/internal/qmitkannotationpresetloaderviewcontrols.ui @@ -0,0 +1,58 @@ + + + AnnotationPresetLoaderControls + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + 0 + 0 + 401 + 301 + + + + + + + Loaded configuration: None + + + + + + + LoadJsonConfiguration... + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + +