Figures and data

Closed-loop cutaneous stimulation of mice freely moving in naturalistic environments.
A Mice can be remotely targeted with cutaneous stimuli while freely exploring complex environments, such as a maze. B Schematic illustrating the closed-loop control workflow. A freely-moving mouse is recorded using a camera feed, enabling real-time pose estimation to track multiple body part keypoints. The extracted frame keypoint (x, y) of a selected body part is converted to pre-mapped x, y mirror galvanometer control signals to direct the laser beam paths. The movement of the galvanometer mirrors and triggering of the laser are determined by pre-programmed behavioral or environmental conditions, allowing stimulation to depend on behaviorally-relevant states: for example, if the mouse was performing specific actions (running, sleeping, grooming, rearing) or making choices (turning right in a maze, exploring a specific area of the environment). Flexible, state-dependent laser targeting was accomplished using an infrared laser for thermal stimulation and a blue laser for optogenetic stimulation of genetically targeted primary afferent neurons, enabling high spatiotemporal control of stimulation to small areas of skin.

A system for closed-loop cutaneous stimulation.
A Rendering of the system shows camera and stimulation optics 1 m below the glass platform, accommodating a large circular arena for freely-moving mice. B Side, rear, and aerial views. The blue laser beam (blue) was aligned to the galvanometer mirrors (GM) using mirrors (M1, M2), and lenses (L1, L2, L3) via ND filters (F). The infrared laser beam (red) is directed through a beam shutter with mirrors (M3, M4) and lens (L4). Converged beams in purple. C Average image of the laser across a linear voltage grid (left) and a pixel grid after mapping (left-middle). Pixel-voltage mapping corrects distortion (right-middle to right). D A mouse on the platform. E Tracking in the arena. F Galvanometer mirrors tracking the left hind paw keypoint. G 2D histograms of paw keypoints highlight the dwell of the locomotor stance phase compared to tail base motion. H Histogram of tail base speed indicating categories from four wild type mice (16,000 frames). I Paw traces illustrating the out-of-phase swing-stance during locomotion. J Traces showing alternating left and right paw movement. K Accuracy of the laser targeting the hind paws across speed categories. L Laser targeting mean average Euclidean error, MAE. See also related figure supplements 1 and 2.

Spatial and temporal characterisation of the closed-loop optical system.
A Uniformity of laser spot area and optical power. Heatmaps of mean measurements taken from triplicates at 16 separate locations encompassing the entire glass platform, and fit with a two-dimensional polynomial. B Galvanometer mirrors directed in a spiral formation across the glass platform. C The shift in the spatial calibration map was negligible as shown every week for 10 weeks during intensive use. Automatic remapping takes 30 minutes to complete. D The relative timings of the camera exposures (blue), mirror galvanometers (green) and laser (red). The acquisition frame time is shown in grey, and corresponding galvanometer mirrors jumps and laser pulse occur around 80 ms later. E Histograms of the dwell time for hind paws spent in the swing and stance phases during locomotion. F Accuracy of the laser targeting the fore paws across the speed categories, which was limited by left-right confusion in the tracking of small bodyparts.

Hardware and software information flow design.
Primary computer (C1) runs real-time pose estimation on the camera feed to predict multiple body part keypoints. These are converted to voltage signals at DAQ device (DAQ1), to control the galvanometer mirrors (GM) to target the laser spot coordinates. C1 also sends a trigger to DAQ1 to trigger the blue light laser or the infrared laser shutter via an Arduino UNO (Arduino 2). To generate blue light pulse trains following a trigger an Arduino was used (Arduino 1). The second computer (C2) interfaces with another DAQ device (DAQ2) to generate audio during experimental sessions. DAQ1 can also interface with DAQ2 to trigger audio depending on processor class conditions and for analog modulation of the blue light laser. The reward delivery system in Figure 4 is controlled via two Arduinos (Arduino 3 and 4) interfacing with DAQ1.

Cutaneous stimulation in large environments drives behavioral responses.
A Schematic of the open arena. B Protocol for minimal cutaneous stimulation using transdermal optogenetic activation of cutaneous nociceptors. C A single frame showing a mouse exploring the open arena (left). Keypoints for the left hind paw for 750 frames prior to and 1750 frames after the frame (1 min 23.33 s duration, middle). The body and head orientation at four time points are shown as orange rhombi connecting snout, left and right fore paw, and tail base (middle). Keypoint skeletons (right). D Representative images of a 10 ms laser pulse spot targeting the plantar surface of the hind paw in littermate (top) and Trpv1::ChR2 (bottom) mice. E Keypoint traces during stimulation of the left hind paw for two trials. F Example keypoint skeletons from Trpv1::ChR2 mice showing orienting behavior to hind paw stimulation (indicated by the blue arrow).

Multi-animal stimulation for automatic nociceptive testing.
A Concept of the random access multi-animal stimulation. Motion energy was used to detect idle mice in multiple chambers, randomly selecting and cropping to one chamber for real-time pose estimation and stimulation. A laser spot was targeted to the hind paw of the mouse placed in the chamber. The process looped through each of the chambers, automatically targeting and stimulating the mice. B An example camera frame from below the stimulation platform, illustrating each chamber in different colors (left). Motion energy and body part keypoints shown for an individual chamber (right). C Representative paw responses and body repositioning following thermal stimulation (10 s pulse; top) and optogenetic stimulation (3 ms pulse; bottom). D Representative paw responses during thermal stimulation of wild type mice. Two motion energy traces are shown in the top panel, while two traces plotted with keypoints are displayed in the bottom panel. The grey dashed line indicates laser stimulation onset. The orange dashed line indicates the motion energy response threshold used to determine paw movement. E Cumulative distribution of paw response latencies to thermal stimulation from one mouse (10 trials). F Representative hind paw responses following optogenetic stimulation of Trpv1::ChR2 mice. The grey dashed line indicates stimulation onset. G Cumulative distribution of paw response latencies to optogenetic stimulation in 9 Trpv1::ChR2 mice (181 trials, range of 15 to 24 trials for individual mice). Response latency followed the rank order of the optogenetic stimulation intensity.

Closed-loop cutaneous stimulation in mice running through a maze.
A Schematic of the maze design. A single trial was defined as the collection of a single reward, indicated by the orange and green arrows. The left and right corridors leading to the reward chambers were paired with stimulation of nociceptors using transdermal optogenetics. B Maze renderings from aerial, front, and side views. Mice entered via an entry chamber leading to a corridor and junction, choosing left or right through one-way doors. A sucrose-water reward awaited in the reward chamber, with exit through another one-way door. C Total number of rewards collected (left and right-hand side reward ports combined) for each training session. D Movement trajectories over an entire session (left) and a single trial (right). Trajectories are shown from one mouse for the first stimulation session. E Frame sequences (0.2 s apart) from four trials in four mice show runs along maze corridors toward the reward chamber. Blue arrows indicate targeted stimulation. F Relative timings of corridor entry and subsequent reward collection (n = 4 mice). G Transition matrix showing mice predominately alternate between rewards at the left and right reward ports. H Example movement trajectories (tail base) in the left and right corridors from one mouse (left). Bar plots showing path coherence and speed in the high stimulation corridor relative to the low stimulation corridor (right).

Optical components required for the assembly of the system.

Parts required for mounting optics in the system.
