Phased array ultrasonic S-scan testing of near-detection-surface defects based on a background subtraction algorithm

In phased array ultrasonic sector scanning testing, echoes from defects near the detection surface are often overlapped with interface echoes and cannot be characterized. Based on linear acoustic theory, a mathematical model combining the background subtraction and the sum of squares differences algorithm is established to extract the characteristics of near-detection-surface defect echoes. The upper surface of the artificial notch defect is used as a near-detection-surface defect for detection. Specially, linear interpolation algorithm is used to suppress the effect of residual interface echo on the defect echo feature extraction and the effect of different interpolation factors is analyzed. The defect location and size were calculated based on the extracted defect characteristics. The simulation and experimental results indicate that the model can effectively extract the near-detection-surface defect echoes characteristics. Furthermore, when the interpolated signal reaches at least 500 MHz, residual interface echoes can be effectively suppressed. More importantly, according to the extracted defect echo characteristics, the localization and quantitative accuracies of near-surface defects can reach 0.2 mm and 0.3 mm, respectively. These findings provide an effective strategy for phased array ultrasonic sector scanning testing of near-detection-surface defects.


Introduction
Phased array ultrasonic testing is widely used for nondestructive testing of defects in the production and processing of materials and has many imaging modes, including linear scanning imaging, sector scanning (Sscan) imaging and total focusing imaging [1]. S-scan imaging is one of the most commonly used imaging modes due to its advantages of efficiency, flexibility, and wide inspection range. It is widely used in many fields, including aerospace [2], axles and bogie frames of rail vehicles [3,4], pressure vessels and pipelines [5,6], weld in ITER vacuum vessel and reactor pressure vessel of BWR [7,8] and steam turbine blade attachment area of nuclear power plant [9]. However, when using pulsed longitudinal wave mode detection, near-detection-surface defect echoes frequently overlap with interface echoes [10], making discernment of defect characteristics difficult. Usually, one or more near-surface defect testing methods, such as those involving magnetic particles [11], eddy currents [12], ultrasonic guided waves [13], and ultrasonic surface waves [14], are used for additional detection, which is not only time-consuming but also costly.
Numerous approaches for separating these overlapping ultrasonic signals have been proposed by researchers. The commonly used approach is to improve the axial resolution of ultrasonic signals via hardware or software. Both the high-frequency probe [15] and the wide-band probe [16] can improve the axial resolution of ultrasonic signals. Unfortunately, the higher the probe frequency is, the worse the penetration of acoustic waves. Additionally, a wider band probe can excite a narrower ultrasonic pulse, resulting in lower detection Any further distribution of this work must maintain attribution to the author(s) and the title of the work, journal citation and DOI. sensitivity. Evidently, the improvement in the axial resolution of ultrasonic signals only by hardware is limited. Thus, long excitation pulses combined with signal postprocessing by software are used to improve the axial resolution of ultrasonic signals. Many postprocessing methods were proposed to separate overlapping ultrasonic signals. Honarvar et al combined Wiener filtering with autoregressive spectral extrapolation to improve the signal-to-noise ratio and axial resolution of ultrasonic signals [17,18]. However, the performance of the algorithm is greatly affected by the size of the frequency window and the order of the autoregressive calculation. Fortineau et al. and Mor et al proposed iterative and supporting pattern matching algorithm respectively to separate the overlapping ultrasonic signals [19,20]. Unfortunately, the process must construct an optimal overcomplete dictionary. Li et al integrated adaptive morphological filtering and sparse minimum entropy deconvolution to separate near-surface defect echoes [21]. However, this method is not only computationally demanding but also require further identification of the target echo from the separated echoes.
Comparing to the above-mentioned algorithms, the background subtraction algorithm has the advantages of simple principle and small computation, and can directly render the target image by eliminating the background image. Additionally, there is rare work reported on extracting near-detection-surface defect echoes from phased array ultrasonic S-scan image using background subtraction algorithm. However, the performance of the background subtraction algorithm is strongly influenced by the variation of the signal time shift. Therefore, a model integrated the background subtraction method and the sum of squared differences (SSD) is proposed to extract near-surface defect echoes from an S-scan image. The main factors affecting the performance of the model are analysed through simulation and experiment. The effect of signal interpolation on its performance is investigated. Finally, a series of notch defects with different sizes and locations are detected and analysed. The reliability of the model was confirmed by locating and quantifying the defects based on the extracted defect features.

Material preparation
In this experiment, test specimens made of SUS304 stainless steel were employed, and the structure of the defect specimen is presented in figure 1(a). To produce a near-detection-surface defect, a notch was machined in the back side of the specimen using electrical discharge machining wire cutting technology. When the upper surface of the notch is close to the specimen surface, it can be considered a near-detection-surface defect. After that, the distance H between the upper surface of the notch and the specimen surface and the width W of the notch were measured with an optical microscope. Since the clamping and deformation of the specimen during processing affect the machining accuracy of defects, a series of specimens with varying notches in terms of W and H were machined, 10 specimens of each parameter are machined to obtain specimens with the same size or location of defects, and the defect location and size measurements of the selected specimens are listed in table 1. The specimens are divided into two groups. In one, the values of W are constant and approximately half the wavelength while the values of H sequentially increase, as shown for Group 1. In the other, the values of H are unchanged while the values of W vary, as shown for Group 2. Additionally, defect-free specimens of the same size, material, and surface condition as the defect specimens were machined, as shown in figure 1(b). Figure 2(a) illustrates the phased array ultrasonic testing system used in this experiment. It consists of a phased array ultrasonic testing instrument with 32 transmit and receive channels, a 32 element linear array probe with a centre frequency of 10 MHz, and a control PC. Glycerine was used as the coupling medium. To avoid the nearfield region, the probe was mounted on a 0°wedge 20 mm in height. The specimens were tested in the S-scan longitudinal wave mode. An aperture with all elements of the probe was used to transmit and receive ultrasonic signals according to preset focus laws, and these signals were then synthesized into A-scan signals that constitute the S-scan image. The test schematic is shown in figure 2(b), and the specific test parameters are listed in table 2. Each S-scan image is composed of 101 A-scan signals with a scanning angle ranging from −25°to 25°at a 0.5°i nterval. As we were primarily interested in signals from the near-detection-surface region,130 sampling points extracted from each A-scan signal of S-scan images were processed and analysed.

Establishment of finite element models
The phased array ultrasonic S-scan test process was simulated using COMSOL Multiphysics finite element software, the simulated signals were processed, and the S-scan image was constructed using MATLAB software. To obtain the test image of the near-defection-surface defect and the background image, two two-dimensional   Defect parameters W and H are set to 0.3 mm (approximately half the wavelength) and 0.6 mm (approximately one wavelength), respectively. To optimize the calculation efficiency, the model specimen structure is merely part of the actual specimen structure. The impedances on boundaries a and b are identical to those inside the specimen to absorb acoustic waves, while the other outer surface boundaries are configured as hard sound field boundaries. Polystyrene, glycerine, and steel are specified as the materials for the wedge, coupling layer, and specimen, respectively. The transient excitation signal for the ultrasonic probe is a five-cycle Hanning window pulse with a central frequency of 10 MHz and a bandwidth of 50% 6 dB. Its waveform diagram is illustrated in figure 3(c). The other main parameters and values used in the finite element analysis are consistent with the actual test parameters shown in table 2.  figure 4(c) has a slightly longer duration than that of figure 4(d) and the echoes are extremely weak in this area. This is because the defect tip is closer to the detection surface, causing defect and interface echoes to overlap; additionally, because the width of the defect is approximately half the wavelength, only weakly diffracted echoes can be generated at its tip.

Simulation results and analysis
Following the completion of the simulations with the two models, the 0°A-scan signals are synthesized. Figures 5(a) and (b) show the background signal and the overlapping signal, respectively. The two signals have similar waveforms, but the latter has a slightly larger amplitude than the former, which is attributed to the interference enhancement effect of the defect echo on the interface echo.
After simulating and generating the A-scan signals at all scanning angles, the S-scan images are constructed as shown in figures 6(a) and (b). Figure 6(a) shows the background image, which contains only interface echoes, whose intensities sharply diminish on both sides of the image. This is because the larger the scanning angle is, the  less the acoustic waves are reflected from the interface to the probe. Compared to figure 6(a), a bump appears beneath the interface echo in figure 6(b). This is the defect echo, which is almost completely submerged in the interface echo and hence cannot be effectively extracted.
The background subtraction algorithm works on the principle of subtracting a background image from the to-be-processed image to obtain a target image without background interference. It is commonly used in foreground detection for machine vision [22][23][24]. The calculation procedure is shown in equation (1): where I(x, y) and I b (x, y) are the pixel intensities of the to-be-processed image and the background image, respectively, at the corresponding pixel locations (x, y). However, in the phased array ultrasonic S-scan test, the image is constructed from A-scan signals with varying scanning angle. This means that the subtraction of two S-scan images can be regarded as the subtraction of all associated A-scan signals. Additionally, as each A-scan signal is obtained through the same aperture according to different focus laws, the A-scan signal can be approximated as an A-scan signal emitted by a single probe at the same scanning angle. At this time, according to the impulse response theory of linear acoustics, any A-scan signal s g (t) in an S-scan image can be expressed by equations (2) and (3): where i(t) represents the system impulse response of the virtual probe, g represents the scanning angle of the A-scan signal, * is the convolution sign, n g (t) is the noise of the system and the material, and x g (t) is the discrete sum of all the impulse echoes from the specimen, which can be represented by equation (3). a g,j and the δ function represent the amplitude and time shift of the echo, respectively. The S-scan test image for near-detection-surface defects contains both the interface echo and the defect echo, but only the interface echo exists in the background image; consequently, the two image signals can be represented by equations (4) and (5), respectively: where t t g f g f . , 2 2 are the interface echoes and a g.d δ(t − t g,d ) is the defect echo. The target signal d(t) is obtained by subtracting equation (4) from equation (5), as shown in equation (6): The A-scan signal in figure 5(b) and the S-scan image in figure 6(b) are processed by equation (6), and the results are shown in figure 7. The processed A-scan signal in figure 7(a) shows that the interface echo has been completely eliminated and the defect echo is effectively extracted. Additionally, the near-detection-surface defect features can also be clearly observed in the S-scan image in figure 7(b).
To confirm the reliability of the extracted defect echoes, the location of the defect is calculated. The location of the defect in figure 7(a) can be accurately calculated based on the acoustic range difference L between the extracted defect echo and the interface echo in the background signal, and the distance H c between the defect tip and the detection surface can be expressed by equation (7): where V represents the ultrasonic velocity in the specimen. According to equation (7), the calculated value of H c is 0.63 mm, which is only a 0.03 mm deviation from the set value in the defect model. This demonstrates that under ideal conditions, the background subtraction model is capable of accurately extracting the properties of near-detection-surface defect echoes and localizing near-detection-surface defects.

Processing and analysis of S-scan images of near-detection-surface defects
A defect specimen with defect parameters W and H of 0.25 mm and 0.53 mm, respectively, and a defect-free specimen were tested, and the resulting S-scan images are presented in figures 8(a) and (b). The changes in the echo amplitudes are almost the same as those recorded during the simulation. However, the interface echoes have a slightly higher position in figure 8(b) than those in figure 8(a). This is due to the fluctuation of the probe coupling state, the nonlinearity of the equipment, and the difference in specimen materials, resulting in various time shifts in ultrasonic signals and hence a time delay between the background image and to-be-processed image. Thus, time delay correction must be performed before using the background subtraction algorithm. The SSD method was used to estimate the time delay, and the principle of this algorithm is as follows: where N represents the number of sampling points. τ denotes the search lag. After a certain range of searches, the calculated SSD will have a minimum value that corresponds to the search lag τ g , which is the time delay of the two signals. At this time, in equation (6), , 2 2 , and d(t) can be expressed as equation (10): After time delay correction, the differences in the amplitudes of the two interface echoes become the main factor affecting the extraction of near-detection-surface defect echoes.  The delay curve between the two images estimated using the SSD method is shown in figure 9(a). After being corrected with the time delay curve, figure 8(a) is subjected to background subtraction with figure 8(b), and the processed image is presented in figure 9(b). While the defect echo is clearly visible in the processed image, residual interface echoes with intensities comparable to or greater than that of the defect echo still remain and these echoes will still interfere with the defect echo if they appear at the same scanning position. Thus, further suppression of the residual interface echoes is required.

Elimination of residual interface echoes
To better understand the formation of the residual interface echoes, four scanning locations with varying intensity of residual interface echoes, −13°, −11°, −10°, and −9°scanning signals, are selected from figure 9(b), and the to-be-processed signals, time-delay-corrected background signals, and processed signals at these positions are extracted for analysis, as shown in figure 10. As can be observed, the background signals almost fully overlap with the to-be-processed A-scan signals after time delay correction. However, in the partially enlarged views, the residual time delays between the two signals are still visible. This is because the ultrasonic signal is a discrete signal, resulting in the time delay value calculated by the SSD algorithm being only an integer multiple of the sampling interval, which means that residual time delays inside the subsampling interval are inevitable. From figures 10(a) to (d), the amplitude of the residual interface echo increases as the residual time delay decreases, indicating that the residual time delay is the main factor affecting the intensity of the residual interface echo.
As the computational accuracy of SSD is limited by the sampling rate, a signal interpolation method is used to increase the sampling rate of ultrasonic signals. The interpolation factor is critical in determining the performance of the proposed method. The larger the interpolation factor is, the shorter the sampling interval, the less intense the residual interface echo intensity, and the less efficient the computation. Therefore, an ideal interpolation factor that balances the algorithm computational efficiency and the defect extraction performance must be determined. The relationship between the residual delay and the residual interface echo intensity at each scanning angle in the S-scan image was evaluated to determine the best interpolation factor. The residual delay can be calculated by subtracting the delay calculated using the SSD method from the actual delay between the background signal and the to-be-processed signal, and the actual delay can be calculated by interpolating the two signals with a sufficiently large factor. In this study, linear interpolation with a factor of 50 was used to obtain the actual delay. The residual delays between the two images in figure 8 were calculated by the above method. Figures 11(a) and (b) show the distribution of the residual interface echoes in the processed image and the corresponding residual time delay curve. When the scanning angle is greater than 20°, the residual interface echoes are weak, and their echo intensities are mostly unaffected by the residual time delay. This is due to the sharp drop in the interface echo intensities of the original images. However, when the scanning angle is less than 20°, the residual interface echoes in regions A-D are stronger, and their residual time delays are greater than 2 ns. The residual interface echo amplitude is invisible in the region where the residual time delay is less than 2 ns. This indicates that only when the sampling interval is less than 2 ns can the residual interface echo be effectively suppressed. As the sampling interval is 10 ns for the original images, the initial interpolation factor should be set to at least 5.
The S-scan images of ten defect-free specimens were used as the to-be-processed images to obtain pure residual interface echoes. Different interpolation factors (ranging from 1 to 10) were used to process all the  acquired images, and then, the mean amplitudes of the residual interface echoes were calculated after the interpolated images were processed by the proposed algorithm. The results are shown in figure 12(a). The mean amplitudes gradually decrease with increasing interpolation factor and tend to be stable when the interpolation factor is greater than 5. Thus, the proposed method combined with the linear interpolation method with a factor of 5 was used to process the S-scan image of figure 8(b), and the result is shown in figure 12(b). As shown, the stronger residual interface echoes are completely eliminated, while the weaker interface echoes remain, which are caused by the difference in the amplitudes of the interface echoes in the two signals, but these echoes have a much lower intensity than the defect echoes and thus have no effect on defect localization or quantitative detection.
The two groups of specimens in table 1 were tested, and the locations and sizes of the near-detection-surface defects were measured according to the processed images; the measurement results and error histograms are shown in figure 13. Figure 13(a) compares the calculated values of the distances H between the defect tip and the detection surface to the actual values, and the errors are shown in figure 13(b). The calculated and actual values basically exhibit the same trend, but the calculated values are slightly larger than the actual values. This is because the size of the defect is smaller than the wavelength, and only extremely weak diffraction waves can be generated, resulting in a slightly larger measured value. According to figure 13(b), the relative errors are within 0.2 mm.
The widths W of the defects were calculated using the 6 dB method. Figure 13(c) compares the calculated and actual values, and the errors are shown in figure 13(d). When the defect width is less than 0.5 mm, the error between the calculated and actual values is large. This is due to the defect width being in the subwavelength range, resulting in inaccurate quantification of the defects. Additionally, when the defect width exceeds 1 mm, the errors slightly increase. This is because the defect echo is repeatedly reflected between the defect and the detection surface, and these echoes interfere with one another, reducing the defect quantitative accuracy. As indicated by the histogram of the error statistics, the relative errors are within 0.3 mm, which meets engineering requirements.

Conclusion
In summary, a mathematical model combining a background subtraction algorithm with the SSD algorithm is presented to extract near-detection-surface defect echoes from the overlapping echoes during phased array ultrasonic S-scan imaging testing. The SSD algorithm can improve the effect of signal time shift on the defect extraction performance and its performance depends on of the sampling rate of signal and can be improved by signal interpolation. When the sampling rate of the interpolated signal is at least 500 MHz, the residual interface echoes are suppressed to a low level and the defect echoes have a high signal-to-noise ratio. At this time, the localization and quantitative accuracies for near-detection-surface defects are within 0.2 mm and 0.3 mm, respectively, which can provide good theoretical and practical experience for practical applications.
Of course, we only tested for near-detection-surface defects of flat specimens, and all specimens have a good and identical surface states, while the surface states of specimens vary in actual detection, so we will next test for different surface conditions of specimens. In addition, this model combined with ultrasonic mechanical sweeping system to achieve real-time processing imaging will be studied.