## 2 Principles and Algorithms
Equation (10) is further used for attenuation compensation, and the value of \(\beta\) is calculated by Equation (8). \[20\log_{10}\frac{u}{u_{0}}=-\beta fz \tag{10}\]  
\[u_{o}=u\cdot 10^{\frac{dfz}{20}}=u\cdot k \tag{11}\]  
where \(k\) is the compensation coefficient. Equation (11) shows that the original pulse-echo signal changes exponentially with the distance. If the echo signal is amplified with the compensation coefficient \(k\), it can compensate for the attenuation. The above formulas can be used to realize adaptive TGC for pulse-echo signals. The process of breast ultrasound image reconstruction algorithm based on adaptive TGC is as follows. Algorithm: Breast ultrasound image reconstruction  
1. The slice data (RF data) was acquired from experiments or simulations by using ultrasound transmitting/receiving circuits. Then, we loaded pulse-echo signal data and stored it as a matrix by using MATLAB software. The matrix name was _sig_. 2. The data were normalized by dividing values by the maximum value of the matrix, and the noise signal was filtered with the Butterworth bandpass filter. The central frequency of the filter was 3 MHz, and the upper cut-off frequency and lower cut-off frequency were 2.8 and 3.2 MHz, respectively. The name of the filtered data matrix was _f-sig_. 3. Adaptive TGC:  
The whole RF dataset was divided into smaller 2D blocks to obtain a consistent power spectrum, and the 2D block diagram is shown in Figure 1. Each 2D block contained ten A-scan lines in the lateral direction, and each 2D block was divided into a gated window with a 50% window overlap in the depth direction. A Hamming window was utilized to minimize spectral leakage artifacts. The size of the 2D block was \(2\times 2\) mm. The blocks overlapped along the axial and lateral directions with an overlap rate of 50%. Thirty Fourier spectra within the 2D block were averaged to acquire the 2D block power spectrum. The attenuation coefficient \(\beta\) was estimated from ten A-scan lines by averaging the attenuation value of blocks in depth. Then, \(k\) was obtained according to Equation (11), and each \(k\) applied to the corresponding ten A-scan lines. Figure 1: A 2D block diagram for computing the power spectrum. After estimating the 2D block power spectra, the center frequency \(f_{c}\) of each 2D block power spectrum was extracted. The different \(f_{c}\) values were stored as a matrix. The center frequency downshift between two consecutive power spectra was obtained. The slope of the attenuation between two consecutive power spectra was estimated by calculating the slope of the linear regression of the frequency shift estimates as a function of depth. Then, we estimated the variance \(\sigma\) using the full-width half maximum (FWHM) of the 2D power spectrum. FWHM refers to the full width of the absorption band when the absorption band is half the maximum height, that is, when the power spectrum width when the peak value drops by \(-6\) dB. The slope of the attenuation and the variance \(\sigma\) were put into Equation (7) to obtain the attenuation coefficient \(\beta\). After estimating the attenuation coefficient \(\beta\), \(k\) in Equation (11) was calculated. The pulse-echo signals stored in the _f-sig_ matrix were compensated for by multiplying by \(k\). 4. Envelope detection was performed on the signals with the Hilbert transform. Then, logarithmic compression to a 60 dB dynamic range was used. 5. The coordinate transformation using the center of the image as a reference point was used to form the image matrix _image-data_. Then, the image-data were processed using a morphological algorithm to reconstruct the breast slice image. To facilitate the understanding of the process of reconstruction, Figure 2 presents the steps in a flowchart.