Supplementary Figure 1: Detection of tail motion events, e.g., to trigger optogenetic stimulation.
From: Evoking and tracking zebrafish eye movement in multiple larvae with ZebEyeTrack

Top left: Users define a ROI within live or recorded video, through which they expect the tail to pass. Top right: For each frame, ZebEyeTrack computes the median intensity of pixels within this ROI. When the median intensity or its rate of change crosses a user-defined threshold, as is the case when the tail moves through the ROI, this event is detected. Bottom left: Users can choose between types of threshold and set the threshold value. Detected events then trigger the desired response: If the user has disabled analog output, none is generated, but the tail motion event is still recorded to the eye-tracking data file, as nonzero values are written to the columns representing analog output (e.g., columns 2–4 if a single fish is tracked). If the user has enabled analog output, it is generated in the same way as for saccade-triggered events. Both types of triggers are allowed in parallel. Bottom right: If desired, the time course of ROI pixel intensity can be included in an additional, second-to-last column of the main eye-tracking data file. Appropriate regulatory board permission was obtained before our zebrafish experiments (Reagent setup)