# Three-Dimensional Imaging of Metallic Grain by Stacking the Microscopic Images
## 3 Algorithms for 3D Imaging of Grains and Results
### Nodes and Stacking  
When the metallographic microscope used in this paper is set to 500\(\times\) magnification, the resolution per pixel is approximately 0.063 \(\upmu\)m; the micrometer accuracy for measuring the height is 0.01 \(\upmu\)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\ \ \ (\text{pixels}) \tag{12}\]  
\[R_{p}=w\times h\ \ \ (\upmu\text{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\ \ \ (\upmu\text{m/pixels}) \tag{14}\]  
Here we were using \(m=2048\) and obtaining \(w=130\ (\upmu\text{m})\). Therefore, \(P\) would be 130/2048 \((\upmu\text{m/pixels})\), corresponding to 0.063 \((\upmu\text{m/pixels})\). However, as indicated in Table 1, the height of each layer after polishing was 1-2 \(\upmu\text{m}\). If we use \(P=0.063\ (\upmu\text{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^{\prime}\) as expressed in Equation (15), with \(P^{\prime}=P\times r\) and \(r=30\sim 60\). \[P^{\prime}=w^{\prime}/n^{\prime}\ \ \ (\upmu\text{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 \(\upmu\text{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 \(\upmu\text{m}\) was applied by skipping nine each. Figure 7a-d shows the boundary with a spatial resolution of 0.57 \(\upmu\)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.