This repository makes nnInteractive available in 3D Slicer. nnInteractive is a deep learning-based framework for interactive segmentation of 3D images, allowing for fast voxel-wise segmentation using prompts like points, scribbles, bounding boxes, and lasso. You can read more about nnInteractive in the ArXiv paper, or in the original GitHub repository. 3D slicer is a free and open source medical image viewer, and can be downloaded here.
nnInteractiveSlicerDemoVideo.mp4
SlicerNNInteractive
needs to be set up on the server side and the client side. The server side needs relatively heavy compute, as described here:
You need a Linux or Windows computer with a Nvidia GPU. 10GB of VRAM is recommended. Small objects should work with <6GB. nnInteractive supports Python 3.10+
The client machine can be the same as the server machine.
You can install the server side of SlicerNNInteractive
in two different ways:
docker pull coendevente/nninteractive-slicer-server:latest
docker run --gpus all --rm -it -p 1527:1527 coendevente/nninteractive-slicer-server:latest
This will make the server available under port 1527
on your machine. If you would like to use a different port, say 1627
, replace -p 1527:1527
with -p 1627:1527
.
pip install nninteractive-slicer-server
nninteractive-slicer-server --host 0.0.0.0 --port 1527
If you would like to use a different port, say 1627
, replace --port 1527
with --port 1627
.
Note
When starting the server, you can ignore the message nnUNet_raw is not defined [...] how to set this up.
. Setting up these environment variables is not necessary when using SlicerNNInteractive
.
Python and a pytorch package with GPU support is required. You can follow the steps below to set these up on your computer for your user:
- Download pixi package manager by running this command in
Terminal
(to launch terminal, press the Windows button on your keyboard, typeterminal
and hitEnter
key):
powershell -ExecutionPolicy ByPass -c "irm -useb https://pixi.sh/install.ps1 | iex"
- Close the terminal and open a new Terminal to run the commands below to install Python and pytorch. The last step may take 10 minutes to complete, with no updates on the output for several minutes.
cd /d %localappdata%
mkdir nninteractive-server
cd nninteractive-server
pixi init .
pixi add python=3.12 pip
cd .pixi\envs\default\Scripts
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
To start the server, there is no need to redo the steps above (install pixi and Python), just open Terminal
and run these commands:
cd /d %localappdata%\nninteractive-server\.pixi\envs\default\Scripts
pip install nninteractive-slicer-server
nninteractive-slicer-server --host 0.0.0.0 --port 1527
If the firewall asks permission to access the port then allow it.
If you would like to use a different port, say 1627
, replace --port 1527
with --port 1627
.
Note
When starting the server, you can ignore the message nnUNet_raw is not defined [...] how to set this up.
. Setting up these environment variables is not necessary when using SlicerNNInteractive
.
- Download and install latest version of 3D Slicer
- Install NNInteractive extension
- Go to the
nnInteractive
module in Slicer and in theConfiguration
tab type in the URL of the server you set up in the server side installation procedure. This should look something likehttp://remote_host_name:1527
or, if you run the server locally,http://localhost:1527
. If running the server on the same Windows computer as 3D Slicer, you must uselocalhost
(ignore that the server suggests that0.0.0.0
may be used).
Once you have completed the installation above, you can use SlicerNNInteractive
as follows:
-
If you haven't done so already, load in your image (e.g., through dragging your image file into Slicer).
-
Click one of the Interaction Tool buttons from the Interactive Prompts tab (point, bounding box, scribble, or lasso) and place your prompt in the image. This should result in a segmentation.
-
Click
Show 3D
button in the segment editor section (below the prompts section) to see the segmentation results in 3D. -
If needed, you can correct the generated segmentation with positive and negative prompts (between which you can toggle using the Positive/Negative buttons).
a) Alternatively, you can reset the current segment using the "Reset segment button".
-
You can add a new segment by clicking the "Next segment" button, or clicking the "+ Add" button in the Segment Editor. You can always go back to previous segments by selecting it in the Segment Editor.
You can edit an existing segmentation (generated using this plugin, or obtained otherwise, such as through loading in a segmentation file), by selecting the segment in the Segment Editor. Prompts are always applied to the selected segment.
Each button in the Interactive Prompts tab has a keyboard shortcut, indicated by the underlined letter.
- When resetting the server, the Slicer extension sometimes fails silently. Reloading the plugin or restarting Slicer often helps.
Read more on how to contribute to this repository here, while taking into account the code of conduct.
For development, SlicerNNInteractive
can be installed directly from github, without the Extensions Manager of 3D Slicer.
git clone git@github.com:coendevente/SlicerNNInteractive.git
(or download the current project as a.zip
file from GitHub).- Open 3D Slicer and click the Module dropdown menu in the top left of the 3D Slicer window:
- Go to
Developer Tools
>Extension Wizard
. - Click
Select Extension
. - Locate the
SlicerNNInteractive
folder you obtained in Step 1, and select theslicer_plugin
folder. - Go to the Module dropdown menu again and go to
Segmentation
>SlicerNNInteractive
. This should result in the following view:a) If you would like to have
SlicerNNInteractive
available in the top menu (as in the image above), go toEdit
>Application Settings
>Modules
and dragSlicerNNInteractive
from theModules:
list to theFavorite Modules:
list.
When using SlicerNNInteractive
, please cite:
-
The original
nnInteractive
paper:Isensee, F.*, Rokuss, M.*, Krämer, L.*, Dinkelacker, S., Ravindran, A., Stritzke, F., Hamm, B., Wald, T., Langenberg, M., Ulrich, C., Deissler, J., Floca, R., & Maier-Hein, K. (2025). nnInteractive: Redefining 3D Promptable Segmentation. https://arxiv.org/abs/2503.08373
*: equal contribution -
The
SlicerNNInteractive
paper:de Vente, C., Venkadesh, K.V., van Ginneken, B., Sánchez, C.I. (2025). nnInteractiveSlicer: A 3D Slicer extension for nnInteractive. https://arxiv.org/abs/2504.07991
This repository is available under a Apache-2.0 license (see here).
Important
The weights that are being downloaded when running the SlicerNNInteractive
server are available under a Creative Commons Attribution Non Commercial Share Alike 4.0
license, as described in the original nnInteractive respository here.