# A Multiscale Approach to the Numerical Simulation of the Solid Oxide Fuel Cell
## 3 Microstructure Analysis and Quantification
### Segmentation of the Microstructure  
The SEM images were resampled, cropped, stacked and aligned in the Avizo 3D analysis software (version 9.2.0, FEI, Hillsboro, OR, USA). However, the result is a set of raw images, with no information about the phases. Therefore, the segmentation procedure is required. The segmentation is a process of assigning every one of the voxels from the images stack to one of the electrodes' structural phases.  
The segmentation is often done manually. This is a difficult and time-consuming task. Therefore, we want to propose a simple framework for the semi-automatic segmentation procedure. The Fiji distribution of the open source image analysis software ImageJ (version 1.52i, National Institutes of Health, Bethesda, MD, USA) [42,43] is primarily used to perform this task, together with the several in-home scripts in the Python programming language, with an extensive use of the scikit-image image processing library [44]. The procedure is illustrated in Figure 5 on an example of the cathode segmentation. The semi-automatic segmentation algorithm, shown in Figure 5, may be summarized as follows:  
1. The homomorphic filter [45] with the high- and low-frequency filters (\(\gamma_{1}=0.1\), \(\gamma_{2}=0.25\)) and the Gaussian filter (\(\sigma=10\)) is applied in order to equalize the brightness of the images (in-house script).
2. The enhance contrast tool (with options: normalize, equalize histogram, use stack histogram) is used to underline the differences between the phases (Fiji).
3. The unsharp masking (\(\sigma=1.0\), mask weight 0.6) is utilized to sharpen the image (Fiji).
4. The Gaussian blur (\(\sigma=2.0\)) is used in order to remove the artifacts, which appear at the phase boundaries (Fiji).
5. The Kuwahara filter (sampling window 5) is exploited to smooth the images and to remove further artifacts (Fiji).
6. The statistical region merging algorithm (\(Q=30\)) [46] is used for the initial recognition of the phases (Fiji).
7. The unsharp masking and the Kuwahara filter with parameters the same as the above are applied to the images (Fiji).
8. The Trainable Weka Segmentation tool (version 3.2.32, see Reference [47] for further details), which utilize the artificial neural networks and machine learning algorithms to automatically segment the images, is used to recognize the phases (Fiji). The following training features were  
Figure 4: Configuration of the FEI Versa 3D FIB-SEM apparatus.  
chosen: Gaussian blur (\(\sigma_{\rm min}=1.0\), \(\sigma_{\rm max}=8.0\)), Laplacian, Hessian, Structure, and Edges. The fast version of the random forests machine learning algorithm is utilized to recognize the phases. The Weka software requires some training data, therefore a few images were segmented manually.
* The Kuwahara filter is applied again (Fiji).
* The image is recolored (the following color levels in the grayscale are required for the quantification algorithms: anode--pore 0, YSZ 127, Ni 256; cathode--pore 0, GDC 127, LSCF 256) and the bad pixels are removed (in-house script).  
The samples of the raw FIB-SEM images and the segmented images are presented in Figure 6. The result images were visually compared with the raw SEM photographs and good agreement was found.  
Figure 5: Semi-automatic segmentation procedure, on the example of the cathode FIB-SEM image.  
Figure 6: Segmentation of the FIB-SEM images.