{'fraction_non_alphanumeric': 0.029369015047879615, 'fraction_numerical': 0.007823187414500684, 'mean_word_length': 4.851175587793897, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Conceptualization of seeded region growing by pixels aggregation. Part 4: Simple, generic and robust extraction of grains in granular materials obtained by X-ray tomography

This paper proposes a simple, generic and robust method to extract the grains from experimental tridimensionnal images of granular materials obtained by X-ray tomography. This extraction has two steps: segmentation and splitting. For the segmentation step, if there is a sufficient contrast between the different components, a classical threshold procedure followed by a succession of morphological filters can be applied. If not, and if the boundary needs to be localized precisely, a watershed transformation controlled by labels is applied. The basement of this transformation is to localize a label included in the component and another label in the component complementary. A"soft"threshold following by an opening is applied on the initial image to localize a label in a component. For any segmentation procedure, the visualisation shows a problem: some groups of two grains, close one to each other, become connected. So if a classical cluster procedure is applied on the segmented binary image, these numerical connected grains are considered as a single grain. To overcome this problem, we applied a procedure introduced by L. Vincent in 1993. This grains extraction is tested for various complexes porous media and granular material, to predict various properties (diffusion, electrical conductivity, deformation field) in a good agreement with experiment data.


I. INTRODUCTION
The 3D reconstruction of microstructures by microtomography is based on X-ray radiography. From several radiographs, obtained after rotations of a specimen, and with an appropriate algorithm, 3D images of the sample are obtained at a micro scale. This article opens the way to predict the physical properties using 3D images where each voxel belongs to a grain of the granular phase or to the matrix phase 1 . For example, 3D images of the microstructure can be introduced in a numerical homogenization process by computer, in order to predict their macroscopic physical properties from the microscopic properties. The first step to achieve this goal is to perform a correct grains extraction. Due to the acquisition of radiographs and to the numerical reconstruction, noise is apparent in the images, as well as some linear grey-level artefacts resulting in impressive images with generally a too weak quality for a quantitative and automatic use. This paper proposes a simple, generic and robust method to achieve this goal. Simple means that this method can be used by anybody who is not a specialist of image processing. Generic means that this method can be applied in a wide range of materials. This method has been applied for granular materials (see figure 1) but its extension to other materials is straightforward. Robust means that the extraction is few sensitive with a "little" variation of the parameters. This method has two steps: 1) segmentation: to transform the grey-level image into an image with different components, 2) splitting: to transform a granular component into a set of grains.
1) Depending on the histogram shape, the segmentation is applied on the initial image to use the tint information or on the gradient image to use the boundary information as sharp variation of grey-level. In these both approaches, a succession of morphological filters is used: • after the threshold, to remove the small islands and to fill the holes of islands for the tint information, • before the watershed transformation, to localize two labels: one included in the component, the other included in the component complementary for the boundary information.
2) Whatever the approach, the final result shows one difficulty: some groups of two grains close one to each other become connected after the segmentation. So if a classical cluster procedure is applied on the segmented binary image, these numerical connected grains are considered as a single grain.
To overcome this problem, a splitting procedure is applied to separate the connected grains. The outline of the rest of the paper is as follows: in Sec. II, the images characteristics obtained by X-ray tomography and the different materials are explained. In Sec. III, the classical threshold procedure is presented. In Sec. IV, the watershed transformation controlled by labels and the localization labels are explained. In Sec. V, a splitting procedure is applied to individualize each grain in the granular component. In Sec. VI, concluding remarks are made.

A. Microtomography
Microtomography is a non-destructive 3D-characterisation technic providing a three-dimensional image 2 . Each voxel of the image is associated to a cube included in the material, under investigation [1]. In first order, its grey-value is the space average of linear X-ray absorption coefficient of the different solids and fluids contained into it. But since more often the tomographic reconstruction amplifies the noise of the projections, and generates artefacts, there is extra-term given impressive images with generally a too weak quality for a quantitative and automatic use. Also, the materials are different in the chemical composition and in the geometrical organisation (see figure 1). Due to the materials variety and the images defects, a generic, simple and robust segmentation procedure has been developed.

B. Materials and applications
For the granular A, the segmented data come from a mechanical triaxial test on a sand specimen realised under a synchrotron microtomograph (ESRF, ID15A) to follow the structural evolution of the granular media. Digital Image Correlation is used to observe and detect the strain localisation mechanisms at the grain scale [8], [12]. This work is funded by the French project ANR-05-BLAN-0192 (J. Desrues project coordinator). For the granular B and C, the segmented data come from pyrotechnical specimen realised by Laboratoire 3S-R, Grenoble under a laboratory microtomograph designed by Skyscan . The finite element code is used to compute stresses and strains as well as other fields like the thermal flux and the temperature distribution in the material at a micro scale in using [11]. This work is funded by les Mines de Paris and le Centre d'Etudes de Gramat (DGA). For the granular D, the segmented data come from estaillade limestone realised under a laboratory microtomograph designed by Skyscan to understand the effects of the porous structure in resistivity index curves [9].

C. The image size
The segmentation procedure must be efficient because the size of the images obtained by X-ray tomography is huge. The previous articles [20], [18], [19] enable to improve the efficiency of the algorithms used for this prupose. Typically, for the biggest image of this article, the granular D with a size equal to 700*700*700=0.35 Giga voxels, the segmentation requires less than 6 hours of executing time with an Intel(R) Xeon(R) CPU 3.00GH and the allocation of RAM is 16 GO. This reasonable time makes the practical use manageable on conventional computers. The algorithms are developed and implemented on the Open source software, called Population available at http://pmc.polytechnique.fr/∼vta/Pop.tar

D. Images characteristics
For every image, the grey-level is coded on one byte (0-255) and a median filter has been applied to minimize the ring artefact and to smooth in keeping the sharpness of the boundary. The images have an uniform illumination and each component on the image has a specific brightness 3 . For the visualization convenience, the results are sometimes presented in 2D but the method has been applied efficiently in 3D for all materials.

III. SEGMENTATION
For each material, depending on the histogram shape, the classical threshold segmentation can be applied to extract a component, using tint information (1). If the contrast between the component and the background is low and if the boundary has to be well localized, the watershed transformation controlled by labels is applied using the boundary information (2). For the both approaches, a combination of morphological filters has to be applied in order to: 1) match the visual segmentation for (1) (the combination is an opening followed by a closing), 2) localize two labels for (2) (the combination is just an opening). This section is decomposed into two parts: threshold segmentation using tint information and watershed transformation using boundary information.
A. Threshold segmentation using tint information 1) Threshold operation: Given that each component has a specific brightness, the threshold operation uses this contrast information to extract the components. Threshold selection is usually based on the information contained in the grey level histogram of the image (see figure 2). The correspondence between the component and a mode in the histogram is required for threshold segmentation. A certain threshold range is chosen. The label '1' is assigned to each image voxel, which gray-level belongs to this range, and '0' label is assigned to each image voxel which gray-level does not belong to this range. The threshold range is selected to best separate the mode of the histogram, see [16], [5], [14], [22]. Manually, the range is chosen on the valleys of the histogram (see figure 2). For the granular A and B, the binary image seems like the real grains aside some holes and isolated voxels. The next paragraph explains how to correct these defects. For the granular C and D, the binary image is very different of the real grains. The reason is that one mode in the histogram is populated with voxels that form the two classes of grains because the contrast between these two classes is low. For these two granular materials, it is impossible to filter the binary image to get a good segmentation. The subsection III-B gives a method to treat this task.
2) Morphological filtration: Briefly, the four basic operator of the mathematical morphology are presented [17]. Erosion of object A by the structural element B is defined by 4 : The Opening of A by B is obtained by the erosion of A by B, followed by dilatation of the resulting structure by B: The Closing of A by B is obtained by the dilatation of A by B, followed by erosion of the resulting structure by B: As the grains are isometric for all granular materials, the structural element is chosen isometric. The structural element is associated to the 26-connectivity in the cubic grid. To remove the isolated voxels for keeping the clusters size, the opening is applied. To fill the holes for keeping the clusters size, the closing is applied. Let A, the binary image after the threshold application. The filtration is only: figure 3). We have a good agreement between the visual segmentation and the numerical segmentation but first the numerical boundary does not match closely the visual segmentation, second some groups of two grains close one to each other become connected after the segmentation. So, the following method has to be applied if 1) for the purpose of the application, it is necessary to have a good match between the numerical boundary and the "real" boundary, 2) the contrast between the components is low.

B. Watershed transformation using boundary information
1) Double labels watershed: An efficient segmentation procedure developed in mathematical morphology is the watershed segmentation [3], usually implemented by a flooding process from labels. We recall these tools in this section, based on our application for the segmentation of the 3D images of materials. Minima watershed: Any greyscale image can be considered as a topographic surface and all boundaries as sharp variations of the grey level. When a gradient is applied to an image, boundaries are enhanced. When the topographic surface obtained from the gradient is flooded from its minima, the waterfronts meet on watershed lines in 2D, and on watershed surfaces in 3D. A partition of the investigated volume is obtained, where the catchments basins are separated by the watershed surfaces. However, in practice, this merging produces an important oversegmentation due to noise or local irregularities in the gradient image, generating a set of uncontrolled and unwanted markers. To avoid this problem coming from too many minima, the image, I, is usually filtered. It is a composition of vertical 4 the inner boundary using for visualisation is defined as: ∂A = A\(A⊖B) (with respect to the grey level) and horizontal filters, in order to individualize each grain with a single marker. This individualisation step is complicated [20]. It is the reason why the labels controlled watershed is used [2]. Labels controlled watershed: The labels controlled watershed is similar to the minima watershed, beside a catchment basin is associated to a label (see figure 4). Component by component : Since the materials are different in the chemical composition and in the geometrical organisation, it is difficult to extract each component in the same procedure. It is simpler to extract component by component. Starting from the simplest component to extract, we proceed to extract the next simplest component each time. Notice that the last component is easily extracted because it is the complementary of the other components addition. Except the last component, the extraction procedure is: 1) to localize two labels: one included in the component and the other in the component complementary (the next paragraph is dedicated to this task), 2) to apply the Deriche's operator [6] on the initial image to get the gradient image, 3) to apply the watershed transformation controled by labels on this gradient image with these labels (see figure 5). The component is the catchment basin associated to the label included in it 2) Localize a Label in a component: Two labels have to be localized: one included in the component and the other included in the component complementary. Since the component complementary can be composed by more than one component, this procedure has to be operated on each complementary component (see figure 5). The procedure uses the tint information like the threshold segmentation: a threshold followed by a succession of morphological filters. The major enhancement of this approach is: it is not necessary that the label localization match the component contrary to the threshold segmentation. It is just sufficient to have some labels in each connected component. The succession of morphological filter is just an opening. The opening operator has one parameter k such as In this article, the selection of the threshold/opening parameters and are done manually following these constraints (see table I): 1) the material specialist checks if the visual segmentation matches the numerical segmentation, 2) if there is some experimental data about the volume fraction, we impose the correspondence between the experimental value and the numerical value obtained by segmentation. This manual limitation is attenuated by a good property: some small parameters modifications have no consequence on the final segmentation (see subsubsection III-B.3). So it is easy to find the right parameters for a good segmentation because the range of the right parameters is large. This simple method gives some good results for the four granular materials. The figure 6 shows the different steps for the extraction of one component for the granular A, B and C. The figure 7 shows the 3D visualization of the multi-component extraction. In the next subsubsection, a method to evaluate the robustness is presented, in more this method opens up the opportunity of an automatic evaluation of the parameters.

3) Robustness:
A definition of the segmentation robustness can be the stability of some morphological descriptors depending on the parameters fluctuation. This subsubsection has two paragraphs: morphological analysis and robustness evaluation.
Morphological analysis: The µ-chord distribution function and the two-point correlation function provide a way to get a morphological analysis of the mesoscopic divided material and particularly for granular materials [4], [13], [15]. These functions can be computed either in 2D or 3D assuming some general conditions similar to the Hadwiger conditions. Their determination gives information about volume fraction, average granular size, mean curvature, granular shape, surface roughness and structural correlation. 1) A chord is a segment belonging either to the grains or to the background and having its two extremities on the interface. As shown in Fig. 8, µ-chord are obtained by tracing random and homogeneous distributed straight lines through the microstructure. The chord-length distribution function gives the probability of getting a chord length between r et r + dr, belonging either to the grain, f g,µ (r),or to the background f b,µ (r).
2) Let a yardstick drawn randomly in the material. The two-point correlation functions gives the probability of having both extremities of the yardstick belonging to the grains, f g,2 point (r) or to the background f i,2 point (r) 5 (see figure 9).
Robustness evaluation: Let S Λ (I) be the resulting binary image after the application of the threshold segmentation or the double labels watershed on the initial image I with the parameters Λ. Let Λ b the parameters that gives the "best" binary image. The method to check the stability of a segmentation method is: 1) select a parameter, λ, in the parameters, Λ, 2) starting from well below of λ b , increase step by step the chosen parameter, λ i = λ i−1 + ǫ, until a value well above of λ b , 3) for each step, • apply the segmentation procedure to get the binary image S Λi (I) associated to the parameter λ i , • calculate the distance for the two point correlation function and for the chord-length distribution between S Λi (I) and S Λi−1 (I) 6 . The figure 10) shows that the double labels watershed is more stable than the threshold segmentation. For the double labels watershed, plotting these curves will allow an automatic determination of the threshold value to localize the labels (see figure 11). Whatever the parameters, there is always a problem: some pairs of grains, close one to each other, become connected. A split procedure will be applied to separate the connected grains.

IV. SPLIT THE GRAINS
For the both segmentation procedure, the final result shows one difficulty: some groups of two grains close one to each other become connected after the segmentation. So if a classical cluster procedure [10] is applied on the segmented binary image, these numerical connected grains are considered as a single grain. To overcome this problem, we apply a procedure introduced by L. Vincent in 1993 [21]. The algorithm principle is to apply the watershed transformation controlled by labels restricted by the binary image, I, on the topographic surface that is the opposite of the distance function of I. In this approach, the crucial step is the labels localization. Each catchment basin is associated to a grain (see figure 12). In a first approach, the labels can be the regional minima of the opposite distance function of the binary image. However, in practice, this merging produces an important over-extraction of grains due to local irregularities of the binary image shape, generating a set of uncontrolled and unwanted labels. To avoid this problem coming from too many labels, the opposite distance function f of the binary image, O(dist(I)), is filtered. A vertical filter is used in order to individualize each grain with a single label. The vertical filter uses the notion of dynamic with a parameter h. The operator is a geodesic erosion of the image O(dist(I)) + h under the image O(dist(I)) that fills the valleys with depth lower than h [7], [19] (see figure 13). The splitting procedure has been successfully applied to the granular A-B-C 7 (see figure 14) because each grain of the granular phase has been correctly extracted. This method 6 The distance is: f g,2 point or µ 2 7 For the granular D, the physical property under investigation is the electrical resistivity and the segmented components image are sufficient to predict it. has been applied for granular materials but its extension to other materials is straightforward. The figure 15 shows the correspondance between the 3d grey-level image and the segmented image for the material presented in this paper and also for a cement paste.
V. CONCLUSION X-ray tomography images involve specific problems of image segmentation, due to some artefacts generated during the reconstruction. In the case of granular materials, we have seen that many problems can appear during the segmentation. In the first part of this paper, we presented the classical threshold segmentation. To overcome the problem due to the low brightness between the components, we introduced a simple, generic, robust method of segmentation, called double labels watershed. This method is simple because the chain of operator is always the same, generic because this method has been applied in a wide range of material, robust because some "little" fluctuation of the parameters does not change the final segmentation. Then to split the connected grains generated by the segmentation in tridimensionnel image, we have applied a classical procedure introduced by L. Vincent. This simple, robust and generic segmentation can be applied efficiently in using the framework introduced in the previous articles. The initial goal, to give a method for any user not especially specialist in image processing, is reach.
ACKNOWLEDGMENT I would like to thank my Ph.d supervisor, P. Levitz, for his support and his trust. The author is indebted to E. Gallucci, D. Jeulin for valuable discussion and C. Wiejak for critical reading of the manuscript. I express my gratitude to the Association Technique de l'Industrie des Liants Hydrauliques (ATILH) for its financial support and the French ANR project "mipomodim" No. ANR-05-BLAN-0017 for their financial support.   Since the complementary is composed by n components (2 in this example), the localization is done for each component such as the final localization for the complementary is the addition of these specific localizations. When a watershed transformation is applied on the gradient with these two labels, the catchment basins are well localized on the grains. There is a good match between the visual segmentation and the numerical segmentation.        Fig. 13. The dynamic filter. Before the application of the dynamic filter, there are many regional minima (green bullets). After the application of the dynamic filter, there are only two regional minima.
Fig. 14. Each colour represents a grain. For each serie, the first image is the visualization of the clusters on the segmented binary image and the second image is the catchment basins after the splitting procedure. The serie and the granular is 1-A, 2-B, 3-C. For each granular, the dynamic parameter is equal to 1. Fig. 15. Corresdance between the 3d grey-level image and the segmented image. The last serie is a cement paste material composed by three phases: porosity (in black), hydrate (in middle grey) and anhydrous grains (in light).
In the segmented image, the porosity is in blue and the the anhydrous grains is in yellow.