# Shear Wave Velocity Estimation Using the Real-Time Curve Tracing Method in Ultrasound Elastography
## 2 Method and Principle  
In this paper, shear waves are generated by ultrasonic radiation force. Firstly, the relationship between the energy of shear wave and the distance of the focus point is obtained by the log compressed B-mode data, that is, to search the spatial distribution of each time \(i\) (\(i\ =\ [1:i]\)) on all \(i\) time points, as shown in Equation (1). \[S_{i}\ =\ \arg\{\max(u(x,t_{i}))\} \tag{1}\]  
where the displacement spatiotemporal data is given by \(u(x,t)\), and the \(\arg\{\cdot\}\) operator is intended to obtain the indices for the points related to the maximum of the displacement profiles. The position information of each point corresponding to \(S_{i}\) is found in the frame \(i\)\(th\) image \(f_{i}(x,y)\) of the shear wave propagation video (where \((x,y)\) are the pixel coordinates, the transverse pixel spacing is 0.25 \(\lambda\) and the longitudinal pixel spacing is 0.5 \(\lambda\), 1 \(\lambda\) = 0.2464 mm). Taking these points as the center, a range is determined with the standard of excitation duration, and then convolution is performed in the range with a 5 \(\times\) 5 Sobel operator and \(f_{i}(x,y)\). In other words, the position of each point corresponding to \(C_{i}\) is taken as the center, and the edge is searched \(i\)\(th\) times in a certain range. The approximate luminance difference matrices \(G_{x}\) and \(G_{y}\) in x and y directions are obtained, as shown in Equations (2) and (3), where \(*\) is the convolution operation. \[G_{x}\ =\ \left[ \begin{array}{cccc}1&2&0&-2&-1\\ 4&8&0&-8&-4\\ 6&12&0&-12&-6\\ 4&8&0&-8&-4\\ 1&2&0&-2&-1\\ \end{array} \right]*f_{i}(x,y) \tag{2}\]\[G_{y}\ =\ \left[ \begin{array}{cccccc}-1&-4&-6&-4&-1\\ -2&-8&-12&-8&-2\\ 0&0&0&0&0\\ 2&8&12&8&2\\ 1&4&6&4&1\end{array} \right]\ast f_{i}(x,y) \tag{3}\]  
Finally, the gradient magnitude \(M\) and direction \(\theta\) of each pixel are calculated. The gradient amplitude and direction angle are obtained by polar coordinate transformation, which are expressed by Equations (4) and (5). \[M(x,y)\ =\ \sqrt{G_{x}(x,y)^{2}+G_{y}(x,y)^{2}} \tag{4}\]  
\[\theta(x,y)\ =\ \arctan\left(\frac{G_{x}(x,y)}{G_{y}(x,y)}\right) \tag{5}\]  
where \(M(x,y)\) and \(\theta(x,y)\) reflect the intensity and the direction of the image edge, respectively. In order to determine the edge information more accurately, we keep the maximum value of the local gradient and suppress its non-maximum value. The gradient intensity of the current pixel \(M(x,y)\) is compared with the gradient intensity of four pixels along its positive and negative gradient directions. If the gradient intensity of the current pixel is higher than that of the other four pixels, the pixel is retained as an edge point. After that, we need to select and connect the edge points, and the specific operation is as follows: (1) selecting the appropriate threshold T, (2) marking the edge points whose gradient amplitudes are greater than T, (3) connecting the marked edge points to form a closed curve. After \(i\) times of searching, the edge information of each search is determined, and it is connected to form a closed curve. Then, the intersection of the closed curves containing any point of \(C_{i}\) in the \(i\) times search is taken as a connected domain. Meanwhile, to eliminate the artifacts of shear wave propagation, this paper includes a directional filter matrix. A directional filter with a minimum circumscribed rectangle is designed for the connected domain of the shear wave image, and the data outside the directional filter are set to 0. Next, Gaussian filtering is applied to the shear wave image \(h_{i}(x,y)\) after this processing, and the filtered image \(p_{i}(x,y)\) is obtained, as shown in Equation (6). \[ \begin{array}{ll}p_{i}(x,y)&=\ K(x,y,\sigma)\ast h_{i}(x,y)\\ &=\left(\frac{2\pi\sigma}{2\pi\sigma}e^{-\frac{\pi^{2}+\sigma^{2}}{2\sigma^{2 }}}\right)\ast h_{i}(x,y)\end{array}  \tag{6}\]  
where \(K(x,y,\sigma)\) is the two-dimensional Gaussian kernel function, \(\sigma\) is the standard deviation and \(\ast\) denotes convolution operation.