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 three 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.
Another option is to run the server with uv (see uv installation instructions here):
uv run --with nninteractive-slicer-server nninteractive-slicer-server --host 0.0.0.0 --port 1527Step 1. Create a Python virtual environment
If setting up the server for the first time, you need to create a Python virtual environment (e.g., using conda or venv) by specifying a location on your disk and activating that environment. For example, on Linux, using venv, you can accomplish this using these commands:
python3 -m venv path_to_your_virtual_environment
source path_to_your_virtual_environment/bin/activateStep 2. Install the server
Next, you can install the server to this environment with these commands:
pip install nninteractive-slicer-server
nninteractive-slicer-server --host 0.0.0.0 --port 1527If you would like to use a different port, say 1627, replace --port 1527 with --port 1627.
Note
Remember that you'll have to start the server again if it was stopped for some reason (e.g., after rebooting your machine). To do so, activate your virtual Python environment with the source command above and run nninteractive-slicer-server --host 0.0.0.0 --port 1527 again to start the server.
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, typeterminaland hitEnterkey):
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
nnInteractivemodule in Slicer and in theConfigurationtab type in the URL of the server you set up in the server side installation procedure. This should look something likehttp://remote_host_name:1527or, 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.0may 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 3Dbutton 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.
SlicerNNInteractiveSegmentationTest is a set of regression tests that verifies the output of SlicerNNInteractive. For every interaction type, it processes a set of test cases through the extension – which requires a running server – and compares the resulting segmentations against reference segementations. All tests use the publicly available MRBrainTumor2 volume from the Sample Data extension.
How to run the test from Slicer:
- Start the nnInteractive server and note its URL/port.
- Launch Slicer, (optionally) load the
SlicerNNInteractivemodule via the Extension Wizard, and configure the module with the server URL (under theConfigurationtab). - Open the
Self Testsmodule, pickSlicerNNInteractive, and clickReload and Test(or use the toolbar’sReload and Testbutton in the module itself). Slicer will re-import the module, execute the scripted prompts, and a "All SlicerNNInteractive segmentation tests passed" message will be in the Python Console if everything matches the stored references.
Reference outputs are stored at slicer_plugin/SlicerNNInteractive/Testing/Data/ (compressed NIfTI files). When running these tests, you do not have to regenerate these. If, for any reason you would still like to do so, set SLICER_NNI_GENERATE_TEST_MASK=1 before launching Slicer (or uncomment the line self.generate_mode = True in SlicerNNInteractiveSegmentationTest.setUp), run the test once, manually review the newly written masks, then rerun without the variable so the test compares against the frozen references.
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 [email protected]:coendevente/SlicerNNInteractive.git(or download the current project as a.zipfile 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
SlicerNNInteractivefolder you obtained in Step 1, and select theslicer_pluginfolder. - 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 SlicerNNInteractiveavailable in the top menu (as in the image above), go toEdit>Application Settings>Modulesand dragSlicerNNInteractivefrom theModules:list to theFavorite Modules:list.
When using SlicerNNInteractive, please cite:
-
The original
nnInteractivepaper: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
SlicerNNInteractivepaper: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.

