I recently attended the IEEE Nuclear Science Symposium and Medical Imaging Conference, where I was invited to give a refresher course on modern scientific computing with Python.
The hour-long course covered the following topics:
- Creating a reproducible computational environment with Docker,
- Interactive analysis and literate programming with the IPython Notebook,
- A brief survey of the fundamental scientific Python packages: numpy, matplotlib, scipy, sympy, pandas, and nose,
- Writing efficient, compiled C/Python hybrid code with Cython, and
- Wrapping C and C++ libraries in Python with XDress.
In addition, during the course, I presented a Docker image of the recently published itk::ka library.
The course was a great success! There were at least 50 people in the audience, and many had questions and positive feedback at the end.
Behind the Scenes of the Course
For a programming course, the literate programming capabilities of the IPython notebook cannot be beat. With reveal.js conversion, it creates a stunning and effective form of presentation. It can also have a deeper impact, as attendees can study and run the material during and after the presentation. In addition, the format is digested well by web browsers and the internet.
There are two options to create a reveal.js presentation from an IPython notebook: with nbconvert or with live_reveal. The former generates static html, while the latter is an executable notebook presentation. Fortunately, I had the opportunity to use the live version, which was particularly effective when demonstrating interactive IPython widgets.
The material was delivered as a github repository, data, and a Docker image. In previous courses, we have used virtual machines to distribute material, which allows attendees to get a usable, consistent, software stack working quickly on their laptops. However, the size of these machines on disk are large, they do not use compute resources efficiently, and this is not the expected way that most people will continue to use the software in their day-to-day work. On the other hand, the Docker image is relatively small (< 3GB for ITK, VTK, SciPy Stack and more), consistent, has low computational overhead, and is a practical working solution. The image is easy to export to a tar file on USB drives, but storage on GitHub also makes it easy for people to build it on their own, learn how it was built, and generate their derivatives. It is also easy to download from DockerHub for those that did not get a USB drive.
Finally, I found a practical way to distribute the course material. We wanted something the attendees could get up and running quickly. It also need not be dependent on a reliable Wifi connection. USB flash drives satisfied both these requirements. But, copying the material to the flash drives has always been a practical challenge. This time around, I used a specialized hardware device called EZ-Dupe to copy and verify the material. These are great, portable devices that made the process fast and pain-free.
Connecting with People at the Course
Tipped off to our course following a news item in The Source, I met up with Michael Sarahan. We met Michael at SciPy 2014, and he led hacking on a project to build Python C-Extensions with CMake called PyCMake.
I also met with a post-doc, Clare Huang, who was appropriately enthusiastic about open-source software :-). We discussed ways to implement her goal of combining d3.js with something like GeoJS or xtk to generate an interactive visual of medical images combined with visualization of statistics on organs.