Abstract
Metal additive manufacturing (AM) is known to produce internal defects that can impact performance. As the technology becomes more mainstream, there is a growing need to establish nondestructive inspection technologies that can assess and quantify build quality with high confidence. This article presents a complete, three-dimensional (3D) solution for automated defect recognition in AM parts using X-ray computed tomography (CT) scans. The algorithm uses a machine perception framework to automatically separate visually salient regions, that is, anomalous voxels, from the CT background. Compared with supervised approaches, the proposed concept relies solely on visual cues in 3D similar to those used by human operators in two-dimensional (2D) assuming no a priori information about defect appearance, size, and/or shape. To ingest any arbitrary part geometry, a binary mask is generated using statistical measures that separate lighter, material voxels from darker, background voxels. Therefore, no additional part or scan information, such as CAD files, STL models, or laser scan vector data, is needed. Visual saliency is established using multiscale, symmetric, and separable 3D convolution kernels. Separability of the convolution kernels is paramount when processing CT scans with potentially billions of voxels because it allows for parallel processing and thus faster execution of the convolution operation in single dimensions. Based on the CT scan resolution, kernel sizes may be adjusted to identify defects of different sizes. All adjacent anomalous voxels are subsequently merged to form defect clusters, which in turn reveals additional information regarding defect size, morphology, and orientation to the user, information that may be linked to mechanical properties, such as fatigue response. The algorithm was implemented in MATLAB™ using hardware acceleration, that is, graphics processing unit support, and tested on CT scans of AM components available at the Center for Innovative Materials Processing through Direct Digital Deposition (CIMP-3D) at Penn State's Applied Research Laboratory. Initial results show adequate processing times of just a few minutes and very low false-positive rates, especially when addressing highly salient and larger defects. All developed analytic tools can be simplified to accommodate 2D images.
Introduction
Significant resources are required to properly evaluate part quality using nondestructive inspection tools such as X-ray computed tomography (CT) scans. Especially for additively manufactured (AM) parts, material integrity and thus part quality cannot always be guaranteed. In fact, discontinuities (or flaws) in the resultant component commonly arise as a result of abnormal part solidification or due to process deviations from the nominal build environment.1,2 As noted in Yavari et al. 3 and Liu et al., 4 the number, size, and morphologies of the resulting flaws can be linked to the structural integrity of the melted material and ultimately to part quality.
Currently, trained professionals are needed to certify the part quality by virtue of manual evaluation of CT scans, which is a labor- and cost-intensive process. In addition, perceived defect severities and morphologies, which hold valuable information regarding material properties and the structural integrity of the part, may often be subjective and thus inconsistent between evaluators. To close this technological gap, we present and validate a complete solution for three-dimensional (3D) automated defect recognition (ADR) using CT scans.
Although commercial ADR algorithms exist, the algorithms are proprietary and therefore closed, have results that are strongly influenced by manual settings, and do not provide detailed flaw morphology information that is critical for certain kinds of analysis (i.e., mapping in situ sensor data collected during an AM build to actual flaws in the final part). Although the algorithm was initially developed for AM parts, it is applicable to any part or material that can be CT scanned. All developed analytic tools can be simplified to accommodate two-dimensional (2D) images.
As described in Spierings and Schneider and Wits et al.,5,6 the commonly used techniques for postbuild inspection include Archimedes' method and ultrasonic inspection (both nondestructive), as well as the evaluation of micrographs of cross sections (destructive). Archimedes' method is a density measurement approach that links the assumed material density and the measured part density, that is, measured weight per volume, to part porosity. Although “the resulting porosity metric is regarded as important quality indicator in metal AM,” Archimedes' method provides no additional information regarding defect sizes, number, or locations.
On the contrary, micrographs of cross sections allow for a very detailed assessment of defect morphologies. The fidelity of the assessment is a function of magnification, the preparation process for the cross section, as well as available analysis tools. However, micrograph assessment is labor-intensive and restricted to just a few local regions, that is, slices, for which micrographs can be obtained and evaluated. Defect statistics for those small, local regions can subsequently be extrapolated across the entire part to approximate the overall porosity using techniques such as the Scheil–Saltykov correction method described in Gegner. 7 Clearly, the latter assumes a rather uniform morphology and distribution of defects, that is, location and size, across the entire part, which may not always be the case.
An overview of the current state-of-the-art in CT is provided in du Plessis et al. 8 and Baniukiewicz. 9 An overall background on X-ray imaging, including parameter choices and their impact on the resulting CT image, is provided. Specifically, the authors of du Plessis et al. 8 establish the fundamental correlation between perceived CT intensities, that is, the X-ray return amplitude, and material density, which ultimately lays the groundwork for CT-based porosity and defect detection. Therefore, it is proposed that X-ray CT inspection and data analysis should be a crucial part of any holistic quality control for AM. However, a high level of automation will be required for consistency and high-confidence CT evaluation and to avoid logistical bottlenecks.
For automated defect detection, one generally distinguishes between supervised and unsupervised classification techniques. The first assumes a set of labeled data that can be utilized to generate a decision boundary between the classes in a higher dimensional feature space. The latter attempts to derive such decision boundaries based on the statistical distribution and spread of available data samples without explicit labels. Supervised classification is carried out in Hou et al. 10 for welding defects using a neural network architecture, and in Mery and Arteta 11 for defect detection in automotive parts while comparing a variety of classifications schemes. Although supervised techniques may achieve accuracies of 90%, classification performance is often dependent on the quantity and quality of available training samples.
In Hou et al. 10 and Mery and Arteta, 11 data sets of 32 × 32 image tiles are provided that have been labeled manually as either “defect” or “no defect.” In contrast, in this study, defects are identified in an unsupervised manner using visual saliency as a discriminator. Since its inception in Itti and Koch, 12 visual saliency has been defined as “the distinct subjective perceptual quality which makes some items in the world stand out from their neighbors and immediately grab our attention.”
Therefore, our approach does not require training samples, which are often difficult and expensive to obtain and label, and there is no assumption regarding the morphology and/or size of the defects. In addition, defect detection is carried out in 3D compared with 2D to fully evaluate CT intensity changes as well as local minima/maxima in all directions. As a consequence, the algorithm is inherently agnostic to the orientation of the part during CT scanning and/or the direction of individual 2D CT slices. Most importantly, our algorithm may accommodate potentially billions of CT voxels and still achieve a reasonable run-time of just 2 min.
Defect detection based on 2D image segmentation is carried out in Faiza and Nacereddine 13 and Lawson and Parker. 14 During image segmentation, adjacent pixels with similar attributes, in this study, CT intensity, are combined into larger segments or superpixels. In Faiza and Nacereddine, 13 features such as compactness, elongation, and/or eccentricity can be computed for each superpixel, and classification can be carried out based on those derived features. In contrast, the work in Faiza and Nacereddine 13 utilizes a neural network for segmentation-based defect detection. Both methods rely on computing similarities between any pixel and its neighbors in a 4-connected or 8-connected sense, which is computationally tractable for most 2D images. However, given 3D imagery data, such as provided by CT scans, neighbor similarities must be computed in a 6-, 18-, or 26-connected sense for potentially billions of voxels.
Therefore, we do not compute 26-connected voxel similarities explicitly but rather address local changes in CT intensity directly by establishing visual saliency using fast 3D convolution operations.
Difficulties for ADR through CT scans often arise due to the so-called beam-hardening effects 15 and scattered radiation.16,17 Beam-hardening describes the process in which the lower frequency (lower energy) portions of a polychromatic X-ray beam are preferentially attenuated as the aggregate beam penetrates the material. As a result, the beam that reaches the interior of the part comprises a greater proportion of higher frequency bands, diminishing the effective attenuation coefficient of those regions of the part. Since the CT reconstruction process produces a map of the relative attenuation coefficients of the part on a voxel-wise basis, the interior appears darker (less attenuating) in the resulting CT scan compared with the regions near the edge. Figure 1 illustrates the beam-hardening effect using an actual CT sample. CT intensities are shown as 2D image (upper left) and surface plot (lower graph).

Illustration of beam-hardening effect using an actual CT sample. CT intensities are shown as gray-scale image (upper left) and surface plot (lower graph). The upper right shows the CT intensities as cross sections along the red and blue lines. CT, computed tomography.
In addition, cross sections of CT intensities are shown along the red and blue lines (upper right). As one can see, recorded CT intensities decrease significantly away from the edges.
Scattering of the incident X-ray beam describes the process through which an incoming photon interacts with orbital electrons of the examination object's atoms, resulting in the photon being deflected from its original vector. 16 The result is that the photon contributes to signal at an element of the digital detector that is inconsistent with the X-ray transmission geometry that is assumed for reconstruction. The impact on the CT data can be the appearance of streaks in the images 17 around highly attenuating objects. In the present case, we consider nominally homogeneous objects, where the primary impact of scatter is to increase the overall noise level, or “randomness,” of the gray-value intensities because of the numerous contributions to signal at random locations in the field of view. The result is an overall diminishing of contrast within the data set.
Although beam hardening and scatter can be reduced through both hardware and software solutions, 18 each of these solutions comes at its own cost, and often cannot completely eliminate the image artifacts. Therefore, ADR based on intensity alone, that is, through simple thresholding, is not considered a feasible approach. Instead, CT intensities, and changes therein, must therefore be evaluated with respect to CT intensity values within a local region.
The article is organized as follows. The Technical Approach section describes the technical approach, including the automated extraction of the part boundary in the Extracting the Part Boundary and Generating the Mask section, the generation of visual saliency in the Generating Visual Saliency section, and the extraction of CT anomaly voxels in the Extracting CT Anomalous Voxels section. The approach is validated in the Experimental Validation section using the existing CT scans. Detected defects are manually inspected to separate true positives (TPs) from false positives (FPs), and performance metrics are derived to assess algorithm performance for various saliency levels. Conclusions are presented in the Conclusion section, while the Future Work section outlines future work.
Technical Approach
This section outlines the technical approach as a complete tool chain that ingests the raw CT image stack in three dimensions and outputs a list of CT anomaly clusters with corresponding attributes, that is, perceived saliency, size, morphology, and orientation.
The Extracting the Part Boundary and Generating the Mask section describes the extraction of the part boundary, that is, the separation of part voxels and background voxels, using statistical measures. This allows the algorithm to be applied to any part geometry without the need for additional part information or CAD files. The part boundary is converted into a 3D binary mask that guides the anomaly detection. The Generating Visual Saliency section focuses on the extraction of CT anomalies within the part. Machine perception and image processing concepts such as visual saliency are generalized, scaled, and applied to the three-dimensional CT voxel data. As a result, individual voxels are flagged as either anomalous or nominal. As the last step, the Extracting CT Anomalous Voxels section discusses a method to merge adjacent anomaly voxels into clusters. Clusters may then be analyzed for severity of the defect as deduced from the resulting CT intensity gradient as well as perceived size, shape, and orientation.
Extracting the part boundary and generating the mask
To confine the ADR to the actual part and avoid false detection near the edge of the part or in the background, a binary mask is generated. As shown in Figure 2, the material generally separates itself from the background through higher CT intensity values. In this case, the cylindrical test coupon (∼10 mmø × 25 mm) was built using metal powder bed fusion AM on a 3D Systems ProX 320 using the standard Ti6Al4V powder and processing recipe, with CT scan parameters set to produce a voxel size of 15 μm.

Two-dimensional slices of the raw 3D CT scan showing XY slice, XZ slice, and YZ slice from left to right. CT intensities are commonly encoded as gray-scale values using 8- or 16-bit unsigned integers. 2D, two dimensional; 3D, three dimensional.
We define the CT intensity at location
The CT intensity
Here,

Histogram of CT intensities (blue) using a 16-bit unsigned integer representation, that is, [0, 65535]. The Gaussian mixture components for background and material are shown in green and red, respectively. A threshold for separation can be found where the expectations of both components are equal, see magenta line.
If needed for computational reasons, the histogram
In addition, it is important to note that the GMM approach outlined above labels individual voxels as material or background using the expectations of the two GMM components. Material voxels may or may not form one connected cluster. In fact, multiple, disconnected clusters may form specifically around the edge of the part. Similarly, large defects with low CT intensity in the interior of the part may be labeled as background, which in turn will exclude them from the subsequent ADR algorithm. It is therefore recommended to apply 3D Gaussian smoothing to the entire CT scan 20 before constructing the GMM to blur out some of those inclusions. Convolution kernels that are twice the size of those used for ADR have shown the best results.
Any remaining background clusters that are fully enclosed by the material cluster may be discarded and merged back into the mask. Figure 4 shows the binary mask resulting from the CT intensity separation through the GMM.

Resulting binary mask for ADR. The mask is generated using a GMM to separate material from background based on the CT intensity values of the smoothened image. ADR, automated defect recognition; GMM, Gaussian mixture model.
Let
Here, the superscript p denotes the
with
Euclidean distance transform algorithms, such as those outlined in Maurer et al.
21
enable efficient computations for both distances (3) and (4) for any binary mask over the entirety of the 3D CT domain. With subsequent convolution operations in mind, utilizing the
Figure 5 shows the CT scan from Figure 2 with contour lines for

Two-dimensional slices of the raw 3D CT scan showing XY slice, XZ slice, and YZ slice from left to right. Contour lines for
A binary mask,
The mask may further be dilated or eroded by adjusting the corresponding threshold
Generating visual saliency
During CT analysis, indications often manifest themselves as voxels or local areas of low or high intensity compared with the surrounding material (Fig. 6). Anomalous CT voxels can be divided into two classes: (1) voids or pores, defined as low-intensity CT voxels surrounded by higher intensity CT voxels (see left side in Fig. 6) and (2) superdensities (perhaps as the result of powder contamination), which are high-intensity CT voxels surrounded by lower intensity CT voxels (see right side in Fig. 6). Nominal CT voxels, characterized by discontinuity and indication-free regions of a test part, are observed as CT voxels that are surrounded by similar intensity CT voxels, thereby generating a near-zero visual saliency.

Indications in CT scan showing (1) void or pore, characterized by low-intensity voxels, that is, local minimum (left) and (2) superdensity, characterized by high-intensity voxels, that is, local maximum (right).
To detect defects such as those shown in Figure 6, the overall saliency is established following machine perception and image processing concepts first outlined in Itti and Koch 12 and Niebur et al. 23 More recent variants and approaches can be found in Cong et al. 24 Specifically, visual attention is generated through saliency to identify voxels or regions that “stand out” in the local neighborhood.
Figure 7 outlines the overall concept for anomaly detection using convolution operations. Assuming a simplified, one-dimensional (1D) case, the CT intensity

Simplified 1D concept for CT anomaly detection using a convolution operation to extract local intensity minima. 1D, one dimensional.
Without assuming any prior knowledge on defect formation, size, or morphology, the ADR algorithm utilizes a multiscale, 3D Gaussian kernel,
with standard deviation
By definition, the zero mean kernel (7) satisfying (8) will generate a visual saliency of zero when convolved over CT intensities that are constant.
In Equation (7), n denotes the size of the kernel, which in turn dictates the spacing of

Left—sliced view of 3D Gaussian kernel of size
The right side of Figure 8 depicts the Gaussian envelop in 1D, which also illustrates the approximate size of the anomaly that would generate a strong correlation (or match) and thus be extracted by virtue of 3D image convolution. The lower plot shows the approximate size of extracted anomalies when using kernel sizes
Compared with prior work outlined in Gobert et al.
25
in which a Gabor wavelet was used, a Gaussian kernel allows for the separation of dimensions during the convolution, which significantly reduces the computational complexity. In fact, it can be shown that any 3D convolution using the Gaussian kernel (7) can be separated using three 1D kernels as follows:
The quantities kx, ky, and kz represent 1D tensors along different spatial directions. Then, for any CT image,
where * denotes the convolution operator. Here, the terms
Given a kernel size, n, the computational requirements to generate the convolution response
The convolution operation (10) is performed over the entire CT scan volume containing part and background. Therefore, background and part edges need to be masked out and subsequently flagged in
In other words, the
Then, for any location r, the kernel is entirely within the mask if and only if
Extracting CT anomalous voxels
For any given kernel size, n, we define highly salient voxels in
for any kernel size n. In other words, a voxel needs to meet condition (12) for only one kernel size to be flagged as anomalous. This is identical to taking the union of all anomalous voxels over all kernel sizes. In Equation (12), the parameter

Histogram of normalized convolution response, that is, zero mean/unit covariance using log scale.
Lowering
After all highly salient voxels
Experimental Validation
The proposed algorithm for ADR was formally evaluated using a test build for an MV-22B Osprey link from Merdes et al.
27
and Simpson,
28
shown on the left side in Figure 10. Experimental validation was carried out in MATLAB for pores only, that is, all

Left: Test coupon (NAVAIR Link) used to validate the ADR algorithm. Right: All 304 detected anomaly clusters.
Again, the latter prevents erroneous detections along the edge of the part that experiences significantly larger intensity gradients. The mask then contains 509 million voxels, roughly 27% of the entire X-ray CT image stack volume.
Kernel sizes of
Figure 11 shows the most salient defect detected, here

Most salient defects detected with saliency
Similar to Figure 11, Figure 12 shows a defect that was labeled as an FP during manual inspection. At

Defect labeled as FP after manual inspection due to lack of saliency. FP, false positive.
Performance metrics for classification and detection algorithms are commonly derived using a fully populated confusion matrix, 29 including resulting numbers for TPs, FPs, FNs, and true negatives (TNs). In this application, the number of negative samples, that is, voxels that are not anomalous, outweighs the number of anomalous voxels by a factor of 20,000, making it a severely unbalanced classification problem. In addition, ground-truth data that label every single voxel as “defect” and “no defect” and the corresponding XYZ location within the entire CT scan of 509 million voxels is hard if not impossible to obtain.
For these reasons, we restrict our performance analysis to TPs, FPs, and FNs only. In other words, we select
When increasing the saliency threshold TPs, number of remaining true detects, FPs, number of remaining false detects, and FNs, number of missed detections compared with the performance baseline with
Figure 13 shows the progression of number of TPs, number of FPs, and number of FNs with increasing saliency threshold

Progression of detection performance measured by number of TPs, number of FPs, and number of FNs as function of increasing saliency threshold parameter
Using TPs, FPs, and FNs only, the following performance metrics for binary classification
28
can be derived.
Here, FDR and MR represent the false discovery rate and miss rate, respectively. In addition, the F1-score, the geometric mean between recall and precision, is defined as
Figure 14 shows the ADR performance as measured by the performance metrics outlined in Equations (13) and (14). Similar to Figure 13, those metrics are plotted as function of the saliency threshold

Detection performance measured by precision, recall, and F1-Score (left) and FDR and MR (Right) as function of saliency threshold
Again, one finds an increase/decrease in precision/recall with increasing
Conclusion
This article presents and validates a complete solution for automated anomaly detection in 3D CT scans that attempts to emulate visual cues used by human observers when detecting flaws. The algorithm is agnostic to part geometry and thus does not require additional input information such as CAD files. Initially, all voxels are categorized as “material” or “background” based on the underlying intensity statistics. All identified “material” voxels then determine the geometric shape of the part including the part surface. Defect detection is based on visual saliency of individual CT voxels, extracted using 3D convolution operations with separable kernels. Kernel separation allows for parallel and thus computationally efficient execution of the algorithm, enabling hardware acceleration using GPUs.
Design parameters include (1) the number and size of convolution kernels to be used, as well as (2) the actual threshold for saliency, that is, the convolution response, measured in standard deviations from the mean. All anomalous voxels are subsequently merged to form anomaly clusters that provide vital flaw information such as size, volume, orientation, and overall morphology. Overall computational complexity is manageable even for CT scans containing billions of voxels because all convolution operations are taking advantage of kernel separability and thus can be carried out in parallel.
Experimental results indicate that the proposed ADR algorithm performs well, with recall, precision, and F1 score well above 90%. Inherent trade-offs exist when specifying the saliency threshold for defect detection, which is generally the case for any binary classification problem. Decreasing the saliency threshold will yield more detected defects but also increase the FP rate. Increasing the saliency threshold will reduce the number of detected defects including the number of FPs. However, the number of missed defects, that is, FNs, will increase.
Future Work
Future work will include additional vetting of the ADR algorithms including a formal correlation between ADR performance and defect size and morphology. It is conceivable to predefine a minimum size for defects of interest, which would be aligned to standard practice in weld inspection that defines a maximum allowable flaw size. Currently, the majority of FPs or missed detections are caused by small defects, which generally have a lesser impact on part performance. In addition, computational complexity can be reduced when focusing only on defects of a certain size.
Although complete performance metrics including accuracy, which requires numbers for TNs, are difficult if not impossible to obtain, additional steps can be taken to provide ground truth using different detection techniques. Serial sectioning, for example, may be utilized to provide a rigorous comparison between actual defects and detected defects using just a subset of the data, that is, 2D slices.
One of the remaining limitations of the proposed algorithm is to detect defects at the edge of the part, which has been observed to be somewhat common in AM parts. Visual saliency is driven by the local CT intensity gradient, which is the largest between part and background, right at the edge of the part. Therefore, future work will focus on modifying the computation of visual saliency in those areas. It is conceivable to compute intensity gradients along the surface while filtering the components normal to it.
Footnotes
Acknowledgments
The authors would like to thank the Naval Air Systems Command and Penn State's Applied Research Laboratory for supporting this project. They also thank Mr. Zack Snow, Mr. Brett Diehl, Dr. David Corbin, and Mr. Griffin Jones for their technical feedback and their efforts in designing the experiments and in data acquisition.
Disclaimer
Any opinions, findings and conclusions, or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of the Naval Air Systems Command (NAVAIR).
Author Disclosure Statement
No competing financial interests exist.
Funding Information
This material is based upon work supported by the Naval Air Systems Command (NAVAIR) under Contract No. N00024-12-D-6404, Delivery Order 0321.
