## 2 Materials and Methods
### Defect Shape Analysis  
To further analyze the results of reconstructed images, we extracted the contour of defects from the reconstructed images using the two methods and the real contour of defects. Then, all contours were put into one image together for comparison. The comparison results of the defect shape are shown in Figure 12.  
As shown in Figure 12, the red line represents the actual contour, the blue line represents the contour extracted from the EBSI result, and the green line represents the contour extracted from the result of the proposed method. The comparison results clearly show that the blue contour is always much larger than the red contour, but the green contour is always closer to the red contour. It reflects that the contour extracted from the reconstructed image using the proposed method is much more similar to the actual contour. In order to quantitatively calculate the imaging accuracy of the proposed algorithm, a confusion matrix is introduced to evaluate the quality of reconstructed image [37]. The confusion matrix contains information about the actual and predicted classification done by an imaging algorithm. As shown in Table 3, TP indicates the area is correctly predicted as defects. FN indicates the area is incorrectly predicted as normal wood. FP indicates the area is incorrectly predicted defects. TN indicates the area is correctly predicted as normal wood. As shown in Figure 13, the confusion matrix can effectively represent the overlap of two figures. Statistical characteristics such as accuracy, precision, and recall can be calculated as follows:  
\[\text{Accuracy}=\frac{\text{TP}+\text{TN}}{\text{TP}+\text{TN}+\text{FP}+ \text{FN}} \tag{10}\]  
Figure 11: Proportion of defective area from the reconstructed images using different methods for all samples. \begin{table}
\begin{tabular}{c c c} \hline \hline  & **Predict Defects** & **Predict Wood** \\ \hline Real defects & TP & FN \\ Real wood & FP & TN \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Four kinds of classification in confusion matrix. TP indicates the area is correctly predicted as defects. FN indicates the area is incorrectly predicted as normal wood. FP indicates the area is incorrectly predicted defects. TN indicates the area is correctly predicted as normal wood. \[\text{Precision}=\frac{\text{TP}}{\text{TP + FP}} \tag{11}\] \[\text{Recall}=\frac{\text{TP}}{\text{TP + FN}} \tag{12}\]  
Figure 12: Comparison of the results of the defect shapes. Accuracy, precision, and recall of EBSI and the proposed method for all of the given samples are shown in Figure 14. The recall of the two algorithms is close to 100%. It indicates that both of the algorithms can detect the location of internal wood defects, and the contours of the reconstructed images using the two algorithms can cover the true defective contour. Therefore, compared with recall, accuracy and precision are able to reflect the quality of the reconstructed images better in this field. It can be found that the accuracy of the proposed algorithm is higher than that of the EBSI algorithm for each sample. Especially for sample 5, the accuracy of the proposed algorithm is 30% higher than that of EBSI algorithm. It indicates that the proposed algorithm has more advantages in dealing with complex defects. The average accuracy of the proposed algorithm is 86.9%, while the average accuracy of EBSI algorithm is only 78.0%. In addition, the precision of the proposed algorithm is also higher than that of the EBSI algorithm for each sample. The precision of the two algorithms is low when dealing with sample 5 or sample 8. It indicates that both of the methods overestimate the size of real defects, especially for complicated defects, and this result is consistent with the results of defect area analysis in the previous paper. In general, the accuracy and precision show the high quality of the reconstructed images using the proposed algorithm. Figure 14: Comparative data of accuracy, precision, and recall for all samples. Figure 13: Illustration of the confusion matrix.