Dear Stefan

I really appreciate your important reply!

If I start writing plugins in Python,
do you recommend using the traditional framework or starting from the branch?
I want to start from the branch if the plugins need to be updated for your new 
framework in the future.

(I have been trying to build the branch for a week now, but have not yet 
succeeded.
 Currently I am getting the SWIG's "syntax error in input(3)" error for 
"itkSmartPointer.h". )

Kind regards,
Hiro

On 2023/02/23 13:55, Dinkelacker, Stefan wrote:
Hi Hiro,

I do not know the page you linked but it seems to be outdated and was updated 
the last time more than 7 years ago. A lot has changed since then, for example, 
we do not support the PluginGenerator anymore, the Python service is in an 
experimental state with big changes nearly done in another branch, the Python 
console plugin was removed, and so on...

We nowadays recommend to start with the MITK-ProjectTemplate: 
https://github.com/MITK/MITK-ProjectTemplate

To still use our Python code in its current state, activate MITK_USE_Python3 
when configuring the MITK *superbuild*. There are additional prerequisites that 
you have to install before:

- Install Python (v3.9 or max v3.10) and make sure NOT to install the debug 
binaries if using the Windows installer
- Install numpy and SimpleITK via pip

Best,
Stefan


________________________________________
Von: Hirohisa Oda <h...@u-shizuoka-ken.ac.jp>
Gesendet: Dienstag, 21. Februar 2023 07:21
An: mitk-users@lists.sourceforge.net
Betreff: [mitk-users] Linking error on PythonService

Hello,

I'm new to MITK plugin development.

I would like to run the following code
(part of the code are found at 
https://neurita.github.io/how_to_create_a_python_plugin_for_mitk )
    #include <autoload/PythonService/mitkPythonService.h>
    ...
    itk::SmartPointer<mitk::PythonService> _PythonService(new 
mitk::PythonService());
    std::string result = _PythonService->Execute( "print ('Hello World!')", 
mitk::IPythonService::SINGLE_LINE_COMMAND );

However, this linking error occurs.
It seems the constructor of "PythonService" is not found.
    PythonTest.obj : error LNK2019:
    unresolved external symbol "public: __cdecl 
mitk::PythonService::PythonService(void)" (??0PythonService@mitk@@QEAA@XZ)
    referenced in function "protected: void __cdecl 
PythonTest::DoImageProcessing(void)" (?DoImageProcessing@PythonTest@@IEAAXXZ)

When I remove this code, the build process always works correctly.
I'm building this plugin on MITK v2022.10 using Visual Studio 2019 Community 
and Windows 11 22H2.

"MitkPython", "MitkQtPython" and "Python3|Python" are listed in the 
CMakeLists.txt of a plugin named PythonTest.
    mitk_create_plugin(
      EXPORT_DIRECTIVE PYTHONTEST_EXPORT
      EXPORTED_INCLUDE_SUFFIXES src
      MODULE_DEPENDS MitkQtWidgetsExt MitkPython MitkQtPython
      PACKAGE_DEPENDS Python3|Python
    )

I would be grateful if you could give me some advice on this problem.
Thank you.

Best regards,
Hiro


_______________________________________________
mitk-users mailing list
mitk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mitk-users




_______________________________________________
mitk-users mailing list
mitk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to