# Implementation of Constrained Swept Synthetic Aperture Using a Mechanical Fixture
## 2 Materials and Methods
### Motion Estimation Methods
#### 2.4.3 Subsample and Multi-Lag Estimation  
For both methods, it is necessary to perform subsample estimation to precisely track motion between frames. For speckle tracking, the beamformed lateral pixel sampling determines the quantization of motion estimates. For channel tracking, estimates were quantized to the element pitch. While it is possible to adjust the choice of lateral pixel sampling to improve the estimation accuracy, that is not possible for the array elements used in channel correlation. Instead, the correlation curve as a function of displacement (lag) was fit to a model allowing us to estimate the location of the peak correlation and the peak correlation value [38]. The iterative reconstructive interpolation method was used for all subsample estimation in this work, although this requires a strictly bandlimited signal and may produce errors for spatially undersampled (aliased) signals. In those cases, a polynomial fit may produce a better result.  
In order to reduce both noise and quantization error multi-lag estimation scheme was implemented, combining displacement estimates from multiple combinations of image frames [39]. A measurement matrix \(\mathbf{H}\) was constructed where each row represents the difference in position between two frames at positions in \(\mathbf{X}\). The estimated displacements are stored in the matrix \(\mathbf{\Delta}\mathbf{X}\) and may contain some error \(\mathbf{\epsilon}\):  
\[\mathbf{H}\mathbf{X}=\mathbf{\Delta}\mathbf{X_{true}}=\mathbf{\Delta}\mathbf{X}+\mathbf{\epsilon} \tag{1}\]  
For example, for a sequence with four images at positions \(X_{1}\)-\(X_{4}\) this becomes:  
\[\left[\begin{array}{cccc}-1&1&0&0\\ -1&0&1&0\\ -1&0&0&1\\ 0&-1&1&0\\ 0&-1&0&1\\ 0&0&-1&1\\ 1&1&1&1\end{array}\right]\left[\begin{array}{c}X_{1}\\ X_{2}\\ X_{3}\\ X_{4}\end{array}\right]=\left[\begin{array}{c}\Delta X_{12}\\ \Delta X_{13}\\ \Delta X_{14}\\ \Delta X_{23}\\ \Delta X_{24}\\ \Delta X_{34}\\ 0\end{array}\right] \tag{2}\]  
where \(\Delta X_{ij}\) is the lateral motion estimate produced between the \(i\) and \(j\) frames. The final row enforces a zero mean condition for the estimates to center the result. A weighted least squares solution to this system was used to estimate the individual frame positions \(\mathbf{\hat{X}}\), using the peak normalized cross-correlation coefficient in the weighting matrix \(\mathbf{W}\) to favor highly correlated measurements:  
\[\mathbf{\hat{X}}=\left(\mathbf{H}^{T}\mathbf{W}\mathbf{H}\right)^{-1}\mathbf{H}^{T}\mathbf{W}\mathbf{ \Delta}\mathbf{X} \tag{3}\]  
In this study measurements were limited to a maximum separation of 10 frames, but if computation time were not an issue the \(\mathbf{\Delta}\mathbf{X}\) matrix could be extended with more distant pairs until the correlation coefficient indicated that the estimates were no longer useful.  
The code for these methods is made available at [[https://github.com/bottenuslab/lateral_transducer_tracking](https://github.com/bottenuslab/lateral_transducer_tracking)]([https://github.com/bottenuslab/lateral_transducer_tracking](https://github.com/bottenuslab/lateral_transducer_tracking)) ([[https://doi.org/10.5281/zenodo.7682384](https://doi.org/10.5281/zenodo.7682384)]([https://doi.org/10.5281/zenodo.7682384](https://doi.org/10.5281/zenodo.7682384))).