**1. Introduction**

Predicting, comprehending, and monitoring the microstructure and mechanical properties, such as heterogeneous microstructure, ductility decreases, the concentration of residual stress, brittleness, and deterioration of toughness, of critical structures, such as heat exchangers, power plants, the oil and gas industry, chemical engineering, and especially nuclear power plants, is important to ensure safety and avoid failures that can lead to environmental disasters, causalities, and financial losses. To prevent and avert such risks, and to ensure the continued safety and integrity of these structures, periodic inspections are required [1–4].

Numerous non-destructive methods can be used for microstructure characterization. In most cases, non-destructive testing cannot directly determine material characteristics, which are established by destructive testing. To quantify material properties non-destructively, non-destructive methods must be correlated with destructively measured standard data. The limitation and disadvantage of destructive methods are that they do not allow the characterization of the evolution of material properties of the same specimen when successively damaged [3], and they are not easily applicable to characterize the mechanical behavior of materials, if possible, with restricted, difficult and expensive access, even using a numerical simulation, such as the finite element method.

The finite element method is used to analyze the relationship between the load, stressstrain, and resistance to failure of a structure [5–8]. Meanwhile, according to conventional studies, the size and shape of the microstructure affect the strength, toughness, and creep

**Citation:** Lee, J.; Berkache, A.; Wang, D.; Hwang, Y.-H. Three-Dimensional Imaging of Metallic Grain by Stacking the Microscopic Images. *Appl. Sci.* **2021**, *11*, 7787. https://doi.org/10.3390/ app11177787

Academic Editors: Carosena Meola and Adel Razek

Received: 20 July 2021 Accepted: 23 August 2021 Published: 24 August 2021

**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

**Copyright:** © 2021 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/).

resistance of the structure [9–11]. However, it is not easy to reflect and demonstrate this with the finite element method [12–15]. This is because the factor used in the finite element method is the shape of the structure and does not include the microstructure of the structure itself. Therefore, we have not yet seen an example in which the size of the microstructure is inserted as an analysis condition in the finite element method (or two-dimensional analysis). Therefore, in order to analyze the shape and size of the microstructure, it is necessary to express the shape of the grain in three dimensions. On the other hand, the size and shape of the grains affect the analysis results of non-destructive tests [16–19], such as ultrasonic testing, magnetic particle testing, and eddy current testing. For instance, in the case of ultrasonic examination, research results have been reported that the size and shape of the microstructure influence the scattering of the sound [20]. However, analysis or qualitative matters considering only the average size of the microstructure are reported in [21], and it is difficult to find previous studies on ultrasound wave scattering targeting the size and shape of the actual microstructure. In the magnetic particle inspection method, the sample is magnetized, and the adsorption of magnetic particles by the magnetic flux leakage generated around the defect is observed. At this point, if a strong external magnetic field is applied and then removed, residual magnetization occurs. A similar fault signal is generated, in which magnetic particles are adsorbed even in non-defective areas due to residual magnetization [22–24]. Even though the deformation caused by an external force causes the magnetic moment inside the magnetic domain to be anisotropic in a specific direction and, therefore, residual magnetization occurs even if an external magnetic field is not applied [25–27]. In addition, residual magnetization is frequently generated in welds where heat and residual stress are generated by an external force. In the eddy current method of inspection, an induced current is applied to an object to be measured, and the distortion of the induced current occurring around a fault, that is, a change in impedance and a different phase due to eddy currents is measured [28,29]. However, it is difficult to determine the presence or size of a defect due to the edge effect that occurs at the end of the object to be measured [30]. This means that even when the grain is needle-shaped or the shape changes rapidly, the eddy current signal can be affected. It is important to provide a means of quantitatively measuring and expressing the three-dimensional shape of a grain in order to grasp the effects of such effects, i.e., the formation of magnetic domains, residual magnetization, and the effects of edge according to the shape and size of the grain. According to nano-radiography and tomography, the metal grain can be imaged in three dimensions [31,32]. Nevertheless, this requires very high accuracy and expensive equipment, including X-ray shielding. Furthermore, it is difficult to measure the distribution of magnetic domains within the grain in three dimensions. In addition, under the heat treatment influence, the application of external field and mechanical stress can rearrange the martensite variant and can change the magnetic domains. It is important to understand their effect not only at the macroscopic level but also at the microscopic level [33–36]. In this context, the use of an alternative method to overcome the limitations of non-destructive testing (NDT) techniques can make a valuable contribution to the characterization of materials and the evaluation of microstructure performance through rapid and efficient experiments and simulations. In this paper, we present a method to reproduce the real shape and size of the grains of the tested sample SA106 by pilling up two-dimensional images obtained by a metal microscope. To achieve this target, we introduce fixtures, procedures, and software algorithms based on mathematical formulas.

Several studies have previously developed 2D and 3D techniques to construct a way to study microstructure using different experimental and simulation techniques. The results of these studies lead to a good outcome that provides access to crucial structural information of the investigated materials, which facilitates and enhances the understanding of physical and chemical concepts at the microscopic level [37–43].

However, we have not seen any work similar to our work, which allows the reconstruction, extraction, and selection of one or more grains with the exact shape and size of the inspected material, without using extensive software and hardware, but just simple

equipment and some algorithms. It should be emphasized that the method presented here permits: (1) 3D grain shape obtaining; (2) using conventional research laboratory environment; (3) easy preparing specimens; (4) multi-parallel data acquisition; (5) easy 3D image processing. This is particularly important for the industry and research laboratories.

The finding is encouraging for the near future application of the method for the analysis of 3D stress, strain deformation at grain level, and the analytical study of nondestructive evaluations using electromagnetic and ultrasound testing.

#### **2. Specimen and Layer Capture**

In this study, carbon steel SA106 was targeted. The sample was cut and cropped to a small volume of 25 × 9 × 25 mm (width × length × height), respectively, and mounted on a cylindrical resin with a diameter of 35 mm and a height of 27 mm. Then, the observation side and the backside of the mounted specimen were polished to be exposed outside the resin. This allows the "polished" height to be measured more accurately when viewed under a microscope. In other words, when measuring the height of the sample with a micrometer after polishing, errors likely to be caused by compression of the resin can be avoided when the resin is used as a measurement reference and not the surface of the sample. As shown in Figure 1a, the side surface was polished to deflect by 1.84 mm. This deflected side surface (hereafter "key-hole") was used as a reference surface for microscopic observation. Figure 1b is a jig for uniform grinding of the key-hole, and Figure 1c is a template (state) in which the key-hole is polished in the sample mounted in the jig. Figure 1d illustrates these mounted samples; they are inserted into the X-Y stage holder under the microscope and are fixed by a key (expressed in black in the figure). Due to this structure, the area observed by the microscope can fix the measurement surface with a repeatability of the order of 10 to 20 μm.

**Figure 1.** Specimen adjustment to reduce positioning error. (**a**) Mounted specimen; (**b**) Jig for keyhole; (**c**) After grinding Mounted specimen; and (**d**) Set specimen on the XY-stage using the key and key-hole.

The observation surface was polished using SiC polishing pads FEPA P200, P400, P800, P1200, and P2000. The last stage, P2000, has a grid size of 10.3 μm. Finally, fine polishing was carried out for 20 s using polishing cloths and polycrystalline diamond paste having a grid size of 1 μm. Once the micro-polishing was completed, an etchant solution obtained by diluting with nitric acid 3 g in 65 g ethanol was exposed onto the observation surface for 5 s, followed by ultrasonic cleaning with distilled water for 15 s and then cleaning with ethanol for 10 s. This chemical etching was performed a total of three times. The height of the four sides of the test sample was measured with a micrometer having an accuracy of ±0.01 μm, visualized through the microscope (500×), and recorded on the laptop. The observation by the microscope was repeated while repeating fine polishing, chemical etching, as well as the height measurement and can be directly linked to the 3D image processing. A total of 60 fine polishes were performed; Table 1 shows the heights measured in each layer.


**Table 1.** Height of the polished sample at each layer.


**Table 1.** *Cont.*

#### **3. Algorithms for 3D Imaging of Grains and Results**

#### *3.1. Local Positioning*

As mentioned above, the main goal of this study is to image MG in 3D. To reach our purpose, micrographs are taken while repeatedly polishing. At this time, the height information measured by the micrometer is taken as the *z*-axis. Then the location of the boundary of a specific MG selected in the photo is stored as the *x-y* coordinates. Therefore, it is possible to obtain three-dimensional coordinates for the node representing the boundary of the MG.

However, as the experimental methodology seems very simple, a challenge associated with this technique is a positional error within ±7 μm that occurred when the specimen was polished, and the same area was observed, even though we used very accurate equipment to avoid this (backlash play), because of the high special-resolution used (2 μm). As an example, Figure 2 is a photograph (hereinafter, *n*th layer photo) taken after polishing an area of 130 × 98 μm three times, four times, and fifth times, respectively, using a microscope at a magnification of 500. For mutual comparison, a white line with a + mark is indicated in the center. Based on the 3rd layer, the position of the 4th layer is shifted to the upper left. Further, based on the 4th layer, the 5th layer has moved to the right. Meaning the photos of each layer are not in the same position.

**Figure 2.** Microscopic photograph of the polished layers. (**a**) 3rd layer; (**b**) 4th layer; and (**c**) 5th layer.

To correctly stake the images, improve the accuracy, and achieve high precision of the final desired result, we have developed and used a set of algorithms that automatically corrects these positional errors. Figure 3a is an *n*th layer and is used as a reference. Figure 3b is a target as the (*n* + 1)th layer. Each microscope image is composed of 1536 and 2048 pixels in the row and column directions, respectively. The horizontal column is the *x*-direction, and the vertical row is the *y*-direction. The origin of the coordinates is (1,1), which is left-top based on the pixel, and the last coordinate is (2048,1536), which is the right-bottom.

**Figure 3.** Area selection for local positioning. (**a**) Reference picture *n*th layer; (**b**) Target picture (*n* + 1)th layer.

The (*x*1, *y*1) and (*x*2, *y*2) shown in Equation (1) are the vertices in the diagonal direction of the area selected to apply the local positioning algorithm. Δ*x* and Δ*y* are the lengths of the horizontal and vertical sides of the analysis area. In the case of Figure 3a, (251,201) and (1900,1300) are the vertices, and the region of Δ*x* = 1650 and Δ*y* = 1100 is selected.

$$\begin{aligned} \Delta \mathbf{x} &= \mathbf{x}\_2 - \mathbf{x}\_1 \\ \Delta y &= y\_2 - y\_1 \end{aligned} \quad \text{(1)}$$

In Equation (2), the region of Figure 3a was selected from the first layer photo, which means that it was used as a reference photo. In other words, when stacking the photos, they should be positioned with the first one defined as the reference. In addition, Equations (3) and (4) involve selecting a region to be analyzed with respect to the reference photo in the second layer photo, which is a target for local positioning. Select a total of cases from the domain of (*x*<sup>1</sup> − *h*, *y*<sup>1</sup> − *h*) and (*x*<sup>2</sup> − *h*, *y*<sup>2</sup> − *h*) to the domain of (*x*<sup>1</sup> + *h*, *y*<sup>1</sup> + *h*) and (*x*<sup>2</sup> + *h*, *y*<sup>2</sup> + *h*). Where *h* represents the maximum position error of each layer. Figure 3b is the case of *h* = 100, which is a schematic diagram of the selection of a total of 40.000 cases from the domains of (151,101) and (1800,1200) to the domains of (351,301) and (2000,1400).

$$\begin{bmatrix} P^1\_{\Lambda x \Lambda y} \end{bmatrix} = \begin{bmatrix} P^1\_{ref} \ (\mathbf{x}\_1 : \mathbf{x}\_2, y\_1 : y\_2) \end{bmatrix} \tag{2}$$

$$\mathbb{E}\left[P^{2}\_{\Lambda x \Lambda y}(i,j)\right] = \left[P^{1}\_{\text{target}}(x\_1 + i : x\_2 + i, y\_1 + j : y\_2 + j)\right] \tag{3}$$

$$
\mathbf{h} - \mathbf{h} \le \begin{pmatrix} \mathbf{i}, \mathbf{j} \end{pmatrix} \le +\mathbf{h} \tag{4}
$$

Equation (5) denotes *S*1(*i*,*j*), the sum of the absolute values of the differences between each element of the matrix of the selected region in the reference photo and the target photo, respectively. Equation (6) denotes the row Δ*X*<sup>2</sup> and column Δ*Y*<sup>2</sup> having the minimum value in *S*1(*i*,*j*). In this instance, (Δ*X*1, Δ*Y*1) = (0, 0). Furthermore, the minimum value of *S*1(*i*,*j*) is generated at the position where the reference photo and the target photo almost coincide.

$$S\_1(i,j) = \sum\_{(x,y)=(1,1)}^{(\Lambda x \Lambda y)} \left[ abs\left( \left[ P\_{\Lambda x \Lambda y}^1 \right] - \left[ P\_{\Lambda x \Lambda y}^2(i,j) \right] \right) \right] \tag{5}$$

$$\left[\left[\Delta X\_{2\prime}\Delta Y\_{2}\right] = \min\left(S\_{1}(i,j), \left\{(i,j) \in \pm h\right\}\right)\right] \tag{6}$$

Thereafter, as shown in Equations (7)–(9), the reflecting region in the *n*th layer photo becomes the reference, and the local positioning is repeated by comparing it with the target (*n* + 1)th layer photo. Using this process along with Δ*Xn* and Δ*Yn* for each layer obtained using Equation (10), the region of interest of the first layer photo, to be the same region as the other target photos, each local positioning of the region having *X*1,*Y*<sup>1</sup> and *X*2,*Y*<sup>2</sup> as the diagonal vertices layer, can be observed, as shown in Equation (11).

$$\mathbb{E}\left[P\_{\text{Ax}\Delta y}^{n}\right] = \left[P\_{\text{target}}^{n}(\mathbf{x}\_{1} + \Delta \mathbf{X}\_{n} : \mathbf{x}\_{2} + \Delta \mathbf{X}\_{n}, y\_{1} + \Delta \mathbf{Y}\_{n} : y\_{2} + \Delta \mathbf{Y}\_{n})\right] \tag{7}$$

$$\left[P\_{\text{Ax}\Delta y}^{n+1}(i,j)\right] = \left[P\_{\text{taryet}}^{n+1}(\mathbf{x}\_1 + i : \mathbf{x}\_2 + i ; y\_1 + j : y\_2 + j)\right] \tag{8}$$

$$S\_n(i,j) = \sum\_{(x,y)=(1,1)}^{(\Lambda x \Lambda y)} \left[ abs\left( \left[ P\_{\Lambda x \Lambda y}^n \right] - \left[ P\_{\Lambda x \Lambda y}^{n+1}(i,j) \right] \right) \right] \tag{9}$$

$$\left[\Delta X\_{n+1\prime}\Delta Y\_{n+1}\right] = \min\left(S\_n(i,j), \left\{(i,j)\in \pm h\right\}\right) \tag{10}$$

$$\mathbb{E}\left[P\_{\text{align}}^{\text{n}}\right] = \left[P\_{\text{target}}^{\text{n}}(X\_1 + \Delta X\_n : X\_2 + \Delta X\_{\text{n}}, Y\_1 + \Delta Y\_n : Y\_2 + \Delta Y\_n)\right] \tag{11}$$

On the other hand, *X*1, *X*2,*Y*1,*Y*<sup>2</sup> of Equation (11) to be selected for observing the change of a specific cross section of the MG are independent of *x*1, *x*2, *y*1, *y*<sup>2</sup> of Equations (1), (2), (7) and (8), which were selected for local positioning. As an example, local positioning was performed at (*x*1, *y*1) = (250, 200), (*x*2, *y*2) = (2000, 1000), Δ*X*<sup>17</sup> = 55 and Δ*Y*<sup>17</sup> = 167 in the 3rd layer photo in Figure 4a,c. Further, values of Δ*X*<sup>18</sup> = 35 and Δ*Y*<sup>18</sup> = 170 were obtained in the 4th layer photo of Figure 4b,d. Then, by adjusting (*X*1, *X*2,*Y*1,*Y*2), an area of 1700 × 1200 pixels in Figure 4a,b, and also 420 × 420 pixels in Figure 4c,d were selected, respectively.

**Figure 4.** Microscopic photographs with local positioning in a certain area. (**a**) 17th layer, (55,167) (1754,1368); (**b**) 18th layer, (35,170) (1734,1369); (**c**) 17th layer, (701,161) (1120,560); and (**d**) 18th layer, (681,164) (1100,583).

#### *3.2. Selection and Binarization*

In order to select a specific MG and image it in 3D, it is necessary to select the boundary surface of the corresponding MG. First, a point inside a specific MGF is read, it is called point-1, and the brightness of the corresponding coordinate is read. Next, a point is read in the boundary area, it is called point-2, and the brightness of the corresponding coordinate is read. Half of the difference between the two coordinates is used as the threshold, and the resulting ones are separated into a double collection of pixels (two levels of color), namely bright and dark. If it is bright, it is replaced by "1", and if it is dark, it is replaced by "0".

After fixing the column at point-1, the row with the first 0 is read while shrinking the row. In Figure 5a, the horizontal direction is the column, and the vertical direction is the row. The column number increases as the column moves to the right. On the other hand, the row number increases as the row goes down. Hence, the upward arrow in Figure 5b means that the row becomes smaller. Therefore, the starting point of the boundary can be found by adding 1 to the row where the first 0 occurs. Furthermore, according to the micrograph, voids may occur in the layer or be expressed as black dots (points) due to decidualization. The presence of these dots may confuse the position of the first zero in the row. As a matter of fact, in this study, as can be seen in Figure 5c, all the small "0" surrounded by the wide distribution of "1" were changed to "1". By these measures, the black dots inside each layer in Figure 5b become collectively "1", as depicted in Figure 5c, such that the position of the boundary can be clearly found.

**Figure 5.** Algorithms for selection, binarization, and boundary extraction. (**a**) Select a structure and background; (**b**) Boundary extraction with voids; (**c**) Boundary extraction without voids; and (**d**) Boundary extraction algorithm.

Figure 5d is a diagram explaining the algorithm for finding the coordinates of the boundary after finding the starting point of the boundary by the algorithm of Figure 5c. We know the positions of the 'first 0 and 'last 1 . The presence or absence of "1" and "0" is checked in four adjacent pixels. There are four cases. Point-1 moves to the upper side and

stops at the boundary of "1" and "0", so it is the fixed condition. We can assume four cases, including this fixed condition, right upper, and right side will be 1-1, 0-1, 0-0, 1-0. In the case of 0-1, the boundary is to the right, as shown in the following case of the breakpoint in Figure 5d. In the case of 1-1, the boundary will be right-side up, as shown in the following case of 0-1 in Figure 5d. In the case of 0-0, as shown in Figure 5d, the peak at the following arrows. The MATLAB command boundary is used.

#### *3.3. Nodes and Stacking*

When the metallographic microscope used in this paper is set to 500× magnification, the resolution per pixel is approximately 0.063 μm; the micrometer accuracy for measuring the height is 0.01 μm. Consequently, the boundary expressed by the (*x*,*y*) coordinates obtained from the MG picture is drawn with a relatively large number of nodes compared to the height *z*, and higher spatial resolution than necessary. This reduces the computational speed during three-dimensional imaging, as well as forming needle-like surfaces up and down. To overcome this problem, if the number of nodes forming the boundary is reduced, the shape of the layer may be distorted. Accordingly, in this section, we examined how effective it is to reduce the number of nodes forming the boundary of the organization.

Let the pixels of the camera (microscope) be as defined by Equation (12). Generally the ratio of vertical and horizontal pixels is such that *m*/*n* = 4/3. The spatial resolution of the image, which can be obtained using the microscope, depends on the optical lens system and can be expressed by Equation (13).

$$R\_c = m \times n \quad \text{(pixels)}\tag{12}$$

$$R\_p = w \times h \quad (\text{\textmu m}) \tag{13}$$

where *w* and *h* are the width and height of each image. The quantitative distance between each pixel can be derived from Equation (14)

$$P = w/n \quad \text{(\text{\textquotedbl{}pm/\textquotedbl{}}\text{\textquotedbl{}}\text{\textquotedbl{}}\text{\textquotedbl{}}\text{\textquotedbl{}}\text{\textquotedbl{}})} \tag{14}$$

Here we were using *m* = 2048 and obtaining *w* = 130 (μm). Therefore, *P* would be 130/2048 (μm/pixels), corresponding to 0.063 (μm/pixels). However, as indicated in Table 1, the height of each layer after polishing was 1–2 μm. If we use *P* = 0.063 (μm/pixels), the lateral surface of the crystal will be expressed as shallow needle-like squares, and the surface lacks uniformity, due to the small value of *P*. In order to reproduce the result well, we defined *P* as expressed in Equation (15), with *P* = *P* × *r* and *r* = 30 ∼ 60.

$$P' = w'/n' \quad (\text{\textmu m/pixels}) \tag{15}$$

Figure 6a is a polygonal figure drawn by the boundary coordinates obtained by the above-mentioned algorithm using the picture shown in Figure 4c. There are 3084 polygonal vertices, represented by solid blue lines. Then, the polygons expressed by 1028 vertices skipping three each were expressed by green dot-lines, and the polygons expressed by skipping nine by 343 dots were expressed by circular lines marked in red. A black dot-line is a polygon expressed by 114 dots that are skipped by 27. In the case of a bay with a complex shape located above the structure, it cannot be expressed by the number of vertices being skipped by 27, but the shape of the bay can be expressed by the marked red circular solid line that is expressed by skipping every nine. This means that detailed regions of the structure can be expressed with a spatial resolution of about 0.57 μm. Meanwhile, Figure 6b shows the area of the polygon as a function of the number of vertices of the polygon. The area of the polygon drawn with 114 vertices by skipping 27 is reduced by about 50%; however, when less than 13 are skipped, the area ratio hardly changes. Therefore, in this study, a boundary with a spatial resolution of 0.57 μm was applied by skipping nine each.

**Figure 6.** Changes of shape and area due to reducing the number of nodes which consists of the boundary. (**a**) Shape changes; (**b**) Area changes.

Figure 7a–d shows the boundary with a spatial resolution of 0.57 μm of the microscope's *xy* section image for the shape of three layers (#1, #2, #3) along the *z*-axis height, respectively, which is the result of extraction. In the case of #1 and #2, we see an example of a layer that gradually narrows in width as it is polished. If the layer of #1 in Figure 7d becomes smaller, this means that it can be eventually be divided into several layers as in #2. Figure 8a–c is the results of stacking by extracting the coordinates of the layer's boundaries #1, #3, #5, and #6 by height. #1 indicates a shape in which the cross-sectional area increases gradually and then decreases again. #3 decreases gradually, and at the same time, #5 increases gradually, and #6 appears. Figure 8d is a top view, and #2 and #3 partially overlap to show that a part of the organization has been merged. On the plus side, the upper part of #1 represents a phenomenon in which the layer is separate as the polishing proceeds into a state in which the upper left layer is integrated.

(**a**) (**b**)

**Figure 7.** *Cont*.

**Figure 7.** Boundaries at several layers. (**a**) 3rd layer; (**b**) 7th layer; (**c**) 10th layer; and (**d**) 26th layer.

**Figure 8.** *Cont*.

**Figure 8.** Stacking boundaries at each height. (**a**) Stacking of #1; (**b**) Stacking of #3; (**c**) Stacking of #5; (**d**) Stacking of #6; and (**e**) Top-view of stacking boundaries with four grains.

#### *3.4. Post-Processing*

The above result is the stacking of the boundary in each layer, and to understand it as a volume, it is necessary to form a surface connecting the coordinate point of the boundary and the position of the adjacent height. In this study, the results shown in Figures 9 and 10 was obtained using "alpha Shape", a function that creates a boundary area or volume surrounding a set 2D or 3D point in MATLAB. This 3D graphical function may help to understand the layer or MG by imaging the shape of the layer in 3D.

**Figure 9.** Three-dimensional imaging of microstructure. (**a**) 3D image of #1 including layer-8; (**b**) 3D image of #1 except layer-8.

Due to the large grain selected in layer 8, as shown in Figure 9, it is difficult to understand the original shape of the 3D image. Furthermore, we do not know which data is correct in layer 8, that is to say, whether it is connected to the neighboring grain or not. Therefore, we have to compare four figures, namely the original microscopic image, the extracted boundary image, and two types of stacked volumetric images. The reconstructed 3D grains volume is illustrated in Figure 10.

**Figure 10.** Three-dimensional volumetric imaging of grains with except discontinuous layers. (**a**) 3D image of #1; (**b**) 3D image of #3; (**c**) 3D image of #6; and (**d**) 3D image of three grains.

#### **4. Discussion**

In this study, a method and its implementation algorithm for the three-dimensional observation of the microstructure of carbon steel (SA106) was proposed while explaining and illustrating its principle.

The visualization of the shape of the 3D grains with simple equipment, namely a polishing machine, a metallurgical microscope, and some algorithms, is a great advantage. Moreover, it is inexpensive and easy to implement due to its simple technique and does not involve extensive hardware and software.

While the mounted object was being polished, a photograph of the layer was taken using a metallurgical microscope. Subsequently, the metallic MG was reconstructed in three dimensions by assembling and processing the collected 2D images through local positioning, MG selection, binarization, resizing, stacking (superimposing), and surfacing, which provides very accurate data. The assembly and processing techniques are based on mathematical formulae as described above; the program derived from these formulae is straightforward. It is easily accessible and provides a quick result, making it a simple resource to operate and can be implemented in general-purpose software, e.g., MATLAB, C, C++, Python.

As shown in the example in Figure 6, the MG image is designed by a large number of nodes and will require a lot of computational power. To overcome this, skipping is necessary. However, there is a limit, which should not be exceeded, to not compromise the accuracy of the final results. Skipping by nine, in this case, leads to both minimal resources simulation time and accurately obtained results. Organizational photos may contain personal opinions. In other words, the shredded pieces may, in fact, be the tip of a large layer. If this personal subjectivity is expressed in three dimensions, a somewhat objective judgment is possible.

Notwithstanding non-destructive testing techniques, three-dimensional imaging grains will be one of the most widely used techniques in the near future. Firstly, for its numerous advantages listed in the introduction. Another interest is to be able to reconstruct the shape of the microstructure, which may allow the evaluation and prediction of the material's behavior under stress, damage, heat treatment effects, etc., and a variety of research has been carried out in this area [19,44,45].

The reconstructed 3D grains volume, as illustrated in Figure 10, from the processed 2D images is of significant interest and may be useful for our future research in the field of non-destructive evaluation using mainly electromagnetic and ultrasonic testing to better understand structural properties at the microstructural level. In addition, the generation of a three-dimensional grains structure may also broaden the scope of applications, especially in the field of materials science, designing structural materials, and investigation of engineering materials.

In the last few years, thanks to numerical models and the increase in computing and processing capacity, it has become possible to obtain precise models and simulations of complex material properties, especially microstructures, using advanced software and modeling techniques [46–48]. The software algorithms developed under MATLAB employed are complementary to the experimental work, and the combination of the two leads to more accurate and realistic grain representations with a very acceptable simulation time. In addition, the method allows the creation of microstructures with the exact shape and size of the grains and offers the possibility of selecting one or more grains, as illustrated in Figures 7, 8 and 10.

#### **5. Conclusions**

Three-dimensional imaging of metallic grain by stacking the microscopic images was successfully applied to obtain 3D grain volume from processed 2D images. This method can be applied as a useful tool for the characterization of metal grains. It is ready to be used in industrial steel applications. It has been pointed out that the method presented here allows quick and easy use. Furthermore, it does not require many experimental resources.

An efficient technique to avoid positional errors in image piling has been established. Owing to the size of a wide number of nodes, an alternate method was adopted and presented without jeopardizing the precision of the results.

The research finding confirmed that the 3D imaging technique would be suitable for the mechanical properties and also very interesting and promising for studying the visualization of 3D magnetic domains, which is the next step of this research.

Algorithms and experimental techniques are constantly being refined to further improve and enhance the reliability and efficiency of the desired 3D microstructures.

**Author Contributions:** Conceptualization, J.L.; methodology, J.L., A.B. and Y.-H.H.; software, A.B., J.L. and D.W.; validation, A.B. and J.L.; formal analysis, A.B., J.L. and Y.-H.H.; investigation, J.L. and A.B.; resources, J.L. and D.W.; data curation, J.L., A.B. and D.W.; writing—original draft preparation, A.B. and J.L.; writing—review and editing, A.B. and J.L.; visualization, D.W. and J.L.; supervision, J.L.; project administration, J.L.; funding acquisition, J.L. This paper was prepared with the contributions of all authors. All authors have read and agreed to the published version of the manuscript.

**Funding:** This work was supported by the National Research Foundation of Korea (NRF) grant funded by the Korea government (MSIT) (No.NRF-2019R1A2C2006064).

**Institutional Review Board Statement:** Not applicable.

**Informed Consent Statement:** Not applicable.

**Data Availability Statement:** Not applicable.

**Conflicts of Interest:** The authors declare no conflict of interest.

#### **References**

