Main

An approaching predator subtends an increasing visual angle on the eye, generating a complex sequence of visual features dominated by radial outward motion. In the fly visual system, directionally selective neurons encode the motion of bright (T4) and dark (T5) edges11,12,13. T4 and T5 are each composed of four subtypes that are directionally selective in one of four cardinal directions11,12,13, and correspondingly project axon terminals to one of four distinct layers in the lobula plate (Extended Data Fig. 1a). We here show that LPLC2 cells, a class of visual projection neurons10, have the precise dendritic configuration—an outward pattern in each lobula plate layer—expected to encode local outward motion.

LPLC2 cells are a population of about 80 visual projection neurons10 whose dendrites cover the lobula plate (Fig. 1a and Extended Data Fig. 1b) and whose axons terminate near the lateral dendrite of the giant fibre (Fig. 1b), a large, looming-responsive descending interneuron that mediates an escape response14. To establish the connectivity of these two cell types, we expressed an optogenetic activator15 in LPLC2 neurons and conducted whole-cell recordings from the giant fibre. Upon illumination, we observed a large and rapid depolarization of the giant fibre (Fig. 1c), consistent with LPLC2 neurons providing direct excitatory input to the giant fibre.

Figure 1: LPLC2 anatomy and connectivity.
figure 1

a, Stochastically labelled LPLC2 neurons on reference neuropil (grey). See Methods and Supplementary Table 2. Scale bar, 30 μm. b, c, Giant fibre (GF) responses to optogenetic depolarization of LPLC2, recorded with whole-cell patch clamp. c, Giant fibre membrane potential time course (top: mean and 95% confidence intervals) and peak values (bottom: individual neurons) (N = 4 flies for each group). d, e, Lobula plate layer pattern (d) and within-layer dendritic arbor spread (e) for a single LPLC2 neuron. Triangles in d indicate the preferred direction of T4/T5 neurons in that layer. Lateral (L) in the lobula plate corresponds to frontal in the visual field, dorsal (D) to upwards. M, medial; V, ventral. Scale bar, 10 μm. f, Schematic showing relative positions of LPLC2 dendrites (coloured rectangles) in each lobula plate layer, with each layer’s preferred direction indicated as arrows. FTB, front-to-back; BTF, back-to-front; LP, lobula plate. g, Anatomy-based model of LPLC2 response to looming, where responses are driven by expansion but not contraction (colour indicates excitation).

PowerPoint slide

We next used multicolour stochastic labelling16 to investigate the morphology of individual LPLC2 neurons. Strikingly, we found that the dendritic arbors of each LPLC2 neuron form four distinct fields, each of which occupies a different lobula plate layer (Extended Data Fig. 1c). Furthermore, these arbors are positioned to form orthogonal axes with branches in opposing motion direction layers opposite one another (Fig. 1d, Extended Data Fig. 1d, e and Supplementary Video 1). The direction of maximum outward dendritic spread in each layer is aligned with the directional preference of the T4 and T5 cells terminating in that layer (Fig. 1e, f and Extended Data Fig. 1f). This dendritic anatomy is ideally suited for the detection of outward motion associated with a small looming object whose visual expansion is aligned with the centre of an individual LPLC2 cell’s dendritic arbor (Fig. 1g).

T4 and T5 cells are essential for looming behavioural responses17. To determine whether they provide direct excitatory inputs to LPLC2 neurons, we performed in vivo two-photon calcium imaging18,19 of the LPLC2 population axon terminal bundle while driving an optogenetic activator in T4/T5 neurons (Extended Data Fig. 2A, B). Red illumination elicited an immediate calcium response in LPLC2 axons, whereas control flies exhibited no red-light calcium response (Extended Data Fig. 2C–H), suggesting that T4/T5 are directly upstream of LPLC2.

We next measured LPLC2 population responses to visual looming stimuli (Fig. 2A–C) that robustly drive giant fibre-mediated escape behaviour14. LPLC2 was highly responsive to dark looming across all measured speeds and slightly responsive to bright looming (Fig. 2D, E). LPLC2 neurons did not respond to dark receding looming or to a luminance-matched motion-free darkening stimulus, suggesting that coherent expanding edge motion is essential for the looming response (Fig. 2E). Surprisingly, LPLC2 did not respond to wide-field motion stimuli that drive the upstream T4/T5 neurons11,20 (Fig. 2F, G and Extended Data Fig. 3A, B), whereas looming induced detectable responses within the first 5° of expansion (Extended Data Fig. 3C–E). Compared with either their upstream inputs11 or previously described looming-sensitive neurons in insects5,7, the LPLC2 population is ultra-selective for looming motion and does not respond to stimuli lacking focal, outward movement. This selectivity for looming is consistent with a role in take-off escape behaviour; optogenetic activation of LPLC2 neurons induces an immediate jumping response10, and blocking synaptic transmission of LPLC2 neurons decreases the looming jump escape response (Extended Data Fig. 3F).

Figure 2: LPLC2 population selectively encodes looming stimuli.
figure 2

A, Imaging setup. B, LPLC2 neurons (green) on reference neuropil (grey); dashed box indicates axon terminal region. C, LPLC2 axon terminal calcium fluorescence; region of interest outlined in yellow. D, E, LPLC2 population looming responses (N = 8 flies). D, Individual fly calcium transients for dark (top) and bright (middle) looming (bottom, disk diameter). Calcium traces shown throughout the paper are an average of three trials. ΔF/F, change in fluorescence intensity. E, Peak responses to a range of looming speeds (mean ± 95% confidence intervals; overlay: individual flies). Repeated-measures analysis of variance (RM-ANOVA), Tukey’s post hoc test. F, G, Individual responses (N = 8 flies) to constant edge velocity looming (a, blue, 10° s−1 edge speed) and wide-field motion stimuli (bg, black, 20° s−1 edge speed). Mean responses (G) measured during stimulus presentation (F, grey regions).

PowerPoint slide

Our structure–function hypothesis predicts that individual LPLC2 neurons are local looming detectors. To resolve single neuron responses, we next examined the region between the lobula plate and lobula where individual LPLC2 axons can be isolated (Fig. 3a, b). We mapped the receptive fields of multiple neighbouring neurons by measuring responses to local disk expansion stimuli from points densely selected in random order on a 5° grid (Fig. 3c, d). In all subsequent experiments, stimuli were shifted to the estimated receptive field centre position of a single neuron. The receptive field structure of neighbouring LPLC2 neurons shows that, as expected from the tiling pattern of the dendrites (Extended Data Fig. 1b, d), LPLC2 responses also tile visual space with overlap (Fig. 3c). We further explored single LPLC2 responses to a set of disk and ring stimuli (Extended Data Fig. 4A–H) and determined 60° as the upper bound for the receptive field size of an individual LPLC2. As expected from the population data, outward dark-edge motion was most effective at eliciting calcium responses from single cells.

Figure 3: LPLC2 single-cell receptive field mapping and directional tuning.
figure 3

a, LPLC2 (green) individual axon imaging region (dashed box). Scale bar, 50 μm. b–d, Single-cell receptive field mapping from a representative fly. b, Single-cell regions of interest overlaid on averaged calcium images. Scale bar, 10 μm. c, Receptive field contour plot: lines at 50% integrated ΔF, dots at fitted receptive field centres. Grid represents visual field as seen by fly. d, Normalized calcium traces arranged in grid corresponding to c. eg, Directional tuning with 10° (e) or 60° (f) one-dimensional bar expansion (n = 10 neurons, N = 7 flies). Population responses shown as mean (line) and 95% confidence intervals (shaded). e, f, Dashed circle in stimulus diagrams represents upper limit of 60° receptive field diameter (Extended Data Fig. 4G, H). g, Peak directional tuning responses in polar coordinates.

PowerPoint slide

Since the LPLC2 dendrites are excited by T4 and T5 cells, we expect strong responses to the four cardinal directions of motion. We used one-dimensional expanding (bar) motion to map the local directional preference of LPLC2. Expansion of a 10°-wide bar produced nearly uniform responses to outward (Fig. 3e, g), but not inward, (Extended Data Fig. 4I, J) motion at all orientations. By contrast, expansion of a 60°-wide bar produced a clover-shaped directional tuning, with each ‘leaf’ aligned to a cardinal direction (Fig. 3f, g and Extended Data Fig. 4K, L). Interestingly, the directional tuning of the 10° and 60° bar-expansion responses were similar along the cardinal axes, but were most different in between these axes (Fig. 3g). These response profiles are consistent with LPLC2 neurons receiving inputs from the T4 and T5 neurons that are tuned to a broad (~90°) range of preferred directions11. When a narrow bar (10°) stimulus expands between the preferred directions of the input neurons, the excitation of individual LPLC2 dendritic arbors is weaker than that elicited by preferred-direction expansion, but more arbors are stimulated such that the total response is similar to the on-axis response. If the LPLC2 inputs are purely excitatory, then a wider bar (60°) should elicit greater responses. However, the prominent response reduction to off-axis motion (Fig. 3g) in conjunction with the lack of response to wide-field motion (Fig. 2F, G) suggest that LPLC2 dendrites must also receive strong visually driven inhibitory inputs.

From these results, we infer that LPLC2 neurons integrate highly structured excitatory and inhibitory inputs, which may explain their exquisite looming selectivity. To directly interrogate the summation of excitatory inputs to different LPLC2 dendritic branches, we used narrow bar (10°) expansions to measure responses along the mapped cardinal axes. LPLC2 neurons responded to the outward motion of expanding bars in a cross formation and did not respond to inward bar motion (Fig. 4A, B). We next decomposed the expanding cross stimulus into individual arms targeted to different dendritic fields. Outward edge motion along single arms generated detectable but small responses (Fig. 4C, a and b, D and Extended Data Fig. 5A–O), whereas expansion along two arms (Fig. 4C, c) produced responses greater than the summed responses to motion along two individual arms (Fig. 4D and Extended Data Fig. 5A, B). These results suggest that LPLC2 performs nonlinear integration of dendritic inputs from different lobula plate layers.

Figure 4: Contributions of excitatory and inhibitory inputs to LPLC2 visual responses.
figure 4

Decomposition of motion along (A–D) or between (E–H) cardinal axes for individual LPLC2 cells. Stimulus diagram above calcium traces shows motion within receptive field (dashed circle). Bar stimuli have 10° fixed width and 20° s−1 edge speed unless otherwise specified. Traces are population average (black) and individual neurons (grey). Statistics analysed using RM-ANOVA with specified post hoc test throughout. Population plots are mean and 95% confidence intervals (n = 10 neurons, N = 7 flies). *P < 0.05, **P < 0.01, ***P < 0.001, ****P < 0.0001. A, B, Responses to disk expansion (a, 10° s−1) and outward (b) or inward (c) cross motion. Dunnett’s post hoc test, reference a. C, D, Responses to outward motion along a cardinal axis (a–c) and the effects of luminance (d) or inward motion (e) on the orthogonal axis. D, Left: comparison of linear sum of individual responses (a, b) to the measured combined response (c). Circles, individual neurons. Bonferroni’s post hoc test. Right: effects of orthogonal axis darkening and inward motion. Dunnett’s post hoc test, reference c . E, F, Effects of bar width on expansion between cardinal axes. Dunnett’s post hoc test, reference 10° bar response. G, H, Decomposing responses to motion between cardinal axes. H, Left: comparison of linear sum of individual responses to motion at receptive field centre (a) and edges (e) to the measured response during expansion in both areas (c). Circles, individual neurons. Bonferroni’s post hoc test. Right: comparison of motion at the edge versus centre of the receptive field. Dunnett’s post hoc test, reference a.

PowerPoint slide

The strong selectivity of LPLC2 may result not only from this outward motion sensitivity, but also from inward motion inhibition. Since calcium imaging is not generally suited to direct measurements of inhibition, we designed visual stimuli to reveal its contribution. We combined outward motion along one cardinal axis with inward motion along the orthogonal axis. Inward motion, but not darkening, reduced LPLC2 responses compared with outward motion alone (Fig. 4C, d and e, D and Extended Data Fig. 5A–O). Since the inward motion was presented many visual columns away from the outward motion, this reduction is unlikely to result from interference with the presynaptic columnar excitatory input, and rather demonstrates direct inhibition of LPLC2 driven by non-preferred motion. In further support of this proposal, we find that LPLC2 responses to wide bars are reduced relative to narrow bar responses (Fig. 4E, F and Extended Data Fig. 5P, Q), and that this size-dependent response reduction is caused by the presence of motion (in either direction) at the periphery of the LPLC2 receptive field (Fig. 4G, H and Extended Data Fig. 5R, S). Considering these results, the observed difference in the narrow and wide bar directional tuning (Fig. 3g) suggests that off-axis motion cues at each dendritic field’s periphery, where excitatory directionally selective inputs are minimal, recruit inhibition that further shapes the selectivity of LPLC2 cells.

Lobula plate intrinsic (LPi) interneurons integrate directionally selective T4/T5 inputs in one lobula plate layer and project inhibitory outputs into the adjacent layer, which encodes the opposite direction of motion21. The LPi neurons are therefore ideally suited to inhibit LPLC2 in response to inward motion. We first explored this hypothesis by imaging calcium responses in LPi4-3, a neuron type with synaptic input and output sites in lobula plate layers 4 and 3 respectively21 (Fig. 5A, B). LPi4-3 responses were highly directionally selective in response to moving gratings (Fig. 5C and Extended Data Fig. 6). In addition, LPi4-3 responded to both dark and bright-edge motion (Fig. 5D), indicating that LPi4-3 direction selectivity is inherited from both T4 and T5 cells in layer 4.

Figure 5: Directionally selective inhibitory inputs to LPLC2 further sculpt looming selectivity.
figure 5

A–D, LPi4-3 anatomy and direction selectivity. Traces are population average (black) and individual flies (grey) (N = 7 flies). A, LPi4-3 neurons (cyan) with synaptogamin marker (red). B, Model of LPi4-3 inputs. C, Directional tuning response to moving square-wave gratings. D, Dark or bright-edge motion along preferred and null directions. E–I, Effect of LPi4-3 depolarization on LPLC2. Stimulus diagram above calcium traces shows motion within receptive field (dashed circle). Traces are population average (black) and individual neurons (grey; circles in statistic plots). Red light stimulation is indicated as red bar (n = 10 neurons, N = 7 flies). E, Lobula plate view of LPLC2 (cyan) and LPi4-3 (red). F, G, Looming alone (a, r/v 40 ms) or with red light (b), and red light stimulation alone (c). G, Individual neuron responses. P = 0.209, paired t-test (two-sided). H, I, Red-light activation effects on responses to bar stimuli (10° width, 20° s−1 edge speed). RM-ANOVA with Bonferroni’s post hoc test. **P < 0.01, ***P < 0.001. J, Single LPLC2 neuron with dendritic branches coloured by lobula plate layer and direction selectivity. K, Proposed input model and receptive fields for lobula plate layer 3 (dashed box in J). The inhibitory receptive field image is composed of three neighbouring LPi4-3 cells.

PowerPoint slide

We next examined whether LPi4-3 inhibits LPLC2 by optogenetically depolarizing LPi4-3 while imaging the calcium response in individual LPLC2 axons (Fig. 5E and Extended Data Fig. 7). We analysed the difference between visual stimulus presentation with and without LPi4-3 depolarization. Neither red light alone nor LPi4-3 depolarization significantly altered LPLC2 looming responses (Fig. 5F, G). However, LPi4-3 depolarization significantly reduced responses to weaker visual stimuli such as expansion of a 10° unidirectional bar (Fig. 5H, I and Extended Data Fig. 7H–S). Since we did not observe any red-light-driven change in visually evoked responses in control flies (Extended Data Fig. 8), we conclude that LPi4-3 interneurons, and presumably other LPi types, provide directionally selective inhibition onto LPLC2 to sharpen looming selectivity.

On the basis of the results presented here and the known anatomy of the lobula plate, a parsimonious circuit model explains the LPLC2 looming detection mechanism (Fig. 5J, K). Excitatory inputs from presynaptic retinotopically arranged, directionally selective T4 and T5 neurons supply four outward-motion selective dendritic fields, making LPLC2 strongly responsive to outward motion from the receptive field centre. LPLC2 respond more strongly to dark-edge looming as opposed to bright-edge looming (Fig. 2E and Extended Data Fig. 4F), indicating that T5 cells are probably the major excitatory input. Furthermore, LPi neurons provide directionally selective inhibition and known LPi cells have larger receptive fields than the small-field T4 and T5 cells (Extended Data Fig. 9). The LPi neurons are thus well positioned also to supply an inhibitory surround to LPLC2 neurons in a radially opposing manner (Fig. 5K). This inhibition further sculpts the response properties of LPLC2, suppressing responses from non-looming stimuli as well as responses to looming motion emanating from outside the neuron’s receptive field centre (Extended Data Fig. 10).

The radial motion opponency exhibited by LPLC2 is distinct from other known mechanisms for looming detection22,23,24,25. For example, the lobula giant movement detector of locusts detects looming without the benefit of directionally selective inputs, instead integrating luminance changes temporally across a single giant dendritic arbor that spans one eye’s entire field of view5,25,26,27. In contrast, individual Drosophila LPLC2 neurons comprise a set of small looming detectors tiling the visual field, with each member relying on precise spatial placement of dendrites within a directionally selective motion feature map to generate looming responses. Sensory feature maps are ubiquitous among organisms3,28, suggesting that a similar strategy may be used in other nervous systems to compose highly selective detectors for features such as looming.

LPLC2 neurons are one of several looming-sensitive visual projection cell types identified in Drosophila7,10,29 and the second visual cell type identified as a presynaptic partner of the giant fibre. These parallel channels encode different features of a looming stimulus, such as its size or speed29. LPLC2 cells are also probably presynaptic to multiple central brain and descending pathways, an organization that would enable use of the same looming information to coordinate different actions. The faithful encoding of a visual feature may thus be divided into parallel channels that are integrated differently by downstream motor pathways to sculpt the spatiotemporal selectivity of behavioural responses.

Methods

No statistical methods were used to predetermine sample size. The selection of flies from housing vials and the presentations of visual stimuli were randomized. The investigators were not blinded to fly genotypes.

Fly stocks

Calcium imaging experiments were performed with female flies 2–5 days after eclosion, maintained under standard conditions (21.8 °C, 55% humidity, 16 h light/8 h dark, standard cornmeal/molasses food). Flies used for simultaneous optogenetics with calcium imaging were raised on 0.2 mM retinal food in foil-covered vials.

Whole-cell patch recording was performed on female flies 3–5 days after eclosion. Flies were reared at 25 °C, 50% humidity, cornmeal/molasses food containing 0.2 mM retinal, and maintained on 0.4 mM retinal as adults. Flies were kept in darkness by foil-covered vials.

Supplementary Table 1 lists fly genotypes used in functional characterization experiments. Supplementary Table 2 contains driver lines and reporter strains used for anatomical analyses. To generate new split-GAL4 lines (OL0047B, SS03752, SS00810), we used GAL4-line expression patterns30,31 (B. J. Dickson, personal communication) to identify potential split-GAL4 combinations. We constructed hemidrivers32 and screened candidate combinations as previously described10. Enhancerless split-GAL4 controls used in calcium imaging optogenetic experiments were as previously described33. We additionally used a split-GAL4 combination (SS01062) lacking central nervous system expression as a control line for whole-cell recording and behaviour experiments (a gift from S. Namiki).

Histology and anatomical analyses

All anatomical analyses used female flies. Multicolour stochastic labelling of individual neurons used MCFO-1 or MCFO-7 as reporter16 and visualization of overall expression patterns for split-GAL4 lines and/or presynaptic marker distribution were performed as previously described16,34, using pJFRC51-3XUAS-IVS-syt::smHA (su(Hw)attP1) and pJFRC225-5XUAS-IVS-myr::smFP-FLAG (VK00005) as reporters. Anti-Brp35 (monoclonal antibody Nc82, Developmental Studies Hybridoma Bank) was used as a neuropil marker. Detailed protocols are also available online (http://www.janelia.org/project-team/flylight/protocols).

A similar protocol with a shorter antibody incubation (overnight for both primary and secondary antibodies) was used to visualize the expression patterns of flies for T4/T5 and LPi4-3 optogenetic experiments. Primary antibodies used were mouse anti-GFP (monoclonal antibody 3E6, A-11120, ThermoFisher Scientific, 1:100 dilution), rat anti-CadN (monoclonal antibody DN-Ex 8 (ref. 36), Developmental Studies Hybridoma Bank, 1:20 dilution) and rabbit anti-DsRed (632496, Clontech, 1:1,000 dilution). Secondary antibodies used were DyLight 488-AffiniPure Donkey Anti-Mouse IgG (H+L) (Jackson ImmunoResearch Laboratories 715-485-151, 1:500 dilution), DyLight 594 AffiniPure Donkey Anti-Rabbit IgG (H+L) (Jackson ImmunoResearch Laboratories, 711-515-152, 1:300 dilution) and Alexa Fluor 647 AffiniPure Donkey Anti-Rat IgG (H+L) (Jackson ImmunoResearch Laboratories, 712-605-153, 1:300 dilution). Brains were mounted in SlowFade Gold (ThermoFisher Scientific, S36937) and imaged on a Zeiss LSM 710 confocal microscope using a 40×/numerical aperture 1.3 objective lens.

Additional specimen and imaging condition details are provided in Supplementary Table 2.

General image processing for anatomical analyses was as described16,34; see also Supplementary Table 2. Most anatomy figures show reconstructions generated from image stacks via the NeuronAnnotator mode of Vaa3D37 and exported as TIFF screenshots. This export step can change pixel resolution but did not affect the comparatively large features (for example, branching patterns) examined in this study. The scale of these exported images was determined from the dimensions and pixel resolution of the original image, and the pixel resolution and zoom factor of the exported image. Brain alignment based on an anti-Brp reference stain was as previously described34. Additional image processing was done using Fiji (http://fiji.sc/) to adjust brightness and/or contrast for each imaging channel. For display purposes, some images were mirrored or rotated during figure assembly.

To characterize LPLC2 arbors in the lobula plate, we examined high-resolution (63×) image stacks with MultiColor FlpOut (MCFO)-labelled LPLC2 cells using the NeuronAnnotator mode of Vaa3D. Because the proximity of the neuropil boundary may constrain cellular morphology at the edge of the lobula plate retinotopic array, we focused on neurons with more central positions. In addition, we only examined cells with arbors that could be distinguished from other cells in the same stack by colour and/or location. One hundred and ten cells from 20 fly brains imaged at high-resolution (63×) met these criteria. We used both new images (14 brains, driver lines OL0047B) as well as images from a previous study10 (6 brains, OL0048B) for these analyses.

To further visualize the three-dimensional distribution of LPLC2 branches in different lobula plate layers for a given cell (Fig. 1d, e, Extended Data Fig. 1e, f and Supplementary Video 1), we segmented and coloured the branches of six MCFO-labelled LPLC2 neurons on the basis of their lobula plate layer positions (estimated using anti-Brp patterns as a layer reference). Segmentations were performed on image stacks using Fluorender38. Other image processing was done with Fiji (https://fiji.sc/) and Vaa3D (for display purposes, see above). Supplementary Video 1 was generated using Fluorender.

Statistics and reproducibility

Statistical tests for calcium imaging data took multiple comparisons into account wherever possible, using the specified (two-sided) post hoc test following an RM-ANOVA. Generally, the groups compared were plotted together. However, the following data sets were plotted separately, but grouped together for statistical multiple comparisons: linear sum versus measured response, Fig. 4D (left) and Extended Data Fig. 5B, E, H, K, N; inhibition at RF periphery, Fig. 4H (left) and Extended Data Fig. 5S (left); LPi4-3 optogenetics, Fig. 5I and Extended Data Fig. 7G–S; LPi4-3 optogenetics controls, Extended Data Fig. 8G–W.

All anatomical results were confirmed across multiple flies and cells. Specific sample numbers for each anatomy figure are included in Supplementary Table 2. The same set of image stacks was often used to examine multiple features of a given cell type (for example, layer pattern and lateral spread).

The general pattern of LPLC2 arbor distribution across lobula plate layers (Fig. 1d, e) was similar for all 110 cells examined in the manner described above. However, details of branching pattern were variable. For example, some LPLC2 cells bifurcated within the lobula (see the third and fifth cells in Extended Data Fig. 1e, f) but nevertheless produced a similar overall dendritic pattern as cells with a single main neurite. Other variable features included the relative size of the branches in different layers (for example, the spread of the layer 3 branches of some cells appeared much smaller than that of the layer 4 branches).

Whole-cell patch clamp recordings

Whole-cell patch electrophysiology was performed in tethered flies as previously described14. Here, all legs were cut at the femur and glued in place to reduce mechanosensory inputs. The posterior surface of the head capsule was dissected to gain access to the giant fibre neuron soma, which was visualized by GFP expression.

Optogenetic activation was performed with an amber light source (CoolLED pE-100, 595 nm), triggered by an isolated pulse stimulator (Model 2100, A-M Systems) to deliver a 50 ms pulse every 30 s, and calibrated to 1.03 mW mm−2 (using S170C Sensor, Thorlabs). Responses in the giant fibre neuron were recorded in current clamp mode (MultiClamp 700B amplifier, Molecular Devices), low-pass filtered at 10 kHz, and digitized (Digidata 1440A, Molecular Devices) at 40 kHz. Traces were not corrected for liquid junction potential (~13 mV) and no current was injected. Recordings were only analysed if a high seal resistance (~8 GΩ) was achieved before membrane rupture and the resting membrane potential remained between −55 mV and −70 mV throughout the experiment.

Fly preparation for imaging

Flies were prepared and mounted in a fly holder as previously described39. Notably, the most anterior legs (T1) were severed and the stumps were glued to the proboscis. The fly’s head was positioned and glued to the fly holder such that the eye’s equator was 55 ± 5° below the horizontal. Head pitch angle for each fly was established using the position of the pseudopupil40. A tungsten dissection needle (World Precision Instruments 501316) was used to remove the cuticle and to sever muscle 16.

Two-photon calcium imaging

Imaging was conducted with a two-photon microscope (Thorlabs) controlled by ScanImage 2015 (ref. 41) and a mode-lock laser (Spectra-Physics Mai Tai eHP DS) tuned to 920 nm delivering less than 14 mW power at the sample. We imaged with a 16× water-immersion objective (Nikon CFI75, numerical aperture 0.8) with a band-pass filter (Semrock 503/40 nm) in front of the photomultiplier tube (Hamamatsu GaAsP H10770PB-40 SEL) to reduce bleed-through from the visual stimulus projector. Volumes were acquired at 5.6–7.4 Hz (z-step size 5 µm) with each frame at xy pixel resolution ranging from 256 × 192 to 256 × 128. Calcium responses were stable throughout imaging sessions under a constant carbogen (95% O2/5% CO2) bubbled saline42 flow at 0.4 ml min−1. For single-axon imaging experiments where an additional 90 min of setup time was required to map and analyse receptive fields before presenting any single-cell receptive-field-centred visual stimuli, we included individual trial calcium traces spanning a recording time duration of roughly 2 h to demonstrate that responses were stable (Extended Data Figs 4D, E, 7E, F and 8E, F).

Optogenetic stimulation during two-photon imaging was delivered through the objective using a fibre-coupled 660 nm red-light-emitting diode (LED) (Thorlabs M660F1) collimated with a fibreport coupler (Thorlabs PAF-X-15-PC-A). The red light was further cleaned up with a band-pass filter (Semrock FF01-661/20-25) and the beam waist was adjusted using an iris to achieve a 150 μm diameter spot at the sample plane. A custom-made alignment target was used to verify that LED illumination spot size and position matched the two-photon scanning region. The total red-light power delivered at the sample plane was either 3.85 μW or 8.77 μW, corresponding to a density of about 220 μW mm−2 and 500 μW mm−2 respectively. For all LPi4-3 optogenetic experiments, only the lowest light power (3.85 μW) was used.

Visual stimulation

Visual stimuli were displayed on a cylindrical screen (HolidayProjectors Mylar screen) with a custom projector setup39 (Texas Instruments DLP LightCrafter) using a green laser light source (Laser Quantum Tau, 532 nm). Stimuli were displayed only to the fly’s right eye at a frame rate of 180 Hz and a spatial coverage of 90° (in both azimuth and elevation). Stimuli were generated with appropriate geometric corrections using custom OpenGL code written in C++.

Visual stimuli were grouped into sets such that each set encompassed a single run of all protocols, and each fly was presented with three sets (for a total of three repetitions per protocol). Protocols within each set were randomly shuffled such that each set had a different protocol order.

For axon terminal population imaging, looming stimuli were centred at a fixed position (35° azimuth, 0° elevation). For single-cell imaging, we first ran protocols to map the receptive field centre and directional tuning, which we then used as parameters for subsequent visual stimulus code.

Constant approach-velocity looming stimuli were generated with r/v parameterization as previously described43. Luminance-matched controls for looming stimulus were generated frame-by-frame with the following equation:

where D is the estimated receptive field diameter (fixed at 60°), d is looming stimulus disk diameter, and I is the intensity (0–100%). The intensity of background (Ibg) was always set to 50%, whereas intensity of foreground (Ifg) was either bright (100%) or dark (0%). The measured 532 nm intensity at projector screen surface was about 1.4, 212, and 378 nW mm−2 for 0%, 50%, and 100% intensity respectively (see Extended Data Fig. 4M for darkening stimulus power measurement).

Single-cell cross-stimuli contained a static 10° square at the receptive field centre throughout the entire stimulus duration (including the pre-motion holding period).

All stimuli included a 2 s pre- and post-motion holding window to decouple the visual response from the appearance of a new visual stimulus versus the motion of that stimulus. For simultaneous visual and optogenetic stimulation experiments, the pre- and post-motion holding window was shortened to 500 ms. We waited at least 8 s between stimuli to allow both visual and calcium responses to return to baseline. The projector background intensity was held at 50% throughout inter-stimulus intervals.

We aligned visual stimulus onset times to specific imaging frames by using a photodiode (Luna Optoelectronics SD112-45-11-221) to monitor visual stimulus frames.

Data analysis

We used custom MATLAB (MathWorks) scripts to parse fluorescence and temporally align imaging frames with the visual stimulus. No motion correction was used on any images. Statistics were computed using Prism7 (GraphPad Software) and MATLAB (MathWorks).

Calculation of fluorescence

We recorded 10–12 z-planes in each imaging volume, but also saved the flyback frames between each volume acquisition when the excitation light source was completely attenuated by the pockel cell. The flyback frames therefore recorded photomultiplier baseline values along with any bleed-through light from visual stimuli and optogenetic modulation. We subtracted the average value of flyback frames in a volume from the images in that volume.

For LPLC2 axon terminal imaging, we calculated the change in fluorescence intensity, ΔF/F, by using the 2 s before visual stimulus onset as the baseline fluorescence. For LPLC2 single-axon imaging, there was no detectable basal (baseline) fluorescence so we measured ΔF by normalizing the raw fluorescence by the peak response of the axon to a dark disc expansion (receptive-field-centred 5–60° looming at either 10° s−1 edge speed for visual stimulus alone or r/v = 40 ms looming for optogenetic experiments).

For LPi4-3 imaging, we measured fluorescence from all visible boutons but excluded all somas. Owing to the fly brain orientation used for imaging, it was not possible to distinguish between lobula plate layers 3 and 4. We assume the measured fluorescence can come from either or both layers. We calculated ΔF/F by using the 2 s before visual stimulus onset as the baseline fluorescence.

Peak fluorescence responses for a given stimulus were found by averaging a 300 ms window around the maximum fluorescence response found between motion onset and 500 ms after motion has ended. The mean fluorescence response for a given stimulus was found by averaging the response through the entire motion interval.

Region of interest selection

We time-averaged all frames in an experiment trial to generate a template image for region of interest selection. All regions of interests were selected manually in three dimensions using Fluorender38 and further curated in ImageJ44. We visually inspected and excluded any pixels where two axons crossed between imaging planes. Representative time-averaged maximum intensity projection calcium images are shown for LPLC2 axon terminals (Fig. 2C and Extended Data Fig. 2B), individual LPLC2 axons (Fig. 3b and Extended Data Figs 7B and 8A), and the LPi4-3 population (Extended Data Fig. 6b). The axon terminal image in Fig. 2C was rotated and the corners were filled with black background.

Receptive field mapping

We computed integrated responses from looming presented on a dense 5° spaced grid where each position corresponded to a looming centre. The looming stimulus expanded from 5° to 20° at a constant 10° s−1 edge speed. The associated grid position and integrated fluorescence response were fitted with a two-dimensional Gaussian:

with the peak position (x0, y0) as the estimated receptive field centre position (azimuth, elevation). The angle (α) between receptive field centre and disk stimulus centre , is calculated assuming the centre positions are on a unit sphere:

Directional tuning

For individual LPLC2 neurons, we performed a series of symmetric bar expansions (edge speed 20° s−1) centred on each neuron’s receptive field, rotating the axis in 15° increments. The measured cardinal axis directions (consistently at 45° offset from the horizontal) were used to orient single-cell visual stimuli. The directional tuning curve was generated using Origin (OriginLab) by interpolating with a Bezier curve.

For the LPi4-3 population, we displayed a 1 Hz temporal frequency square-wave grating (20° spatial period) motion for 2 s inside a 50° square aperture (centred at 35° azimuth, 0° elevation). The grating motion direction was shifted every 22.5° to sample directional preference. To assess edge selectivity along the measured preferred (315°) and null (135°) directions, we showed a dark or bright-edge sweeping across the screen at 20° s−1 edge speed.

Behaviour assay

We tested fly responses to looming stimuli using a custom built, semi-automated apparatus to gate individual flies onto a platform, where they stood at the centre of a 6′ sphere and were subjected to a dark looming circle (10–90°) that expanded frontally with an r/v ratio of either 40 ms or 80 ms (ref. 14). High-speed videos (6,000 frames per second) of fly responses were manually scored for whether or not the fly took off from the ground and initiated flight. The results were modelled as a binomial distribution with x flies that jumped out of N flies for each genotype and looming condition tested. The confidence interval was calculated using the following Wilson score interval (WSI):

where p = x/N, and z = 1.96 is the critical value at α = 0.05.

Data and code availability

All imaging data and analysis code are available upon reasonable request from the corresponding authors. Representative image stacks used for anatomical analyses are available from http://splitgal4.janelia.org/cgi-bin/splitgal4.cgi.