3D Holographic Observatory for Long-term Monitoring of Complex Behaviors in Drosophila

Drosophila is an excellent model organism towards understanding the cognitive function, aging and neurodegeneration in humans. The effects of aging and other long-term dynamics on the behavior serve as important biomarkers in identifying such changes to the brain. In this regard, we are presenting a new imaging technique for lifetime monitoring of Drosophila in 3D at spatial and temporal resolutions capable of resolving the motion of limbs and wings using holographic principles. The developed system is capable of monitoring and extracting various behavioral parameters, such as ethograms and spatial distributions, from a group of flies simultaneously. This technique can image complicated leg and wing motions of flies at a resolution, which allows capturing specific landing responses from the same data set. Overall, this system provides a unique opportunity for high throughput screenings of behavioral changes in 3D over a long term in Drosophila.

). DIH obtains 3D information by recording both the amplitude and phase of the light through interference. As shown in Supplementary Fig. 1a, the light incident on the object scatters, forming the object wave, and interferes with the remaining unscattered portion, called the reference wave. The interference produces modulation of intensity, shown as concentric rings around the object that encode the size (low frequency) and depth information (high frequency). The information in these patterns (fringes), can be decoded through numerical reconstruction to obtain sharply focused images of objects that are out of focus in the recorded holograms. A typical DIH system (Supplementary Fig. 1b) consists of a coherent light source to generate the interference between the object and reference beams. The light passes through a spatial filter, with an objective lens to focus the beam through a pinhole, performing an optical low pass filter. After the spatial filter, a convex lens collimates the beam to create a planar wave front which is then incident on the object of interest. The use of planar waves allows us to extend the length of the test section without loss of laser intensity, at any size of beam diameter used. images at different z locations. Note that the object is in focus at z = 180 mm, which is identified by the sharp features of the legs and wings (marked by arrows).
Note that due to the characteristics of diffraction kernel (e.g., , being symmetric), objects located at the same distance |z| from the recorded hologram plane will be reconstructed in the same manner. The feature induces ambiguity in determining the actual location of the object (i.e. z>0 or z<0). This ambiguity is usually rectified by ensuring that all the objects being studied are located on the same side of the hologram during recording.

Fly Arena
The fly arena consists of a custom made 70×35×50 mm 3  indicating the food trays and the replaceable imaging windows. Scale bar is 10 mm.

Estimation of Single Trajectories
The trajectories obtained after the planar tracking process contain several candidates  Table 1). For example, if the number of detections is 8, we know that we have one object that is merged with another, providing us 7 single objects at a minimum.  The Fresnel kernel used for the reconstruction of the hologram places a limitation on the minimum z position that can be used which is based on the far field criterion 5 explained in a section below. So by placing an aperture at 150 mm from the imaging plane the synthesized holograms satisfy this criterion and can be analyzed by the algorithm. The curve is then compared to the hologram reconstructed to each z position which clearly validates that the peak corresponds to the in focus location of the aperture ( Supplementary Fig. 4). A detailed analysis of this phenomenon of minimum z limit is provided in the following section.

Supplementary
To validate the algorithm, we translate a hypodermic needle (460 µm diameter) on a linear stage (Supplementary Fig. 5a) and calibrate the displacement measured by holographic processing to the one set by the stage. The micrometer offers a precision of up to 10 µm which is much higher than the imaging resolution of our system. In order to show that the focus metrics are independent of size, we repeated the experiment with a needle of 900 µm diameter and compared the errors and measurements with the previous case (Supplementary Fig. 7). The focus metric curves for both images are of similar SNR, with small variations in the curve for the larger diameter (Case 2).
The comparison of the measured displacements for both needles match within the measurement uncertainty obtained above (~300 µm). This shows that the accuracy and error in the technique doesn't vary with the size of the object and can be an effective calibration for our experiment involving flies with a body length of about 3 mm.

Automatic Thresholding
The histogram of the enhanced holograms (Supplementary Fig. 8a) shows a distribution with a peak at the background intensity and high frequencies at both ends corresponding to the interior of the flies and saturations spots in the background. Most automatic thresholding algorithms expect a smoothly varying bi-modal or multi-modal distribution to be able to pick an accurate threshold to segment effectively (Otsu 1975). The current data set does not satisfy this requirement making its application difficult. An alternative and simple automatic threshold, equal to the mean of the 1 st two peak values, was chosen to segment the hologram (Supplementary Fig. 8b). Such a threshold corresponds to pixels in the interior of the flies as well as some background pixels. Applying a mean filter before the segmentation and a morphological opening operation both with a disk of 10 pixels eliminates the segmented background pixels (Supplementary Fig. 8c). The

Uncertainty Analysis
This section provides estimates of uncertainties in the measurements of position and velocity of Drosophila using the presented DIH approach.

Position Uncertainty
The Note that the uncertainty scales with the temporal resolution of the measurement, and a lower value of uncertainty can be obtained by reducing on temporal resolution.
The velocity measurement in the longitudinal direction is calibrated by translating a needle, 0.9 mm in diameter, at a constant speed along the optical axis, using a motorized linear stage (Supplementary Fig. 9a). A camera records holograms of this motion, at a resolution of 30 µm/ pixel at 100 fps, which are processed using the DIH algorithm to extract the z positions. The speed of the pump is measured through image based tracking, by recording the motion with a DSLR camera at 60 fps at a resolution of 125 µm/ pixel.
By thresholding the captured video, we can segment a circle and identify its centroid, and use the position to extract the speed of motion (Supplementary Fig. 9b). We obtain a speed of 0.7424 ± 0.0036 mm/s where the uncertainty is from the thresholding operation calculated to be ±0.3 mm. The uncertainty in the measured position is converted into a velocity using the same equation (Supplementary Equation 3) as that in the lateral case.
Similarly, the speed of the needle is also extracted from holographic processing by fitting a least squares line through the calculated positions (Supplementary Fig. 9c)

Multi-Pass Peak Selection and position correction
To eliminate small motions of flies, which are below the precision of our measurement (±

Poor Peak Quality
A systematic analysis is performed using holograms of the hypodermic needle, to identify the source of noise peaks in the Focus metric curves. Two specific cases are selected by changing the location of the region of interest (ROI) in the captured hologram, one with the tip of the needle and one without. The focus metric curves for both cases are created ( Supplementary Fig. 11) in which we clearly observe a large noise peak near 100 mm, for case 2 alone. Due to the absence of fringes in the horizontal direction, the needle from case 2 loses some longitudinal information that is contained in the horizontal fringes.
This bias of fringe alignment leads to additional peaks in the focus metric curve of Case 2 compared with that of Case 1.  (Supplementary Fig. 12a).

Supplementary
Case A, where the fringe pattern associated with the fly are not contaminated by the wall generated fringes, show the most distinctive peak corresponding to the in-focus location of the fly (Supplementary Fig. 12b). Case B and C are samples with flies on the side and bottom walls, respectively (Supplementary Fig. 12c and d).

Calibration of z position range for optimal performance
The location of the object affects the fringe patterns on the recorded hologram, and subsequently impacts the signal-noise-ratio of the focus metric curves. The calculation of the focus metrics is performed with the Fresnel diffraction kernel (Supplementary   Equation 4), which is only valid when the optical imaging setup satisfies paraxial approximation 5 . Specifically, as shown in Supplementary Equation 5, this approximation only holds for the case that the axial distance of an object to the recorded hologram plane is significantly larger than its lateral distance to the optical axis.
Consequently, as the axial distance between the object and the recording plane (z) approaches zero, the functional form of the kernel represents a delta function at the origin (i.e. z = 0) and overwhelms the calculated l1 norm close to this location.  Fig 13a). However, when we start the z scan at 90 mm (three times z limit) and end at 275 mm, the large peak at the origin is completely suppressed and the individual peaks become appreciable (Supplementary Fig. 13b). In order to avoid the effects of the delta function at the origin, during the fly experiments, we set the location of the arena to be 140 mm, which is 1.5 times of the minimal recorded distance for implementing the focus metric method in the present study. The same legend is used for both figures.

Ethograms
The ethograms of motion are created for the three selected trajectories with three specific levels of motion defined as resting, walking and flying. These are identified by a threshold of speeds computed for each trajectory and can be seen in the Supplementary The calculated speeds are filtered with a median filter of size 5 to eliminate large fluctuations in speed that arise at locations of large acceleration (quick turns). Along with the speed, position of objects in proximity to the side walls can also be used to define walking motions.

Identification of complex motions
The complex behaviors we identify in this study are landing responses, consisting of high speed motions. Using the speed of the fly calculated at every instant of time, an identification function is created to separate trajectories with complex behaviors from the complete list, before the track elimination step (Supplementary Equation 6). The identification of tracks before elimination ensures that complex motions with partial occlusions in the motion are not missed. A threshold of mean plus twice the standard deviation on the function helps identify 25 tracks with complex motions from the list of 5700, corresponding to 0.44% of the total. The plot in Supplementary Figure 14 represents the values of this function for all selected tracks whose color indicates whether the selection was accurate or a false positive.

Supplementary Equation 6: Vertical motion identification function
After identifying specific track IDs, the velocity and acceleration of those specific tracks over time are used to narrow down the time of the motion. We create in-focus movies of these specific sequences (Supplementary Video 1 & 2) by the holographic processing algorithm that additionally saves refocused images as a video at the resolution images were recorded at. With an increased data set additional machine learning approaches can be applied to make the identification process more robust.