RTK icon indicating copy to clipboard operation
RTK copied to clipboard

Conflict between module ITKRegistrationCommonPython and RTK ?

Open arobert01 opened this issue 4 years ago • 0 comments

Hello,

When I tried to use filters from the module itk.ITKRegistrationCommonPython in Python I got this error:

Traceback (most recent call last):

  File "/export/home/arobert/Documents/code/src/algo/registration.py", line 13, in <module>
    trans_registration = itk.ImageRegistrationMethodv4[image_type, image_type].New()
  File "/export/home/arobert/.local/lib/python3.6/site-packages/itkLazy.py", line 52, in __getattribute__
    itkBase.LoadModule(module, namespace)
  File "/export/home/arobert/.local/lib/python3.6/site-packages/itkBase.py", line 91, in LoadModule
    LoadModule(dep, namespace)
  File "/export/home/arobert/.local/lib/python3.6/site-packages/itkBase.py", line 91, in LoadModule
    LoadModule(dep, namespace)
  File "/export/home/arobert/.local/lib/python3.6/site-packages/itkBase.py", line 61, in LoadModule
    swig.update(this_module.swig)
AttributeError: module 'itk.ITKRegistrationCommonPython' has no attribute 'swig'

I found out that instantiate a RTK filter before using the ITK filter fixed this error. Another way to get rid of this error is to uninstall the package python itk-rtk (not really convenient).

You can use the following code to reproduce this behavior:

import itk
from itk import RTK as rtk

image_type = itk.Image[itk.F,2]
#osem = rtk.OSEMConeBeamReconstructionFilter.New()
trans_registration = itk.ImageRegistrationMethodv4[image_type, image_type].New()

I'am using the itk-rtk package generated here on Linux with Python 3.6.

Thanks.

arobert01 avatar Nov 10 '20 15:11 arobert01