Talk Visualizing and segmenting large synchrotron-tomography datasets with the scientific-Python stack

Abstract

Authors: E. Gouillart (joint laboratory CNRS/Saint-Gobain UMR 125, 39 quai Lucien Lefranc 93303 Aubervilliers, France) and G. Varoquaux (Parietal team, INRIA Saclay Ile-de-France, France).

Synchrotron X-ray tomography images the inner 3-D micro-structure of objects. Recent progress bringing acquisition rates down to a few seconds have opened the door to in-situ monitoring of material transformations during, e.g., mechanical or heat treatments.

However, this powerful imaging technique presents many challenges. First, in-situ experiments generate very large datasets made of tens to hundreds of 3-D images with 1000x1000x1000 voxels. Another challenge comes from the 3-D nature of the images, which makes the visualization and exploration of data more difficult. Finally, image processing tasks, such as the segmentation of objects, may be arduous due to poor contrast and artifacts in the images.

In this contribution, we present how the standard modules of the scientific Python stack, combined with a few additional developments, are used to process and visualize such 3-D tomography images for research purposes. The data at hand consists of 100 3-D images of a small sample of window-glass raw materials. This mixture of sand and carbonate grains is heated from room temperature up to 1100°C. During this heating, chemical reactions take place, so that the initial granular packing transforms gradually into a liquid with bubbles and unmolten grains.

Basic data manipulation

The scientific computing environment is provided by the IPython shell, which allows to tinker interactively with the data in various ways and to run processing scripts. The size of typical images being 500 Mo or 1 Go, I/O aspects are handled with PyTables, which gives fast data access, optimized memory usage, and the manipulation of data as Numpy arrays.

Visualization

Single volumes are displayed using the 3-D visualization package Mayavi both from Ipython and using the GUI. For example, one can display 2-D cut planes and slice through the 3-D volume. Using the Traits module, it was possible to write at minimal cost a custom graphical application with an embedded Mayavi scene to perform "4-D visualization", that is, to display cuts through a 3-D volume that can be updated with the next or previous image of the dataset. This is very useful to determine for example where the first chemical reactions take place. The application was further enriched to include the possibility of placing markers, for example to track individual objects such as grains during the evolution of the sample (see Fig. 1).

Image processing

Quantitative image processing is needed to obtain statistical information about the physico-chemical transformation. Typical information of interest is the contacts network of the granular packing, or the evolving size of individual grains and gas bubbles.

  • A first denoising step uses a state-of-the-art denoising technique called non-local means denoising [1]: regions of the image are averaged with similar patches in order remove the noise without blurring salient features. The algorithm is written in C and binded with Cython.
  • For segmentation, we have adapted the recent random walker algorithm [2], that finds the anisotropic-diffusion basins of predetermined markers. The algorithm was implemented using Scipy sparse linear algebra routines, and PyAMG for multigrid resolution [3].

In addition to these two algorithms, we make heavy use of out-of-the-box routines. For instance, we use scipy.ndimage -mathematical morphology and measurement functions- and Numpy fancy indexing facilities in order to operate on the different segmented regions. At a higher level, we use NetworkX to explore the graph of connections between the segmented grains.

For visualization as well as processing tasks, the combination of i) easy interaction with data, ii) a large number of readily-available scientific black-box routines, and iii) easy assembly of custom graphical interfaces with powerful data visualization and interaction, surely make the scientific-Python stack an ideal tool chain for synchrotron-tomography-datasets processing.

http://sd-2116.dedibox.fr/euroscipy/appli_markers.png

Fig. 1 Custom application for placing markers inside the 3-D images at different times.

http://sd-2116.dedibox.fr/euroscipy/bubbles_colored.png

Fig. 2 Segmentation of gas bubbles, color-coded according to their size.

[1]A non-local algorithm for image denoising, A. Buades et al., CVPR 2005 (2), 2005.
[2]Random walks for image segmentation, L. Grady, IEEE Transactions on Pattern Analysis and Machine Intelligence 28, p. 1 (2006).
[3]An introduction to algebraic multigrid, R.D. Falgout, Computing in Science and Engineering 8, p. 24 (2006).