We present an imaging system for pan-neuronal recording in crawling Caenorhabditis elegans. A spinning disk confocal microscope, modified for automated tracking of the C. elegans head ganglia, simultaneously records the activity and position of ∼80 neurons that coexpress cytoplasmic calcium indicator GCaMP6s and nuclear localized red fluorescent protein at 10 volumes per second. We developed a behavioral analysis algorithm that maps the movements of the head ganglia to the animal's posture and locomotion. Image registration and analysis software automatically assigns an index to each nucleus and calculates the corresponding calcium signal. Neurons with highly stereotyped positions can be associated with unique indexes and subsequently identified using an atlas of the worm nervous system. To test our system, we analyzed the brainwide activity patterns of moving worms subjected to thermosensory inputs. We demonstrate that our setup is able to uncover representations of sensory input and motor output of individual neurons from brainwide dynamics. Our imaging setup and analysis pipeline should facilitate mapping circuits for sensory to motor transformation in transparent behaving animals such as C. elegans and Drosophila larva.C. elegans | Drosophila | calcium imaging | thermotaxis U nderstanding how brain dynamics creates behaviors requires quantifying the flow and transformation of sensory information to motor output in behaving animals. Optical imaging using genetically encoded calcium or voltage fluorescent probes offers a minimally invasive method to record neural activity in intact animals. The nematode Caenorhabditis elegans is particularly ideal for optical neurophysiology owing to its small size, optical transparency, compact nervous system, and ease of genetic manipulation. Imaging systems for tracking the activity of small numbers of neurons have been effective in determining their role during nematode locomotion and navigational behaviors like chemotaxis, thermotaxis, and the escape response (1-6).Recordings from large numbers of interconnected neurons are required to understand how neuronal ensembles carry out the systematic transformations of sensory input into motor patterns that build behavioral decisions.Several methods for fast 3D imaging of neural activity in a fixed imaging volume have been developed for different model organisms (7)(8)(9)(10)(11)(12)(13)(14). High-speed light sheet microscopy, light field microscopy, multifocus microscopy, and two-photon structured illumination microscopy have proved effective for rapidly recording large numbers of neurons in immobilized, intact, transparent animals like larval zebrafish and nematodes (15)(16)(17)(18)(19). However, these methods are problematic when attempting to track many neurons within the bending and moving body of a behaving animal. Panneuronal recording in moving animals poses higher demands on spatial and temporal resolution. Furthermore, extracting neuronal signals from recordings in a behaving animal requires an effective analysis pipel...