Skip to content
This repository was archived by the owner on Mar 17, 2021. It is now read-only.

NiftyNet FAQ

Wenqi Li edited this page Sep 11, 2018 · 26 revisions

How to install the latest version of NiftyNet with pip (a package manager for Python packages)?

The latest version is available at the dev branch of the GitHub repository. This could be installed with pip commands:

pip install -r https://raw.githubusercontent.com/NifTK/NiftyNet/dev/requirements-gpu.txt
pip install git+https://github.com/NifTK/NiftyNet.git

You could also install the optional dependencies:

pip install scikit-image
pip install SimpleITK

To verify the installation,net_run --version should return a version stringNiftyNet version x.x.x+xxxx.

How to export the meta-graph as a file after training a model?

The meta-graph can be exported by adding a tf.train.export_meta_graph command after session initialisation https://github.com/NifTK/NiftyNet/blob/v0.3.0/niftynet/engine/application_driver.py#L402 and running net_segment inference ... (See also: https://www.tensorflow.org/api_guides/python/meta_graph).

Note that if you run the network inside of NiftyNet, the meta file is not needed since NiftyNet recreates the graph in Python code. If you are aiming to run the network outside of NiftyNet, the meta file exported should let you do that, but you will need to be careful to feed data that matches the preprocessing done by NiftyNet.

What are the configuration parameters -- spatial_window_size, volume_padding_size, border, loss_border, and their interactions?

http://nbviewer.jupyter.org/gist/fepegar/1fb865494cb44ac043c3189ec415d411

How to do cross-validation experiments?

An example is presented at https://github.com/NifTK/NiftyNet/issues/110.

How to finetune a model downloaded from the model zoo?

Does the augmentation layer increase the number of training samples?

All random augmentation layers will be applied to each of the original samples, without generating new ones. The number of training samples is always "batch_size x number of iterations x num_gpus". Please see the demo of visualising the augmented samples: https://github.com/NifTK/NiftyNet/blob/dev/demos/unet/U-Net_Demo.ipynb.

Error message: indices are out-of-bounds w.r.t. dense side with broadcasted shape when training

After the inference is done on the image, what's a good way of accessing the Numpy version of the image?

it's in NIfTI format, one option would be using NiBabel (http://nipy.org/nibabel/nibabel_images.html#getting-the-image-data-the-easy-way):

import nibabel
numpy_array = nibabel.load_data('image.nii.gz').get_data()

Shape of numpy_array is [width, height, depth, time, num_channels]


Clone this wiki locally