Skip to content
Michael Ebner edited this page Oct 30, 2017 · 61 revisions

ITK_NiftyMIC:

This repository contains numerous additional filters and functions to extend the standard WrapITK Release 4.13. 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

  • Mac OS X 10.10 and 10.12
  • Ubuntu 14.04 and 16.04

using

  • CMake 3.6.2, 3.8.1 and 3.9.0

Compilation

Clone this repository and prepare for an out-of-source build by executing

  • git clone [email protected]: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 was successful (which can take a couple of hours), the ITK path file needs to be linked so that Python can access it.

Linking

  • Link Python libraries:

    • Virtualenvironment:
      • cp Wrapping/Generators/Python/WrapITK.pth path-to-venv/lib/python*/site-packages/
    • No virtualenvironment:
      • SITEDIR=$(python -m site --user-site)
      • mkdir -p "$SITEDIR"
      • cp Wrapping/Generators/Python/WrapITK.pth $SITEDIR
  • If NiftyMIC is to be installed:

    • export NIFTYMIC_ITK_DIR=absolute-path-to-ITK_NiftyMIC-build

Usage

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.

Funding

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.

Clone this wiki locally