Installation#

Docker image#

We recommend to use our docker image to run nesvor.

Install docker and NVIDIA container toolkit#

You may follow this guide to install docker and NVIDIA container toolkit.

Download NeSVoR image#

Pull the latest NeSVoR image from docker hub.

docker pull junshenxu/nesvor

Note: our latest image was built with CUDA 11.7.

Run NeSVoR with docker#

You may run a container in an iterative way.

docker run -it --gpus all junshenxu/nesvor:v0.5.0
nesvor -h

You may also run the nesvor command directly as follows.

docker run --rm --gpus all \
    -v <path-to-inputs>:/incoming:ro -v <path-to-outputs>:/outgoing:rw \
    junshenxu/nesvor:v0.5.0 \
    nesvor reconstruct \
    --input-stacks /incoming/stack-1.nii.gz ... /incoming/stack-N.nii.gz \
    --thicknesses <thick-1> ... <thick-N> \
    --output-volume /outgoing/volume.nii.gz

From source#

Prerequisites#

If you are installing from source, you will need:

  1. An NVIDIA GPU;

  2. Python 3.8 or later;

  3. GCC/G++ 7.5 or higher;

  4. CUDA v10.2 or higher;

  5. CMake v3.21 or higher.

See tiny-cuda-nn for more about prerequisites.

Get the NeSVoR source#

Since the master branch might be messy sometimes, it is recommanded to clone a specific release.

git clone https://github.com/daviddmc/NeSVoR --branch v0.5.0
cd NeSVoR

Install dependencies#

pip install -r requirements.txt

Install PyTorch extension of tiny-cuda-nn. Make sure the installed CUDA version mismatches the version that was used to compile PyTorch. Then, run the following command (see this for more details)

pip install git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch

Other dependencies#

Some functionalities of NeSVoR require extra dependencies.

Fetal brain masking (MONAIfbs)#

To use the MONAIfbs model for fetal brain ROI masking, MONAI need to be installed. Check out the orginal repo for more details.

pip install monai>=0.3.0

N4 bias field correction#

To use the N4 algorithm for bias field correction, SimpleITK need to be installed.

pip install SimpleITK

3D IQA#

The 3D MR quality assessment tool uses a pretrained Tensorflow model. Tensorflow needs to be installed to enable this tool. Check out the orginal repo for more details.

Install NeSVoR#

The last step is to install NeSVoR itself.

pip install -e .