Interactive Image Analysis Web Pages: Open Science in JavaScript

The Insight Toolkit

Kitware is one of the lead developers of the Insight Toolkit (ITK) for medical image segmentation and registration. ITK provides state-of-the art methods and is used in cutting-edge research and commercial products. It is a high-quality and accessible software system through its open-source license and test-driven development methods. As a vehicle for innovation and sharing, it provides a foundation for open science, but written in C++, it has a limited user base. We have developed a method for delivering ITK’s methods over the web, enabling its methods to be interactively applied by users with no programming experience, enabling ITK to realize its full potential in promoting open science.

Interactive figures for reproducible research

A primary tenet of the scientific method is that conjectures require verification and proofs require reproducibility. Therefore, science that involves analytic software requires publication of the source code and the input data so that results can be verified and reproduced with only a reasonable amount of effort.

Interactive Figures are gaining interest as a basis for open science.  Traditionally, results in publications are presented in static figures that contain author-specified interpretive visualizations of results. Interactive figures allow a reader to manipulate how computational results are generated and visualized, thereby providing an opportunity for the immediate verification of the science, in addition to necessary sharing of data and code. Ideally, interactive figures can also enable a user to process and visualize new data.  Kitware has broken ground on the concept of Interactive Figures through collaborations with the Optical Society of America to develop the Interactive Scientific Publishing (ISP) system. This concept has caught traction with progressive journals like F1000.

ITK-based Interactive Figures on the Web

With the Internet becoming the new standard for scientific publication, we have brought the concept of Interactive Figures to web browsers, particularly for ITK-based algorithms and applications.

The concept is simple.  Modern web standards make it possible to distribute “apps,” in addition to data, through the browser  A leading programming language for writing these apps is JavaScript (ECMAScript) which provides scalability to a large number of users, security for the host web server, offline functionality, and free hosting sites such as  With the release of ITK version 4.8, it is now possible to use and extend ITK via JavaScript.  There are currently some limitations in the amount of computation and size of data that client-side JavaScript can handle, but via community contributions and growth of the internet infrastructure, those limitations are quickly being overcome.

An example Interactive Figure using ITK: anisotropic diffusion research

An excellent illustration of an ITK-based Interactive Figure has been developed in conjunction with an article published in the Insight Journal.  In that article, the authors proposed improvements to ITK’s anisotropic diffusion image filter.  Anisotropic diffusion is used in medical imaging and multiple other fields to reduce the appearance of noise in images while preserving fine details.  The authors’ introduce a new implementation of anisotropic diffusion, based on a numerical method from discrete geometry, Lattice Basis Reduction (LBR). The proposed method is computationally efficient while avoiding the generation of undesirable artifacts in images.  We created a web page with interactive versions of the figures from this article.


This Interactive Figure is dynamically generated within a reader’s web browser, utilizing the same ITK code and data presented in the article. Interactive Figure presets can be selected by the reader to exactly recreate the figures in the article.  The reader can also modify the parameters of the algorithms, visualize the effects of those changes, and thereby gain new insights into the operation of the method.  Furthermore, we have extended the concept of Interactive Figures to allow readers to upload their own data and run the authors’ algorithms on it

Technical Details Behind Interactive Figures: Cross-Compilation with Emscripten, CMake, and Docker

Nearly any C++ software library can become a foundation for Interactive Figures.  In particular, most computational analysis are performed using scientific programming languages based on C/C++. Such C/C++ libraries represent decades of scientific knowledge, and as described in a recent blog post, it is now possible to easily cross-compile the them into JavaScript, using CMake and Emscripten. Furthermore, when high-quality software practices are used to define a modular CMake-based build system for those libraries, as was done with Insight Toolkit, it is possible to generate Javascript code that is extremely small and portable, making it particularly useful for embedding in Interactive Figures.

What’s next

Interactive figures not only enhance reproducibility and scientific understanding, but they also engage the reader, leading to a viable new extension to traditional publishing methods.

Furthermore, we are constantly evolving new applications of this modular, interactive technology.   For example, the modules that comprise an Interactive Figure can also operate as a downloadable extensions as applications are being developed and even as applications are running.  In particular, in ITK this modularity is being promoted as “Remote modules” which can be accessed and configured using CMake as ITK is built.  Additionally, we are creating methods for wrapping these modules so that they are accessible via Python, further extending the reach and impact of ITK in the scientific community. On another front, we are also working on embedding these modules into “big data” analysis with systems like Romanesco, enabling ITK to contribute to solving problems that span terabytes of data.

The future is bright and exciting for ITK and open science.  If you are interested in taking advantages of these developments in you research or product development, Kitware is here to help.

2 comments to Interactive Image Analysis Web Pages: Open Science in JavaScript

Leave a Reply