SuperElastix / SimpleElastix

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

confusion with methods from SimpleITK vs SimpleElastix #293

Closed Borda closed 5 years ago

Borda commented 5 years ago

I feel very confused in between image registration methods which comes with SimpleITK package installed from pip and this compiled version of SimpleElastix which become part of the SimpleITK too. See some examples of image registration and methods which comes with this package... I would have the following questions/remarques:

Borda commented 5 years ago

moreover, I fail to compile the SimpleITK package, following instruction I got

-- Adding Google Test source directory as subdirectory.
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
-- Generating tests...
-- Generating tests...Done
-- Configuring incomplete, errors occurred!
See also "/home/jirka/Applications/SimpleElastix/build/SimpleITK-build/CMakeFiles/CMakeOutput.log".
See also "/home/jirka/Applications/SimpleElastix/build/SimpleITK-build/CMakeFiles/CMakeError.log".
CMakeFiles/SimpleITK.dir/build.make:112: recipe for target 'SimpleITK-prefix/src/SimpleITK-stamp/SimpleITK-configure' failed
make[2]: *** [SimpleITK-prefix/src/SimpleITK-stamp/SimpleITK-configure] Error 1
CMakeFiles/Makefile2:442: recipe for target 'CMakeFiles/SimpleITK.dir/all' failed
make[1]: *** [CMakeFiles/SimpleITK.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

even it seems that the missing library is there

$ ldconfig -p | grep pthread
    libpthread.so.0 (libc6,x86-64, OS ABI: Linux 3.2.0) => /lib/x86_64-linux-gnu/libpthread.so.0
    libpthread.so.0 (libc6, OS ABI: Linux 3.2.0) => /lib/i386-linux-gnu/libpthread.so.0

so to be ale to used already installed version of SimpleITK would be really welcome...

Borda commented 5 years ago

just rerun the make I got

[ 72%] Completed 'Elastix'
[ 77%] Built target Elastix
[ 79%] Performing configure step for 'SimpleITK'
Not searching for unused variables given on the command line.
loading initial cache file /home/jirka/Applications/SimpleElastix/build/SimpleITK-build/CMakeCacheInit.txt
CMake Warning at CMake/sitkSourceVersion.cmake:41 (message):
  Unable to determine source version!

  Please use the git repository or an official source distribution.

Call Stack (most recent call first):
  Version.cmake:17 (include)
  CMakeLists.txt:23 (include)

-- Building SimpleITK version "1.2.0.dev-gGITDIR-NOTFOUND"
-- Checking if c++11 is required...
-- Checking if c++11 is required... NO
-- Found Java: /usr/bin/java (found version "11.0.2") found components:  Development Runtime 
-- Could NOT find Tclsh (missing: TCL_TCLSH) 
-- Processing json files...
-- Processing json files...done
-- Found Java: /usr/bin/java (found version "11.0.2") 
CMake Error at Wrapping/R/CMakeLists.txt:64 (math):
  math cannot parse the expression: "9000 + ": syntax error, unexpected $end,
  expecting exp_PLUS or exp_MINUS or exp_OPENPARENT or exp_NUMBER (7).

-- Adding Google Test source directory as subdirectory.
-- Generating tests...
-- Generating tests...Done
-- Configuring incomplete, errors occurred!
See also "/home/jirka/Applications/SimpleElastix/build/SimpleITK-build/CMakeFiles/CMakeOutput.log".
See also "/home/jirka/Applications/SimpleElastix/build/SimpleITK-build/CMakeFiles/CMakeError.log".
CMakeFiles/SimpleITK.dir/build.make:112: recipe for target 'SimpleITK-prefix/src/SimpleITK-stamp/SimpleITK-configure' failed
make[2]: *** [SimpleITK-prefix/src/SimpleITK-stamp/SimpleITK-configure] Error 1
CMakeFiles/Makefile2:442: recipe for target 'CMakeFiles/SimpleITK.dir/all' failed
make[1]: *** [CMakeFiles/SimpleITK.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
kaspermarstal commented 5 years ago

SimpleITK was not built with extension in mind so it is not straightforward to rename the package. Most likely it is not impossible, but so far I have not been able to find a way to do this. Help is wanted with this issue.

This is on the todo-list. We have a CI system from which it could get posted to PyPI. But this is blocked by the renaming issue.

Some things are always rebuilt, e.g. the language wrappings. This is just what the SimpleITK build system does. Probably they have good reasons to do this. In my own experience, sometimes CMake does not produce exact same results on rebuilds as on clean builds.

Yes, unfortunately. To fix this we have to figure out a way to rename the Python package.

Borda commented 5 years ago

I have built the package according to instruction, but it seems that I am struggling to have it run on Python3, is there something like default python is py2?

Python 3.6.7 (default, Oct 22 2018, 11:32:17) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import SimpleITK
Traceback (most recent call last):
  File "/home/jb/Applications/build/SimpleITK-build/Wrapping/Python/SimpleITK.py", line 14, in swig_import_helper
    return importlib.import_module(mname)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 658, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 571, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 922, in create_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: /home/jb/Applications/build/SimpleITK-build/Wrapping/Python/_SimpleITK.so: undefined symbol: PyInstance_Type

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jb/Applications/build/SimpleITK-build/Wrapping/Python/SimpleITK.py", line 17, in <module>
    _SimpleITK = swig_import_helper()
  File "/home/jb/Applications/build/SimpleITK-build/Wrapping/Python/SimpleITK.py", line 16, in swig_import_helper
    return importlib.import_module('_SimpleITK')
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: /home/jb/Applications/build/SimpleITK-build/Wrapping/Python/_SimpleITK.so: undefined symbol: PyInstance_Type

ok, I think that I found it... https://github.com/rcasero/pysto/wiki/Build-and-install-SimpleElastix-for-python-3.x