The radiographic inspection setup geometry and the procedure is illustrated in Figure1. Common setup geometry parameters such as source to rotation point *x* coordinate (*R*_{
x
}), source to detector distance (SDD), and object to detector distance (ODD) are defined in the figure. The intended inspection application is to detect, position, and size submillimeter pore defects in thin (≈ 5 mm) laser-welded titanium. The laser weld geometry parametrization[14] is also indicated in Figure1. The parameters are nominal thickness (*T*), weld width (*B*), enforcement radius (*R*_{0}) and thickness (*δ*_{0}), and undercut radius (*R*_{1}) and thickness (*δ*_{1}).

The image analysis of the radiographs faces two main difficulties, which are illustrated with synthetic radiographs. Firstly, as can be seen in Figure2, large-scale variations over small pixel length scales in the projected weld geometry dominate the gray scale variation compared to the pore indications shown in Figure3. The pore indications in Figure3 are some 20 to 30 times smaller than the large-scale variations in Figure2. Secondly, as indicated in Figure3, the CNR of the pore indications are low. For pores at the size of the detector pixel size, the contrast is highly sensitive to the pore size. The contrast is approximately proportional to radius^{3} or even worse depending on its size compared to the detector pixel size. Furthermore, the pore indication is small in terms of affected number of detector pixels.

The algorithm is divided into the following three tasks: segmentation, tracking, and size measurement. The segmentation output is a set of coordinates of pore projection indications in the radiographs from the different rotations. This list is input to the tracker, which solves for the 3-D coordinates at the same time as it filters out false pores. The pores proposed as true pores are then paired up with their projection coordinates and used as input to the size measurement algorithm. It should be noted that the concept is to retrieve what is interesting, the pore indications, rather than to first make a low-noise radiograph.

### 2.1 Segmentation

The segmentation should output a set of 2-D pixel coordinates representing the mass centers of all pore indications in each of the radiographs. It is preferred to have a high true-positive rate, a low false-positive rate, a high precision in the mass centers, and a high uniqueness. Where a high uniqueness is defined as each pore coordinates is only listed once among the coordinates, three different segmentation methods (see Figure4) have been evaluated: a radial symmetry based, a cross correlation, and an energy weighted cross correlation. To address the uniqueness, a merger algorithm common to all methods is applied as a final step.

#### 2.1.1 Radial symmetry

The idealized pore will be projected with circular symmetry in the intensity pixel values around the mass center point when the intensity is otherwise constant. Therefore, a high level of circular symmetry is expected to be a good measure of a pore projection center. In[15], a measure of local symmetry based on normalized axial moments is derived and implemented as a discrete symmetry transform (DST). The DST is calculated as given in[15, 16] according to

\begin{array}{l}\text{DST}(i,j)=1-\sqrt{\frac{{\sum}_{k}({T}_{k}{(i,j)}^{2})}{{n}_{\text{rs}}}-{\left(\frac{\sum _{k}{T}_{k}(i,j)}{{n}_{\text{rs}}}\right)}^{2}},\end{array}

(1)

\begin{array}{ll}\phantom{\rule{5pt}{0ex}}{T}_{k}(i,j)& =\frac{1}{{T}_{\text{max}}}\sum _{(l,m)\epsilon {C}_{r}}|(i-l)sin(\frac{k\pi}{{n}_{\text{rs}}})\\ \phantom{\rule{1em}{0ex}}-(j-m)cos(\frac{k\pi}{{n}_{\text{rs}}}){|}^{{l}_{\text{rs}}}\times I(l,m).\end{array}

(2)

The sum in *T*_{
k
}(*i*,*j*) is summed over the indexes which are on the boundary of the pixelated circle *C*_{
r
} of radius *r*_{rs} with pixels centered in (*i*,*j*). In total, *n*_{rs} number of local axial moments *T*_{
k
} at the order *l*_{rs} are calculated and summed over with *k* = 0,…,*n*_{rs}-1 at each *i*,*j*. The maximum value of *T*_{
k
} is then used as the normalization factor *T*_{max}. The transform will look for symmetry around the axis with slope given by *k* *π*/*n*_{rs}, that is, axes in the case of *n*_{rs} > 1.

In[15], the DST is only applied at points of nonuniformity; here, the nonuniformity stage is changed to identify potential pore projection center points instead. The following differential expression is proposed to identify a symmetric peak around the second index *j* with possible radius ≈ *r*_{rs}:

\begin{array}{ll}\phantom{\rule{5pt}{0ex}}E(i,j)& =[I(i,j+{r}_{\text{rs}})-I(i,j+{r}_{\text{rs}}+1)]\\ \phantom{\rule{1em}{0ex}}+[I(i,j-{r}_{\text{rs}})-I(i,j-{r}_{\mathit{\text{rs}}}-1)],\end{array}

(3)

where the direction of index *j* is perpendicular to the weld geometry. *E* will be large when slopes are opposite around (*i*,*j*) and, for example, identical to zero for a perfect line. As a final step, the DST matrix is convoluted with a Gaussian kernel *G* with standard deviation *σ*_{rs} resulting in a correlation image:

{C}_{\text{rs}}(i,j)=(E(i,j)\times \mathit{\text{DST}}(i,j))\star G.

(4)

This procedure is run *i*_{rs} number of times for different *r*_{rs}, with the result averaged. It should be noted that when the number of axial moments is set to 1 (*n*_{rs} = 1), the correlation image will only depend on *E*(*i*,*j*) since DST(*i*,*j*) = 1 for all *i*,*j*.

#### 2.1.2 Cross correlation

If a mathematical model of the pore projection can be derived, such a model can be correlated against the image to find correlation maximums and hence the locations of the pore indications. The same linear X-ray attenuation model as in[14] is used but with the detector approximated as ideal and the X-rays approximated as parallel. The 2-D projection of the pore with radius *r*_{cc} pixels centered in *c* is approximated as

K(i,j)\sim {e}^{2\mu \sqrt{{r}_{\text{cc}}^{2}-[{(i-c)}^{2}+{(j-c)}^{2}]}}-1,

(5)

where *μ* is the linear attenuation per pixel for the surrounding material. Furthermore, the equation is only valid for{(i-c)}^{2}+{(j-c)}^{2}\le {r}_{\text{cc}}^{2}.

The detector model used for the synthetic radiographs will smooth the pore projection indications due to its point spread function. This smoothing will also be present in real radiographs. However, due to the idealized detector model used, this effect is not included in Equation 5. Furthermore, the buildup factor (fraction of scattered to direct radiation) is assumed to be approximately constant over the area of the projected pore. This has been shown to hold for this application in[14]. Finally, probably the least valid assumption is that the background intensity profile, in this case dominated by the weld geometry, is changing little compared to the change due to the pore. This assumption is not valid, and therefore, geometry-related intensity changes must be reduced. This reduction is done using a simple local median with radius *r*_{me},{I}^{\star}(i,j)=I(i,j)-{\text{Median}}_{k,l\epsilon {r}_{\text{me}}}I(i\pm k,j\pm l). As a last step, the normalized cross correlation is calculated at each pixel against the model proposed in Equation 5 according to the standard equation:

\begin{array}{ll}\phantom{\rule{5pt}{0ex}}{C}_{\text{cc}}(i,j)& =\\ \frac{{\sum}_{(l,m)}K(l,m)\times {I}^{\star}(i+l,j+m)}{\sqrt{{\sum}_{(l,m)}{(K(l,m)-\u3008K\u3009)}^{2}\times {I}^{\star}{(i+l,j+m)}^{2}}},\end{array}

(6)

where the summation is over all indexes within a square of size *s*_{cc} and 〈〉 denote average. A value close to 1 will indicate a high similarity to *K*.

A variation of the cross correlation method is also considered and referred to as energy weighted cross correlation. The cross correlation is scaled with the energy in the intensity according to

{C}_{\text{ene}}(i,j)={C}_{\text{cc}}(i,j)\times \sum _{(l,m)}{I}^{\star}{(i+l,j+m)}^{2},

(7)

where the indexes *l*,*m* is given by *K*(*l*,*m*) ≠ 0.

#### 2.1.3 Mean shift merging

The last step of the segmentation is a merger algorithm, which intends to make the coordinates unique. The algorithm is based on the mean shift algorithm[17]. The mean shift algorithm is generally used to find high-density regions (clusters) in multidimensional spaces. Here, it is used to find the centers of pore indication clusters in 2-D.

In more detail, the merger iteratively selects the pixels in the correlation image with values larger than *C*_{
T
}. For each pixel above *C*_{
T
}, the mean shift algorithm is restarted and iterated until it has converged into a local maximum in density. At each iteration, the mass center within a radius *r*_{ms} is calculated and compared with the previous mass center, the mean shift vector. In the next iteration, this next proposed mass center is used. This is repeated until the solution is considered as having converged, with the mean shift vector changing less than *δ*_{ms} percent. The converged coordinates are incrementally averaged in bins of 1-pixel sizes. As a consequence, indications closer than ≈ *r*_{ms} will not be resolvable.

### 2.2 Tracking

The tracker should not only invert the 3-D to 2-D X-ray projection for the defects to solve for the 3-D physical coordinates of the defects in the weld but at the same time also handle the high false-positive rate from the segmentation algorithm. Formally, a tracker tracks a state *X* of a single or multiple objects by assigning measurements *Y* to different objects as time increases (data association). The measurement is predicted, and the state of each object is updated when a new measurement is assigned to it (filtering). The measurements are the set of pore projection coordinates in the detector plane given by the segmentation.

The filtering step consists of measurement prediction and object state vector update. It is often handled by a member of the Kalman filter family (see for example[18]). In this article, the extended Kalman filter (EKF) is used since the measurement function *Y* = *h*(*X*) is nonlinear. The nonlinearity is rather low, and the EKF is assumed to be sufficient. The filter state variables are the 3-D coordinates **p** = (*p*_{
x
},*p*_{
y
},*p*_{
z
}) of each of the pores and the rotation angle *ω*. The mass center coordinates **m** of the projection of an ideal pore following the notations in Figure5 are given by

\begin{array}{l}{\mathbf{m}}_{y}=\frac{\text{SDD}[{T}_{x}\phantom{\rule{.15em}{0ex}}sin\phantom{\rule{.15em}{0ex}}\omega +{T}_{y}\phantom{\rule{.15em}{0ex}}cos\phantom{\rule{.15em}{0ex}}\omega +{R}_{y}-{S}_{y}]}{{T}_{x}\phantom{\rule{.15em}{0ex}}cos\phantom{\rule{.15em}{0ex}}\omega -{T}_{y}\phantom{\rule{.15em}{0ex}}sin\phantom{\rule{.15em}{0ex}}\omega +{R}_{x}}+{S}_{y},\\ \phantom{\rule{.5pt}{0ex}}{\mathbf{m}}_{z}=\frac{\text{SDD}[{p}_{z}-{S}_{z}]}{{T}_{x}\phantom{\rule{.15em}{0ex}}cos\phantom{\rule{.15em}{0ex}}\omega -{T}_{y}\phantom{\rule{.15em}{0ex}}sin\phantom{\rule{.15em}{0ex}}\omega +{R}_{x}}+{S}_{z},\\ \phantom{\rule{.35em}{0ex}}{T}_{x}={p}_{x}-{R}_{x},\\ \phantom{\rule{.35em}{0ex}}{T}_{y}={p}_{y}-{R}_{y},\end{array}

(8)

where **m** is in millimeters and is translated and scaled into the detector plane before it is used. These equations are then linearized in the EKF framework, and a standard Kalman filter approach is applied. The measurement errors are assumed to be Gaussian with a diagonal covariance matrix. The diagonal elements are denoted *R* for the pore indication coordinates and *R*_{
ω
} for the angle. The states will typically oscillate weakly, an effect which can be modeled by a nonzero state covariance matrix. However, it is set to zero since the oscillations are assumed to be negligible compared to the measurement errors. Being linearized, the EKF is sensitive to the initial state. However, in some cases an initial state close to the true state can be derived from two measurements; therefore, the state initiation is delayed until measurements from two rotations are present. Allowing rotation only around one of the euclidean base vectors, one can solve the two equations in Equation 8 for the two unknown coordinates (*p*_{
x
},*p*_{
y
}). Additionally, *p*_{
z
} is approximately known from the rotation axis limitations. The state initiation is accepted if *G*_{x 0} < *p*_{
x
} < *G*_{x 1} and otherwise rejected. The gates *G*_{x 0} and *G*_{x 1} are approximated from the setup geometry. The initial state could also be derived using the formalism of vision systems, relaxing the demand on rotation axis, though this approach has not been takenhere.

One data association method suitable for the situation is the multiple hypothesis tracker (MHT) originally presented in[19]. It is suitable when the number of objects to track is not known *a priori* and/or when the clutter density is high. The implementation derived is very similar to the ‘Structured Branching’ MHT as described in[20]. The assumptions made are that each object generates at most one measurement but each measurement can originate from many different objects. The last assumption accepts overlapping pore projections in some of therotations.

In the nomenclature of tracking, as the object changes its state in some partly known way, the measurements belonging to it forms a track and the track can be used to solve for the state. The main idea of the MHT is that it computes many possible tracks from different combinations of measurements and selects only the most probable. The different combinations can be kept in a tree, with the path from each leaf to the root representing one solution. The probability for each track (object) to be a true positive is, if it is not properly normalized, referred to as its score. The score is constructed by the summation over all nodes, one at each rotation *k*, for each track as log likelihoods according to

\begin{array}{l}{\text{score}}_{k}={\text{score}}_{k-1}+\mathrm{\Delta}\text{score},\end{array}

(9)

\begin{array}{l}\mathrm{\Delta}\text{score}=-{d}_{0}^{2},\end{array}

(10)

\begin{array}{l}\mathrm{\Delta}\text{score}={S}_{\text{mht}}\times ln\left[1/\sqrt{det(\text{RS})}\right]-{d}^{2},\end{array}

(11)

where Equation 10 refers to the case of no measurement (the pore indication is not detected in the radiograph) and Equation 11 refers to when a measurement is present. RS is the measurement residual covariance matrix, which increases with *R*, *R*_{
ω
}, and the covariance matrix calculated in the Kalman filter step. *S*_{mht} is a scaling parameter to weight the two terms. Further, *d*^{2} is a normalized statistical distance indicating how far away the measurement is from the prediction with respect to the uncertainty indicated by RS. See[13] for an in-depth discussion on the constants and the scores.

In the last paragraphs of this subsection, (row *X*) will be used to refer to row number *X* in the following pseudocode of the implementation:

Adding new nodes to the tree is done with great care for the tree not to grow too large. The gates *G*_{
z
} and *G*_{
y
} are applied on the two detector coordinates (row 5). If the difference between the previous measurement and the new one is within the gates, a new node for the measurement is added (row 6). There is always a node added for the no measurement case (row 7). The no measurement case represents the hypothesis that the measurement was not detected in the current rotation.

Apart from the gating, a pruning of the tree is also conducted. At the pruning (row 9), the leaves with 〈score〉 = score_{
k
}/*k* ≥ *T*_{1} are accepted and kept while the rest are rejected and pruned. In addition, a maximum limit of five leaves per root is applied, where the leaves with the highest 〈score〉 are kept. These two constants are chosen to yield reasonable run times. The pruning is skipped for those trees which have less than three rotations since two rotations are required for deriving the initial state alone.

At the first rotation, all measurements lead to new track roots, but at later rotations, only the measurements which are far away from any current track prediction are added (row 10). The distance to other track threshold is given by{d}_{min}^{2}>{d}_{\text{upd}}^{2}, where *d*_{min} is the minimum distance to any track prediction for the measurement at the current rotation. This is done to assure that those measurements which are likely not to belong to any existing track are identified as new roots.

At the decide stage (row 11), the single most probable track (pore) from each tree root is selected and either accepted or rejected. The most probable track is the leaf with the highest 〈score〉. In addition, the following conditions must be met in order for the selected tracks to be accepted: 〈score〉 ≥ *T*_{2}, *G*_{x 0} < *p*_{
x
} < *G*_{x 1}, and it should have less than *i*_{lost} number of no measurement nodes.

As a final step (row 12), the tracks (pore proposals) which have states close to each other are combined. This combine step is required since the creation of new tracks might lead to multiple pore proposals originating from the same physical pore. The distances between all pair of solutions are verified not to be closer than *δ*_{
u
} (in millimeters); if so, the highest 〈score〉 solution is chosen. This is iterated until there are no solutions closer than *δ*_{
u
} (in millimeters). The solution will, in most cases, not be unique but is believed to represent reality just as good as any of the other solution. As a consequence, *δ*_{
u
} becomes a resolution limiting parameter.

### 2.3 Size measurement

Two possible approaches to measure the size of a pore is either by its projection spatial size or intensity. A projection spatial size approach is assumed to have lower resolution in size than an intensity based for pore sizes at the order of the detector pixel size. Therefore, an intensity-based approach is used, where a scalar depending on the intensity is constructed to correlate with the pore size. Different scalar proposals are constructed in three steps. Firstly, the natural logarithm is optionally applied to the radiograph. Secondly, the weld geometry background (see Figure2) is removed by subtracting the local median of size *r*_{me} from the original radiograph as

{I}^{\star}(i,j)=I(i,j)-{\text{Median}}_{k,l\le {r}_{\text{me}}}I(i\pm k,j\pm l).

(12)

Thirdly, a sum *U* is constructed for the pore indication centered at (*i*_{0},*j*_{0}) according to

U=\sum _{i={i}_{0},j={j}_{0}\pm {r}_{\mathit{\text{siz}}}}F[{I}^{\star}(i,j)],

(13)

where the index *j* is along the direction perpendicular to the weld direction. Three functions *F* are evaluated: linear *F* = *I*^{⋆}, absolute value *F* = |*I*^{⋆}|, and square *F* = (*I*^{⋆})^{2}. The sum *U* is then averaged over the radiographs at different rotations. The proposed method will yield relative pore sizes; to get real pore sizes, a calibration step is required, which is not elaborated on in this article.