-
Notifications
You must be signed in to change notification settings - Fork 2
home
This repository contains numerous additional filters and functions to extend the standard WrapITK Release 4.13.1. Its installation is a necessary requirement in order to use NiftyMIC and related research-focused toolkits within the GIFT-Surg project.
The installation as described here was tested for Python 2 and 3 on
- Ubuntu 16.04 and 18.04
using
- CMake 3.11.0 and 3.12.3
Clone this repository and prepare for an out-of-source build by executing
git clone https://github.com/gift-surg/ITK_NiftyMIC.git
mkdir ITK_NiftyMIC-build
cd ITK_NiftyMIC-build
In case you want to use a Python environment, activate it first before you proceed. Additionally, make sure that NumPy
is installed (pip install numpy --upgrade
).
Then compile ITK_NiftyMIC -- including Python wrapping -- by running
cmake \
-D CMAKE_BUILD_TYPE=Release \
-D BUILD_TESTING=OFF \
-D BUILD_EXAMPLES=OFF \
-D BUILD_SHARED_LIBS=ON \
-D ITK_WRAP_PYTHON=ON \
-D ITK_LEGACY_SILENT=ON \
-D ITK_WRAP_float=ON \
-D ITK_WRAP_double=ON \
-D ITK_WRAP_signed_char=ON \
-D ITK_WRAP_signed_long=ON \
-D ITK_WRAP_signed_short=ON \
-D ITK_WRAP_unsigned_char=ON \
-D ITK_WRAP_unsigned_long=ON \
-D ITK_WRAP_unsigned_short=ON \
-D ITK_WRAP_vector_float=ON \
-D ITK_WRAP_vector_double=ON \
-D ITK_WRAP_covariant_vector_double=ON \
-D Module_ITKReview=ON \
-D Module_SmoothingRecursiveYvvGaussianFilter=ON \
-D Module_BridgeNumPy=ON \
../ITK_NiftyMIC/
make -j8
Once the compilation is finished (which can take a couple of hours), the ITK path file needs to be linked so that Python can access it.
Link Python libraries:
- Virtual environment is used:
cp Wrapping/Generators/Python/WrapITK.pth path-to-venv/lib/python*/site-packages/
- No virtual environment:
SITEDIR=$(python -m site --user-site)
mkdir -p "$SITEDIR"
cp Wrapping/Generators/Python/WrapITK.pth $SITEDIR
ITK_NiftyMIC should now be available in Python. Check it by opening Python and run
import itk
print(itk.Image.D3.New())
print(itk.OrientedGaussianInterpolateImageFilter.ID3ID3.New())
In case everything went fine without any error you are ready to go to use ITK_NiftyMIC within Python now.
This work is partially funded by the UCL Engineering and Physical Sciences Research Council (EPSRC) Centre for Doctoral Training in Medical Imaging (EP/L016478/1), the Innovative Engineering for Health award (Wellcome Trust [WT101957] and EPSRC [NS/A000027/1]), and supported by researchers at the National Institute for Health Research University College London Hospitals (UCLH) Biomedical Research Centre.
ITK_NiftyMIC currently is based on ITK 4.13 code. Given the very active development of ITK some of the previously used download links during compilation time were outdated. Associated problems should now have been fixed. Plans to upgrade to the current ITK version are made but this might take some more time.
If this error occurs please reinstall curl
with https functionality as described, e.g., here.
Alternatively, this could potentially be resolved by executing the following (not tested with the mentioned error in front of me; but I would try this first):
sudo apt install libcurl4 libcurl4-openssl-dev