To determine the change in vessel diameter upon sensory stimulation when artery walls were labeled with Alexa 633, we first used a Gaussian filter (σ ≈ 1 μm) to smooth each imaging frame of the time series. Vessel cross-sections were then selected manually using a graphical user interface. When vessels were imaged longitudinally (Fig. 1a,c,e), the cross-section was drawn perpendicular to the two parallel lines that represented each side of the vessel wall. When a vessel was imaged transversely (Fig. 2a), cross-section line segments passed through the center of the circular vessel. Because Alexa 633 labeled the arterioles brightly with minimal dye in the lumen of the vessel and the brain parenchyma (Fig. 1), the profile of image brightness along the cross-section line segment always had only two maxima. Each maximum corresponded to each side of the vessel. The distance between the two maxima of each cross-section line segment represented the diameter of the vessel. The above procedures were used to calculate the diameter in each imaging frame of the time series, resulting in a time course of vessel dilation for each cross-section examined (for example, Figs. 1h and 2d,g,h). The Lilliefors test for normality was satisfied for all vessels examined. Vessels selectively tuned for particular receptive field location was defined by ANOVA across n stimulus periods (P < 0.05). Typically, our two-photon imaging frame rates for vessel imaging were slow (1–1.64 s frame−1) but well within the range used in our previous calcium imaging work5 (link)–7 (link). With faster imaging frame rates (0.16–0.2 s frame−1) we could extract the latency of arteriole dilation relative to the onset of the grating visual stimulus. To determine the latency of dilation upon sensory stimulation, each of n baseline and m stimulus frames were averaged across all repeats. We then performed a linear regression on the rising phase of the vessel dilation response using data points between 20% and 80% to the peak dilation11 (link) (for example, Fig. 1h). Visually evoked latencies of dilation for arterioles ranged from 0.67 s to 0.99 s (n = 3 arteriole branches in two mice and 5 arteriole branches in two rats). To quantify the change in vessel diameter upon sensory stimulation when the lumen of veins and arteries were labeled with fluorescein dextran, we applied the same Gaussian smoothing as described above for Alexa 633–labeled walls. However, maxima with fluorescein dextran labeling did not necessarily correspond with the vessel diameter because the lumen could have near equal brightness at more than two points along the cross-section line segment. Thus, for fluorescein dextran labeling, we calculated the first derivative of the profile of image brightness along the cross-section line segment. The first derivative had a maximum at the wall-lumen interface. Red blood cell velocity was determined from line scans of fluorescein dextran– (or Alexa 633–) labeled lumen of the blood vessel of interest (Supplementary Fig. 19). We used the Radon transform to calculate velocity (in millimeters per second) as described previously16 (link). Typically, we calculated the average velocity per block of 300 sequential line scans with an overlap of 100 lines between blocks. The algorithm was implemented using the Matlab function ‘radon’. The time courses of visual stimulus evoked velocity responses (blank versus stimulation periods; for example, Fig. 2f) were smoothed by a 10-point sliding mean.