# Real-Time Simulation of Wave Phenomena in Lung Ultrasound Imaging
## 2 Simulation Method
### Artifacts Simulation  
In order to create an effective learning tool, it is crucial to simulate various ultrasound artifacts that are commonly encountered during lung examinations. These artifacts play a significant role in the interpretation and analysis of ultrasound images. By accurately replicating these artifacts in the Lung Ultrasound Simulator, users can develop the necessary skills to identify and interpret them in real-life scenarios. The artifacts can be rendered according to the classical wave equation [43; 44]:  
\[\
abla^{2}p-\frac{1}{c^{2}}\frac{\partial^{2}p}{\partial t^{2}}=0 \tag{1}\]  
where:  
\(p\)--acoustic pressure,  
\(c\)--speed of sound in the medium,  
\(t\)--time,  
and with a relaxation term:  
\[\
abla^{2}p-\frac{1}{c^{2}}\frac{\partial^{2}p}{\partial t^{2}}=-\tau\frac{ \partial p}{\partial t} \tag{2}\]  
where:  
\(\tau\)--is a relaxation coefficient. In cases where there is negligible or no scattering, it leads to (1-D):  
\[I(x)=I_{0}e^{-2\alpha x} \tag{3}\]  
where:  
\(I(x)\)--remaining intensity at the distance \(x\) to the wave source,  
\(I_{0}\)--initial intensity,  
\(\alpha\)--absorption coefficient--a product of the medium attenuation coefficient and the frequency of the ultrasound wave. To solve Equation (2), ultrasound waves can be simplified as a ray that is generated at the transducer and marched over a 2D cross-section plane. During that process, a ray interacts with the medium (tissue characteristics set up with a custom material) and renders the intensity image. The attenuation is implemented using the Equation (3). No reflection or refraction rays are implemented. However, the reflected intensity is calculated as follows:  
\[I_{r}=I_{i}\bigg{(}\frac{Z_{2}-Z_{1}}{Z_{2}+Z_{1}}\bigg{)}^{2} \tag{4}\]  
where:  
\(I_{r}\)--is the reflected intensity,  
\(I_{i}\)--is the incoming intensity,  
\(Z_{1}\), \(Z_{2}\)--are the acoustic impedances, defined as a product of tissue density and speed of sound. Key artifacts that should be simulated include shadows, A-lines, B-lines, pleural breaks, and pleural sliding. The strength of each artifact can be adjusted as needed and defined for each standard probe application point. 1. Shadows are dark areas that occur when ultrasound waves are blocked or absorbed by dense structures, such as ribs or air-filled spaces (Figure 2). To simulate shadows, first, the cross-section image is rendered with Material attributes defined for each tissue. Then, a ray marching technique utilizes these values to compute shadows for each ray. 2. A-lines are horizontal, parallel lines seen in normal lung tissue and are created by the multiple reflections of ultrasound waves between the pleural line and the transducer. This is achieved during the ray marching step without a time-consuming ray generation: the input frame buffer, which stores the image of the first render pass, is repeatedly sampled relative to the distance of a pleural line to the transducer. The results can be seen in Figure 3.
3. B-lines, on the other hand, are vertical lines that represent thickened or edematous lung interstitial spaces and are commonly associated with pulmonary edema or interstitial lung diseases. To simulate this artifact, the intensity of the response is randomly increased at the pleural line, leaving a bright trail interpreted as a B-line. A pseudo-random value is calculated from the UV map (rendered in the previous step) for each ray of the ray marching algorithm. Then, a strength parameter associated with the patient's landmark determines the visibility of the B-lines. This parameter ranges from 0 (no B-lines) to 1 (multiple coalescent B-lines). Radial blur, added in the final step, increases visual similarity to real artifacts. An example of that artifact results is visible in Figure 4.  
Figure 3: A-lines example: (**a**) real examination; (**b**) the LUS simulation. Figure 2: Ultrasound shadows example: (**a**) real examination; (**b**) the LUS simulation. 4.