Skip to content

Instantly share code, notes, and snippets.

@kevin-keraudren
Created December 10, 2015 21:44
Show Gist options
  • Save kevin-keraudren/849332f1c8f01294cfdb to your computer and use it in GitHub Desktop.
Save kevin-keraudren/849332f1c8f01294cfdb to your computer and use it in GitHub Desktop.
Building SimpleElastix

Building SimpleElastix

Swig can be installed separately:

brew install swig

Then run the SuperBuild:

git clone https://github.com/kaspermarstal/SimpleElastix
mkdir build
cd build
cmake -D BUILD_EXAMPLES:BOOL=OFF \
      -D BUILD_SHARED_LIBS:BOOL=OFF \
      -D BUILD_TESTING:BOOL=OFF \
	  -D USE_SYSTEM_SWIG:BOOL=ON \
	  -D PYTHON_EXECUTABLE:FILEPATH=~/anaconda/envs/py34/bin/python \
	  -D PYTHON_LIBRARY:FILEPATH=~/anaconda/envs/py34/lib/libpython3.4m.dylib \
	  -D PYTHON_INCLUDE_DIR:PATH=~/anaconda/envs/py34/include/python3.4m/ \
	  -D CMAKE_INSTALL_PREFIX:PATH=~/anaconda/envs/py34/ \
	  -D WRAP_CSHARP:BOOL=OFF \
      -D WRAP_JAVA:BOOL=OFF \
      -D WRAP_LUA:BOOL=OFF \
      -D WRAP_PYTHON:BOOL=ON \
      -D WRAP_R:BOOL=OFF \
      -D WRAP_RUBY:BOOL=OFF \
      -D WRAP_TCL:BOOL=OFF \
      ../SuperBuild/

Lastly, install the python package:

cd SimpleITK-build/Wrapping/PythonPackage
python setup.py install		  

Try it out:

ipython
import SimpleITK as sitk

It shamelessly fails with:

Library not loaded: libpython3.4m.dylib

So update .bash_profile with:

export DYLD_FALLBACK_LIBRARY_PATH=$ANACONDA_HOME/envs/py34/lib:${DYLD_FALLBACK_LIBRARY_PATH}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment