Welcome to SimpleITK Jupyter Notebooks

Newcomers to Jupyter Notebooks:

  1. We use two types of cells, code and markdown.
  2. To run a code cell, select it (mouse or arrow key so that it is highlighted) and then press shift+enter which also moves focus to the next cell or ctrl+enter which doesn't.
  3. Closing the browser window does not close the Jupyter server. To close the server, go to the terminal where you ran it and press ctrl+c twice.

For additional details see the Jupyter Notebook Quick Start Guide.

SimpleITK Environment Setup

Check that SimpleITK and auxiliary program(s) are correctly installed in your environment, and that you have the SimpleITK version which you expect (requires network connectivity).

You can optionally download all of the data used in the notebooks in advance. This step is only necessary if you expect to run the notebooks without network connectivity.

The following cell checks that all expected packages are installed.

In [1]:
# check that all packages are installed (see requirements.txt file)
required_packages <- c("SimpleITK", "rPython", "scatterplot3d", "tidyr", "ggplot2", "xtable", "purrr")
missing_packages <- required_packages[!unlist(lapply(required_packages, require, character.only = TRUE, quietly = TRUE))]
In [2]:


SimpleITK Version: 1.2.4-g69741 (ITK 4.13)
Compiled: Jan 30 2020 12:05:46

We expect that you have an external image viewer installed. The default viewer is Fiji. If you have another viewer (i.e. ITK-SNAP or 3D Slicer) you will need to set an environment variable to point to it.

In [3]:
# Retrieve an image from the network, read it and display using the external viewer. 
# The show method will also set the display window's title and by setting debugOn to TRUE, 
# will also print information with respect to the command it is attempting to invoke.
# NOTE: The debug information is printed to the terminal from which you launched the notebook
#       server.
Show(ReadImage(fetch_data("SimpleITK.jpg")), "SimpleITK Logo", debugOn=TRUE)

Download all of the data in advance if you expect to be working offline (may take a couple of minutes).

In [4]:
fetch_data_all(file.path("..","Data"), file.path("..","Data","manifest.json"))