Skip to content

NiftyMIC Installation

Michael Ebner edited this page Feb 13, 2022 · 1 revision

Installation of NiftyMIC

Requirements and Dependencies

Installation

Clone the NiftyMIC repository by

Install all Python-dependencies by

  • pip install -r requirements.txt

Set environment variables so that the NiftyMIC installer can build the necessary command line interfaces written in C++. Respective variables can be set using the prefix NIFTYMIC_. Typically, pointing to the installed ITK_NiftyMIC directory is sufficient, i.e.

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

Install NiftyMIC and its command line interfaces by running

  • pip install -e .

Check installation via

  • python -m nose tests/installation_test.py

Installation of MONAIfbs (Optional for automated segmentation)

In the NiftyMIC repository, fetch the MONAIfbs submodule by

  • git submodule update --init

Install all Python-dependencies and the package by

  • pip install -r MONAIfbs/requirements.txt
  • pip install -e MONAIfbs/

The automated segmentation tool MONAIfbs comes with a pre-trained segmentation model. To fetch the model:
Option 1 - manual download from the webpage, unzip and copy the folder models under <path_to_MONAIfbs>/monaifbs/
Option 2 - use zenodo_get from command line:

  • pip install zenodo-get
  • zenodo_get 10.5281/zenodo.4282679
  • tar xvd models.tar.gz
  • mv models <path_to_MONAIfbs>/monaifbs/

More information on pre-trained model download can be found here.

Finally, check installation via

  • python -m nose tests/installation_test_monaifbs.py

(Note: NiftyMIC versions before v0.8 relied on fetal_brain_seg. A legacy mode is provided to use fetal_brain_seg instead of MONAIfbs as described here.)

Installation Remarks

Installation of the command line tools (install_cli.py executed via setup.py) relies on CMake and Boost. In case of having installed them in standard locations, the above instructions should work fine.

If the command line install fails you might need to set additional environment variables so that the underlying cmake compilation is successful. The respective variables can be set by exporting the respective variables using the prefix NIFTYMIC_. For example, in case of Boost is not installed in a standard directory also run

  • export NIFTYMIC_BOOST_ROOT=path-to-Boost-root

You can then test the installation running python install_cli.py. Once successful, run pip install -e . afterwards.


During the installation on our cluster a problem was encountered as an incorrect Boost path was returned after exporting NIFTYMIC_ITK_DIRonly. Adding the flag export NIFTYMIC_Boost_NO_BOOST_CMAKE=ON did the trick.

Code Documentation

Documentation for the Python source-files can be generated provided Doxygen is installed. Within the root folder run

  • cd doc
  • doxygen doxyfile
  • open html/index.html