## 2 Materials and Methods
### Image Acquisition and Data Processing  
The focal plane of IVM was adjusted during artificial ventilation by tracking the pleural surface using the depth information from OCT cross sections. Previous experiments with our animal model have shown that lung tissue movement in the axial (\(z\)-) direction is limited to a maximum of 1 mm. Using conventional ventilation settings (especially avoiding high inspiration pressure) in addition to the physiological conditions of the thorax after surgery (refer to Section 2.3), the axial shift of the lung tissue is typically 0.6 mm. In OCT cross sections, the signal-to-noise ratio (SNR) is reduced with increasing depth (so-called \"roll-off\"). In former studies, the roll-off of our system was measured with 8 dB over 1.7 mm depth with an overall SNR of 87 dB. It means that an axial lung tissue movement smaller than 1 mm has just minor effect on OCT image quality and vice versa that the whole tissue movement can be visualized in the OCT cross sections (overall imaging depth 2.8 mm) without the need of refocusing. Therefore, the size of the OCT cross sections is reduced to 64 \(\times\) 512 pixels (width \(\times\) depth) leading to 8 ms per B-scan (125 B-scans per second). With this high temporal resolution for visualizing tissue movement, the OCT signal can be used to keep the lung in focus for IVM. Hence, the maximum intensity index, which always corresponds to the lung surface (brightest reflection at air-tissue interface), is extracted from two successive OCT cross sections and the difference of the index position in depth is calculated. Using a lens calibration curve obtained from preliminary tests, the new lens current is set to match the new focus position to grab the IVM image. Because one breath cycle is sufficient for an IVM recording, these video sequences were taken prior to the OCT data acquisition and saved as a video file. Three-dimensional OCT data were acquired using two galvanometer scanners mounted perpendicularly to each other. For one single cross section, the first scanner deflects the light in one direction to measure several A-scans forming the OCT B-scan. Adjacent B-scans were recorded by tilting the second scanner, resulting in a three-dimensional image stack. As mentioned before, the line scan rate of this system is fixed to 12 kHz, resulting in 29 ms for a single cross section (320 \(\times\) 512 pixels) and an overall measurement time of 9.2 s for an 3D image stack (320 \(\times\) 320 \(\times\) 512 pixels). As this takes much longer than a ventilation cycle in rats, other ways to acquire 3D image stacks are needed. Because the ventilation is periodic and changes in the viscoelastic properties of the lung are rather slow, we collected image data over a longer time period and rearranged the image data afterwards. Therefore, during one ventilation cycle, B-scans were acquired at the same line showing the axial tissue movement in one plane with a temporal resolution of 29 ms (using an image size of 320 \(\times\) 512 pixels). That means that 34 cross sections can be acquired within a ventilation cycle time of 1 s (at an exemplary ventilation rate of 60 breaths per minute). After each ventilation cycle, a trigger signal from the ventilator sets the second scanner to the next position, and cross sections are grabbed continuously at this new position. Each acquired B-scan within a ventilation cycle is consecutively numbered and additionally marked by the corresponding cycle number. In a post-processing step, shown as scheme in Figure 2, all B-scans are re-sorted by using the index number and the trigger number to form the different 3D OCT stacks, each showing a different phase of the ventilation cycle. The general reconstruction is shown in Figure 2 where the rearrangement of OCT cross sections from successive ventilation cycles for the first 3D stack at the beginning of inspiration and the 14 th OCT stack at maximum pressure are visualized (inspiration to expiration ratio I:E = 1:1 see below).