These are unofficial instructions to build SimpleElastix for python 3.x. These are slightly different steps to the official instructions to build SimpleElastix for python 2.x.
These instructions have been tested with Ubuntu 18.04 (Bionic).
-
Install dependencies
sudo apt-get install cmake swig monodevelop r-base r-base-dev ruby ruby-dev \ python python-dev python3 python3-dev tcl tcl-dev tk tk-dev
-
Download source code and build (note that you need ~4GB per processor, e.g.
make -j4
needs 16GB)git clone https://github.com/kaspermarstal/SimpleElastix cd SimpleElastix mkdir build cd build cmake -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/python3 \ -DPYTHON_LIBRARY:FILEPATH=/usr/lib/x86_64-linux-gnu/libpython3.6m.so \ -DPYTHON_INCLUDE_DIR:PATH=/usr/include/python3.6m \ -DBUILD_EXAMPLES=OFF \ -DBUILD_TESTING=OFF \ ../SuperBuild make -j4
In some cases, it seems to be necessary to run
make
twice. -
Add the built SimpleITK with SimpleElastix modules to your python install
cd SimpleITK-build/Wrapping/Python sudo python3 Packaging/setup.py install
From now on, you can import SimpleITK with the SimpleElastix extension into your python code. See the SimpleElastix README.md, and SimpleElastix parameters maps for details.