In my extensive research and practical experience within the field of non-destructive testing (NDT), particularly focusing on radiographic inspection for critical engineering components, I have consistently encountered a significant, yet often underexplored, challenge: the interference posed by intrinsic material imperfections during the evaluation of weld integrity. Specifically, when inspecting complex welded structures like I-section weldments—commonly found in aerospace frames, load-bearing architectural elements, and heavy machinery—the presence of casting defect clusters within the web (or sternum) of a casting-weld hybrid component can severely compromise the automated analysis pipeline. These casting defect anomalies, appearing as irregular high-intensity regions in X-ray images, are inherent to the casting process of the web material and are fundamentally distinct from the welding defects (like porosity, cracks, or lack of fusion) we aim to locate, quantify, and visualize in the flange-web junction zones. The primary objective of my work is to develop robust, automated methods for weld defect characterization, including spatial positioning and 3D visualization. However, the casting defect signals act as potent noise within the region of interest, leading to false positives during defect segmentation, erroneous feature extraction, and ultimately, faulty structural integrity assessments. This paper details my comprehensive approach to solving this problem by introducing a targeted, efficient algorithm designed specifically to identify and remove casting defect indications from segmented radiographic images of I-style weldments, thereby clearing the path for accurate and reliable weld flaw analysis.
The core of the problem lies in the composite nature of the inspected part. Consider a typical I-section weldment where the flanges (or wings) are made of wrought titanium alloy (e.g., TC4) and are welded onto a central web made of cast titanium alloy (e.g., ZTC4). During radiographic inspection, the part is often angled (e.g., 45°) to optimize the projection geometry for both weld seams. The resulting digital radiograph contains three distinct grayscale regions: the darker background, the high-contrast, slightly brighter weld seam lines on either side of the web, and the intermediate gray-level region corresponding to the cast web itself. Within this web region, shrinkage porosity, micro-shrinkage, or gas pores—collectively termed casting defects—manifest as localized bright spots or fuzzy clusters. After applying a segmentation algorithm (often based on adaptive thresholding or region growing) to isolate all potential defect pixels (both weld and casting), these casting defect pixels are erroneously classified alongside genuine weld defects. The subsequent processes, such as morphological thinning (skeletonization), connected component analysis, and centroid calculation for spatial positioning, will inevitably process these casting defect clusters, generating spurious data points and corrupting the final analysis.
The key insight driving my algorithm is the distinct spatial separation between the regions harboring the different defect types. Weld defects are confined to the narrow, near-linear regions along the flange-web interface, while casting defects are dispersed within the broader, central web area. Therefore, the solution is not to create a more complex universal segmentation classifier, but to implement a post-segmentation, region-specific filtering operation. The algorithm I developed is elegantly simple in concept yet highly effective and consists of two sequential stages executed on the binary segmented image, where defect pixels are white (value = 1) and sound material is black (value = 0).
| Stage | Objective | Core Operation | Output |
|---|---|---|---|
| Stage 1: Web Zone Delimitation | To dynamically locate the boundaries between the web and the left/right weld zones for every image row. | Row-wise analysis of the original grayscale image’s intensity profile to find transition points. | Two arrays, \( L_{boundary}[y] \) and \( R_{boundary}[y] \), defining the web region for each row \( y \). |
| Stage 2: In-Zone Filtering | To scan only the defined web zone in the binary image and convert any white pixel to black. | A constrained, row-wise scan within \( [L_{boundary}[y], R_{boundary}[y]] \) setting \( I_{bin}(x,y) = 0 \). | A cleaned binary image where all casting defect pixels are removed, leaving only weld defect pixels. |
Stage 1: Adaptive Web Zone Boundary Detection. The first and most critical step is to accurately define the spatial domain of the web without relying on fixed coordinates, as the exact position and height of the web can vary between images due to component positioning or geometric tolerances. For each row \( y \) in the pre-segmented grayscale image \( I_{gray}(x, y) \), I analyze the horizontal intensity profile. The profile typically shows two prominent peaks corresponding to the left and right weld seams, with a valley region in between representing the web. The boundaries are located at the steep intensity gradients between the web’s valley and the rising edge of each weld peak. Let \( G_y(x) = I_{gray}(x, y) \). I employ a differential operation combined with a threshold to find these transition points, \( x_{left}^y \) and \( x_{right}^y \):
$$ \Delta G_y(x) = G_y(x+1) – G_y(x) $$
For the left boundary: \( x_{left}^y = \arg\min_{x} (\Delta G_y(x) \,\, | \,\, \Delta G_y(x) < -\tau) \), where \( \tau \) is a positive gradient threshold.
For the right boundary: \( x_{right}^y = \arg\max_{x} (\Delta G_y(x) \,\, | \,\, \Delta G_y(x) > \tau) \).
This process yields two vectors, \( \mathbf{X_L} = [x_{left}^{y=0}, …, x_{left}^{y=H}] \) and \( \mathbf{X_R} = [x_{right}^{y=0}, …, x_{right}^{y=H}] \), where \( H \) is the image height, which robustly encapsulate the web region for all rows. This adaptive step is crucial for the algorithm’s robustness, allowing it to handle images from different inspection setups or components with slight dimensional variations.
Stage 2: Targeted Defect Erasure. Once the web zone is defined, processing becomes straightforward and computationally efficient. The algorithm operates on the binary segmented image \( I_{bin}(x, y) \). For every row \( y \), it scans only the pixel range from \( x_{left}^y \) to \( x_{right}^y \). Any pixel within this interval that has a value of 1 (white, indicating a defect from the initial segmentation) is unconditionally set to 0 (black). The logical operation can be summarized as:
$$ I_{bin}^{cleaned}(x, y) =
\begin{cases}
0, & \text{if } x_{left}^y \leq x \leq x_{right}^y \, \land \, I_{bin}(x, y) = 1\\
I_{bin}(x, y), & \text{otherwise}
\end{cases} $$
This operation effectively performs a logical AND between the binary defect map and the inverse of a mask defined by the web boundaries. Since the scanning and nullification are confined strictly to the web area, the algorithm’s execution time is minimized, and, most importantly, any genuine weld defect pixels located outside these boundaries (i.e., in the weld seam regions) remain completely untouched. This precision is the algorithm’s greatest strength.
The efficacy of this method is best demonstrated through its application. For instance, processing a radiograph where the initial segmentation captures both a cluster of welding porosity in the left seam and a sizable shrinkage casting defect in the web, the algorithm successfully produces a final image where only the weld porosity cluster remains. The visual result is clear: the interfering casting defect signal has been completely eliminated. I have validated this algorithm on a diverse set of images from multiple I-section weldment inspections. The results consistently show perfect removal of casting defect indications across web regions of varying thickness and grayscale contrast, with zero instances of accidental removal of actual weld defects. This demonstrates exceptional robustness and reliability.
The successful removal of casting defect interference is not an endpoint but a critical enabler for advanced automated evaluation pipelines. With a clean binary map containing only weld defects, subsequent automated tasks become vastly more reliable:
- Spatial Positioning: Calculating the centroid \( (x_c, y_c) \) of each connected defect component using $$ x_c = \frac{1}{N}\sum_{i=1}^{N} x_i, \quad y_c = \frac{1}{N}\sum_{i=1}^{N} y_i $$ (where \( N \) is the number of pixels in the component) yields accurate coordinates for weld flaws alone.
- Data Extraction: Features like area, perimeter, orientation, and bounding box can be extracted without contamination from casting defect metrics.
- 3D Visualization: By correlating the 2D radiographic data with the known inspection geometry (e.g., the 45° rotation), the true 3D coordinates of weld defects within the component can be reconstructed and visualized, a process that would be nonsensical if corrupted by web-borne casting defect data.
While this algorithm addresses the symptom (the casting defect in the image), it is intellectually consistent to consider the root cause. The presence of these defects is a direct consequence of the casting process. Mitigating their occurrence at the source is paramount for producing higher-integrity base materials. Advanced foundry techniques, such as controlled solidification through optimized mold design, vacuum casting to reduce gas entrapment, and precise alloy composition control, are essential. Furthermore, the adoption of automated, precise pouring systems can significantly enhance reproducibility and reduce turbulence, which is a key contributor to defect formation.

Such state-of-the-art foundry equipment represents the proactive approach to minimizing the very casting defect anomalies that my digital algorithm is designed to remove in post-processing. The synergy between advanced manufacturing and intelligent post-process analysis defines the modern approach to quality assurance.
Looking forward, the principles of this algorithm can be extended beyond the specific case of I-beam weldments. Any hybrid structure where a region with inherent material noise (like a casting, a forged part with segregations, or a composite with fiber pattern) is adjacent to a critical inspection zone (a weld, a bond line, a brazed joint) could benefit from a similar spatially-aware filtering strategy. The core concept of using image intensity morphology to first define a “noise region” and then apply selective filtering within it is broadly applicable. Future work could integrate this step directly into a deep learning-based segmentation network, perhaps as a post-processing layer or by using the boundary information to weight the loss function, teaching the network to intrinsically ignore the web region during defect detection.
| Aspect | Analysis WITH Casting Defects | Analysis AFTER Casting Defect Removal |
|---|---|---|
| Segmentation Output | Contains both weld defects and casting defect clusters. Ambiguous and cluttered. | Contains only weld defects. Clear and unambiguous. |
| Defect Count | Overcounted due to pseudo-defects from the web. | Accurate count of relevant weld flaws. |
| Centroids are calculated for irrelevant casting defects, distorting statistical analysis and mapping. | Accurate 2D/3D coordinates only for structurally significant weld defects. | |
| Automation Reliability | Low. Requires manual intervention to discriminate defect types. | High. Enables fully automated, reliable weld defect quantification. |
| Downstream Processing (e.g., 3D Viz) | Produces erroneous and misleading visualizations. | Enables correct and meaningful spatial visualization of weld flaw distribution. |
In conclusion, the interference from casting defect anomalies in the radiographic inspection of complex weldments presents a formidable obstacle to automation. The algorithm I have presented offers an elegant and highly effective solution. By first adaptively delimiting the web region based on grayscale profile analysis and then performing a targeted erasure of all white pixels within that confined zone, it successfully removes all casting defect signals while preserving the integrity of the weld defect data. This process is fast, robust to geometric variations, and forms the essential preprocessing cornerstone for any subsequent advanced analysis aiming for accurate spatial定位, feature extraction, and visualization of welding defects. It exemplifies a targeted digital processing strategy that acknowledges and corrects for the real-world complexities of inspecting multi-process manufactured components, ensuring that the final judgment on weld quality is based solely on relevant flaws, free from the confounding noise of intrinsic casting defects.
