# Resolving Gas Bubbles Ascending in Liquid Metal from Low-SNR Neutron Radiography Images
## 3 Image Processing
### Multi-Scale Recursive Interrogation Filter (MRIF)
#### 3.4.1 MRIF Core
It was designed to be less aggressive because MRIF ensures that only the crucial background context from the image is retained within an IW, e.g., the somewhat destructive SCTMM is not required. The local filter operates on an IW as described in Algorithm 5. Here the mean filtering radius is a fraction of the expected bubble scale--this is to avoid averaging out the finer shape features. The filtering radius is set based on the expected lower threshold for bubble surface perturbation wavelength. The gradient filter regularization kernel (3) scale was set equal to the mean filtering radius. ```
Input: Global SSCF filter output (Algorithm 3) mapped onto an IW
1 Mean filtering Implicit edge detection
2 Compute edge halos using the gradient filter (Gaussian regularization + Bessel derivative kernel)
3 Chan-Vese binarization (11)
4 (Optional) Morphological erosion
5 Thinning transform Segment filling and cleanup
6 Filling transform
7 Mean filtering (small radius)
8 Otsu binarization
9 Remove border components Output: Updated local shape estimate
```

**Algorithm 5**Local segment refinement for IWs

Chan-Vese binarization is a variational method for object segmentation in images that does not explicitly utilize edges. It is generally more robust than edge- and histogram-based methods (e.g., Otsu, Canny [70; 71]) but is more computationally expensive [72]. However, this can be afforded relatively easily in the case of IWs that are only a fraction of the original images. Chan-Vese two-level segmentation works by assigning the following functional to an image (in this case single-channel) and minimizing it iteratively [72]:

\[\min\underbrace{\mu\cdot L(C)}_{1}+\underbrace{\
u\cdot S(C)}_{2}+\underbrace{ \lambda_{1}\int_{D_{1}}\left|I(\vec{r})-\langle I\rangle_{D_{1}}\right|^{2} \,dS}_{3}+\underbrace{\lambda_{2}\int_{D_{2}}\left|I(\vec{r})-\langle I \rangle_{D_{2}}\right|^{2}\,dS}_{4},\ \ \ C=\partial D_{1,2} \tag{11}\]with respect to \(C\), where \(C\) is the set of segment contours, \(L\) is the length of \(C\), \(S\) is the area enclosed by \(C\), and \(\mu\), \(\
u\), \(\lambda_{1}\) and \(\lambda_{2}\) are the control parameters. The Chan-Vese process is typically initialized by defining \(C\) such that the image area is covered with a checkerboard of small circular contours of adjustable size, preferably very fine [72]. Two regions within an image are defined: areas within \(C\) initially given by circular contours (\(D_{1}\)) and outside \(C\) (\(D_{2}\)). Minimizing (11) has several effects on \(C\): their combined length (term 1), area of \(D_{1}\) (term 2), as well as the total discrepancy between the region luminance values and the region averages (terms 3 and 4) are reduced--the relative prevalence of these effects is dictated by \(\mu\), \(\
u\), \(\lambda_{1}\) and \(\lambda_{2}\). \(C\) is defined as the zero crossing of a special level set function [72]. Optimization is performed for a certain number of iterations, generally resulting in the unification/dissolution of the initial disjoint \(C\) components until, ideally, \(C\) encapsulates the desired segments in the image. The Chan-Vese process also guarantees that \(C\) is a set of Jordan curves. Minimization of (11) can be performed by solving the following PDE with respect to the level set function \(\varphi\) for \(C\)[72]:

\[\frac{\partial\varphi}{\partial t}=\delta(\epsilon,\varphi)\left(\mu\cdot \
abla\left(\frac{\
abla\varphi}{|\
abla\varphi|}\right)-\
u-\lambda_{1} \left(I-\langle I\rangle_{D_{1}}\right)^{2}+\lambda_{2}\left(I-\langle I \rangle_{D_{2}}\right)^{2}\right) \tag{12}\]

with the BC

\[\frac{\delta(\epsilon,\varphi)}{|\
abla\varphi|}\cdot\frac{\partial\varphi}{ \partial\vec{n}}=0 \tag{13}\]

defined for \(\partial D:D=D_{1}\cup D_{2}\).