Image Segmentation Variants for Semi-Automated Quantitative Microstructural Analysis with ImageJ Bildsegmentierungsvarianten für eine halbautomatische quantitative Gefügeanalyse mit ImageJ

Porosity, pore distribution, mean grain size, and grain size distribution determine the mechanical and physical properties of ceramics. The quantitative structural analysis is therefore essential for the char­ acterization of sintered materials. A semi­ automated structural analysis requires a preceding image segmentation step in which all pixels are divided into respective objects to be examined so that they can be clearly assigned to a microstructural constituent. The present work analyzes the watershed transformation, IsoData, and WEKA algorithm image segmentation methods with regard to a grain size and pore characterization using light micro ­


Introduction
Technical ceramics, such as sintered silicon carbide, are preferentially used in applica tions where they are subjected to increased thermal or corrosive stresses [1,2].The ce ramic's strength is, amongst others, a func tion of the porosity, the pore distribution, the grain size, as well as the grain size distribu tion.According to Duckworth, the strength decreases exponentially with the increase of the porosity [2 -4].Furthermore, shape and size of the pores also have an influence on the mechanical characteristics.As opposed to metals, the single crystal in ceramics is considered a local stress raiser geometri cally increasing mechanical stresses [2,5].Accordingly, the lower the porosity and the smaller the grains, the higher the flexural strength of a ceramic [2].
In the manufacturing process of a ceramic component, sintering inevitably leads to pores and foreign inclusions such as B 4 C. Their proportion, distribution, and size are a function of the type and purity of the ma terial as well as of the conditions in which the various technological steps (such as mixing, shaping, sintering) take place.The microstructure is qualitatively and quantita tively characterized to conduct a check or to assess the condition or the quality of the sintered ceramic.Thus, conclusions with regard to the microstructure and eventually to the manufacturing conditions and/or raw materials can be drawn from the resulting material properties such as the strength.

Beide im Beitrag vorgestellten Verfahren er möglichen eine Charakterisierung des ge
The microstructural characterization of the ceramics for the porosity measurement is performed according to DIN EN ISO 13383 -2 and the grain size analysis is per formed according to DIN EN ISO 13383 -1.The porosity is determined by means of a point analysis, whereas two methods can be applied to determine the grain size: The line intercept method determines the mean linear intercept length g mli , while the measuring method determines a mean cir cle equivalent diameter g ecd corresponding to the respective grain boundary radius.A digital structural analysis requires that im ages are segmented.In the course of such a segmentation, an image is (where possi ble, automatically) subdivided into different regions with the aid of an algorithm.Grains are segmented by grouping all pixels locat ed between the grain boundaries into one region/grain.The watershed transformation is a method which reveals grain bounda ries in an image [6].During this process, the gray scales are interpreted as height information of a topological map while it is assumed that the image is "filled" top down."Dams" mark spots where "floodings" from different zones meet and thus provide a segmentation of the image.The watershed transformation tends to a strong overseg mentation and appropriate preprocessing must take place in order to avoid this phe nomenon.
Grains can also be segmented by socalled "clustering".This method subdivides the micrographs with the aid of a mathematical pattern recognition machine.Such a model either learns in an unsupervised manner (comparable to the kmeans algorithm) or based on preselected classes or by means of training and a validation dataset (supervised, corresponding to the trainable WEKA algorithm) [7].
Both methods presented in this work allow a characterization of the entire image area samten Bildbereichs, womit schnell eine sta tistisch abgesicherte Anzahl an untersuchten Objekten ermittelt werden kann.An automatic threshold value setter accord ing to the ISOData method is used for the detection of the pores.It separates pores in the image lying above a threshold value from the remaining material.This algorithm gen erates a binarized image in several iteration steps.In this context, the internal change function assigning the pixels of the image to the background/the object must remain constant, so that a likewise constant thresh old value can be set [8].An advantage over manually setting the threshold value during point analysis is the fact, that the respec tive value is less dependent on the exposure level of the image.Thus, changes of the am bient radiation can be better compensated and subjective influences on the threshold value setting process can be avoided.
In order to filter the pores/grain surface areas and boundaries in the micrograph, the image must be prepared and con trasted such that differences between the microstructural constituents can be identi fied by the presented segmentation meth ods.Here, the preparation/revelation of the microstructure is particularly dependent on the skills of the metallographer and the ap plied contrasting method [9].
Feebased solutions providing a semi or fully automated measurement of micro structural constituents already exist.The commonly available software ImageJ pro vides access to image analysis algorithms [10].However, it is left to the user to work out a solution and perform respective veri fications which requires additional time and effort.Aiming at presenting an image seg mentation that can be performed in the con text of a quantitative microstructural char acterization, a semiautomated pore and grain size analysis using ImageJ is therefore addressed in this work and discussed with regard to its use in the field of materialog raphy.Thus, the objective of this work is to perform an image analysis using a free and openly available software.In this context, the use of a thresholdbased, edgebased, and pixelbased image segmentation vari ant already used for cell analyses in the field of biotechnology and medical technology is presented [11,12].

Experimental Procedure
The chosen methods are performed by way of example to analyze a sintered sili con carbide ceramic (grade SCS, FCT Ingenieurkeramik GmbH, Rauenstein, Germany).The grain size (maximum Feret diameter) and the total porosity specified by the manufacturer are 1 -10 µm and < 3 %, respectively.

Hauptteil der Arbeit
The microstructural image with a resolution of 1024 × 768 was acquired using a 3D color and laser scanning microscope (VK9700K, Keyence, Japan) and 50× and 150× objec tives.Applying two magnification steps the goal is pursued to exclude an erroneous interpretation of features in the boundary region between pores and their surround ings or grain boundaries due to an exces sive magnification.Owing to such an exces sive magnification, such misinterpretations can occur when boundary regions extend over several pixels.They can thus not be unambiguously assigned to a class (pore pixels, grain area pixels, grain boundary pix els) anymore.During image acquisition, the brightness was automatically set.The ratio pixel/length of the 50× and 150× objec tives was determined as 279 ± 0.7 nm/pixel and 92 ± 0.2 nm/pixel, respectively, using a stage micrometer.

Grain Size Analysis
For the grains size analysis, the software ImageJ (Fiji Distribution) was used in its "Analyze Particles" mode [11].The grain size was determined based on the Feret diameter d ci, max .The grain surface areas were segmented applying the edgebased segmentation method "watershed transfor mation" in the "MorphoLibJ" package [13].Furthermore, a pixelbased segmentation of the micrographs was carried out using the "Trainable WEKA Segmentation" plugin [14].Once the segmentation completed, the grain boundaries and surface areas in the images are clearly separated from one another, so that the "Analyze Particles" com mand autonomously determines a thresh old value.In order to convert the pixel values into units of length, the ratio pixel/length was defined using the "Set Scale" command.The
For the watershed transformation, the mi crographs were first converted into 8bit grayscale images and loaded into the "Morphological Segmentation" plugin.Due to the images being taken in the bright field, the object boundaries' (grain boundaries') intensity is lower than that of the grain sur face areas.Therefore, the images needed to be analyzed as "Object Image".Best re sults were obtained for the "Morphological" gradient type and a gradient radius of one pixel.Subsequent to the segmentation, the results were read out in the form of "water shed lines" and the binarization was carried out by applying an image analysis erosion operation to the pixels.
First, the WEKA algorithm for the pixel based segmentation needs to be trained for the different microstructure areas.There fore, at least two microstructural areas must be marked differently in an image and the desired filtering techniques must be chosen.For the SiC samples, the images were filtered using the following settings: "Gaussian blur", "Sobel filter", "Hessian", "Difference of gaussians", and "Membrane projections".The primary aim pursued by this choice of filters is to detect the grain boundary edges by derivative filters and their variations, i. e. an edge detection using the simple and double derivation based on the image values with the aid of the re spective normalized kernel.The "Gaussian blur" filter, however, rather filters coarse image structures, as the image noise and fine image information of the pixels within a kernel are suppressed by convoluting the image using a Gaussian distribution.Thus, oversegmentations are caught by the edge detection filters and the algorithm is less sensitive to fine variations in intensity.The last filter used is the "Membrane pro jections" filter.This modified edge detector identifies textures in images in up to 30 dif
The values of the labeled pixels impacted by the filter and the previously manually la beled pixels together train the selflearning algorithm.It can subsequently accurately classify the pixels in the remaining image with a certain degree of probability.Micro graphs can thus be segmented very quickly.Given an unvarying image analysis/source image, it thus takes just a little investment in time to analyze several images simultane ously once the algorithm is trained.
The segmented image can subsequently be evaluated in a surface analysis process and the trained classifier can be saved for upcoming images.
According to DIN EN ISO 13383 -1 : 2016, a lognormal distribution is assumed for the calculation of the confidence interval of the grain size distribution.

Pore Analysis
The Fiji Distribution ImageJ "Analyze Par ticles" tool was also used to measure the porosity and the pore distribution [11].In this context, the images were first converted to a binary image using the "Make Binary" option based on automatic threshold value setting applying the IsoData method [8].Further more, the pixel/length ratio was specified via the command "Set Scale".Based on the threshold value setting, the "Include holes" option fills any "holes" that occurred in the pores, i. e. insufficiently segmented pore areas are "repaired".ImageJ thus automati cally establishes a gray value limit between the pixels of the ceramic and the remain ing foreign inclusions, such as B 4 C, and the pores in the microstructure and generates a segmented binarized image (cf.Fig. 1).
Once the segmentation completed, the pores are measured and counted.Based on the determined pore surface areas, the volume fraction of the entire ceramic can then be measured.Moreover, ImageJ can be used to determine the number distribu tion of the pores Q 0 and, where necessary, the shape parameters.
The porosity present in the ceramic sam ples was measured according to DIN EN 1389 : 2003, method B, by the manufacturer for comparison with the image analysis method.
The grain analysis as well as the pore anal ysis are performed using images acquired with 50× and 150× objectives, respectively, in order to detect variations of the segmen tation method.

Pore Analysis
The area analysis method yields a porosity of 3.38 % (50× objective) and 4.34 % (150× ob jective, respectively; cf.Tab. 1).The porosity determined by the manufacturer according to DIN EN 1389 was 3.17 %.A porosity deter mined based on image analysis of sections can be slightly higher than the porosity de termined according to the Archimedes' prin ciple.Thus, Telle et al. found, that despite the verification of the ceramographic findings, breakoffs and smearedup pores increase the porosity determined by image analysis as opposed to the porosity determined by density measurements [15].
The higher resolution of the 150× objectives which allows to reveal even smaller pores and the inhomogeneous distribution of the pores in the microstructure are responsible for the different porosity values measured by image analysis.These effects can also be observed when taking a look at the distribution curve in Fig. 2: While, for the images acquired using the 150× objective, the number of detected pores with a mean diameter below 1.25 µm increases, it decreases for those acquired using the 50× objective.Moreover, 50× ob jectives magnify the pores, as pixels in the interface region between ceramic and pores are partially rather considered as pores than as a grain area.This results in a lower rela tive frequency of pores with a diameter below 1 µm (cf.Fig. 3a, arrows mark pixels which extend beyond the edge of the pore but are nevertheless segmented as pore pixels)

Korngrößenanalyse
Die Analysen der 50× Aufnahmen ergeben eine mittlere Korngröße der Keramik von 1,578±0,016 µm nach der Segmentierung mit der Wasserscheidentransformation und von 3,181±0,057 µm nach der WEKAAnalyse.Das standardisierte Linienschnittverfahren kommt zu einem Ergebnis von 3,504±0,1 µm (vgl.Tab. 3 und 4).Damit weicht der d 50 Wert der Wasserscheidentransformation um ca.55 % und der des WEKAAlgorithmus um ca. 10 % von dem Ergebnis des Linienschnitt verfahrens ab.Ein Grund für die hohen Abwei chungen der Wasserscheidentransformation, ist die Übersegmentierung der Poren entlang der Korngrenzen und innerhalb der Körner due to the higher ratio pixel/length in the image.The interface regions in the images acquired using the 150× objective offer a higher resolution and the IsoData segmen tation provides more shape accuracy.For this reason, the pores are overestimated due to the preparationinduced breakoffs which results in a larger difference between the porosity value of the 150× images and the value measured according to the Archi medes principle (cf.Fig. 3b).
The increased fraction of pores with a Feret diameter smaller than 1.25 µm revealed by the 150× objective results in a decrease of the d 10 and d 50 percentiles (see Tab. 2).However, in percentage terms, more pores with larger diameters are determined.Ac cordingly, the d 90 percentiles (3.145 µm) ex ceed the value obtained in images acquired with the 50× objective.

Grain Size Analysis
The analysis of the 50× images after the segmentation by watershed transformation yields a mean grain size of the ceramic of 1.578 ± 0.016 µm, while the WEKA analysis provides a value of 3.181 ± 0.057 µm.The standardized line intercept method yields a value of 3.504 ± 0. the pores along the grain boundaries and within the grains (cf.Figs. 4 and 5).To date, no existing preprocessing variant filters pores or gray value minima in a way that the watershed transformation detects the present grain boundaries but disregards the pores, so that the mapped grain size re mains unchanged.Due to the oversegmen tation of the images, nonexistent smaller ob jects are detected during the area analysis (cf.Figs.6a, b).
The WEKA algorithm is capable of filtering out grain boundaries and pores during the analysis of the grain surface areas.Thus, the result hardly differs from the result ob tained using the line intercept method.Any differences between the d 10 and d 90 percen tiles can be attributed to the high number of detected grains.The line intercept method  1.029 ± 0.016 µm for the watershed transfor mation, 2.181 ± 0.0782 µm for the WEKA al gorithm, and 3.074 ± 0.160 µm for the line intercept method suggest that smaller grains can be detected owing to the higher resolution and are incorporated into the quantitative grain size analysis.The devia tion of the result obtained by the watershed transformation from the result yielded by the line intercept method increases to 67 %, that of the WEKA algorithm to just under 30 %.A closer examination of the segmented 150× images reveals the double segmentation of the grain boundaries (cf.Fig. 4d) which brings about a shift towards smaller values for the percentiles, too.
The thermal etching process tends to round off the grain surface areas, so that shadows are cast on areas near the grain boundaries.As a consequence, the segmentation of the distance between grain surface areas in the case of a 150× magnification brings about broadened segments, thus apparently re ducing the size of the grains.A look at the number distribution sum for the 50× magni fication shows that the results of the distribu tion measurement by the WEKA algorithm are comparable to those obtained by the Für eine exaktere Segmentierung mittels der Wasserscheidentransformation kann eine al ternative Korngrenzenätzung, beispielsweise mit einer MurakamiLösung, erfolgen, da die Körner nicht so stark abrunden, wie bei einer line intercept method (cf.Fig. 7).This finding suggests that, given a sharp contrast of the grain boundaries such as the one obtained during the 50× magnification, the segmen tation performed by the WEKA algorithm generates a qualitatively better distribution than for the wider grain boundary areas.
An alternative grain boundary etching pro cess, such as using a Murakami solution, can be performed for a more precise wa tershed transformation segmentation, as the grains are not rounded off as much as  net, klassifiziert und die daraus entstehende Wahrscheinlichkeitskarte über eine Wasser scheidentransformation segmentiert [16].Der WEKAAlgorithmus ist ebenfalls in der Lage eine Wahrscheinlichkeitskarte zu erstellen und arbeitet nach einem ähnlichen Klassi fikationsverfahren wie der RandomForest Algorithmus.Die Eigenschaften nach denen klassifiziert wurde, sind im WEKAAlgorithmus jedoch nicht abgebildet und müssen dem entsprechend zusätzlich angepasst werden.Die Wahrscheinlichkeitskarten des WEKAAl gorithmus können mittels der Morphological Segmentation (Wasserscheidentransforma tion) weiterbearbeitet werden, dabei muss ein sogenannter hWert (Tolerance) eingesetzt werden (vgl.Bild 8) [13].Dieser Wert be schreibt eine Intensitätsschwelle unter wel cher Pixel mit einer geringeren oder gleichen Intensität nicht mehr für "Wachstumskeime" zur Verfügung stehen.Dadurch sollen lokale Maxima, die für die Segmentierung keine nütz lichen Informationen tragen und eine daraus folgende Übersegmentierung unterdrückt werden.Ist der hWert jedoch zu groß wird das Bild untersegmentiert, aus diesem Grund muss er manuell und nach der subjektiven Einschätzung des Nutzers optimiert werden the thus created probability map applying a watershed transformation [16].The WEKA algorithm is also capable of generating a probability map and uses a classifica tion method similar to that of the Random Forest algorithm.However, the properties based on which the classification was per formed are not represented in the WEKA algorithm and thus need to be additionally fitted.The probability maps of the WEKA algorithm can be further processed by the Morphological Segmentation process (watershed transformation).For that, a so called hvalue (Tolerance) needs to be ap plied (cf.Fig. 8) [13].It defines an intensity threshold, where pixels with the same in tensity or those falling below the threshold are not available for "growth seeds".Thus, local maxima which do not provide infor mation useful for the segmentation and a resulting oversegmentation are to be sup pressed.However, if the h value is too high, the image is undersegmented.Therefore, it must be manually optimized based on the subjective assessment of the user [17 -19].
Here, the standard deviation (or the in crease) of the Error function (cf.equation 1) is suggested as an option.It describes the It yields an inverted profile for the standard deviation as a function of the Tolerance, showing a minimum for the 50× images (90 Tolerance) as well as for the 150× im ages (110 Tolerance, cf.Fig. 9).
This could be an indication for a correlation of the imaged grain boundaries and the wa tershed transformation's h value.This cor relation could be used in order to provide a more precise segmentation of the grain boundaries in the image.
As opposed to Fig. Tab.

Summary
For the first time, this work focuses on the semiautomated analysis of a SSiC micro structure with the aid of the open source software ImageJ.This work demonstrates that the thresholdbased pore analysis of the material correlates remarkably well with the results of the nondestructive test meth od.However, it is advisable to determine the porosity of the material before the prepara tion by applying the Archimedes principle.Thus, reference values for the materialo graphic preparation are available and it is ensured that the image of individual pores to be examined is unaffected in the ground plane to the greatest possible extent.
Another finding is that, owing to the pres ence of a second phase in the form of pores, the grain boundary analysis by edgebased watershed transformation re sults in an oversegmentation of the micro structural image of the ceramic.It can be concluded from this that this segmentation variant is primarily suitable for singlephase materials.
Based on the application of the WEKA algo rithm to the examined sample, it could fur thermore be observed that it is, in principle, suitable for the analysis of the microstructure of multiphase materials.However, special attention has to be paid to sharp, not widely dispersed grain and phase boundaries in order to avoid an oversegmentation of the grain boundaries.This can be achieved by a chemical etching process such as Muraka mi etching or by reduced etching times and/ or temperatures during thermal etching.The greatest strength of this algorithm is demon strated when it is used for the examination of micrographs of materials with different phases as it may generate, quickly train, and segment several color and gray scale areas.In order to offer a better protection of the extracted data from wrongly segmented image regions, it is recommended that a distribution check in the form of a chi² test is performed to test the fit of the lognormal distribution.
Another aspect discussed was the pos sibility to couple the WEKA algorithm and the watershed transformation.In this case, the probability maps from the pixelbased segmentation are used for the watershed transformation.It was shown that both an oversegmentation and grain boundaries with a too wide segmentation are thus avoided.

Figs. 2 a
Figs. 2 a and b: Relative frequency of the pores (a) and corresponding number distribution sums (b).Bilder 2 a und b: Relative Häufigkeit der Poren (a) und die dazugehörigen Anzahlverteilungssummen (b).

Figs. 6 a
Figs. 6 a and b: Relative frequency of the grain size for the images with 50× (a) and 150× (b) objective, respectively, for the watershed transformation, the WEKA algorithm, and the line intercept method.Bilder 6 a und b: Relative Häufigkeit der Korngröße bei den Aufnahmen mit 50× (a) bzw.150× (b) Objektiv für die Wasserscheidentransformation, dem WEKA-Algorithmus und dem Linienschnittverfahren.
Percentiles of the number distribution sum of the grains based on the Feret diameters as a function of the magnification and the segmentation method.