This is the second in a series of articles that describes how Sphinx has been extended to create a powerful example documentation system, the ITK Sphinx Examples.
For previous posts, see
The Insight Toolkit (ITK) is intended for analysis instead of visualization, so we generate the visualizations with other tools whose purpose is visualization, like the Visualization Toolkit (VTK) or ParaView. Using the VTKWeb capabilities available in VTK 6.1, a PolyData visualization can be generated with a simple Python script. Or, a WebGL visualization can be generated with Paraview by clicking File -> Export Scene -> WEBGL files.
The resulting HTML file with embedded data is easiest to archive. The file is self-contained and only requires a static web server to serve interactive 3D files. Since the visualization is self contained, including data, it can be relatively large, so we use the CMake ExternalData system to store a content link in the Git repository.
Browser Support Check
.. raw:: html <div class="figure"> <iframe src="InputMesh.html" width="200" height="225" seamless></iframe> <p class="caption">Interactive input mesh</p> </div>
An example visualization iframe (may not work in all browsers):