# On-the-Fly Machine Learning for Improving Image Resolution in Tomography
## 3 Method
### Reconstruction  
From the acquired datasets, two reconstructions are computed. The first reconstruction contains the entire object at low resolution, and the second reconstruction describes the region of interest at high resolution. Because these reconstructions are later used for the training of a neural network, we ensure that their voxel grids are aligned. The dimensions of the low-resolution reconstruction grid are determined using the pixel size \(r\) and the physical dimensions \(\Omega\) of the object. We calculate the effective voxel size \(v_{\text{low}}=r/a_{\text{low}}\) using Equations (4) and (5). Given the voxel size, the shape of the voxel grid \(\mathbf{x}^{\text{low}}\), \(N_{\text{low}}\times N_{\text{low}}\times N_{\text{low}}\), is established such that its real-world volume \(\Omega_{\text{low}}\subset\mathbb{R}^{3}\) covers the object, i.e., \(\Omega\subseteq\Omega_{\text{low}}\). On this grid, the low-resolution reconstruction is computed using the FDK algorithm  
\[\mathbf{\tilde{x}}^{\text{low}}=\mathbf{FDK}\left(\mathbf{p}^{\text{low}} \right)\in\mathbb{R}^{N_{\text{low}}^{3}}. \tag{8}\]  
Next, we determine the shape and voxel size \(v_{\text{high}}\) of the high-resolution voxel grid \(\mathbf{x}^{\text{high}}\). We set the voxel size to equal \(v_{\text{high}}=v_{\text{low}}/k\), where \(k\) equals \(a_{\text{high}}/a_{\text{low}}\) rounded to the nearest integer. In practice, magnification factors \(a_{\text{low}}\) and \(a_{\text{high}}\) can be carefully chosen to avoid the need for rounding. The voxel size \(v_{\text{high}}\) is close to the limit defined by Equation (4), since, by Equation (5), we have  
\[v_{\text{high}}=\frac{v_{\text{low}}}{k}\approx v_{\text{low}}\frac{\alpha_{ \text{low}}}{\alpha_{\text{high}}}=\frac{r}{\alpha_{\text{low}}}\frac{\alpha_{ \text{low}}}{\alpha_{\text{high}}}=\frac{r}{\alpha_{\text{high}}}. \tag{9}\]  
We fix the physical volume of the high-resolution grid, \(\Omega_{\text{high}}\), to be contained in the region of interest, i.e., \(\Omega_{\text{high}}\subseteq\Omega_{\text{ROI}}\), and set its shape, \(N_{\text{high}}\times N_{\text{high}}\times N_{\text{high}}\), such that \(N_{\text{high}}\) is divisible by \(k\). Now, voxels from \(\mathbf{x}^{\text{low}}\) relate to cubes of \(k\times k\times k\) voxels in \(\mathbf{x}^{\text{high}}\). This assists in modeling the forward projection of the second scan. As shown in Figure 3, the rays forming the projection data, \(\mathbf{p}^{\text{high}}\), have been transmitted through both \(\Omega_{\text{high}}\) and \(\Omega\setminus\Omega_{\text{high}}\). This is modeled by the discrete linear equation  
\[\mathbf{p}^{\text{high}}\approx\mathbf{A}^{(\text{high})}\mathbf{x}^{\text{ high}}+\mathbf{A}^{(\text{low}\to\text{high})}\mathbf{M}\,\mathbf{x}^{\text{ low}}, \tag{10}\]  
where \(\mathbf{M}\in\mathbb{R}^{N_{\text{low}}^{3}\times N_{\text{low}}^{3}}\) is a matrix that masks all voxels in \(\mathbf{x}^{\text{low}}\) that are contained in \(\Omega_{\text{high}}\). In other words, \(\mathbf{M}\) is a diagonal matrix where the diagonal is 0 on row \(i\) if voxel \(i\) of the large grid \(\mathbf{x}^{\text{low}}\) overlaps \(\Omega_{\text{high}}\), and is 1 elsewhere. The matrix \(\mathbf{A}^{(\text{low}\to\text{high})}=(a_{ij})\) is defined such that \(a_{ij}\) represents  
Figure 3: An illustration of the second tomographic scan. The object, supported on \(\Omega\), is scanned at magnification \(a_{\text{high}}=SDD/SOD_{2}\). Now, only the region of interest, \(\Omega_{\text{ROI}}\), is always in full view of the detector. The high-resolution reconstruction grid \(\mathbf{x}^{\text{high}}\) is thus constrained to the rectangular volume \(\Omega_{\text{high}}\). Part of the object outside of \(\Omega_{\text{high}}\) contributes to the acquired projection data. This is highlighted in red. the contribution of the low-resolution volume voxel \(\mathbf{x}_{j}^{\text{low}}\) to detector pixel \(\mathbf{p}_{i}^{\text{high}}\) at magnification \(\alpha_{\text{high}}\).