diff --git a/Modules/Python/autoload/PythonService/CMakeLists.txt b/Modules/Python/autoload/PythonService/CMakeLists.txt index a1a8f9c6ed..1afde71599 100644 --- a/Modules/Python/autoload/PythonService/CMakeLists.txt +++ b/Modules/Python/autoload/PythonService/CMakeLists.txt @@ -1,16 +1,16 @@ MITK_CREATE_MODULE( PythonService INCLUDE_DIRS PRIVATE src/PythonService DEPENDS PUBLIC MitkPython PACKAGE_DEPENDS PUBLIC Qt4|QtGui Qt5|Widgets CTK|CTKScriptingPythonCore+CTKScriptingPythonWidgets PRIVATE PythonLibs VTK|vtkPython+vtkWrappingPythonCore ${OpenCV_DEP} - AUTOLOAD_WITH MitkCore + AUTOLOAD_WITH MitkPython ) if(TARGET ${MODULE_TARGET}) configure_file(PythonPath.h.in "${CMAKE_CURRENT_BINARY_DIR}/PythonPath.h" @ONLY) if(NOT MITK_USE_SYSTEM_PYTHON) target_compile_definitions(${MODULE_TARGET} PRIVATE -DUSE_MITK_BUILTIN_PYTHON) endif() -endif() \ No newline at end of file +endif() diff --git a/Modules/QtPython/Testing/mitkCommonPythonTest.h b/Modules/QtPython/Testing/mitkCommonPythonTest.h index 8bf1b5a832..1bcf73a455 100644 --- a/Modules/QtPython/Testing/mitkCommonPythonTest.h +++ b/Modules/QtPython/Testing/mitkCommonPythonTest.h @@ -1,71 +1,73 @@ /*=================================================================== 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 #include #include #include #include #include #include #include #include //#include #include //#include namespace mitk { class CommonPythonTestSuite : public mitk::TestFixture { protected: mitk::IPythonService* m_PythonService; mitk::Image::Pointer m_Image; mitk::Image::Pointer m_Image2D; mitk::Surface::Pointer m_Surface; //QMap m_Snippets; public: void setUp() { + // Workaround to fix microservice loading issues!!! + mitk::IPythonService::ForceLoadModule(); //get the context of the python module us::Module* module = us::ModuleRegistry::GetModule("MitkPythonService"); us::ModuleContext* context = module->GetModuleContext(); //get the service which is generated in the PythonModuleActivator us::ServiceReference serviceRef = context->GetServiceReference(); m_PythonService = dynamic_cast( context->GetService(serviceRef) ); m_Image = mitk::IOUtil::LoadImage(GetTestDataFilePath("Pic3D.nrrd")); m_Image2D = mitk::IOUtil::LoadImage(GetTestDataFilePath("Png2D-bw.png")); m_Surface = mitk::IOUtil::LoadSurface(GetTestDataFilePath("binary.stl")); //QmitkPythonSnippets::LoadStringMap(QmitkPythonSnippets::DEFAULT_SNIPPET_FILE,m_Snippets); } void tearDown() { m_Image = NULL; m_Image2D = NULL; m_Surface = NULL; } }; }