/SimpleITK-Notebooks

Jupyter notebooks for learning how to use SimpleITK

Primary LanguageJupyter NotebookApache License 2.0Apache-2.0

SimpleITK Notebooks

Ubuntu   Windows   http://insightsoftwareconsortium.github.io/SimpleITK-Notebooks/   Code style: black

SimpleITK is an abstraction layer and wrapper around the Insight Segmentation and Registration Toolkit (ITK). It is available in the following programming languages: C++, Python, R, Java, C#, Lua, Tcl and Ruby.

This repository contains a collection of Jupyter Notebooks illustrating the use of SimpleITK for educational and research activities. The notebooks demonstrate the use of SimpleITK for interactive image analysis using the Python and R programming languages.

The repository and its contents can be used for:

  1. Learning SimpleITK.
  2. As a basis for your teaching activities.
  3. As a basis for your research activities.

For the latter two use cases you can take advantage of the the repository's infrastructure which supports remote data downloads and notebook testing. These readily facilitate collaborative research.

The animation below is a visualization of a rigid CT/MR registration process created with SimpleITK and Python (the script used to generate the frames for the animated gif is found in the repository's Utilities directory).

Getting Started

Note that currently SimpleITK with R is only available on Linux and Mac.

  1. Language specific details for installing the notebooks is given in the README files in the respective directories (Python, R). For general information about installing SimpleITK please see the SimpleITK read-the-docs pages.

  2. The SimpleITK API documentation is based on the C++ implementation which is readily mapped to your language of choice.

  3. Learn the general concepts underlying the implementations of segmentation and registration by reading the (ITK book). The relevant portion is "Book 2: Design and Functionality". The ITK API is significantly different from the SimpleITK one, but the general concepts are the same (e.g. combination of optimizer and similarity metric for registration).

  4. General notebook setup. By default the contents of the Jupyter notebooks do not occupy the full browser window width. To take advantage of the full window width you can either configure each notebook independently by adding the following into a code cell:

from IPython.core.display import display, HTML
display(HTML("<style>.container { width:100% !important; }</style>"))

Or apply this configuration to all notebooks by adding the following to the custom.css jupyter configuration file:

.container { width:100% !important; }

On OSX/Linux this file is found in ~/.jupyter/custom/custom.css on windows it is found in C:\Users\[your_user_name]\.jupyter\custom\custom.css.

Kicking the Tires

Before you clone the repository to your computer you may want to try it out, kick the tires so to speak.

Thanks to the awesome people from the Binder Project you can try out the Python notebooks without installing a thing.

Some caveats:

  1. This is a free public service with limited resources, so may not always be available.
  2. Some of our notebooks require significant computational resources which may not be available.
  3. All cells that use the sitk.Show() command will generate an exception because they require a Fiji installation. Either ignore this or modify the code for the session.

After you launch binder, go to the Python directory and select the notebook of interest:

Binder

Contributions from the Community

We encourage contributions from the community!!!

  1. Ask questions on the ITK discourse.
  2. Report issues you encounter (compatibility/bugs) using the GitHub issue reporting system.
  3. Contribute code (instructions):
    1. bug fixes.
    2. improved versions of existing notebooks, both text and code.
    3. new notebooks.

How to Cite

If you find these notebooks or the notebook testing infrastructure useful in your research, support our efforts by citing it as:

Z. Yaniv, B. C. Lowekamp, H. J. Johnson, R. Beare, "SimpleITK Image-Analysis Notebooks: a Collaborative Environment for Education and Reproducible Research", J Digit Imaging., https://doi.org/10.1007/s10278-017-0037-8, 31(3): 290-303, 2018.