SuperElastix / SimpleElastix

Multi-lingual medical image registration library
http://simpleelastix.github.io
Apache License 2.0
513 stars 149 forks source link

Anaconda : Module 'SimpleITK' has no attribute 'ElastixImageFilter' #414

Open Hoda-GH opened 3 years ago

Hoda-GH commented 3 years ago

Hi all,

I have 3D Slicer installed on my mac 10.14 . And I'm running my registration within Anaconda(connected to Slicer ). I compiled SimpleElastix on my computer and installed the python package in the jupyter notebook via this code: sudo python setup.py install which finishes successfully.

Installed /anaconda3/lib/python3.6/site-packages/SimpleITK-2.0.0rc2.dev1+g8244e-py3.6-macosx-10.7-x86_64.egg Processing dependencies for SimpleITK==2.0.0rc2.dev1+g8244e Finished processing dependencies for SimpleITK==2.0.0rc2.dev1+g8244e

but I get this error in the notebook when I run the registration : Module 'SimpleITK' has no attribute 'ElastixImageFilter' I read in other issues that there might be incompatibility between versions of SimpleITK so I uninstalled SimpleITK once and did the sudo python setup.py install again. I checked the version that is installed : sitk.Version().VersionString() which gave me '2.0.0'

I don't know what's wrong, Am I missing something? Thanks for any help.

emilyjanedennis commented 3 years ago

do you have a conda environment you're using? For each environment, once it's activated, go to the same cd ../build/SimpleITK-build/Wrapping/Python/and run python Packaging/setup.py install

Hoda-GH commented 3 years ago

Thanks for your message. This is what I do. The problem is that I have a python 2.7 installed on my mac. Then I install Anaconda with python 3.8 . I feel the problem is that SimpleElastix can't distinguish these two? Is SimpleElastix get installed for a specific version of python?

I did the following: $conda create myenv $conda activate myenv $git clone https://github.com/SuperElastix/SimpleElastix $ mkdir build $ cd build $ sudo cmake ../SimpleElastix/SuperBuild $ sudo make

After this I go in the build folder where setup.py is and then run

sudo python Packaging/setup.py install

**I know it mentions in the instructions that don't use sudo for virtual environment but if I don't put it , I get errors that I don't have permission to write the packages.