Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency propblem: #34

Closed
olegl opened this issue Feb 3, 2020 · 5 comments
Closed

Dependency propblem: #34

olegl opened this issue Feb 3, 2020 · 5 comments

Comments

@olegl
Copy link

olegl commented Feb 3, 2020

Hello.

I seem to have a problem running ITKElastix both with my own registration script and with itkElastixRegistrationMethodTest.py from master.

$ python3 itkElastixRegistrationMethodTest.py global_0001.png global_0002.png  test.png
Traceback (most recent call last):
  File "itkElastixRegistrationMethodTest.py", line 61, in <module>
    registered, transform = itk.elastix_registration_method(fixed, moving)
  File "/home/lobacheo/.local/lib/python3.7/site-packages/itkLazy.py", line 52, in __getattribute__
    itkBase.LoadModule(module, namespace)
  File "/home/lobacheo/.local/lib/python3.7/site-packages/itkBase.py", line 82, in LoadModule
    LoadModule(dep, namespace)
  File "/home/lobacheo/.local/lib/python3.7/site-packages/itkBase.py", line 78, in LoadModule
    data = module_data[name]
KeyError: 'ITKSmoothing'

I have Python bindings to ITK from the latest pip.

$ pip3 install --upgrade --user pip
Requirement already up-to-date: pip in /home/lobacheo/.local/lib/python3.7/site-packages (20.0.2)
$ pip3 list | grep itk | awk '{print $1}' | xargs pip3 install --user --upgrade
$ pip3 list | grep itk
itk                          5.1rc1.post1       
itk-anisotropicdiffusionlbr  1.0.2              
itk-core                     5.1rc1.post1       
itk-elastix                  0.5.1              
itk-elastix-opencl           0.5.1              
itk-filtering                5.1rc1.post1       
itk-io                       5.1rc1.post1       
itk-meshtopolydata           0.5.1              
itk-numerics                 5.1rc1.post1       
itk-registration             5.1rc1.post1       
itk-segmentation             5.1rc1.post1       
itkwidgets                   0.25.2             
$ uname -a
Linux iana1 4.19.0-6-amd64 #1 SMP Debian 4.19.67-2+deb10u1 (2019-09-20) x86_64 GNU/Linux
$ cat /etc/debian_version 
10.2
$ python3 --version
Python 3.7.3

python -v dump is attached: py-v_dump.txt.

I can provide the images at the request, but it lloks to be as the poblem is not the input. It is also not the file format. It is around the parameter file object, as far as I can see.

Best,
Oleg

@thewtex
Copy link
Member

thewtex commented Feb 5, 2020

itk-anisotropicdiffusionlbr 1.0.2

itk-meshtopolydata 0.5.1

In a fresh virtualenv without these packages, does the error still occur?

python3 -m pip install --upgrade pip
python3 -m pip install --upgrade --pre itk-elastix itk

@olegl
Copy link
Author

olegl commented Feb 5, 2020

I uninstalled anisotropicdiffusionlbr and meshtopolydata. Error persits. I upgraded pip and itk (but it was already at the most recent version). Error persists.

$ python3 -m pip install --upgrade --user pip
Requirement already up-to-date: pip in /home/lobacheo/.local/lib/python3.7/site-packages (20.0.2)
$ python3 -m pip install --upgrade --user --pre itk-elastix itk
Requirement already up-to-date: itk-elastix in /home/lobacheo/.local/lib/python3.7/site-packages (0.5.1)
Requirement already up-to-date: itk in /home/lobacheo/.local/lib/python3.7/site-packages (5.1rc1.post1)
Requirement already satisfied, skipping upgrade: itk-filtering==5.1rc1.post1 in /home/lobacheo/.local/lib/python3.7/site-packages (from itk) (5.1rc1.post1)
Requirement already satisfied, skipping upgrade: itk-registration==5.1rc1.post1 in /home/lobacheo/.local/lib/python3.7/site-packages (from itk) (5.1rc1.post1)
Requirement already satisfied, skipping upgrade: itk-core==5.1rc1.post1 in /home/lobacheo/.local/lib/python3.7/site-packages (from itk) (5.1rc1.post1)
Requirement already satisfied, skipping upgrade: numpy in /home/lobacheo/.local/lib/python3.7/site-packages (from itk) (1.17.4)
Requirement already satisfied, skipping upgrade: itk-segmentation==5.1rc1.post1 in /home/lobacheo/.local/lib/python3.7/site-packages (from itk) (5.1rc1.post1)
Requirement already satisfied, skipping upgrade: itk-numerics==5.1rc1.post1 in /home/lobacheo/.local/lib/python3.7/site-packages (from itk) (5.1rc1.post1)
Requirement already satisfied, skipping upgrade: itk-io==5.1rc1.post1 in /home/lobacheo/.local/lib/python3.7/site-packages (from itk) (5.1rc1.post1)
$ python3 itkElastixRegistrationMethodTest.py input_0001.png input_0002.png  test.png
Traceback (most recent call last):
  File "itkElastixRegistrationMethodTest.py", line 61, in <module>
    registered, transform = itk.elastix_registration_method(fixed, moving)
  File "/home/lobacheo/.local/lib/python3.7/site-packages/itkLazy.py", line 52, in __getattribute__
    itkBase.LoadModule(module, namespace)
  File "/home/lobacheo/.local/lib/python3.7/site-packages/itkBase.py", line 82, in LoadModule
    LoadModule(dep, namespace)
  File "/home/lobacheo/.local/lib/python3.7/site-packages/itkBase.py", line 78, in LoadModule
    data = module_data[name]
KeyError: 'ITKSmoothing'
$ pip3 list | grep itk
itk                          5.1rc1.post1       
itk-core                     5.1rc1.post1       
itk-elastix                  0.5.1              
itk-elastix-opencl           0.5.1              
itk-filtering                5.1rc1.post1       
itk-io                       5.1rc1.post1       
itk-numerics                 5.1rc1.post1       
itk-registration             5.1rc1.post1       
itk-segmentation             5.1rc1.post1       
itkwidgets                   0.25.2 

@olegl
Copy link
Author

olegl commented Feb 5, 2020

A fresh virtualenv seems to bring me further. The current error is gone. Thank you!

I still get:

(test) $ python3 ../itkElastixRegistrationMethodTest.py ../input_0001.png ../input_0002.png  test.png
Traceback (most recent call last):
  File "../itkElastixRegistrationMethodTest.py", line 61, in <module>
    registered, transform = itk.elastix_registration_method(fixed, moving)
TypeError: cannot unpack non-iterable itkImageF2 object

I am investigating futher.

@olegl
Copy link
Author

olegl commented Feb 5, 2020

Okay, it works.

One caveat, as expected from above: in https://github.com/InsightSoftwareConsortium/ITKElastix/blob/master/wrapping/test/itkElastixRegistrationMethodTest.py in else branch (line 60): we are not getting a transform back. So, there is no tuple. And also no transform defined for the later output.

@olegl olegl closed this as completed Feb 5, 2020
@thewtex
Copy link
Member

thewtex commented Feb 5, 2020

registered, transform = itk.elastix_registration_method(fixed, moving)

This is a difference in the API of master versus the released Python package.

Thank you for your patience.

This will be cleaned up with the ITK 5.1.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants