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

ITK_NiftyMIC:

This repository contains numerous additional filters and functions to extend the standard ITK 4.13. The installation of this extended ITK package is a necessary requirement in order to use the NiftyMIC.

Compilation was described here was tested for Python 2 and 3 on

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

Installation

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 about 4 hours -- at least on my machine), the ITK path file needs to be linked so that Python can access it.

Linking

  • Automatic linking of all Cpp and Python dependencies:
    • make install
  • Manual Linking:
    • Prepare installation for NiftyMIC (or others): export NIFTYMIC_ITK_DIR=absolute-path-to-ITK_NiftyMIC-build
    • 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

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.

Clone this wiki locally