Zero-Defect Manufacturing and Automated Defect Detection Using Time of Flight Diffraction (TOFD) Images

: Ultrasonic time-of-ﬂight diffraction (TOFD) is a non-destructive testing (NDT) technique for weld inspection that has gained popularity in the industry, due to its ability to detect, position, and size defects based on the time difference of the echo signal. Although the TOFD technique provides high-speed data, ultrasonic data interpretation is typically a manual and time-consuming process, thereby necessitating a trained expert. The main aim of this work is to develop a fully automated defect detection and data interpretation approach that enables predictive maintenance using signal and image processing. Through this research, the characterization of weld defects was achieved by identifying the region of interest from A-scan signals, followed by segmentation. The experimental results were compared with samples of known defect size for validation; it was found that this novel method is capable of automatically measuring the defect size with considerable accuracy. It is anticipated that using such a system will signiﬁcantly increase inspection speed


Introduction
Non-destructive testing (NDT) refers to a set of procedures and techniques used to test the materials without destroying them or modifying their physical characteristics.The material under test can range from small devices to heavy equipment with a variety of geometrical shapes and material characteristics.The necessity for the application of NDT has grown recently for diverse reasons, including product safety, quality control, health monitoring, and security testing [1].NDT also forms an integral part of quality inspection and planning for maintenance in various manufacturing systems [2].One such application is the use of NDT techniques to identify defects in welded structures.There are several different types of NDT methods that are applicable to weld inspection and ultrasonic time-of-flight diffraction (TOFD) is one such technique that can be used to detect the size of embedded defects [3].Through this process, it is possible to obtain ultrasound signals, namely, the A-scan mode, which can be displayed on the screen of the ultrasound equipment as an amplitude versus time trace.
Although ultrasonic TOFD uses computer-aided data acquisition, the data processing and interpretation are performed manually, subject to the skill of the operator [4].The output of the TOFD data acquisition needs significant processing before using for defect detection.These include denoising, scan alignment, the estimation of lateral-backwall positions, and segmentation.Even though there are numerous software programs available for processing TOFD data, trained operators are necessary for these activities, which takes more time and operator effort [5].Additionally, the operator-dependent processing mechanism can occasionally result in inconsistencies and mistakes.
Machines 2022, 10, 839 2 of 16 Therefore, to address these problems, this research proposes the novel contributions of:

•
Automated processing via image and signal-processing algorithms; • Developing reliable and robust algorithms capable of producing results of different operating conditions and components that are characterized by having various shapes and sizes; • Decision support regarding defect detection.
The key benefits of the work include: • The automatic processing systems that break through the limitations of the conventional processing and interpretation systems; Improving the efficiency of the inspection process; • Enabling smart manufacturing through the automation of inspections and maintenance.

Literature Review 2.1. Related Works on TOFD
The most widely used NDT method for subsurface defect analysis is ultrasound TOFD.The experimental work was initiated by [5][6][7][8]; since then, several research projects have been conducted in related areas, including the experimental analysis of TOFD, hardware and software development, image and signal processing analysis for TOFD data augmentation, and automatic analysis.Image denoising, segmentation, classification, and fault sizing analysis are some of the many automation efforts related to TOFD data processing.The undesirable form of energy known as noise can have an impact on the ultrasonic signal's accuracy and precision.Noise can arise due to unwanted electronic properties or material grain properties; to obtain consistent data quality, noise reduction should be considered a crucial processing step.Numerous TOFD signal denoising algorithms [9] have previously been described in the literature.One of the most promising methods for signal conditioning is wavelet analysis.The usage of DWT-based signal denoising by numerous authors demonstrates its applicability in a wide range of applications.Wavelet transform-based TOFD signal denoising was utilized by [9] to improve the obtained TOFD signal quality.By using wavelet-based thresholding, the structural noise that contributed to the A-scan signals during acquisition was eliminated.Compared with lower-order wavelets, the higher-order wavelets displayed a higher signal-to-noise ratio (SNR).The drift that was discovered during inspection has been fixed in [10].They used a subpixel registration algorithm based on a discrete Fourier transform (DFT) to enhance the image by correcting the drift.Jiaxu Duan et al. [11] presented a signal denoising technique based on wavelet transforms as an improved method for TOFD processing.Maximum correlation-based image registration could eliminate the displacement between TOFD pictures caused by the adjustment of the probes.This method's results showed that the SNR of the TOFD signals had improved.Different combinations of wavelets [12], decomposition levels, and thresholding were employed to develop an optimum denoising algorithm; the performances were then evaluated using the SNR calculations.To create the best denoising algorithm, various wavelet combinations [12], decomposition levels, and thresholding were used, then the performance was assessed using SNR estimates.In the same year, wavelet transform for TOFD data was examined by the authors of [13] for the automatic positioning and sizing of flaw detection.This strategy uses a fuzzy clustering method, with fuzzy C-means wavelet transform and texture analysis.This hybrid approach to fault detection from a TOFD-type ultrasonic image is quick and accurate.

Automated Defect Detection
Even though TOFD signal enhancement has received much scientific attention, only a few notable works have been proposed for automatic defect segmentation.Two-dimensional (2D) entropy-based TOFD D-scan defect segmentation begins with wavelet-based denoising [14], which is a pre-processing step.In terms of automation, the obtained results have been encouraging.The segmentation of flaws in TOFD images of austenitic stainless-steel welds has been performed using several segmentation techniques [15].For automatic defect detection, the discontinuity-based segmentation algorithm and the region-based level set technique were investigated.While the segmentation algorithms extracted the flaws, an expert operator was still required to identify the specific type of defect that was present in the test sample.Researchers have demonstrated how machine learning can categorize weld defects.Wavelet-based image processing with a support vector machine (SVM) was used for TOFD signal classification in [16].The SVM classifier is reliable, promising, and performs well, even in the absence of training data.The classification of a lack of fusion and a lack of penetration cracks from TOFD images was also conducted using a backpropagation neural network [17].By extracting multiscale features rather than single-scale features, classification accuracy can be increased.Depending on the application, artificial intelligence (AI) plays a crucial part in automation.However, most applications in TOFD data processing might not be able to obtain as many training and test D-scan images.The researchers therefore employed image-and signal-processing techniques to automatically detect flaws in the TOFD images.For the purpose of differentiating between distinct defect types, the phase correlations between diffracted echoes from the defect tips and with the lateral wave and backwall signals were used [18].The TOFD image interpretation system was created by the same author [19] and comprises defect segmentation, noise suppression, drift correction, scan alignment, and an estimation of lateral-backwall echo.When dealing with highly variable data, the suggested strategy used in this research performed well in terms of accuracy and dependability.
TOFD signal enhancement and automatic defect detection have been the subject of numerous studies.Automatic sizing and positioning are also necessary for automatic defect quantification.The TOFD data acquisition and visualization setup themselves may result in some errors that cannot be identified by manual interpretation.For the purposes of defect detection, previous studies have suggested using TOFD B-scan images.The edge detection method was used for defect identification by the authors of [20].The manual and automated sizing and positioning of defects have been investigated using ultrasonic B-scan images [21].Compared to what the user could have calculated using manual calibration, this does not demonstrate very high accuracy.

Applications in Manufacturing
Manufacturing systems are faced with high levels of uncertainties that are associated with product variety, demand fluctuations, supply chain issues, etc.In such circumstances, there is a high probability that product defects, rework and manual errors will occur.It is, however, important to ensure that these defects do not impact the production environment.This can be achieved by instituting procedures to constantly monitor, detect, and prevent defects.For this purpose, there are several different NDT approaches that are built upon various principles and theories.They have been proven to be successful at finding defects across various manufacturing processes [22,23].NDT principles also play a significant role in the Industry 4.0 revolution; the integration between NDT and the manufacturing sector is highly desirable [23].For instance, the application of NDT methods for additive manufacturing [24], in-process inspection, and in-process calibration systems [25] have been much discussed in the literature.This underscores the importance of NDT methods to provide the much-needed push that manufacturing systems require to fulfill the concepts of sustainability and zero-defect manufacturing.

Summary of the Literature Review
This literature review provides a summary of the core methods, such as the theory behind TOFD and automated defect detection, that are proposed in this research work.It also highlights the research gap demonstrated by the lack of an effective and appropriate method for image and signal processing in the context of TOFD data processing.This review also highlights the need for an automated defect detection process within the wider context of zero-defect manufacturing in the welding process.

TOFD Setup
In TOFD, a pair of ultrasonic probes are used that sit on opposite sides of a weld joint or an area of interest.When the transducers are moved in a direction parallel or perpendicular to the weld center line, a transmitter probe emits an ultrasonic pulse that is picked up by the receiver probe on the opposite side [1,2].In an undamaged part, the signals picked up by the receiver probe are from two waves: one that travels along the surface (lateral wave) and one that reflects off the far wall (backwall reflection).When a discontinuity such as a crack is present, there is a diffraction of the ultrasonic sound wave from the top and bottom tips of the crack to be generated.The resulting ultrasonic waveforms are digitized, stored, and finally processed to generate a cross-sectional image of the weld for further interpretation and analysis.
A-scan mode is the most typical form of an ultrasound signal, which can be displayed on the screen of the ultrasound equipment as an amplitude versus time trace.The acquisition of several unrectified A-scan signals, consecutively recorded along a weld bead, allows the formation of a grayscale D-scan or grayscale B-scan image in a format commonly known as a "waterfall" diagram.These images are created by stacking A-scans from successive probe positions.The display configuration is shown in Figure 1.
Machines 2022, 10, 839 4 of 17 review also highlights the need for an automated defect detection process within the wider context of zero-defect manufacturing in the welding process.

TOFD Setup
In TOFD, a pair of ultrasonic probes are used that sit on opposite sides of a weld joint or an area of interest.When the transducers are moved in a direction parallel or perpendicular to the weld center line, a transmitter probe emits an ultrasonic pulse that is picked up by the receiver probe on the opposite side [1,2].In an undamaged part, the signals picked up by the receiver probe are from two waves: one that travels along the surface (lateral wave) and one that reflects off the far wall (backwall reflection).When a discontinuity such as a crack is present, there is a diffraction of the ultrasonic sound wave from the top and bottom tips of the crack to be generated.The resulting ultrasonic waveforms are digitized, stored, and finally processed to generate a cross-sectional image of the weld for further interpretation and analysis.
A-scan mode is the most typical form of an ultrasound signal, which can be displayed on the screen of the ultrasound equipment as an amplitude versus time trace.The acquisition of several unrectified A-scan signals, consecutively recorded along a weld bead, allows the formation of a grayscale D-scan or grayscale B-scan image in a format commonly known as a "waterfall" diagram.These images are created by stacking A-scans from successive probe positions.The display configuration is shown in Figure 1.

Image Denoising
Ultrasonic signals are dominated by various noise types, such as environmental noise, instrumental noise, material noise, shot noise, thermal noise, Johnson noise, etc.The TOFD technique is considered one of the most effective techniques for the generation of images of weld imperfections and it does not involve ionizing radiation.The main drawback associated with TOFD signals is the appearance of noise, which principally originated when the micro-structure-grains of the material under test-interfered with the weak diffracted echo wave.Hence, noise reduction is an important process in the evaluation of TOFD signals for the detection and characterization of weld defects [9].

Image Denoising
Ultrasonic signals are dominated by various noise types, such as environmental noise, instrumental noise, material noise, shot noise, thermal noise, Johnson noise, etc.The TOFD technique is considered one of the most effective techniques for the generation of images of weld imperfections and it does not involve ionizing radiation.The main drawback associated with TOFD signals is the appearance of noise, which principally originated when the micro-structure-grains of the material under test-interfered with the weak diffracted echo wave.Hence, noise reduction is an important process in the evaluation of TOFD signals for the detection and characterization of weld defects [9].

Mean-Based Segmentation
Thresholds (T) for image segmentation can be represented by the following expression: The parameter µ represents the mean gray level of the entire image's pixels.The parameter σ represents the standard deviation of the mean gray levels in the defective image (original).Factor z could be selected by trial and error to determine the strictness of the defect-detection test [26].

One-Dimensional Extropy-Based Method
Let f 1 , f 2 , f 3 . . .., f n be the observed gray level frequencies [27], and let: where N is the total number of pixels and n is the total number of gray levels.The total entropy, based on the distribution p 1 , p 2 , p 3 . . .., p n , is given by: The object and background distributions are derived from the original gray level distribution p 1 , p 2 , p 3 . . .., p n of the images, as follows: Then, the entropies associated with each of the distributions are given by: and ln(1 The sum of E(A) and E(B) is denoted by ψ(s).Hence: Finally, we select the optimal thresholding using the following formula:

Two-Dimensional Entropy-Based Segmentation
The two-dimensional entropy [28] thresholding segmentation method separates an image with the thresholding, based on a two-dimensional histogram, which is formed of the gray level values of the pixels of the image and the average gray level values of their neighborhoods.The following details on two-dimensional entropy-based segmentation have been identified from [29].Let the gray level be divided into M values; the average gray level is also divided into the same M values.At each pixel, the average gray-level value of the neighborhood is calculated.This forms a pair: the pixel gray level and the average of the neighborhood.Each pair belongs to a two-dimensional bin.The total number of bins is obviously m X m and the total number of pixels to be tested is N × N. The total number of occurrences f ij of a pair (i, j), divided by the total number of pixels, N 2 , defines the joint probability mass function P ij : , where i and j = 1 . . . . . ...m (13) The relationship between the defect, the background image, and noise can be represented using a two-dimensional grey histogram.For example.A and B, along the diagonal, represent the objects and the background of an image.Then, the probability of A and B is normalized using their posterior probability, which is represented as P ij .If we suppose the thresholding is (s, t), then: According to Shannon's entropy function, we can define two-dimensional discrete entropy as follows: Then, the two-dimensional entropy of the object and background of an image is appointed by the following: In the formula, E 1 and E 2 are defined as: Then: The entropy function can be defined as follows: Finally, we select the optimal thresholding using the following formula: Machines 2022, 10, 839 7 of 16

Research Methodology
This section presents the proposed methodology and explains the experimental setup and implementation.The overview of the proposed method is shown in Figure 2.

Research Methodology
This section presents the proposed methodology and explains the experimental setup and implementation.The overview of the proposed method is shown in Figure 2.

Wavelet Transform Image Denoising
The first step is image denoising.The following steps are involved in wavelet-based denoising.First, we apply discrete wavelet transform (DWT) to a signal, obtain the wavelet coefficients, and threshold the detail coefficients, assigning zero to the wavelet coefficients based on a certain threshold.After thresholding, the thresholded wavelet coefficients need to be transformed to reconstruct the signal, using inverse discrete wavelet transform (IDWT).The most important thing in the application of thresholding is the determination of the threshold value.There are four different estimators of the threshold value, given as Heasure, Minimax, Rigsure, and Sqtwolog.Thresholding can also be applied in two different methods: hard and soft thresholding.A hard threshold can be explained as setting elements to zero where their absolute values are lower than the threshold.A hard threshold gives sharper results.On the other hand, soft thresholding softens the coefficients that exceed the threshold by lowering them by as much as the threshold value.Soft thresholding requires more computations but gives a better denoising performance.The SURE-threshold selection rule with soft thresholding can be used to denoise the A-scan signals.

Scan Alignment
To make sure that all the signals are of equal length, we compare the length of the first signal with that of the second one and then zero-pad the shortest one.The same procedure is repeated until all A-scan signals are of equal length.Several data acquisition factors may contribute to the misalignment of adjacent A-scans, including coupling thickness variations, surface irregularities, inadvertent changes in probe separation, and accidental probe lift-off.Scan alignment is carried out by subsampling each scan and crosscorrelating each scan with an arbitrary "reference" scan.
Here, we suppose two A-scan signals, x(t) and y(t), respectively.The cross-correlation function can be described as:

Wavelet Transform Image Denoising
The first step is image denoising.The following steps are involved in wavelet-based denoising.First, we apply discrete wavelet transform (DWT) to a signal, obtain the wavelet coefficients, and threshold the detail coefficients, assigning zero to the wavelet coefficients based on a certain threshold.After thresholding, the thresholded wavelet coefficients need to be transformed to reconstruct the signal, using inverse discrete wavelet transform (IDWT).The most important thing in the application of thresholding is the determination of the threshold value.There are four different estimators of the threshold value, given as Heasure, Minimax, Rigsure, and Sqtwolog.Thresholding can also be applied in two different methods: hard and soft thresholding.A hard threshold can be explained as setting elements to zero where their absolute values are lower than the threshold.A hard threshold gives sharper results.On the other hand, soft thresholding softens the coefficients that exceed the threshold by lowering them by as much as the threshold value.Soft thresholding requires more computations but gives a better denoising performance.The SURE-threshold selection rule with soft thresholding can be used to denoise the A-scan signals.

Scan Alignment
To make sure that all the signals are of equal length, we compare the length of the first signal with that of the second one and then zero-pad the shortest one.The same procedure is repeated until all A-scan signals are of equal length.Several data acquisition factors may contribute to the misalignment of adjacent A-scans, including coupling thickness variations, surface irregularities, inadvertent changes in probe separation, and accidental probe lift-off.Scan alignment is carried out by subsampling each scan and cross-correlating each scan with an arbitrary "reference" scan.
Here, we suppose two A-scan signals, x(t) and y(t), respectively.The cross-correlation function can be described as: and the discrete description of R xy (t) is where λ is the delay between x(t) and y(t).The D-scan image is aligned in the following way.We choose one A-scan signal as a reference signal, M(0).We then calculate the crosscorrelation function (R xy ) between M(0) and other A-scan signals N(l) and determine the largest peak of (R xy ) and the corresponding delay time interval, t.Then, we find the medium value of all the samplings in the signals M(0) and N(l), and compute the difference between the delay time t and the medium value of all samplings.
We shift each A-scan signal N(l) forward or backward, from the difference between the time t and the medium value of all samplings, in such a way as to align the envelope of the lateral wavelets.The amplitude of each sample in the cross-correlation signal is a measure of how much the signal input signal resembles the target signal at that point.The value of the cross-correlation is maximized when the target signal is aligned with the received signal.Finally, we accumulate the successive A-scan ultrasonic signals and the ultrasonic D-scan image is calibrated [20].

Region of Interest Extraction
For the automatic interpretation to be accurate, the positions of the lateral and backwall echo must be correctly estimated, with high accuracy.

•
The first positive maximum of the signal is identified using a particular threshold and is marked as a lateral wave.

•
The backwall echo has been identified using threshold and maximum amplitude information.The region between the latter and the backwall echo is marked as an area of interest for defect segmentation.

Defect Segmentation
After estimating the positions of the lateral wave and backwall signals, the region of interest is marked between the two echoes, and only the defect segmentation in the chosen ROI is performed.Only a small fraction of the collected data represents defects, whereas the majority of the data are considered redundant.The three segmentation methods, as explained in Sections 3.3-3.5,are employed in the experiments.

Defect Sizing
The position of the lateral and backwall wave signals must be determined from the Ascan data to automatically quantify the extent of the flaws.The arrival time of the diffracted echo carries information about the spatial relationship of the crack tips.Hence, the depth and height of the defect can be estimated by measuring the arrival time of the lateral and backwall echoes.The size of the defect is determined by its width, height, and depth.The width is measured as the difference between defect extremities in a horizontal direction.The height is defined as the vertical distance between top and bottom echoes.The depth is directly related to the time of flight between the lateral wave and echo from the defect top tip.The depth information could be calculated by substituting the predefined calibration parameters, such as the velocity of the sound in the material (C), probe center spacing (PCS), time of flight of the signal from the reflector(t), probe delay (time taken for the sound wave traveling through one wave (t 0 ) the depth of the reflector in the material (d), and thickness of the material (D) in the following A-scan signal.The discontinuity depth (backwall echo) and the time of flight are shown in the x-axis.The y-axis indicates the amplitude of the reflected signals (echoes) and can be used to estimate the size of the discontinuity compared to a known reference reflector.

Example Calculation of Defect Size
The lateral and backwall time have been calculated by calculating lateral and backwall wave point from A-scan signals.For example, with lateral wave points of 74 and backwall point of 295 shown in Figure 3. the amplitude of the reflected signals (echoes) and can be used to estimate the size of the discontinuity compared to a known reference reflector.

Example Calculation of Defect Size
The lateral and backwall time have been calculated by calculating lateral and backwall wave point from A-scan signals.For example, with lateral wave points of 74 and backwall point of 295 shown in Figure 3. Estimation of the depth of the backwall is given by the formula: Arrival time of the backwall or depth calculation: For the experiment, carbon steel samples with a thickness of 25 mm were given a weld of approximately 30 mm.The samples included known defects of different characteristics (planar: cracks, lack of fusions; volumetric) and sizes that allowed evaluating the results of the algorithm described above.As a way of comparison, a competent operator used phased-array ultrasonic testing (PAUT) to test the samples and to establish a benchmark for the algorithm's detection and sizing capabilities.The schematic of the experimental setup is shown in Figure 4.The shaded areas of the figure highlight the novel contributions.
All the experiments were performed using the same setup, only changing the parameters depending on the thickness of the sample.The data acquisition was performed with an Olympus OmniScan MX2 (https://www.olympus-ims.com/en/omniscan-mx2/,accessed on 2 August 2022) using a pair of TOFD probes (highly dumped probes, producing 1.5 cycles) of 5MHz and 6 mm crystal diameter, with the corresponding 60-degree wedges (the angle on the material).The scans were performed in a direction perpendicular to the sound beam, with a resolution of 1 mm.The PCS was established using two-thirds of the sample thickness as focus depth and with the following calculation where θ is the angle of the sound beam in the material (i.e., 60 degrees): The acquisition was performed at a maximum scanning speed of 60 mm/s and with a digitizing frequency of 100 MHz (A-scan time resolution, 10 ns).As the probes and wedges were the same for all the tests, the probe delay used was 5.9 µs.Although the algorithm allows performing post-processing calibration, for this test, the parent material velocity and PCS were calibrated to ensure the quality of the data.The acquired data were in the form of text (.txt) files, which included header information specifying the calibration parameters and data for further defect detection.
cessed on 2 August 2022) using a pair of TOFD probes (highly dumped probes, producin 1.5 cycles) of 5MHz and 6 mm crystal diameter, with the corresponding 60-degree wedg (the angle on the material).The scans were performed in a direction perpendicular to th sound beam, with a resolution of 1 mm.The PCS was established using two-thirds of th sample thickness as focus depth and with the following calculation where  is the ang of the sound beam in the material (i.e., 60 degrees): The acquisition was performed at a maximum scanning speed of 60 mm/s and wi a digitizing frequency of 100 MHz (A-scan time resolution, 10 ns).As the probes an wedges were the same for all the tests, the probe delay used was 5.9 μs.Although th algorithm allows performing post-processing calibration, for this test, the parent materi velocity and PCS were calibrated to ensure the quality of the data.The acquired data we in the form of text (.txt) files, which included header information specifying the calibratio parameters and data for further defect detection.

Results and Discussion
The inspection text data file was processed using an automatic defect detection alg rithm.The inspection text data file's header comprises scan data along with calibratio parameters and workpiece specifications.Each column of the text file represented one A scan signal.All the A-scan signals have been combined to form a TOFD D-scan imag The results at each stage of the methodology are shown in Figures 5-15.

Results and Discussion
The inspection text data file was processed using an automatic defect detection algo-                     A TOFD detection system is always operating in high-gain mode, which increases both the signal intensity and the noise added to the signal.Wavelet transform-based denoising has been used here to denoise the signal, as shown in Figures 7 and 8. Initially, to make all the signals of equal length, zero was appended to the shortest signal by comparing them with the reference one.The signals were further aligned to avoid any misalignment of A-scan singles caused during the experiment, using the correlation function.After that, the ROI between the lateral and backwall echoes was identified using thresholding and amplitude information.Finally, the defects were segmented from ROI using segmentation algorithms, namely, mean segmentation and two-and one-dimensional entropybased segmentation.The size of the defects was measured using an automatic defect-sizing algorithm.
The process of image denoising eliminated the small peaks, which are noise from the signal, as is shown in Figure 9. Therefore, the automatic defect detection algorithm could be able to locate the lateral and backwall wave positions precisely.The mean and standard deviation-based segmentations are easy to implement, and the observed defects are more accurate, as can be seen in Figure 12.The constant value is set here at 0.5, based on previous experiments.One-dimensional (1D) entropy-based segmentation limits the threshold, based on the selection of the number of bins.One serious drawback of first-order thresholding, based on a 1D histogram, is that the spatial correlation between pixels is not considered.A two-dimensional (2D) histogram-based image thresholding segmentation method means that the original grey-level histogram is integrated with the local averaging of pixels to form a grey-local 2D histogram.No prior knowledge is necessary to determine the ideal threshold.
Finally, automatic defect sizing was performed to measure the width, height, and A TOFD detection system is always operating in high-gain mode, which increases both the signal intensity and the noise added to the signal.Wavelet transform-based denoising has been used here to denoise the signal, as shown in Figures 7 and 8. Initially, to make all the signals of equal length, zero was appended to the shortest signal by comparing them with the reference one.The signals were further aligned to avoid any misalignment of A-scan singles caused during the experiment, using the correlation function.After that, the ROI between the lateral and backwall echoes was identified using thresholding and amplitude information.Finally, the defects were segmented from ROI using segmentation algorithms, namely, mean segmentation and two-and one-dimensional entropy-based segmentation.The size of the defects was measured using an automatic defect-sizing algorithm.
The process of image denoising eliminated the small peaks, which are noise from the signal, as is shown in Figure 9. Therefore, the automatic defect detection algorithm could be able to locate the lateral and backwall wave positions precisely.The mean and standard deviation-based segmentations are easy to implement, and the observed defects are more accurate, as can be seen in Figure 12.The constant value is set here at 0.5, based on previous experiments.One-dimensional (1D) entropy-based segmentation limits the threshold, based on the selection of the number of bins.One serious drawback of first-order thresholding, based on a 1D histogram, is that the spatial correlation between pixels is not considered.A two-dimensional (2D) histogram-based image thresholding segmentation method means that the original grey-level histogram is integrated with the local averaging of pixels to form a grey-local 2D histogram.No prior knowledge is necessary to determine the ideal threshold.
Finally, automatic defect sizing was performed to measure the width, height, and depth of the defects automatically, which would consume the operator's time and give greater accuracy.Defect sizing using TOFD depends on an accurate measurement of the arrival time of the diffracted and reflected waves at the defect extremities-the lateral and backwall wave arrival times, calculated for each A-scan signal.The depth of the reflector material is calculated using Equation ( 27) automatically and is verified with the actual value of the 30 mm weld.Once the depth has been evaluated, the time of flight of the signal from the reflector is measured.The final interpretation has been made via post-processing to calculate the actual sizing and positioning measurements.The post-processing begins by rescaling the vertical and horizontal axes of the D-scan image.The vertical axis is rescaled to represent depth while the horizontal axis is rescaled to the actual scanned distance in millimeters.
The advantage of using three segmentation methods is that the user is able to compare the detected defects on the developed graphical user interface (GUI).Therefore, a GUI that is interactive has been created to assist users in loading and viewing flaws has been created.The decision support GUI is shown in Figure 16.The created GUI tool offers a user-interactive subsurface plot that is easy for the users to understand.

Conclusions
The proposed work comprised several image and signal processing functions to aid in the automation of pre-processing, segmentation, and defect sizing with TOFD D-scan data, in terms of an interpretation tool.The interpretation system starts by pre-processing the D-scan image to prepare the data for subsequent processing.It was discovered that wavelet-based denoising had a positive impact on lateral and backwall echo identification and defect detection.Scan alignment was utilized to ensure the consistency of the data for defect detection and sizing.The region between the lateral and backwall echoes has been marked as a region of interest (ROI) for the next stage of defect segmentation.For the purpose of automatically detecting defects, three segmentation methods were verified.As a result, the operator can compare and see the segmentation findings to make appropriate decisions.The sizing associated with the defects are height, width, and depth, and were determined by the automatic sizing algorithm.The actual experimental data could be used to confirm the obtained sizing measurements.Overall, the acquired findings showed substantial improvements in terms of speed and accuracy regarding the highly variable

Conclusions
The proposed work comprised several image and signal processing functions to aid in the automation of pre-processing, segmentation, and defect sizing with TOFD D-scan data, in terms of an interpretation tool.The interpretation system starts by pre-processing the D-scan image to prepare the data for subsequent processing.It was discovered that wavelet-based denoising had a positive impact on lateral and backwall echo identification and defect detection.Scan alignment was utilized to ensure the consistency of the data for defect detection and sizing.The region between the lateral and backwall echoes has been marked as a region of interest (ROI) for the next stage of defect segmentation.For the purpose of automatically detecting defects, three segmentation methods were verified.As a result, the operator can compare and see the segmentation findings to make appropriate decisions.The sizing associated with the defects are height, width, and depth, and were determined by the automatic sizing algorithm.The actual experimental data could be used to confirm the obtained sizing measurements.Overall, the acquired findings showed substantial improvements in terms of speed and accuracy regarding the highly variable TOFD data.This would make the proposed system a better option in an environment requiring the automatic interpretation of a large volume of data, hence, reducing the time spent and cost for the operator.The created GUI offers a result that is both easier for experts to use and more user-friendly.However, this tool is intended to reduce human error and give the inspector more time for decision-making, rather than to completely replace human inspections.This aligns with the goals of smart manufacturing and zero-defect manufacturing and supports decision-making, while also improving quality and efficiency and reducing the defects in manufacturing settings.

Figure 4 .
Figure 4. Schematic of the experimental setup.

Figure 4 .
Figure 4. Schematic of the experimental setup.

17 Figure 5 .Figure 5 .
Figure 5. Schematic of the experimental setup.Depth of backwall echo Amplitude of the reflected signals Figure 5. Schematic of the experimental setup.

Figure 5 .
Figure 5. Schematic of the experimental setup.

Figure 5 .
Figure 5. Schematic of the experimental setup.

Figure 10 .Figure 9 .
Figure 10.The region between the lateral and backwall wave.