scieee AI-readable full text Open interactive document viewer

A Robust Role for Motor Cortex

Lopes, Gonçalo Cardoso

Abstract

The function of mammalian motor cortex has remained a persistent mystery. There is a long history of research linking activity in this part of the brain with the control of voluntary movements but surprisingly there is an equally large body of evidence in non-human animals describing all kinds of complex behaviours that are not impaired when motor cortex is fully removed. What is the reason behind this discrepancy? What kind of movements are actually controlled by motor cortex? This thesis attempts to reconcile the many con icting views on the cortical control of movement and outline a strategy for investigating the teleology of this brain region. We start out by introducing a new set of hardware and software tools for neuroscience that aim to make it easier to study in detail more naturalistic motor behaviours in rodents. These tools allow the experimenter to quickly recon gure the physical and virtual environment of a behaviour task while simultaneously tracking in real-time ne-scale measurements of motor performance. (...)

Full text

Dissertation presented to obtain the Ph.D degree in Biology | Neuroscience Instituto de Tecnologia Química e Biológica António Xavier | Universidade Nova de Lisboa Oeiras, December, 2016 Gonçalo C. Lopes A Robust Role for Motor Cortex Gonçalo C. Lopes Dissertation presented to obtain the Ph.D degree in Biology | Neuroscience Instituto de Tecnologia Química e Biológica António Xavier | Universidade Nova de Lisboa Oeiras, December, 2016 A Robust Role for Motor Cortex Research work coordinated by: A Robust Role for Motor Cortex Gonçalo C. Lopes A Dissertation Presented to the Faculty of Universidade Nova de Lisboa in Candidacy for the Degree of Doctor of Philosophy Supervisors: Joseph J. Paton Adam R. Kampff 2016 In loving memory of Kiba Acknowledgments An impressively large number of people have accompanied me throughout this journey, and to all of them I am deeply and profoundly thankful. All interactions have a meaning we can never recognize and their combined impact ripples into the future unabated. This is true even if I forget to publicly acknowledge some of them, as I'm sure will be the case. The Champalimaud Neuroscience Programme has been to me a place of deep personal and intellectual transformation. I can barely recognize the person that six years ago set out on the journey from computer science to neuroscience, intrigued by the mysteries of the brain. The eorts of the institute as a whole to bring together people from widely dierent cultural and academic backgrounds has created a nexus in which interesting personalities cannot help but be forged and tempered. I will never forget the unique opportunity I had to interact with such a large community of scientists from all over the world, and to discuss nearly every possible topic to my utmost satisfaction. These interactions were always done freely and passionately, in the best spirit of scientic companionship, with no regard for hierarchy or rank. My rst dedication goes to my companions of the International Neuroscience Doctoral Programme, Carolina Doran, Simone Lackner, Tiago Marques, Ivo Marcelo, Bruno Miranda, Raimundo Leong, and Gustavo Moreno, who in the year of 2010 embarked with me on this adventure. Together we have shared much more than just our initial training in neuroscience. Even though we all parted to pursue our own individual projects, there were many crucial points during the journey where, even serendipitously, we were still able to support each other as pillars of sanity in the middle of uncontrollable turbulence. It was an honour and a pleasure to have met each one of you and I hope to have contributed back a small inkling of all the inspiration and admiration you have provided me. ix Financial Support The research leading to these results has received funding from the European Union's Seventh Framework Programme (FP7/2007-2013) under grant agreement no. 600925 and the Bial Foundation (Grant 190/12). GL was supported by the PhD Studentship SFRH/BD/51714/2011 from the Foundation for Science and Technology, and a Visiting Research Fellow stipend from the Sainsbury Wellcome Centre for Neural Circuits and Behaviour at University College London. The Champalimaud Neuroscience Programme is supported by the Champalimaud Foundation. xvi Contents Acknowledgements ........................ ix Título e Resumo ..........................xiii Abstract ............................... xv Financial Support .........................xvi 1 Towards a Teleology of Cortical Motor Control 1 1.1 ChapterSummary ....................... 2 1.2 A Dilemma for Cortical Motor Control . . . . . . . . . . . . 3 1.2.1 Discovery of the Motor Cortex . . . . . . . . . . . . 3 1.2.2 The Goltz-Ferrier Debates . . . . . . . . . . . . . . . 4 1.3 The Role of the Corticospinal Tract . . . . . . . . . . . . . . 8 1.3.1 A Functional Theory for the Motor Cortex . . . . . . 9 1.3.2 The Eects of Lesions in the Corticospinal Tract . . 13 1.4 An Integrative View of the Motor System . . . . . . . . . . 20 1.4.1 The Coordinative Role of Inhibition . . . . . . . . . 22 1.4.2 Hierarchical Organization of Motor Behaviour . . . . 25 1.5 A Strategy for Probing Cortical Control . . . . . . . . . . . 30 1.5.1 Outline of the Thesis . . . . . . . . . . . . . . . . . . 32 2 Rapid Prototyping Tools for the Study of Behaviour 47 2.1 ChapterSummary ....................... 48 2.2 Introduction........................... 49 xvii 2.3 Methods............................. 51 2.3.1 The Modular Behaviour Box . . . . . . . . . . . . . 51 2.3.2 The Bonsai Framework . . . . . . . . . . . . . . . . . 55 2.4 Results.............................. 71 2.4.1 Getting Started with Bonsai . . . . . . . . . . . . . . 71 2.4.2 Under the Hood . . . . . . . . . . . . . . . . . . . . 72 2.4.3 Applications . . . . . . . . . . . . . . . . . . . . . . . 74 2.5 Discussion............................ 79 2.6 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 82 2.7 Author contributions . . . . . . . . . . . . . . . . . . . . . . 83 3 Moving with and without Motor Cortex 87 3.1 ChapterSummary ....................... 88 3.2 Introduction........................... 89 3.3 Methods............................. 91 3.4 Results..............................103 3.5 Discussion............................121 3.6 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 122 3.7 Author contributions . . . . . . . . . . . . . . . . . . . . . . 123 4 Extended Discussion 129 4.1 ChapterSummary .......................130 4.2 A challenge from robotics . . . . . . . . . . . . . . . . . . . 131 4.3 A primordial role for motor cortex . . . . . . . . . . . . . . 133 4.4 Implications for non-primate mammals . . . . . . . . . . . . 133 4.5 Implications for primate studies . . . . . . . . . . . . . . . . 134 4.6 Some speculation on the role of direct cortical control . . . 135 4.7 Some preliminary conclusions . . . . . . . . . . . . . . . . . 136 xviii Chapter 1 Towards a Teleology of Cortical Motor Control The innite fertility of the organism as a eld for adapted reactions has become more apparent. The purpose of a reex seems as legitimate and urgent an object for natural inquiry as the purpose of the colouring of an insect or a blossom. And the importance to physiology is, that the reex reaction cannot be really intelligible to the physiologist until he knows its aim. Sir Charles S. Sherrington , The Integrative Action of the Nervous System (1906) 1 1.1 Chapter Summary Motor cortex has 150 years of conicting history. It was originally dened as the part of cortex where movements can be evoked by low-current stimulation. Stimulated points across the cortical surface were found to be organized into a rough map of the body. A monosynaptic projection system, the corticospinal tract, was found to directly link motor cortex to neurons in contralateral spinal cord. There is a marked decrease in granular layer IV, the main source of inputs from sensory thalamus, across this excitable zone. Lesions of the motor cortex in humans can cause paralysis in any limb and permanently disrupt the execution of basic actions such as standing or walking. Recordings of neural activity in motor cortex correlate with various movement parameters. These lines of evidence support the idea that this part of the brain directly controls movement. However, lesions of the motor cortex in non-human animals preserve most of the animal's behaviour repertoire. Sectioning of the corticospinal tract in primates is sucient to reinstate the primary eects of motor cortical lesions, but there are also vast projections from motor cortex to other cortical and sub-cortical areas, including multiple disynaptic parallel descending pathways to spinal centers via brainstem. In most mammals, the corticospinal tract does not target motor neurons in ventral spinal cord, as it does in most primates, but rather spinal interneurons. It is clear that this part of the brain is somehow involved in movement, but a large number of questions remain strangely unanswered. If motor cortex is a controller, what kind of movements does it control? How does it interact with other existing brain structures to generate behaviour? Why do motor cortical lesions produce such an apparently incomplete eect on movement? This chapter is an attempt to piece together all the fragmentary and contradictory evidence on motor cortical structure and physiology in order to derive a unied functional picture of cortical motor control. 2 1.2 A Dilemma for Cortical Motor Control The involvement of the brain and spinal cord in motor control has been recognized since the earliest known clinical records on head and spinal injury, dating back to ancient Egypt (Louis, 1994; van Middendorp, Sanchez & Burridge, 2010). However, the role of the nervous system in generating behaviour was not fully appreciated until Galvani rst reported his famous experiments on animal electricity (Galvani, 1791). By isolating the sciatic nerve and gastrocnemius muscle in the frog, Galvani clearly demonstrated in a series of stimulation experiments that an electrical process, contained entirely within the biology of the frog's leg, was responsible for the spontaneous generation of muscle contractions. This would lead over the following century to the discovery and physiological characterization of the nerve impulse, the action potential, that travels across the nerve to initiate muscle movement (du Bois-Reymond, 1843; Bernstein, 1868; Schuetze, 1983). The success of these seminal experiments immediately raised a fundamental question regarding nerve conduction: if spontaneous muscle contraction is generated by nerve impulses transmitted throughout the nervous system, how is this transmission coordinated in order to generate the complex patterns of muscle activity observed in natural behaviour? 1.2.1 Discovery of the Motor Cortex In search of answers to this question, many researchers looked at the brain, the seat of anatomical convergence of the nervous system, for such an integrative role. Following Galvani's footsteps, several attempts were made to stimulate the cerebral cortex electrically, but with little success (Gross, 2007). It wasn't until the 1870s that the rst indications of a direct involvement of the cortex in the production of movement came to light, around the time when Hughlings Jackson underwent his studies on epileptic convulsions (Jackson, 1870). He observed that in some patients the 3 ts would start by a deliberate spasm on one side of the body, and that dierent body parts would become systematically aected one after the other. He connected the orderly march of these spasms to the existence of localized lesions in the post-mortem brain of his patients and hypothesized that the origin of these ts was uncontrolled excitation caused by local changes in cortical grey matter (Jackson, 1870). In that same year, Fritsch and Hitzig published their famous study demonstrating that it is possible to elicit movements by direct stimulation of the cortex in dogs (Fritsch & Hitzig, 1870). Furthermore, stimulation of dierent parts of the cortex produced movement in dierent parts of the body (Fritsch & Hitzig, 1870). It appeared that the causal mechanism for epileptic convulsions predicted by Hughlings Jackson had been found, and with it a possible explanation for how the normal brain might control movement. The cerebral cortex was already considered at the time to be the seat of reasoning and sensation, so if activity over this so-called motor cortex was able to exert direct control over the whole musculature of the body, then it might represent in the normal brain the area that connects volition to muscles (Fritsch & Hitzig, 1870). 1.2.2 The Goltz-Ferrier Debates David Ferrier, a Scottish neurologist deeply impressed by the ideas of Hughlings Jackson and by the positive results of Fritsch and Hitzig's experiments, proceeded to reproduce and expand on their observations with comprehensive stimulation studies showing how activity in the motor cortex was sucient to produce a large variety of movements across a wide range of mammalian species (Ferrier, 1873). Meanwhile, other researchers across Europe such as Goltz and Christiani were facing a dilemma: in many of the so-called lower mammals massive lesions of the cerebral cortex failed to demonstrate any visible long-term impairments in the motor behaviour of animals (James, 1885; Goltz, 1888). These two lines of 4 inquiry rst clashed at the seventh International Medical Congress held in London in August 1881, where Goltz of Strassburg and Ferrier of London presented their results in a series of debates on the localization of function in the cerebral cortex (Phillips, Zeki & Barlow, 1984; Tyler & Malessa, 2000). Goltz assumed a clear anti-localizationist position. He advanced that it was impossible to produce a complete paresis of any muscle, or complete dysfunction of any perception, by destruction of any part of the cerebral cortex, and that he found mostly decits of general intelligence in his dogs (Tyler & Malessa, 2000). Following Goltz's presentation, Ferrier emphasized the danger of generalizing from the dog to animals of other orders (e.g. man and monkey). He then proceeded to exhibit his own lesion results by means of antiseptic surgery in the monkey, describing how a circumscribed unilateral lesion of the motor cortex produced complete contralateral paralysis of the leg. He also produced a striking series of microscopic sections of Wallerian degeneration (Waller, 1850) of the motor path from the cortex to the contralateral spinal cord, the crossed descending projections forming the pyramidal corticospinal tract (Tyler & Malessa, 2000). The debates concluded with the public demonstration of live specimens: a dog with large lesions to the parietal and posterior lobes from Goltz; and from Ferrier, a hemiplegic monkey with a unilateral lesion to the motor cortex of the contralateral side. As predicted, Goltz's dog showed a clear ability to locomote and avoid obstacles and to make use of its other basic senses, while displaying peculiar decits of intelligence such as failing to respond with fear to the cracking of a whip or ignoring tobacco smoke blown to its face. On the other hand, Ferrier's monkey showed up severely hemiplegic, in a condition similar to human stroke patients. After the demonstrations, the animals were killed and their brains removed. Preliminary observations revealed that the lesions in Goltz's dog were less extensive than expected, particularly on the left hemisphere. Ferrier's le- 5 sions on the other hand were precisely circumscribed to the contralateral motor cortex. These demonstrations secured the triumph of Ferrier, who went on to rmly establish the localizationist approach to neurology and the idea of a somatotopic arrangement over the motor cortex. The Goltz-Ferrier debates had far-reaching implications throughout the entire research community of the time, and the basic dilemma that was presented has sparked controversy and confusion for over a hundred years since (Phillips et al., 1984; Lashley, 1924; de Barenne, 1933; Tyler & Malessa, 2000; Gross, 2007). In the meantime, views of motor cortex have evolved to suggest it plays a role in understanding the movements of others (Rizzolatti & Craighero, 2004), imagining one's own movements (Porro et al., 1996), or in learning new movements (Kawai et al., 2015), but where are we today regarding its suggested primary role in directly controlling movement? Stimulating motor cortex causes movement; motor cortex is active during movement Motor cortex is still broadly dened as the region of the cerebral hemispheres from which movements can be evoked by low-current stimulation, following Fritsch and Hitzig's original experiments in 1870 (Fritsch & Hitzig, 1870). Stimulating dierent parts of the motor cortex elicits movement in dierent parts of the body, and systematic stimulation surveys have revealed a topographical representation of the entire skeletal musculature across the cortical surface (Leyton & Sherrington, 1917; Peneld & Boldrey, 1937; Neafsey et al., 1986). Electrophysiological recordings in motor cortex have routinely found correlations between neural activity and many dierent movement parameters, such as muscle force (Evarts, 1968), movement direction (Georgopoulos, Schwartz & Kettner, 1986), speed (Schwartz, 1993), or even anisotropic limb mechanics (Scott, Gribble, Graham & Cabel, 2001) at the level of both single neurons (Evarts, 1968; 6 Churchland & Shenoy, 2007) and populations (Georgopoulos et al., 1986; Churchland et al., 2012). Determining what exactly this activity in motor cortex controls (Todorov, 2000) has been further complicated by studies using long stimulation durations in which continuous stimulation at a single location in motor cortex evokes complex, multi-muscle movements (Graziano, Taylor & Moore, 2002; Aalo & Graziano, 2006). However, as a whole, these observations all support the long standing view that activity in motor cortex is involved in the direct control of movement. Motor cortex lesions produce dierent decits in dierent species What types of movement require motor cortex? In humans, a motor cortical lesion is devastating. Permanent injury to the frontal lobes of the brain by stroke or mechanical means is often followed by weakness or paralysis of the limbs in the side of the body opposite to the lesion (Louis, 1994). Although the paretic symptoms have a tendency to recover partially by themselves, especially with training and rehabilitation, permanent movement decits and loss of muscle control in the aected limbs is the common prognosis; movement is permanently and obviously impaired (Laplane, Talairach, Meininger, Bancaud & Bouchareine, 1977; Kwakkel, Kollen, van der Grond & Prevo, 2003). In non-human primates, similar gross movement decits are observed after lesions, albeit transiently (Leyton & Sherrington, 1917; Travis, 1955). The longest lasting eect of a motor cortical lesion is the decreased motility of distal forelimbs, especially in the control of individual nger movements required for precision skills (Leyton & Sherrington, 1917; Darling, Pizzimenti & Morecraft, 2011). But equally impressive is the extent to which other movements fully recover, including the ability to sit, stand, walk, climb and even reach to grasp, as long as precise nger movements are not required (Leyton & Sherrington, 1917; Darling et al., 2011; Zaaimi, Edgley, Soteropoulos & Baker, 2012). In non-primate mammals, the absence of lasting decits following motor 7 That the pyramidal tracts are in the dog requisite for volitional impulses to reach limbs and body seems negatived by the fact that the animal can run, leap, turn to either side, use neck and jaws, &c. with ease and success after nearly, if not wholly, complete degeneration of these tracts on both sides. Further, after complete degeneration of one pyramid, there is in the dog no obvious dierence between the movements of the right and left sides. (Sherrington, 1885, p.189) Interestingly, he does note that `defect of motion is observable only as a clumsiness in execution of ne movements' (Sherrington, 1885). These observations once again stood out in stark contrast with lesion experiments reported by Ferrier in the monkey, where cauterization of specic motor cortical areas produced complete and persistent paralysis of the corresponding body parts (Ferrier & Yeo, 1884). Years later, Sherrington would come back to the motor cortex with a new set of landmark studies on stimulation and ablation of the precentral region (Grünbaum & Sherrington, 1903; Graham Brown & Sherrington, 1913; Leyton & Sherrington, 1917). In these studies together with Grünbaum, Sherrington targeted motor cortical lesions to the excitable area of the arm or the leg and tracked the recovery of the animals over time. Following the initial paresis and loss of muscle control they observed dramatic recovery of most skilled motor acts, such as peeling open a banana or climbing cages (Leyton & Sherrington, 1917). In order to test whether the recovery process was due to cortical reorganization, they systematically stimulated the areas adjacent to the lesion as well as the motor cortex of the opposite hemisphere, but failed to evoke movements in the aected limb (Leyton & Sherrington, 1917), as would be expected if commands were traveling down the corticospinal tract in spared regions. Furthermore, subsequent ablation of those areas failed to produce any new impairments 14 in the recovered limb, leaving Sherrington and his colleagues at a loss to nd the locus of recovery (Leyton & Sherrington, 1917). Confused by these results, which they thought caused concern to, students of cerebral physiology, Glees and Cole introduced a set of more quantitative behavioural assays in the hope of tracking in detail the recovery of motor control (Glees & Cole, 1950; Cole, 1952). They studied the behaviour of monkeys solving various puzzle boxes following successive circumscribed lesions to the thumb, index and arm areas of the motor cortex. As Sherrington reported, there was a quick recovery after an initial period of paralysis and loss of motor control. However, even though the monkeys fully recovered their ability to skillfully open the puzzle box, some subtle movement decits and paresis in the control of ne movements of the digits was reported to persist (Glees & Cole, 1950). When stimulating motor cortical areas surrounding the circumscribed lesions, they were able to evoke movements in the impacted digits and reinstate the paretic symptoms after further ablation (Glees & Cole, 1950). This suggested the hypothesis that surrounding areas of the motor cortex could undergo reorganization following the lesion. However, an important dierence to emphasize between these experiments and those of Sherrington is the fact that only relatively circumscribed motor cortical regions were removed in each surgery, whereas in the original Sherrington study the entire elbow, wrist, index, thumb and remaining digit motor areas were excised at once (Leyton & Sherrington, 1917), most likely causing degeneration of the entire corticospinal pathway for the aected limb. The presence of an intact corticospinal tract, excitability of movements to low-current stimulation and transient paretic symptoms following ablation thus seem to go hand in hand. In the hopes of clarifying the confusion of which exact movements were controlled by cortex, other studies focused on lesions restricted to the corticospinal tract, using both unilateral and bilateral section at the level 15 of the medullary pyramids (Tower, 1940; Lawrence & Kuypers, 1968a; Lawrence & Kuypers, 1968b). The goal was to isolate the eects of all the individual descending pathways to the spinal cord and resolve once and for all the question of whether the corticospinal tract of the motor cortex was the source of all voluntary movements. Sarah Tower was the rst to describe in detail the results of unilateral and bilateral pyramidotomy in primates, with and without lesion of the motor cortex (Tower, 1940). She summarized the condition as hypotonic paresis, characterized by a loss of skeletal muscle tone and depression of the vasomotor system, along with general weakening of the reexes involving the aected limb segments. Although all discrete usage of the hand and digits was eliminated, she did emphasize the clear presence of voluntary movements in the various purposeful compensations produced by the animals to deal with the aiction. Tower attributed these compensations to the preserved capacities of brainstem circuits. A more denitive study to dissociate the eects of direct corticospinal and indirect brainstem descending pathways was conducted by Lawrence and Kuypers, and presented in their now classical publications (Lawrence & Kuypers, 1968a; Lawrence & Kuypers, 1968b). Using the Klüver board, a task where monkeys have to pick morsels of food from dierently sized round holes, they observed that while normal monkeys routinely pick up the food by pinching individual bits with their ngers, monkeys with bilateral corticospinal lesions were mostly unable to perform this precise pincer movement, and instead employed coarser compensatory clasping strategies to retrieve the food (Lawrence & Kuypers, 1968a). In addition, lesioned monkeys were consistently reported to be somewhat slower and less agile than normal animals. However, most of their overall movement repertoire was surprisingly preserved. Their nal conclusions t remarkably well with the initial observations of Sherrington in the dog, suggesting that the corticospinal pathways superimpose speed and agility on subcortical 16 mechanisms, and provide the capacity for fractionation of movements such as independent nger movements (Lawrence & Kuypers, 1968a). These observations recapitulate the eects of motor cortical lesions reported by Sherrington, but remain at odds with the primary stated role involving motor cortex, and the direct corticospinal tract, with the control of all voluntary movements. There are anatomical dierences in corticospinal projections between primates and other mammals In primates, the conspicuous eects of motor cortical lesion can also be induced by sectioning the corticospinal tract, the direct monosynaptic projection that connects motor cortex, and other cortical regions, to the spinal cord (Tower, 1940; Lawrence & Kuypers, 1968a). In monkeys, and similarly in humans, this pathway has been found to directly terminate on spinal motor neurons responsible for the control of distal muscles (Leyton & Sherrington, 1917; Bernhard & Bohm, 1954) and is also thought to support the low-current movement responses evoked by electrical stimulation of the cortex, as evidenced by the increased diculty in obtaining a stimulation response following section at the level of the medulla (Woolsey et al., 1972). However, the corticospinal tract is by no means the only pathway from cortex to movement (Figure 1.2). Motor cortex targets many other brain regions that can themselves generate movement. In fact, this specialized connection from telencephalon to spinal cord appeared only recently in vertebrate evolution (ten Donkelaar, 2009), and was further elaborated to include a direct connection from cortex to motor neurons only in some primate species and other highly manipulative mammals such as raccoons (Hener & Masterton, 1983). In all other mammals, including cats and rats, the termination pattern of the corticospinal tract largely avoids the motor neuron pools in ventral spinal cord and concentrates instead on 17 intermediate zone interneurons and dorsal sensory neurons (Kuypers, 1981; Yang & Lemon, 2003). Why then is there such a large dependency on this tract for human motor control? One possibility is that the rubrospinal tracta descending pathway originating in the brainstem and terminating in the intermediate zoneis degenerated in humans compared to other primates and mammals (Nathan & Smith, 1955, 1982), and is thought to play a role in compensating for the loss of the corticospinal tract in non-human species (Lawrence & Kuypers, 1968b; Zaaimi et al., 2012). It thus seems likely that most mammals rely on indirect pathways to convey cortical motor commands to muscles. These dierences in anatomy might explain the lack of conspicuous, lasting movement decits following motor cortical lesion in non-primates, but leaves behind a signicant question: what is the motor cortex actually controlling in all these other mammals? What is the role of motor cortex in non-primate mammals? In the rat, a large portion of cortex is considered motor based on anatomical (Donoghue & Wise, 1982), stimulation (Donoghue & Wise, 1982; Neafsey et al., 1986) and electrophysiological evidence (Hyland, 1998). However, the most consistently observed long-term motor control decit following motor cortical lesion has been an impairment in supination of the wrist and individuation of digits during grasping, which in turn impairs reaching for food pellets through a narrow vertical slit (Whishaw et al., 1991; Alaverdashvili & Whishaw, 2008). Despite the fact that activity in rodent motor cortex has been correlated with movements in every part of the body (not just distal limbs) (Hill, Curtis, Moore & Kleinfeld, 2011; Erlich, Bialek & Brody, 2011), it would appear we are led to conclude that this large high-level motor structure, with dense eerent projections to motor areas in the spinal cord (Kuypers, 1981), basal ganglia (Turner & DeLong, 2000; Wu, Corwin & Reep, 2009), thalamus (Lee, Carvell & 18 ~ 110BmillionByears ~ 560BmillionByears Human Forebrain Interbrain Midbrain SpinalBcord Hindbrain Motor Pallium Striatum Thalamus Tectum MLR Cerebellum Brainstem Dorsal Ventral MM Rodent Motor Pallium Striatum Thalamus Tectum MLR Cerebellum Brainstem Dorsal Ventral MM Lamprey Motor Pallium Striatum Thalamus Tectum MLR Cerebellum Brainstem ? Dorsal Ventral MM Figure 1.2. Forebrain motor control pathways across dierent vertebrate taxa. The molecular divergence times between human (primate), rodent and lamprey groups (Kumar & Hedges, 1998) are noted above a schematic view of the major divisions in the vertebrate brain. Arrows indicate the descending monosynaptic projections identied in each group from motor regions of the forebrain pallium to lower motor centres. Note the specialized monosynaptic projection directly targeting spinal motor neurons in human. MLR, Mesencephalic Locomotor Region; M, Motor Neurons. 19 Simons, 2008), cerebellum (Baker, Javid & Edgley, 2001) and brainstem (Jarratt & Hyland, 1999), as well as to most primary sensory areas (Petreanu et al., 2012; Schneider, Nelson & Mooney, 2014), evolved simply to facilitate more precise wrist rotations and grasping gestures. Maybe we are missing something. Might there be other problems in movement control that motor cortex is solving, but that we may be overlooking with our current assays? 1.4 An Integrative View of the Motor System A dierent approach to the problems of motor control developed initially from studies on the integration of spinal reexes conducted by the Sherrington school. While many researchers continued to look for the integration of complex movements in higher brain structures like the motor cortex, Sherrington turned instead to systematically characterizing anatomically and physiologically the distribution of eerent (Sherrington, 1892) and aerent (Sherrington, 1893a) nerve roots in the spinal cord of multiple species. His goal was to shed light on the so-called reex arc , the nerve pathways involved in muscular reactions like the knee-jerk whereby simple sensory stimuli elicit an immediate, automatic response from the animal, even in the absence of higher brain input (Sherrington, 1893b). Sherrington and his contemporaries studied in detail a number of long and short spinal reexes 3 in a variety of model organisms under dierent levels of anesthesia, pharmacological manipulations and spinal transsection (Sherrington & Laslett, 1903). This systematic approach made abundantly clear a number of facts about how the nervous system organizes motor behaviour. 3 A reex action in which a stimulus applied to one region elicits a response in another region is termed a long spinal reex, whereas a reex reaction where the muscular response happens in the same region as the stimulus is termed a short spinal reex. 20 The rst one, and perhaps the most striking, is that complex motor responses can be integrated and coordinated even in the complete absence of the brain (Sherrington, 1906). While the existence of automatisms and xed action patterns had been recognized since antiquity, systematic stimulation studies in decerebrate animals quickly revealed that the reex was far from being a rigid and xed entity, but was rather adaptive and dynamic. In particular, reex circuits revealed a much wider range of response characteristics than nerve bers, which were well known since the time of Galvani to exhibit complete stereotypy in their response to a stimulus under various conditions 4 . Indeed, the motor output produced by the massively simplied spinal circuits was remarkably organized and displayed clear ethological meaning: adaptive behaviours such as scratching (Sherrington & Laslett, 1903), shaking (Goltz & Ewald, 1896; Sherrington & Laslett, 1903) or reex stepping and standing (Sherrington, 1910; Sherrington, 1915) were all available to be elicited from stimulation of the isolated spinal system. Strikingly, these reexes were also shown to be deployed and modulated appropriately to specic stimuli. The scratch reex, for example, carries the foot roughly to the place of stimulation (Sherrington, 1904), and in reex stepping the animal can maintain a rhythmic march through all phases of locomotion over unobstructed surfaces (Sherrington, 1910). Integration of these reexes with input from the telereceptors is obviously entirely absent, but these observations claried, beyond any reasonable doubt, that spinal cord circuits alone are sucient to produce and sustain entire behaviour sequences under the right conditions. Furthermore, deaerentation experiments showed that aspects of these rhythmic network motifs persist 4 Some unique response characteristics of reex arc conduction include irreversibility of the direction of conduction; fatigability and refractory period; greater variability of threshold; temporal facilitation with successive stimuli; a weaker correspondence of end-eect with intensity and frequency of the stimulus; and a greater susceptibility to metabolic and pharmacological manipulations (Sherrington, 1906, p.14) 21 even in the absence of sensory input (Graham Brown, 1911). Many of these reex circuits were later termed central pattern generators , or CPGs (Grillner & Zangger, 1975; Grillner, 1981), and found to be present across both vertebrate and invertebrate species (Orlovsky, Deliagina & Grillner, 1999; Selverston, 2010). 1.4.1 The Coordinative Role of Inhibition One of the aspects of spinal reexes that most deeply impressed Sherrington was the general capacity of reex circuits to initiate and switch between concurrent responses despite the existence of a nal common path from the nervous system to muscles (Sherrington, 1904). Motor neurons in the spinal cord send their axons through the ventral roots of spinal segments to synapse directly on muscle bres. From his experiments, Sherrington showed that it was common to nd multiple motor neurons participating synergistically or antagonistically in a single coordinated reex response. More importantly, he revealed that the same motor neurons were actually shared among multiple, potentially conicting, reex arcs. Sherrington was fascinated by the fact that these antagonistic reexes, initiated simultaneously from distinct sensory receptors, were still found to be able to coordinate their inuence despite sharing this nal common path to muscles. That such coordination existed was made clear by stimulation experiments where two or more reexes were elicited at the same time, generating muscle responses to the combined stimulation that were not a simple summation or linear combination of the responses obtained by stimulation delivered in isolation. Sherrington describes the conception clearly: Take the primary retinal reex, which moves the eye so as to bring the fovea to the situation of the stimulating image. From all the receptors in each lateral retinal half rise reex 22 arcs with a nal common path in the nerve of the opposite rectus lateralis . Suppose simultaneous stimulation of two of these retinal points, one nearer to, one farther from, the fovea. If the arcs of both points pour their impulses into the nal common path together, the eect must be a resultant of the two discharges. If these sum, the shortening of the muscle will be too great and the fovea swing too far for either point. If the resultant be a compromise between the two individual points, the fovea will come to lie between the two points of stimulation. In both cases the result obtained would be useless for the purposes of either.... When two stimuli are applied simultaneously which would evoke reex actions that employ the same nal common path in dierent ways, in my experience one reex appears without the other. The result is this reex or that reex, but not the two together. (Sherrington, 1904, p.461) In Sherrington's time the existence of such common paths was a problem for the classic view of reex control, where the function of the nervous system was conceived in terms of nerve conduction of excitatory impulses. The existence of the nal common path mediating multiple reexes made it necessary to speak openly of the problem of how to coordinate dierent circuit elements and to describe mechanisms that would allow the same neurons to take on context-dependent roles in generating motor responses. It was during the hunt for such a mechanism of reex arc coordination that Sherrington hit upon the fundamental role of inhibition in the organization of neural function. Inhibition had always been a complicated topic for physiologists, but following the demonstration of cardiac muscle inhibition by the vagus nerve (Weber, 1846), and Sechenov's grand proposal of a central origin of reex inhibition (Sechenov, 1863), Sherrington was able to 23 Kably & Lavoie, 1996). These observations suggest that motor cortex neurons are necessary for precise stepping and adjustment of ongoing locomotion to changing conditions. However, long-term eects seem to require complete lesion of both the corticospinal and rubrospinal tracts (Drew et al., 2002). Even in these animals, the voluntary act of stepping over an obstacle does not disappear entirely, and moreover, they can adapt to changes in the height of the obstacles (Drew et al., 2002). Specically, even though these animals never regain the ability to gracefully clear an obstacle, when faced with a higher obstacle, they are able to adjust their stepping height in such a way that would have allowed them to comfortably clear the lower obstacle (Drew et al., 2002). Furthermore, decits caused by lesions restricted to the pyramidal tract seem to disappear over time (Liddell & Phillips, 1944), and are most clearly visible only the rst time an animal encounters a new obstacle (Liddell & Phillips, 1944). The view that motor cortex in non-primate mammals is principally responsible for adjusting ongoing movement patterns generated by lower brain structures is appealing. What is this modulation good for? What does it allow an animal to achieve? How can we assay its necessity? 1.5 A Strategy for Probing Cortical Control It should now be clear that the involvement of motor cortex in the direct control of all voluntary movement is human-specic. There is a role for motor cortex across mammals in the control of precise movements of the extremities, especially those requiring individual movements of the ngers, but these eects are subtle in non-primate mammals. Furthermore, what would be a devastating impairment for humans may not be so severe for mammals that do not depend on precision nger movements for survival. Therefore, generalizing this specic role of motor cortex from humans to all other mammals would be misleading. We could be missing another, more 30 primordial role for this structure that predominates in other mammals, and by doing so, we may also be missing an important role in humans. The proposal that motor cortex induces modications of ongoing movement synergies, prompted by the electrophysiological studies of cat locomotion, denitely points to a role consistent with the results of various lesion studies. However, in assays used, the ability to modify ongoing movement generally recovers after a motor cortical lesion. What are the environmental situations in which motor cortical modulation is most useful? Cortex has long been proposed to be the structure responsible for integrating a representation of the world and improving the predictive power of this representation with experience (Barlow, 1985; Doya, 1999). If motor cortex is the means by which these representations can gain inuence over the body, however subtle and modulatory, can we nd situations (i.e. tasks) in which this cortical control is required? The necessity of cortex for various behavioural tasks has been actively investigated in experimental psychology for over a century, including the foundational work of Karl Lashley and his students (Lashley, 1921, 1950). In the rat, large cortical lesions were found to produce little to no impairment in movement control, and even decits in learning and decision making abilities were dicult to demonstrate consistently over repeated trials. However, Lashley did notice some evidence that cortical control may be involved in postural adaptations to unexpected perturbations (Lashley, 1921). These studies once again seem to recapitulate the two most consistent observations found across the entire motor cortical lesion literature in non-primate mammals since Hitzig (Fritsch & Hitzig, 1870), Goltz (Goltz, 1888), Sherrington (Sherrington, 1885) and others (Oakley, 1979; Terry et al., 1989). One, direct voluntary control over movement is most denitely not abolished through lesion; and two, certain aspects of some movements are denitely impaired, but only under certain challenging situations. The 31 latter are often reported only anecdotally. It was this collection of intriguing observations in animals with motor cortical lesions that prompted us to expand the scope of standard laboratory tasks to include a broader range of motor control challenges that brains encounter in their natural environments. 1.5.1 Outline of the Thesis In this work, an attempt to delineate a new role for motor cortex is reported. As many previous eorts, it starts with behaviour, and the realization that controlled exposure of animals to a wider range of environments is of absolute necessity to gain insight into the teleology of the system. To this end, we have developed new tools to make it easier to survey a large range of environments while recording as many ne scale measures of behaviour and physiology as possible. These technical and methodological developments are described in Chapter 2. In Chapter 3, a set of behaviour and lesion studies is reported in the rat. These studies had the goal of probing the limits of recovery following extensive cortical lesions by exposing animals to more challenging and dynamic environments. Detailed analysis of the moment by moment behaviour of lesioned animals revealed a number of intriguing observations, the implications of which we discuss in Chapter 4. 32 References Aalo, T. N. & Graziano, M. S. A. (2006). Possible origins of the complex topographic organization of motor cortex: reduction of a multidimensional space onto a two-dimensional array. The Journal of neuroscience : the ocial journal of the Society for Neuroscience , 26 (23), 628897. doi:10.1523/JNEUROSCI.0768-06.2006 Alaverdashvili, M. & Whishaw, I. Q. (2008). Motor cortex stroke impairs individual digit movement in skilled reaching by the rat. The European journal of neuroscience , 28 (2), 31122. doi:10.1111/j.1460- 9568.2008.06315.x Armstrong, D. M. & Drew, T. (1984). Discharges of pyramidal tract and other motor cortical neurones during locomotion in the cat. The Journal of Physiology , 346 , 471495. Ashby, W. R. (1960). Design for a brain: The origin of adaptive behavior . New York: Wiley. Baker, M. R., Javid, M. & Edgley, S. A. (2001). Activation of cerebellar climbing bres to rat cerebellar posterior lobe from motor cortical output pathways. Journal of Physiology , 536 (3), 825839. doi:10. 1111/j.1469-7793.2001.00825.x Barlow, H. (1985). Cerebral cortex as model builder. Models of the visual cortex , (1985), 3746. Bernhard, C. G. & Bohm, E. (1954). Cortical representation and functional signicance of the corticomotoneuronal system. Archives of Neurology And Psychiatry , 72 (4), 473502. doi:10.1001/archneurpsyc.1954. 02330040075006 Bernstein, J. (1868). Ueber den zeitlichen Verlauf der negativen Schwankung des Nervenstroms. Pügers Archiv , 1 , 173207. doi:10 . 1007 / BF01640316 33 Betz, W. (1874). Anatomischer Nachweis zweier Gehirncentra. Centralblatt für die medizinischen Wissenschaften , 12 , 57880, 59599. Bjursten, L. M., Norrsell, K. & Norrsell, U. (1976). Behavioural repertory of cats without cerebral cortex from infancy. Experimental brain research , 130 (2857), 115130. Brodmann, K. (1909). Localisation in the Cerebral Cortex . Springer. doi:10. 1097/00005053-191012000-00013 Brösamle, C. & Schwab, M. E. (2000). Ipsilateral, ventral corticospinal tract of the adult rat: Ultrastructure, myelination and synaptic connections. Journal of Neurocytology , 29 , 499507. doi:10.1023/A: 1007297712821 Campbell, A. W. (1905). Histological studies on the localisation of cerebral function . Churchland, M. M. & Shenoy, K. V. (2007). Temporal complexity and heterogeneity of single-neuron activity in premotor and motor cortex. J Neurophysiol , 97 (6), 42354257. doi:10.1152/jn.00095.2007 Churchland, M. M., Cunningham, J. P., Kaufman, M. T., Foster, J. D., Nuyujukian, P., Ryu, S. I. & Shenoy, K. V. (2012). Neural population dynamics during reaching. Nature , 487 (7405), 516. doi:10.1038/ nature11129 Clark, S. L. & Ward, J. W. (1937). Electrical stimulation of the cortex cerebri of cats. Arch NeurPsych , 38 (5), 927943. Clarke, E. & O'Malley, C. (1996). The Human Brain and Spinal Cord: A Historical Study Illustrated by Writings from Antiquity to the Twentieth Century . Norman Publishing. Cole, J. (1952). Three tests for the study of motor and sensory abilities in monkeys. Journal of Comparative and Physiological Psychology , 45 (3), 226230. Darling, W. G., Pizzimenti, M. A. & Morecraft, R. J. (2011). Functional recovery following motor cortex lesions in non-human primates: experi- 34 mental implications for human stroke patients. Journal of Integrative Neuroscience , 10 (3), 353384. doi:10.1142/S0219635211002737 de Barenne, J. G. D. (1933). "Corticalization" of function and functional localization in the cerebral cortex. Archives of Neurology And Psychiatry , 30 (4), 884901. doi:10.1001/archneurpsyc.1933. 02240160196012 Donoghue, J. & Wise, S. P. (1982). The motor cortex of the rat: cytoarchitecture and microstimulation mapping. The Journal of comparative neurology , 212 (1), 7688. doi:10.1002/cne.902120106 Doya, K. (1999). What are the computations of the cerebellum, the basal ganglia and the cerebral cortex? Neural networks : the ocial journal of the International Neural Network Society , 12 (7-8), 961974. Drew, T., Jiang, W., Kably, B. & Lavoie, S. (1996). Role of the motor cortex in the control of visually triggered gait modications. Canadian journal of physiology and pharmacology , 74 (4), 42642. Drew, T., Jiang, W. & Widajewicz, W. (2002). Contributions of the motor cortex to the control of the hindlimbs during locomotion in the cat. Brain research. Brain research reviews , 40 (1-3), 17891. du Bois-Reymond, E. (1843). Vorläuger Abriss einer Untersuchung über den sogenannten Froschstrom und über die elektromotorischen Fische. Annalen der Physik und Chemie , 58 , 130. Erlich, J. C., Bialek, M. & Brody, C. D. (2011). A cortical substrate for memory-guided orienting in the rat. Neuron , 72 (2), 33043. doi:10. 1016/j.neuron.2011.07.010 Evarts, E. V. (1968). Relation of pyramidal tract activity to force exerted during voluntary movement. Journal of neurophysiology , 31 (1), 14 27. Ferrier, D. (1873). Experimental Researches in Cerebral Physiology and Pathology. Journal of anatomy and physiology , 8 (Pt 1), 1525. doi:10.1136/bmj.1.643.457 35 Ferrier, D. & Yeo, G. (1884). A Record of Experiments on the Eects of Lesion of Dierent Regions of the Cerebral Hemispheres. Philosophical Transactions of the Royal Society of London (1776-1886) , 175 (January), 479564. Forssberg, H., Grillner, S. & Rossignol, S. (1975). Phase dependent reex reversal during walking in chronic spinal cats. Brain Research , 85 (1), 103107. doi:10.1016/0006-8993(75)91013-6 Foster, M. & Sherrington, C. S. (1897). A textbook of physiology (7th). London: Macmillan. Fritsch, G. & Hitzig, E. (1870). Über die elektrische erregbarkeit des grosshirns. Archiv fur Anatomie, Physiologie und Wissenschaftliche , 37 , 300332. Galvani, L. (1791). De viribus electricitatis in motu muscularis commentarius. De Bononiensi Scientiarum et Artium Instituto atque Academia Commentarii , 7 , 363418. doi:10 . 1097 / 00000441 - 195402000-00023 Georgopoulos, A., Schwartz, A. & Kettner, R. (1986). Neuronal population coding of movement direction. Science , 233 (4771), 14161419. doi:10. 1126/science.3749885 Glees, P. & Cole, J. (1950). Recovery of skilled motor functions after small repeated lesions in motor cortex in macaque. J Neurophysiol. 13 (2), 137148. Goltz, F. (1888). Über die verrichtungen des grosshirns. Pügers Archiv gesamte Physiologie des Menschen und der Tiere , 42 , 419467. Goltz, F. & Ewald, J. R. (1896). Der Hund mit verkürztem Rückenmark. Püger's Archiv für die gesamte Physiologie des Menschen und der Tiere , 63 (7), 362400. Graham Brown, T. & Sherrington, C. S. (1912). On the Instability of a Cortical Point. Proceedings of the Royal Society B: Biological Sciences , 85 (July), 250277. doi:10.1098/rspb.1912.0050 36 Graham Brown, T. (1911). The Intrinsic Factors in the Act of Progression in the Mammal. Proceedings of the Royal Society B: Biological Sciences , 84 (572), 308319. doi:10.1098/rspb.1911.0077. arXiv: NIHMS150003 Graham Brown, T. & Sherrington, C. S. (1913). Note on the functions of the cortex cerebri. Journal of Physiology , 46 (suppl), xxii. Graziano, M. S. A., Taylor, C. S. R. & Moore, T. (2002). Complex Movements Evoked by Microstimulation of Precentral Cortex. Neuron , 34 , 841851. Grillner, S. & Shik, M. L. (1973). On the descending control of the lumbosacral spinal cord from the "mesencephalic locomotor region". Acta Physiol Scand. 87 (0001-6772), 320333. Grillner, S. & Zangger, P. (1975). How detailed is the central pattern generation for locomotion? Brain Research , 88 (2), 367371. doi:10.1016/ 0006-8993(75)90401-1 Grillner, S. (1981). Control of locomotion in bipeds, tetrapods, and sh. Handbook of Physiology, The Nervous System II , 11791236. doi:10. 1002/cphy.cp010226 Gross, C. G. (2007). The discovery of motor cortex and its background. Journal of the history of the neurosciences , 16 (3), 32031. doi:10. 1080/09647040600630160 Grünbaum, A. S. F. & Sherrington, C. S. (1903). Observations on the Physiology of the Cerebral Cortex of the Anthropoid Apes. Proceedings of the Royal Society of London , 72 (477-486), 152155. doi:10. 1098/rspl.1903.0033 Hebb, D. O. (1949). The Organization of Behavior: A Neuropsychological Theory . New York: Wiley. Hener, R. S. & Masterton, R. B. (1983). The role of the corticospinal tract in the evolution of human digital dexterity. Brain, behavior and evolution , 23 , 165183. 37 Hill, D. N., Curtis, J. C., Moore, J. D. & Kleinfeld, D. (2011). Primary motor cortex reports eerent control of vibrissa motion on multiple timescales. Neuron , 72 (2), 344356. doi:10.1016/j.neuron.2011.09. 020. arXiv: NIHMS150003 Hyland, B. (1998). Neural activity related to reaching and grasping in rostral and caudal regions of rat motor cortex. Behavioural Brain Research , 94 (2), 255269. doi:10.1016/S0166-4328(97)00157-5 Jackson, J. H. (1870). A study of convulsions. Transactions of the Saint Andrews Medical Graduates Association , 3 , 162204. doi:10.1001/ archneur.1970.00480200090012 James, W. (1885). Localization of functions in the brain. Science , 6 (143), 379380. doi:10.1126/science.ns-6.143.379 Jarratt, H. & Hyland, B. (1999). Neuronal activity in rat red nucleus during forelimb reach-to-grasp movements. Neuroscience , 88 (2), 629642. doi:10.1016/S0306-4522(98)00227-9 Kawai, R., Markman, T., Poddar, R., Ko, R., Fantana, A. L., Dhawale, A. K., Kamp, A. R. & Ölveczky, B. P. (2015). Motor Cortex Is Required for Learning but Not for Executing a Motor Skill. Neuron , 113. doi:10.1016/j.neuron.2015.03.024 Kumar, S. & Hedges, S. (1998). A molecular timescale for vertebrate evolution. Nature , 392 , 917920. Kushchayev, S. V., Moskalenko, V. F., Wiener, P. C., Tsymbaliuk, V. I., Cherkasov, V. G., Dzyavulska, I. V., Kovalchuk, O. I., Sonntag, V. K. H., Spetzler, R. F. & Preul, M. C. (2012). The discovery of the pyramidal neurons: Vladimir Betz and a new era of neuroscience. Brain , 135 (1), 285300. doi:10.1093/brain/awr276 Kuypers, H. G. J. M. (1981). Anatomy of the descending pathways. Comprehensive Physiology , 597666. Kwakkel, G., Kollen, B. J., van der Grond, J. & Prevo, A. J. (2003). Probability of Regaining Dexterity in the Flaccid Upper Limb: Impact of 38 Severity of Paresis and Time Since Onset in Acute Stroke. Stroke , 34 (9), 21812186. doi:10.1161/01.STR.0000087172.16305.CD Lacroix, S., Havton, L. a., McKay, H., Yang, H., Brant, A., Roberts, J. & Tuszynski, M. H. (2004). Bilateral corticospinal projections arise from each motor cortex in the macaque monkey: a quantitative study. The Journal of comparative neurology , 473 (2), 147161. doi:10.1002/ cne.20051 Langley, J. N. & Sherrington, C. S. (1884). Secondary Degeneration of Nerve Tracts following removal of the Cortex of the Cerebrum in the Dog. Journal of Physiology , 5 (2), 4965. doi:10.1113/jphysiol.1884. sp000151 Laplane, D., Talairach, J., Meininger, V., Bancaud, J. & Bouchareine, A. (1977). Motor consequences of motor area ablations in man. Journal of the Neurological Sciences , 31 (1), 2949. doi:10 . 1016 / 0022 - 510X(77)90004-1 Lashley, K. S. (1921). Studies of cerebral function in learning. III. The motor areas. Brain , 44 , 255285. doi:10.1037/h0070668 Lashley, K. S. (1924). Studies of cerebral function in learning: V. The retention of motor habits after destruction of the so-called motor areas in primates. Archives of Neurology and Psychiatry , 12 (3), 249 276. doi:10.1001/archneurpsyc.1924.02200030002001 Lashley, K. S. (1950). In search of the engram. Symposia of the Society for Experimental Biology . Lawrence, D. G. & Kuypers, H. G. J. M. (1968a). The functional organization of the motor system in the monkey. I. The eects of bilateral pyramidal lesions. Brain , 91 (1), 114. Lawrence, D. G. & Kuypers, H. G. J. M. (1968b). The functional organization of the motor system in the monkey. II. The eects of lesions of the descending brain-stem pathways. Brain , 91 (1), 1536. 39 Chapter 2 Rapid Prototyping Tools for the Study of Behaviour It is not true that the laboratory can never be like life. The laboratory must be like life! James J. Gibson , The Ecological Approach to Visual Perception (1979) 47 2.1 Chapter Summary The study of animal behaviour has provided tremendous insight into the functions of the brain. However, in the laboratory, behaviour is often studied in impoverished and repetitive regimes in order to control its complexity. In this chapter, we introduce a set of hardware and software tools that make it easier to rapidly survey a larger range of environments without losing control over observable behavioural data. In the rst part of the chapter, we introduce an architecture for a multi-purpose modular behaviour box. This architecture makes it possible to use simple fabrication and rapid prototyping tools to quickly recongure a physical environment for dierent assays requiring complex combinations of sensors and actuators. In the second part, we present Bonsai, a high-performance visual programming language for controlling and monitoring real-time data streams on a digital computer. We describe Bonsai's core principles and architecture and demonstrate how it allows for the rapid and exible prototyping of integrated experimental designs in neuroscience. We specically highlight some applications that require the combination of many dierent hardware and software components, including video tracking of behavior, electrophysiology and closed-loop control of stimulation. All the results concerning the Bonsai framework have been published as: Lopes, G., Bonacchi, N., Frazão, J., Neto, J., Atallah, B., Soares, S., Moreira, L., Matias, S., Itskov, P., Correia, P., Medina, R., Calcaterra, L., Dreosti, E., Paton, J. & Kamp, A. (2015). Bonsai: An eventbased framework for processing and controlling data streams. Frontiers in Neuroinformatics , 9 (7). doi:10.3389/fninf.2015.00007 48 2.2 Introduction The formal study of animal behaviour has a long history spanning hundreds of years across the elds of ethology, experimental psychology and neuroscience. While the ethologists mainly endeavoured to study behaviour in its natural environment, the psychologists and neurophysiologists have classically resorted, of necessity, to more controlled laboratory settings. The reason is mainly one of complexity. Behaviour is a highly multidimensional, multi-scale phenomenon that often allows no clear separation between relevant and irrelevant variables (Gomez-Marin, Paton, Kamp, Costa & Mainen, 2014). It is in general impossible to predict what an animal is going to do simply because some of the crucial information is not even accessible to measurement. In order to mitigate this problem, neuroscientists resort to making impoverished preparations where the number of variables that are changing at any given moment is low and very carefully controlled. The hope is that in this way the interpretation of brain signals recorded simultaneously with animal behaviour will be facilitated. Depending on the kind of question a neuroscientist is after, an appropriate behaviour paradigm is set up. Anaesthetized and head-xed preparations, as well as classical or operant conditioning boxes are regularly employed to drive the behaviour of the animal to oscillate between a set of repeatedly reproducible states more amenable to statistical analysis. Building such behaviour assays often requires very specialized engineering skills and long development cycles of trial and error in order to ensure all the relevant variables are controlled accordingly. Because of this, the tendency of the eld has been to concentrate on a small set of standardized assays which have been shown to work for one area of research or other. Small variations to the standard tasks are gradually introduced in order to probe dierent aspects of the system. The complexity of behaviour 49 studies in neuroscience has thus traditionally progressed by attrition and painstaking accumulation of small perturbations to overall design patterns. Interestingly, however, many of the most signicant conceptual advances in our understanding of brain function have in fact developed pari passu with forays into entirely new behaviour spaces. Moving from anaesthetized to awake physiology completely changed the way we understand the neural processing of sensory stimuli (Sellers, Bennett, Hutt, Williams & Fröhlich, 2015). Similarly, moving from head-xed to freely moving behaviour led to the discovery of place elds in hippocampus (O'Keefe & Dostrovsky, 1971). Single trial analysis of simultaneously recorded responses have revealed patterns of neural activity such as hippocampal ripples that are simply impossible to recover from statistical averages of repetitive behaviour episodes (Foster & Wilson, 2006; Davidson, Kloosterman & Wilson, 2009). Each of these developments has required signicant advances in tools used to record and control behavioural data at a ne scale. Unfortunately, the technical cost and scientic risk of trying something novel means that such advances are still much fewer and far between than would be desirable. From the beginning of this work it was understood that revealing the teleology of cortical control over behaviour would require just this kind of foray into diverse and potentially unknown behaviour spaces. We agreed that it might be worth to try and develop a toolkit for the behavioural neuroscientist that would accelerate the exploration of this vast space. One of the rst obvious targets for improvement was the behaviour box. Traditionally, when a given behaviour assay is found to produce interesting results, its design is progressively tweaked so as to exacerbate the features of the original eect. In this work, we started by breaking apart this concept of the polished behaviour box, and wondered what would happen if instead of a standard box, we could have a box of standards. 50 2.3 Methods 2.3.1 The Modular Behaviour Box At the outset it was decided that the scale of the modular architecture would probably have to match a given animal model, given the vastly different size scales between rodents, cats and primates. Our animal model of choice is the rodent rattus norvegicus , and all of our proposed design choices target its size scale. Small adjustments could, however, be reasonably made up to a point for other mammals of similar stature, such as mice. The main component and interface of the modular box is the individual 1×1 module (Figure 2.1A). This module denes a standardized footprint ( 12 cm ×12 cm ), against which all other modules are measured. Every newly fabricated module is built to specication to match a multiple of this standardized footprint (e.g. it is possible to have 2×1 , 2×2 , 4× 1 or any other multiple combination of the standard size). Inside the module footprint the module designer places a single logical component of a behaviour box and ensures that it can operate in isolation. Figure 2.1 shows some examples of reusable modules developed throughout the project. One of the principal requirements for assembling a box is fastening all its components together. By having a standard footprint, it is possible to design a set of regularly spaced mounting points that allows the experimentalist to quickly generate an entirely new conguration by simply swapping modular components inside the box (Figure 2.2, 2.3). For this work, we took advantage of an existing aluminium structural framing system (Bosch Rexroth, DE) to build the common mounting points (Figure 2.1A). Modules are fastened against post-insertion nuts which are able to slide across the whole length of the aluminium rail. Each of the modules is fastened by four screws, one in each corner. In order to ensure modules 51 A B C D Figure 2.1. Some examples of standardized behaviour modules. ( A ) Detail of a 1×1 module mounted in support frame. Fixation is achieved by driving a screw through post-insertion nuts placed in the structural framing (see text). ( B ) Example reward port module which can be oor- or wall-mounted. All relevant electronics and water distribution circuits are assembled on the back of the module (not shown). ( C ) Wall-mounted recongurable obstacle course stepper module. Stepper motors mounted on the back of the module allow for dynamic reconguration of the orientation of each step. ( D ) Floor-mounted obstacle course step pair. Multiple of these modules can be tiled together to assemble obstacle courses of arbitrary length. 52 Figure 2.2. Example of a linear shuttling box assembled from a 1 m ×1 m modular structure using reward port and obstacle course step modules. Figure 2.3. Side view of the linear shuttling box. 53 AB Figure 2.4. Example of vertical assembly. ( A ) Detail of a 1×1 wallmounted platform module. ( B ) Example of a vertical maze conguration. can be tightly and securely xed one next to the other, we used a system of regularly spaced double rails (Figure 2.2). This gives the frame the exibility to easily reposition and rearrange individual modules tiling the entire footprint of any arbitrarily large box. If the support frame is laid out vertically, it is possible to create modular walls of arbitrary dimensions. Some of the modules can be mounted equally well on a vertical or horizontal conguration, such as reward ports (Figure 2.1B). The three-dimensionality of the design has even been exploited to create vertical mazes (Figure 2.4) to great success. Throughout the project we made the base of every module from 5 mm acrylic pieces. While not an absolute requirement for the design, this choice of plastic material has the advantage that a laser cutter can be used to very quickly produce a large collection of custom-built modules. In addition, patterns can be engraved or cut on the base to provide additional mounting points for hardware embedded in the module. The use of such rapid prototyping fabrication tools alongside with o the shelf available electronic sensors and actuators meant we were able to completely redesign the entire behaviour box, sometimes in a matter of days. 54 2.3.2 The Bonsai Framework Modern scientic experiments crucially depend on the control and monitoring of many parallel streams of data. Multiple measurement devices, from video cameras, microphones, and pressure sensors to neural electrodes, must simultaneously send their data in real-time to a recording system. General purpose digital computers have gradually replaced many of the specialized analog and digital technologies used for this kind of data acquisition and experiment control, largely due to the exibility of programming and the exponential growth in computing power. However, the serial nature of programming instructions and shared memory makes it a challenge, even for experienced programmers, to develop software that can elegantly deal with the asynchronous, parallel nature of scientic data. Another challenge arises from the need for software integration. Each hardware vendor provides their own set of drivers and programming interfaces for conguring and acquiring data from their devices. In addition, the growth of the open-source movement has greatly increased the number of freely available technologies for dierent data processing domains. Integration of these diverse software and hardware components remains a major challenge for researchers. These diculties lead to increased development times when setting up an experiment. Moreover, it requires experimenters to pursue specialized training outside their domain of research. This limits the ability to rapidly prototype and try out new designs and can quickly become the factor limiting the kinds of questions that are amenable to scientic investigation. Here we describe Bonsai, an open-source visual programming framework for processing data streams. The main goal of Bonsai is to simplify and accelerate the development of software for acquiring and processing the many heterogeneous data sources commonly used in (neuro) scientic research. We aim to facilitate the fast implementation of state-of-the-art experimental designs and to encourage the exploration of new paradigms. 55 show up as properties of the group node itself. This allows for the parameterization of nested dataows and increases their reuse possibilities. In addition, encapsulated dataows are used to specify more complicated, yet powerful, operators such as iteration constructs that allow for the compact description of complex data processing scenarios that can be cumbersome to specify in pure dataow visual languages (Mosconi & Porta, 2000) (see below). Bonsai was designed to be a modular framework, which means it is possible to extend its functionality by installing additional packages containing sources and combinators developed for specic purposes. New packages can be written using C# or any of the.NET programming languages. Python scripts [via IronPython (IronPython Community, 2014)] can be embedded in the dataow as transforms and sinks, allowing for rapid integration of custom code. All functionality included in Bonsai was designed using these modular principles, and we hope to encourage other researchers to contribute their own packages and thereby extend the framework to other application domains. At present, the available packages include computer vision and signal processing modules based on the OpenCV library (Itseez, 2014). Drivers for several cameras and interfaces to other imaging and signal acquisition hardware were integrated as Bonsai sources and sinks, including support for Arduino microcontrollers (Banzi, Cuartielles, Igoe, Martino & Mellis, 2014), serial port devices and basic networking using the OSC protocol (Wright, Freed & Momeni, 2003). Given the specic applications in the domain of neuroscience, we also integrated a number of neuroscience technology packages. The Ephys package, for example, builds on the Open Ephys initiative for the sharing of electrophysiology acquisition hardware (Voigts, Siegle, Kemere, Moore & Wilson, 2013) by providing support for the Rhythm open-source USB/FPGA interface (Intan Technologies, US). Therefore, the next generation tools for electrophysiology can already be used inside Bonsai, the acquired physiology data implicitly integrated with 62 other available data streams and thus easily assembled into a powerful and exible experimental neuroscience platform. Advanced Operators The most common application of Bonsai is the acquisition and processing of simple, independent data streams. However, for many modern experiments, basic acquisition and storage of data is often not sucient. For example, it can be convenient to only record the data aligned on events of interest, such as the onset of specic stimuli. Furthermore, neuroscience experiments often progress through several stages, especially for behavioral assays, where controlled conditions vary systematically across dierent sessions or trials. In order to enforce these conditions, experiments need to keep track of which stage is active and use that information to update the state of control variables and sensory processing. These requirements often cannot be described by a simple linear pipeline of data, and require custom code to handle the complicated logic and bookkeeping of experimental states. Below we describe a set of advanced Bonsai operators that can be used to exibly recongure data processing logic to cover a larger number of scenarios. These operators and their applications are all built on the single idea of slicing a data stream into sub-sequences, called windows, which are then processed independently and, potentially, in parallel (Figure 2.7). Bonsai provides dierent combinators that allow the creation of these sub-sequences from any observable data stream, using element count information, timing, or external triggers (Figures 2.7AC). The specic set of operations to apply on each window is described by encapsulating a dataow inside a SelectMany group, as detailed in the signal processing example of Figure 2.7D. The input source in this group represents each of the window sub-sequences, i.e., it is as if each of the windows is a new data source, containing only the elements that are a part of that window. 63 Ready Go Timer KeyDown F. A. Time Data Source S W Window (ElementCount) Source Window (Count 2, Skip 2) Window (Count 2, Skip 3) Window (Count 2, Skip 1) B. S W Source Window (TimeSpan) Source Window (TimeSpan 1s) D. Raw Filtered S W S Source Window SelectMany S A W Input Average Output 57 3 27 6 57 3 7 3 2 327 27 6 54 4 5 Source Window (Count 3, Skip 1) SelectMany (Average) C. S W T Source Window (Triggered) Trigger Trigger Source Window (Triggered) E. VideoWriter S V W Input Output C W S T Camera Trigger SelectManyWindow Trigger * * * * * * File 1 File 2 File 3 Camera SelectMany (Average) Window (Triggered) Ready R G R Go Repeat WK T KeyDown Take (1) Output S S Input Stimulus Onset Figure 2.7. Using slicing and window processing combinators in Bonsai. 64 These elements will be processed as soon as they are available by the encapsulated dataow. Windows can have overlapping common elements, in which case their processing will happen concurrently. The processing outputs from each window are merged together to produce the nal result. In the case of Figure 2.7D, past and future samples are grouped in windows to compute a running average of the signal through time, necessarily time-shifted by the number of future samples that are considered in the average. The processing of the elements of each window happens independently, as if there was a new isolated dataow running for each of the sequences. We can exploit this independence in order to dynamically turn dataows on and o during an experiment. In the video splitting example of Figure 2.7E, we use an external trigger source to chop a continuous video stream into many small video sequences, aligned when the trigger red. We then nest a VideoWriter sink into the SelectMany group. The VideoWriter sink is used to encode video frames into a continuous movie le. It starts by creating the video le upon arrival of the rst frame, and then encoding every frame in the sequence as they arrive. When the data stream is completed, the le is closed. By nesting the VideoWriter inside the SelectMany group, what we have eectively done is to create a new video le for each of the created windows. Whenever a new trigger arrives, a new clip is created and saving proceeds, implicitly parallelized, for that video le. More generally, we can use this idea to implement discrete transitions between dierent processing modes, and chain these states together to design complex control structures such as nite state machines (FSMs). FSMs are widely used to model environments and behavioral assays in systems and cognitive neuroscience. One example is illustrated in Figure 2.7F, where we depict the control scheme of a stimulus-response apparatus for a simple reaction time task. In this task, there are only two states: Ready and Go. In the Ready state, no stimulus is presented and a timer 65 is armed. Whenever the timer res, the task transitions into the Go state, and a stimulus is presented. The subject is instructed to press a key as fast as possible upon presentation of the stimulus. As soon as the key is pressed, the system goes back to the Ready state to start another trial. In a FSM, nodes represent states, e.g., stimulus availability or reward delivery, and edges represent transitions between states that are caused by events in the assay, e.g., a key press. In each state, a number of output variables and control parameters are set (e.g., turning on a light) which represent the behaviour of the machine in that state. In the Bonsai dataow model, dataows encapsulated in a SelectMany group can be used to represent states in a FSM (Figure 2.7F, bottom). Specically, a state is activated whenever it receives an input event, i.e., the dataow nested inside the state will be turned on. The dynamics of the nested dataow determine the dynamics of the state. In the Go state presented in Figure 2.7F, the activation event is used to trigger stimulus onset. In parallel, we start listening for the key press which will terminate the state. Conversely, for the Ready state we would trigger stimulus oset and arm the timer for presenting the next stimulus. An important difference between Bonsai dataows and pure state machine models is that a dataow is specied as a directed acyclic graph, i.e., the data stream cannot loop back on itself. However, by taking advantage of the Repeat combinator, we can restart a dataow once it is completed, allowing us to reset the state machine for the next trial. Many of the control tasks in experiments have this sequential trialbased structure, which has allowed us to rapidly prototype complex behaviour assays, such as closed-loop rodent decision making tasks, simply by leveraging the exibility of the data stream slicing operators. 66 Alternatives to Bonsai Although graphical user interfaces have played a crucial role in the widespread proliferation of computing technology throughout various scientic elds, the majority of these interfaces tend to be applied to relatively narrow domains, such as the operation of a specic instrument. Their goal is often to provide access to all the various conguration parameters of the hardware and to provide basic data acquisition functionality. There is often no opportunity to parameterize or condition the behaviour of the instrument beyond the possibilities presented by the interface, and interconnections with other devices are often limited to simple hardware triggers. The alternative, when available, is to access low-level application programming interfaces (APIs), and program the desired behaviour from scratch. In the more exible domains of data analysis, behaviour control and software simulations, the use of more versatile graphical interfaces has become increasingly prevalent. In these scenarios, it is not uncommon to encounter the development of domain-specic languages (DSLs), where graphical building blocks related to the domain of application can be combined together by the user to generate new behaviors, such as the sequence of steps in a psychophysics experiment or a state-machine diagram used to control stimuli and rewards in operant conditioning. While providing more exibility to the end user, such DSLs are usually not conceived, at their core, to be applied to wildly dierent domains (e.g., an operant conditioning state machine is not expected to be able to lter continuous electrophysiology signals). In fact, most DSLs will not even allow the user to extend the set of built-in operations. In those that do, the developer may nd a customization pit (Cook, Jones, Kent & Wills, 2007), where concepts and operations that are within the range of what the DSL can express are easy to develop, whereas tasks that are a little bit outside of the 67 boundaries of the language quickly become impossible or too cumbersome to implement. As the level of exibility of a graphical user interface increases, we start to approach the space occupied by general purpose visual programming languages (GPVPL). These are languages that are designed from the outset to be capable of solving problems across a wide variety of domains using a general set of operations. Ideally, the core building blocks of the language will themselves be domain-independent, so that the user can easily apply the same set of operations to the widest possible class of inputs. In order to better illustrate the feel and expressive power of GPVPLs, and to clarify where Bonsai itself is positioned, we will give two examples of popular languages that have succeeded in this niche: LabVIEW (National Instruments, 2014) and Simulink (MathWorks, 2014). LabVIEW is one of the best examples of a GPVPL applied to the design and control of experiments (Elliott, Vijayakumar, Zink & Hansen, 2007). In LabVIEW, users create virtual instruments (VIs) which are composed of a graphical front-panel containing an assortment of buttons, dials, charts and other objects; as well as a back-panel where a owchart-like block diagram can be used to specify the behaviour of the VI. In this back-panel, nodes and terminal elements can represent hardware components, numerical operations or front-panel objects, which are connected together using virtual wires that specify the ow of data between them. The popularity of LabVIEW grew initially from its support for state-of-the-art data acquisition cards and hardware as well as its data visualization capabilities. The modularity of its architecture also allowed users to quickly develop and implement new nodes within the language itself by using VIs themselves as nodes. Although the LabVIEW back-panel is a dataow visual programming language, its execution model tends to follow a polling, rather than eventdriven, strategy for dealing with multiple data streams. In order to prop- 68 erly scale this model to the increasing number of available processor cores, LabVIEW has implemented sophisticated code analysis tools that attempt to identify parallelizable portions of block diagrams automatically (Elliott et al., 2007). Once these sections are identied, LabVIEW will automatically generate parallel processes depending on the number of available cores and will manage the bottlenecks in the code accordingly. Although this mitigates the limitations of the sequential polling programming model, it is important to realize that the goal of such automatic parallelization is still to provide the user with a logically synchronized programming model. Simulink is a popular dataow visual programming language for modeling, simulating and analyzing multi-domain dynamic systems. It has become extremely popular for modeling response characteristics of control systems, allowing not only for the rapid prototyping of algorithms, but also the automatic generation of microcontroller code for embedded systems. Again, the success of the language stemmed primarily from the exibility and ease of use of the block diagrams, as well as the number of prebuilt operations and data visualization tools which quickly took care of many crucial but tedious aspects of control systems modeling. Like LabVIEW, the execution model for Simulink generated code is still based on polling strategies, where ready to execute dataow nodes are updated in turn as inputs become available. Again, strategies to scale the output of Simulink to multiple cores have been proposed based on analyzing and segmenting the model into parallelizable sections which can be converted into equivalent parallel execution code for microcontrollers (Kumura, Nakamura, Ishiura, Takeuchi & Imai, 2012). Similar to LabVIEW and Simulink, Bonsai was designed as a general purpose modular language. The core architecture of Bonsai is domainindependent and provides a general framework to compose asynchronous data streams. A general set of composition operators, or combinators, provides support for iteration, segmentation and merging of parallel data 69 streams, as well as other common manipulations on observable sequences. Both the sources of data and available processing operations can be extended within the language itself using nesting of dataows. Data visualizers and a growing library of data stream acquisition, processing and logging modules are provided to allow rapid prototyping of a large number of different applications. However, in contrast to LabVIEW or Simulink, Bonsai adopts a very dierent strategy to implement dataow execution. Rather than trying to derive a global sequential execution order of dataow nodes based on the number of active inputs, Bonsai nodes simply react to incoming inputs immediately, without the need to wait for all of them to be active. When multiple observable sequences are present, this allows for a choice of dierent concurrency composition strategies. Nevertheless, as the result of the composition is an observable sequence itself, such concurrency management can remain functionally isolated from the combinator that is handling the composition. From the point of view of downstream operators, they are simply receiving an observable sequence. There is a tradeo, of course, that more responsibility for managing the ow of data is passed to the end user, but it also allows for a ner grained control of concurrency that is critical to the specication of parallel applications. One important caveat of developing asynchronous systems is that debugging can be more dicult in situations where the precise timing and ordering of events is required to reproduce an oending behaviour. In synchronized and sequential execution environments, one can easily go step by step through the precise cascade of transformations that resulted in a problem. In contrast, when multiple processes are executing concurrently, it can be harder to analyze the program ow in a similarly reproducible, deterministic manner. However, it should be noted that this issue is not unique to reactive environments with real asynchronous devices. A sequen- 70 tial polling strategy will be equally decient in reproducing a particular execution sequence when data from parallel input devices is being accessed. Another important caveat is that Bonsai currently runs exclusively in Windows operating systems. However, Microsoft has recently opensourced the execution engine of the.NET framework and will pursue implementations for all the major operating systems (Linux/Mac). This raises the interesting possibility of eventually extending the Bonsai user base into these important platforms. 2.4 Results 2.4.1 Getting Started with Bonsai Community The Bonsai framework can be downloaded at https://bitbucket.org/ horizongir/bonsai and installed on Windows operating systems starting with Windows 7 and above. The website is organized into dierent sections: Downloads (where the latest installer is located), Wiki (with a Getting Started guide, tutorials and (FAQ) frequently asked questions), and Issues (where bugs can be reported). We have also created a user forum (address is listed in the FAQ section) where the community of Bonsai users have been sharing their feedback, questions and experiences. A video tutorial introduction to Bonsai is included with this publication (Video 2.1). Extending Bonsai Bonsai was designed from the outset to support many dierent layers of extensibility: (a) Dataows: The rst layer is through the creation of Bonsai dataow les themselves. Existing dataows can be directly reused inside 71 electrophysiology or other digital acquisition systems where multiple data samples, from one or more channels, are synchronously acquired, buered and streamed to the computer. These buers are often represented as data matrices, where rows are channels and columns represent individual data samples through time, or vice-versa. Support for simple band-pass lters, thresholding and triggering allowed us to build exible spike detection and waveform extraction systems (Figure 2.8F). Using Intan's Rhythm API, we integrated into Bonsai support for a variety of next-generation electrophysiology devices using Intan's digital amplier technology, such as the Open Ephys acquisition system (Voigts et al., 2013) or Intan's evaluation board (RHD2000, Intan Technologies, US). This system was successfully used to acquire and visualize simultaneous recordings from dense silicon probes where spikes from a loose-patch juxtacellular pipette were used as triggers to align and extract waveform data appearing on the multi-channel extracellular probe. Responses from every silicon probe site could then be superimposed on an accurate rendition of the probe geometry, in real-time. The ability to rapidly integrate new modules allowed us to support the development and cross-validation of new tools for behavioral neuroscience. A paradigmatic example was the yPAD, a new method for quantifying feeding behaviour in Drosophila melanogaster by measuring changes in electrode capacitance induced by the proboscis extension of a y (Itskov et al., 2014). The integration of the yPAD in Bonsai allowed researchers to quickly get started using this approach to design new experiments. Furthermore, it also allowed the validation of the tool by enabling simultaneous acquisition of high-speed video recordings of y behaviour which were later used for annotation and classication of the sensor feeding traces (Figure 2.8G). In a dierent set of experiments, Bonsai was used to implement a variation on a popular two-alternative forced choice (2AFC) decision-making task for rodents (Figure 2.8H). In this type of task, animals are placed in 78 an environment with three ports. They are presented with a stimulus in the center port and afterwards report their perception of the stimulus by going either to the left or right choice ports. In the variation we present in this work, the two choice ports were replaced by regions of interest where the activity of the animal is analyzed using computer vision. This example oered unique challenges as it combined sophisticated sequential control of a task environment with continuous data stream processing of video and sensor data. The integration of all these diverse components for data acquisition and experiment control does not only allow for the rapid deployment of established protocols. In fact, the modular nature of their integration (i.e., how they can be combined together) opens up new avenues for research, by allowing a rich, rapid exploration of novel methodologies. To demonstrate this, we created a dynamic virtual environment for freely moving rodents where the visual presentation of a stimulus is tightly controlled in closedloop to the actions of the animal. We used a projection setup similar to the low-cost multi-touch sensing table proposed by (Han, 2005), where a visible light rear-projection system is coupled with infrared illumination and an infrared imaging sensor to detect in real-time where the animal is located with respect to the visual display surface (Video 2.2). 2.5 Discussion After about a year of using Bonsai in an active neuroscience research institute, dozens of dierent experimental protocols and data analysis pipelines have been successfully implemented using the provided building blocks (Gouvêa, Monteiro, Soares, Atallah & Paton, 2014; Itskov et al., 2014; Tecuapetla et al., 2014). We were surprised by the diversity of applications and by the pace at which new modules and devices were developed and integrated. 79 The performance achieved by Bonsai dataow processing was an important consideration throughout. Video processing can be particularly challenging to handle given the bandwidth required to quickly acquire and process large data matrices. In order to correlate continuous measures of behaviour with neural activity, it is useful for those measurements to have both high spatial and high temporal resolution. Using Bonsai, we were able to simultaneously process and compress grayscale image sequences from high resolution ( 1280 ×960 ) and high frame rate (120 Hz) cameras using standard o-the-shelf desktop computers (Intel Core i7, 8 GB RAM). In fact, many of the reported assays use multiple (>2) such video streams with success and actually process the behaviour video online either to control states of the behaviour protocol or to pre-process video data for oine analysis. One of the areas where we see the application of Bonsai becoming most signicant is in the development of dynamic behaviour assays (environments) using reactive control strategies. Brains evolved to generate and control behaviors that can deal with the complexity of the natural world. However, when neuroscientists try to investigate these behaviors in the lab, it is often dicult to design equivalent environmental complexity in a controlled manner. As an example, consider a simple foraging scenario in which a land animal must collect, in a timely manner, food items that become available at random intervals in many sites. If the item is not collected in time, it rots or gets eaten by competitors. In the case of a single foraging site, a FSM description intuitively represents the workings of the environment (Figure 2.9A). However, let us now consider a situation where the environment has two of these food sites operating independently, thus introducing the possibility of dierent events occurring simultaneously at each of the sites. If our environment is modeled as a nite-state machine, then we must represent every possible combination of states and transitions, as in Figure 2.9B. In the classical state machine 80 Figure 2.9. Describing the behaviour of dynamic environments using either state-machines or dataows. formalism the machine can only be in one state at a time, which means we now need to model each state as the combination of the individual independent states at each reward location. Furthermore, because transitions between these states are asynchronous and independent, we thus have edges between nearly every pair of nodes, as each reward site can change its state at any point in time relative to the other. How would designing such a scenario feel like in a reactive programming language? Figure 2.9C shows a possible specication of the 1-site foraging task in reactive terms. In this case, we have two sources of events from the environment: one timer signaling the availability of reward (A); and a sampling event (S) which is triggered every time the animal checks 81 the location for food. Both of these events can occur independently of each other, but when a sampling event coincides with reward availability (C), then reward (R) is delivered. Because this description is intrinsically asynchronous and parallel, it makes it extremely easy to scale the task to a larger set of locations: just replicate the dataow for each of the other locations (Figure 2.9D). In this example, the design space was made more intuitive by introducing the parallel and asynchronous nature of a real-world situation into our modeling formalism. Another diculty of the classical state machine formalism is dealing with continuous variables. The natural environment provides constant real-time feedback that tightly correlates with the actions of an animal. Reproducing such closed-loop interaction and manipulating its dynamics is a necessary tool for fully investigating brain function. Such models are virtually impossible to represent in a machine of nite states, given the potential innitude of feedback responses. However, the dataow formalism of asynchronous event sources can easily accommodate such models. In fact, this is their natural battleground; nodes represent reactive operators that promptly respond to input values broadcasted by event sources. These models of asynchronous computation are thus ideal for recreating the complex discrete and continuous aspects of natural environments that brains evolved to master. We thus propose Bonsai as a new tool for neuroscientists trying to understand how the brain deals with real world complexity. 2.6 Acknowledgements We thank João Bártolo Gomes for suggesting the name Bonsai; Danbee Kim for early discussions on creating virtual environments for rodents; Joana Nogueira, George Dimitriadis and all the members of the Intelligent Systems Laboratory for helpful discussions and comments on the manuscript. We also thank all the members of the Champalimaud Neuroscience 82 Programme who used Bonsai to setup their data analysis and acquisition experiments and in so doing provided valuable feedback to improve the framework. The research leading to these results has received funding from the European Union's Seventh Framework Programme (FP7/2007- 2013) under grant agreement no. 600925 and the Bial Foundation (Grant 190/12). GL is supported by the PhD Studentship SFRH/BD/51714/2011 from the Foundation for Science and Technology. The Champalimaud Neuroscience Programme is supported by the Champalimaud Foundation. 2.7 Author contributions Conceived and designed the modular box: GL, ARK; Conceived and developed the Bonsai framework: GL; Technical advisory board: NB, JF; Conceived and developed the experimental applications: GL, NB, JF, JPN, BVA, SS, LM, SM, PMI, PAC, REM, LC, ED, JJP, ARK; Performed and analyzed experiments: GL, JF, JPN, BVA, SS, LM, SM, PMI, PAC, REM, LC, ED; Wrote the Bonsai manuscript: GL, ARK. 83 References Bainomugisha, E., Carreton, A. L., Cutsem, T. V., Mostinckx, S. & Meuter, W. D. (2013). A survey on reactive programming. ACM Computing Surveys , 45 (4), Article No. 52. doi:10.1145/2501654.2501666. arXiv: 1005.3014 Banzi, M., Cuartielles, D., Igoe, T., Martino, G. & Mellis, D. (2014). Arduino. Cook, S., Jones, G., Kent, S. & Wills, A. C. (2007). Domain Specic Development with Visual Studio DSL Tools . Addison-Wesley Professional. Davidson, T. J., Kloosterman, F. & Wilson, M. A. (2009). Hippocampal Replay of Extended Experience. Neuron , 63 (4), 497507. doi:10. 1016/j.neuron.2009.07.027 Elliott, C., Vijayakumar, V., Zink, W. & Hansen, R. (2007). National Instruments LabVIEW: A Programming Environment for Laboratory Automation and Measurement. Journal of Laboratory Automation , 12 (1), 1724. doi:10.1016/j.jala.2006.07.012 Foster, D. J. & Wilson, M. a. (2006). Reverse replay of behavioural sequences in hippocampal place cells during the awake state. Nature , 440 (7084), 6803. doi:10.1038/nature04587 Garrido-Jurado, S., Munõz-Salinas, R., Madrid-Cuevas, F. J. & Marín- Jiménez, M. J. (2014). Automatic generation and detection of highly reliable ducial markers under occlusion. Pattern Recognition , 47 (6), 22802292. Gomez-Marin, A., Paton, J. J., Kamp, A. R., Costa, R. M. & Mainen, Z. F. (2014). Big behavioral data: psychology, ethology and the foundations of neuroscience. Nature Neuroscience , 17 (11), 1455 1462. doi:10.1038/nn.3812 Gouvêa, T. S., Monteiro, T., Soares, S., Atallah, B. V. & Paton, J. J. (2014). Ongoing behavior predicts perceptual report of interval dur- 84 ation. Frontiers in neurorobotics , 8 (March), 10. doi:10.3389/fnbot. 2014.00010 Han, J. (2005). Low-cost multi-touch sensing through frustrated total internal reection. Proceedings of the 18th annual ACM symposium on User interface software and technology (UIST '05) , 115118. IronPython Community. (2014). IronPython. Itseez. (2014). OpenCV (Open Source Computer Vision). Itskov, P. M., Moreira, J.-M., Vinnik, E., Lopes, G., Safarik, S., Dickinson, M. H. & Ribeiro, C. (2014). Automated monitoring and quantitative analysis of feeding behaviour in Drosophila. Nature Communications , 5 , 4560. doi:10.1038/ncomms5560 Johnston, W. M., Hanna, J. R. P. & Millar, R. J. (2004). Advances in dataow programming languages. ACM Computing Surveys , 36 (1), 134. doi:10.1145/1013208.1013209 Kato, H. & Billinghurst, M. (1999). Marker tracking and hmd calibration for a video-based augmented reality conferencing system. In Augmented reality, 1999.(iwar'99) proceedings. 2nd ieee and acm international workshop on (pp. 8594). IEEE. Kumura, T., Nakamura, Y., Ishiura, N., Takeuchi, Y. & Imai, M. (2012). Model Based Parallelization from the Simulink Models and Their Sequential C Code. In Proc. of the 17th workshop on synthesis and system integration of mixed information technologies (sasimi 2012) (pp. 186191). Lopes, G., Bonacchi, N., Frazão, J., Neto, J., Atallah, B., Soares, S., Moreira, L., Matias, S., Itskov, P., Correia, P., Medina, R., Calcaterra, L., Dreosti, E., Paton, J. & Kamp, A. (2015). Bonsai: An event-based framework for processing and controlling data streams. Frontiers in Neuroinformatics , 9 (7). doi:10.3389/fninf.2015.00007 MathWorks. (2014). Simulink. 85 Microsoft Open Technologies. (2014). Reactive Extensions for the .NET framework (Rx). Mosconi, M. & Porta, M. (2000). Iteration constructs in data-ow visual programming languages. Computer Languages , 26 (2000), 67104. National Instruments. (2014). LabVIEW. O'Keefe, J. & Dostrovsky, J. (1971). The hippocampus as a spatial map: Preliminary evidence from unit activity in the freely moving rat. Brain research , 34 (1), 171175. Sellers, K. K., Bennett, D. V., Hutt, A., Williams, J. H. & Fröhlich, F. (2015). Awake vs. anesthetized: layer-specic sensory processing in visual cortex and functional connectivity between cortical areas. Journal of Neurophysiology , 113 (10), 37983815. doi:10.1152/jn. 00923.2014 Tecuapetla, F., Matias, S., Dugue, G. P., Mainen, Z. F. & Costa, R. M. (2014). Balanced activity in basal ganglia projection pathways is critical for contraversive movements. Nature communications , 5 , 4315. doi:10.1038/ncomms5315 Voigts, J., Siegle, J. H., Kemere, C., Moore, C. & Wilson, M. (2013). A low-cost, open-source system for combining high-channel count electrophysiology with closed-loop optogenetic feedback. In Society for neuroscience (san diego, ca, 13 november) . Wright, M., Freed, A. & Momeni, A. (2003). Open Sound Control: State of the Art 2003. In Proceedings of the 2003 conference on new interfaces for musical expression (nime-03) (pp. 153159). Montreal, Canada. 86 Chapter 3 Moving with and without Motor Cortex I rst became sceptical of the supposed path of the conditioned reex when I found that rats, trained in a dierential reaction to light, showed no reduction in accuracy of performance when almost the entire motor cortex, along with the frontal poles of the brain, was removed. Karl S. Lashley , In Search of the Engram (1950) 87 measured relative to Bregma, and later used to reconstruct the precise placement of all grid electrodes in the brain. At the end of the surgery, a titanium screw was inserted posteriorly to the craniotomy in contact with the brain in order to be used as reference for the recording system. The stability of the implant depends critically on the absence of movement in the bony plates of the skull during development, which can compromise the mechanical xation of the recording chamber to the head (Dimitriadis et al., 2014). For this reason, it is recommended that rats undergoing this procedure should be older than 7 months (Dimitriadis et al., 2014). Behaviour assay: During each session the animal was placed inside a behaviour box for 30 min , where it could collect water rewards by shuttling back and forth between two nose pokes (Island Motion Corporation, USA). To do this, animals had to cross a 48 cm obstacle course composed of eight 2 cm aluminium steps spaced by 4 cm (Figure 3.1). The structure of the assay and each step in the obstacle course was built out of aluminium structural framing (Bosch Rexroth, DE, 20 mm series). The walls of the arena were fabricated with a laser-cutter from 5 mm thick opaque black acrylic and xed to the structural framing. A transparent acrylic window partition was positioned in front of the obstacle course in order to provide a clear view of the animal. All experiments were run in the dark by having the behavioural apparatus enclosed in a light tight box. A motorized brake allowed us to lock or release each step in the obstacle course (Figure 3.2). The shaft of each of the obstacles was coupled to an acrylic piece used to control the rotational stability of each step. In order to lock a step in a xed position, two servo motors are actuated to press against the acrylic piece and hold it in place. Two other acrylic pieces were used as stops to ensure a maximum rotation angle of approximately +/- 100◦ . Two small nuts were attached to the bottom of each step to work as a counterweight that gives the obstacles a tendency to return to their original at conguration. In order to ensure that noise from servo 94 stable unstable random Figure 3.1. Schematic of the apparatus and summary of the dierent conditions in the shuttling protocol. motor actuation could not be used as a cue to tell the animal about the state of each step, the motors were always set to press against an acrylic piece, either the piece that keeps the step stabilized, or the acrylic stops. At the beginning of each trial, the motors were run through a randomized sequence of positions in order to mask information about state transitions and also to ensure the steps were reset to their original conguration. Control of the motors was done using a Motoruino board (Artica, PT) along with a custom workow written in the Bonsai visual programming language (Lopes et al., 2015). Prior to the micro-ECoG recordings, each step in the obstacle course was outtted with a micro load cell (CZL616C, Phidgets, CA) secured between the step front holder and the base (Figure 3.2). This allowed us 95 servo motors load cell (0-750g) Figure 3.2. Schematic of the step locking mechanism and load cell sensor. to record a varying voltage signal proportional to the load applied by the animal on each step. This load signal was acquired simultaneously on all eight steps and digitized synchronously with the ECoG data acquisition system. Data acquisition: The behaviour of the animals was recorded with a high-speed and high-resolution videography system (1280x680 @ 120 Hz ) using an infrared camera (Flea3, PointGrey, CA), super-bright infrared LED front lights (SMD5050, 850 nm) and a vari-focal lens (Fujinon, JP) positioned in front of the transparent window partition. A top view of the assay was simultaneously recorded with the same system at a lower frame-rate ( 30 Hz ) for monitoring purposes. All video data was encoded with MPEG-4 compression for subsequent oine analysis. Behaviour data acquisition for the nose poke beam breaks was done using an Arduino board (Uno, Arduino, USA) and streamed to the computer via USB. All video and sensor data acquisition was recorded in parallel using the same Bonsai workow used to control the behaviour assay. For the micro-ECoG recordings, all electrophysiological signals were amplied, digitized and multiplexed using two 64-channel amplier boards (RHD2164, Intan Technologies, US) connected to the electrode interface board (EIB) on the recording chamber. The amplier boards were then 96 connected through a dual headstage adapter (C3440, Intan Technologies, US) to the main data acquisition USB interface board (RHD2000-Eval, Intan Technologies, US). In order to facilitate the free movement of the animal in the behaviour box, the single cable connecting the head of the animal to the USB interface board was passed through a slip ring (MMC235, Moon, CN) and hooked into a nylon string crossing the top of the assay. In this way, movement and rotation of the tethered animal were compensated to avoid unwanted strain and twisting on the cables during the entire recording period. In order to synchronize the videography and ECoG recording systems, we connected the strobe output of the camera to a digital input in the Intan USB interface board using a GPIO cable (ACC-01-3000, PointGrey, CA). The camera strobe output is electronically coupled to individual frame exposures (i.e. shutter opening and closing events), and can be used for sub-millisecond readout of individual frame acquisition times. The strobe signal was acquired and digitized synchronously with ECoG data acquisition, and used for post-hoc reconstruction of precise frame timing. Data acquisition from the USB interface board was recorded using a Bonsai workow and care was taken that it was always started rst and terminated last in order to ensure that no external synchronization events were lost. Behaviour protocol: The animals were kept in a state of water deprivation for 20 h prior to each daily session. For every trial, rats were delivered a 20 µ L drop of water. At the end of each day, they were given free access to water for 10 min before initiating the next deprivation period. Sessions lasted for six days of the week from Monday to Saturday, with a day of free access to water on Sunday. Before the start of the water deprivation protocol, animals were run on a single habituation session where they were placed in the box for a period of 15 min . 97 The following sequence of conditions were presented to the animals over the course of a month (see also Figure 3.1): day 0, habituation to the box; day 1-4, all the steps were xed in a stable conguration; day 5, 20 trials of the stable conguration, after which the two centre steps were made unstable (i.e. free to rotate); day 6-10, the centre two steps remained unstable; day 11, 20 trials of the unstable conguration, after which the two centre steps were again xed in a stable state; day 12, all the steps were xed in a stable conguration; day 13-16, the state of the centre two steps was randomized on a trial-by-trial basis to be either stable or unstable. Following the end of the random protocol, animals continued to be tested in the assay for a variable number of days (up to one week) in dierent conditions. At the end of the testing period, all animals were exposed to a nal session where all steps were made free to rotate in order to assay locomotion performance under challenging conditions. For the micro-ECoG recordings, the basic behaviour protocol was adjusted to allow for extra recording time during conditions of interest. First, all session times were doubled for the recordings (e.g. 30 min for the habituation session, and 60 min for all other sessions). Second, the number of days on each condition was also extended to allow extracting more trials from each animal for analysis. Finally, the condition where the centre two steps were reliably unstable was replaced with a condition of rare instability. In this condition, after the animal is exposed to an unstable conguration, the steps are reverted back to being stable for another 20 trials, after which they become again unstable for one trial, and so on. Data analysis: All scripts and custom code used for data analysis are available online 1 . The raw video data was rst pre-processed using a custom Bonsai workow in order to extract features of interest (Figure 3.3). Tracking of the nose was achieved by background subtraction and connected component labelling of segmented image elements. First we 1 https://bitbucket.org/kamp-lab/shuttling-analysis 98 Figure 3.3. Example video frame from the behaviour tracking system. Coloured overlays represent regions of interest and feature traces extracted automatically from the video. compute the ellipse best-t to the largest object in the image. We then mark the tip of the nose as the furthermost point, in the segmented shape of the animal, along the major axis of the ellipse. In order to analyse stepping performance, regions of interest were dened around the surface of each step and in the gaps between the steps. Background subtracted activity over these regions was recorded for every frame for subsequent detection and classication of steps and slips. Analysis routines were run using the NumPy scientic computing package (van der Walt, Colbert & Varoquaux, 2011) and the Pandas data analysis library (McKinney, 2010) for the Python programming language. Crossings were automatically extracted from the nose trajectory data by rst detecting consecutive time points where the nose was positively identied in the video. In order for these periods to be successfully marked as crossings, the starting position of the nose must be located on the opposite side of the ending position. Inside each crossing, the moment of stepping with the forelimb on the centre steps was extracted by looking at the rst peak above a threshold in the rst derivative of the activation signal in 99 the corresponding region of interest. False positive classications due to hindlimb or tail activations were eliminated by enforcing the constraint that the position of the head must be located before the next step. Visual conrmation of the classied timepoints showed that spurious activations were all but eliminated by this procedure as stepping with the hindlimb or tail requires the head to be further ahead in space unless the animal turned around (in which case the trajectory would not be marked as a crossing anyway). The position of the nose at the moment of each step was extracted and found to be normally distributed, so statistical analysis of the step posture in the random condition used an unpaired t-test to check for independence of dierent measurement groups. In order to evaluate the dynamics of crossing in the random condition, we rst measured for every trial the speed at which the animals were moving on each spatial segment of the assay. To minimize overall trial-by- trial variation in individual animal performance, we used the average speed at which the animal approached the manipulated step as a baseline and subtracted it from the speed at each individual segment. To summarize dierences in performance between stable and unstable trials, we then computed the average speed prole for each condition, and then subtracted the average speed prole for unstable trials from the average speed prole for stable trials. Finally, we computed the sum of all these speed dierences at every segment in order to obtain the speedup index for each animal, i.e. an index of whether the animal tends to accelerate or decelerate across the assay on stable versus unstable trials. For the micro-ECoG experiments, evoked potentials were analysed by splitting the raw physiological voltage traces into 750 ms windows, where time zero was aligned to the moment of stepping with the forelimb on one of the obstacles in the course (see below). Each individual time series was low-pass ltered at 50 Hz (4th order Butterworth lter, two-pass) and baselined by subtracting the average of the rst 250 ms before event onset 100 in order to compensate for constant voltage shifts between the two grids. Some of the channels in each grid were entirely excluded from the analysis due to potentially damaged surface contacts, as evidenced by wide amplitude, random oscillatory behaviour, which was often matched by the presence of high impedance measurements extracted from the electrode site in vivo. In one of the sessions, the cable connecting the headstage to the interface board was accidentally removed by the animal, and all the trials falling during this period had to be excluded from analysis. Correspondence between individual ECoG samples and video frames was computed by matching the individual hardware frame counter with the sequence of falling edges detected in the shutter strobe signal acquired from the infrared camera. Video classication: Classication of paw placement faults (i.e. slips) was performed in semi-automated fashion. First, possible slip timepoints were detected automatically using the peak detection method outlined above. All constraints on head position were relaxed for this analysis in order to exclude the possibility of false negatives. A human classier then proceeded to manually go through each of the slip candidates and inspect the video around that timepoint in order to assess whether the activation peak was a genuine paw placement fault. Examples of false positives include tail and head activations as well as paw activations that occur while the animal is actively engaged in exploration, rearing, or other activities that are unrelated to crossing the obstacles. A similar technique was used to detect and classify the event onsets for the analysis of evoked potentials in the micro-ECoG experiments. In this case, a preliminary classication of each video frame into left and right forelimb was achieved by rst computing the brightness histogram of each frame, which was used to encode the image as a lower-dimensional vector. The vectors for all step frames were subsequently clustered using K-means and then manually inspected for label correction. 101 Classication of behaviour responses following rst exposure to the unstable condition was done on a frame-by-frame analysis of the high-speed video aligned on rst contact with the manipulated step. The frame of rst contact was dened as the rst frame in which there is noticeable movement of the step caused by animal contact. Three main categories of behaviour were observed to follow the rst contact: compensation, investigation and halting. Behaviour sequences were rst classied as belonging to one of these categories and their onsets and osets determined by the following criteria. Compensation behaviour is dened by a rapid and adaptive postural correction to the locomotion pattern in response to the perturbation. Onset of this behaviour is dened by the rst frame in which there is visible rapid contraction of the body musculature following rst contact. Investigation behaviour consists of periods of targeted interaction with the steps, often involving manipulation of the freely moving obstacle with the forepaws. The onset of this behaviour is dened by the animal orienting its head down to one of the manipulated steps, followed by subsequent interaction. Halting behaviour is characterized by a period in which the animal stops its ongoing motor program, and maintains the same body posture for several seconds, without switching to a new behaviour or orienting specically to the manipulated steps. This behaviour is distinct from a freezing response, as occasional movements of the head are seen. Onset of this behaviour is dened by the moment where locomotion and other motor activities besides movement of the head come to a stop. A human classier blind to the lesion condition was given descriptions of each of these three main categories of behaviour and asked to note onsets and osets of each behaviour throughout the videos. These classications provide a visual summary of the rst response videos; the complete dataset used for this classication is included as supplementary movies. 102 3.4 Results To investigate whether the intact motor cortex is required for the robust control of movement in response to unexpected perturbations, we designed a recongurable dynamic obstacle course where individual steps can be made stable or unstable on a trial-by-trial basis (Figure 3.1, also see Methods). In this assay, rats shuttle back and forth across the obstacles, in the dark, in order to collect water rewards. We specically designed the assay such that modications to the physics of the obstacles could be made covertly. In this way, the animal has no explicit information about the state of the steps until it actually contacts them. Water deprived animals were trained daily for 4 weeks, throughout which they encountered increasingly challenging states of the obstacle course. Our goal was to characterize precisely the conditions under which motor cortex becomes necessary for the control of movement, and this motivated us to introduce an environment with graded levels of uncertainty. We compared the performance of 22 animals: 11 with bilateral ibotenic acid lesions to the primary and secondary forelimb motor cortex, and 11 age and gender matched controls (5 sham surgery, 6 wild-types). Animals were given ample time to recover, 4 weeks post-surgery, in order to specically isolate behaviours that are chronically impaired in animals lacking the functions enabled by motor cortical structures. Histological examination of serial coronal sections revealed signicant variability in the extent of damaged areas (Figure 3.4), which was likely caused by mechanical blockage of the injection pipette during lesion induction at some sites. Nevertheless, volume reconstruction of the serial sections allowed us to accurately quantify the size of each lesion, identify each animal (from Lesion A to Lesion K; largest to smallest), and use these values to compare observed behavioural eects as a function of lesion size. 103 progression height A stable unstable stable random 0 1 2 3 4 5 6 7 8 progression (cm) step posture across trials (Control A) B Figure 3.8. Measuring postural approach to the obstacles. ( A ) Schematic of postural analysis image processing. The position of the animal's nose is extracted whenever the paw activates the ROI of the rst manipulated step (see methods). ( B ) The horizontal position, i.e. progression, of the nose in single trials for one of the control animals stepping across the dierent conditions of the shuttling protocol. posture of the animals when stepping on the obstacles changed signicantly over time (Figure 3.8B, 3.9A). Specically, the centre of gravity of the body was shifted further forward and higher during later sessions, in a manner proportional to performance. However, after the obstacles changed to the unstable state, we observed an immediate and persistent adjustment of this crossing posture, with animals assuming a lower centre of gravity and reducing their speed as they approached the unstable obstacles (Figure 3.9A,B). Interestingly, we also noticed that a group of animals adopted a dierent strategy. Instead of lowering their centre of gravity, they either kept it unchanged or shifted it even more forward and performed a jump over the unstable obstacles (Figure 3.10A,B). These two strategies were remarkably consistent across the two groups, but there was no correlation between the strategy used and the degree of motor cortical lesion (Figure 110 stable unstable stable random 1.5 1.0 0.5 0.0 0.5 1.0 1.5 2.0 2.5 progression (cm) * * * average step posture control lesion A 4 2 0 2 4 progression (cm) 40 20 0 20 40 60 80 speed (cm / s) 0 200 n = 3550 trials 0 200 400 stable unstable B 4 2 0 2 4 progression (cm) 4 2 0 2 4 6 height (cm) 0 100 200 n = 1995 trials 0 200 stable unstable controls C 4 2 0 2 4 progression (cm) 4 2 0 2 4 6 height (cm) 0 50 100 n = 1555 trials 0 100 200 stable unstable lesionsD Figure 3.9. Rats adapt their postural approach to the obstacles after a change in physics. ( A ) Average horizontal position of the nose across the dierent protocol stages for both lesion and control animals. Asterisks indicate the average nose position on the 20 trials immediately preceding a change in protocol conditions (see text). ( B ) Distribution of horizontal position against speed for the last two days of the stable (blue) and unstable (orange) protocol stages. ( C-D ) Distribution of nose positions for control and lesion animals over the same sessions. 111 Control A stable unstable Lesion B Control H Lesion C A 10 15 20 25 30 35 40 progression (cm) 0 1 2 3 4 5 6 height (cm) crossing trajectories (n = 21) control lesion B 200 250 300 350 400 450 500 550 600 650 weight (g) 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 p (skip middle steps) correlation of jumping with weight control lesion C Figure 3.10. Animals use dierent strategies for dealing with the unstable obstacles. ( A ) Example average projection of all posture images for stable (green) and unstable (red) sessions for two non-jumper (top) and two jumper (bottom) animals. ( B ) Average nose trajectories for individual animals crossing the unstable condition. The shaded area around each line represents the 95% condence interval. ( C ) Correlation of the probability of skipping the center two steps with the weight of the animal. 3.9C,D, 3.10C). In fact, we found that the use of a jumping strategy was best predicted by the body weight of the animal (Figure 3.10C). During the two days where the stable state of the environment was reinstated, the posture of the animals was gradually restored to premanipulation levels (Figure 3.8B, 3.9A), although in many cases this adjustment happened at a slower rate than the transition from stable to unstable. Again, this postural adaptation was independent of the presence or absence of forepaw motor cortex. We next looked in detail at the days where the state of the obstacle course was randomized on a trial-by-trial basis. This stage of the protocol is particularly interesting as it reects a situation where the environment has a persistent degree of uncertainty. For this analysis, we were forced to exclude the animals that employed a jumping strategy, as their experience with the manipulated obstacles was the same irrespective of the state of the world. First, we repeated the same posture analysis comparing all 112 the stable and unstable trials in the random protocol in order to control for whether there was any subtle cue in our motorized setup that the animals might be using to gain information about the current state of the world. There was no signicant dierence between randomly presented stable and unstable trials on the approach posture of the animal (Figure 3.11A). However, classifying the trials on the basis of past trial history revealed a signicant eect on posture (Figure 3.11B). This suggested that the animals were adjusting their body posture when stepping on the affected obstacles on the basis of their current expectation about the state of the world, which is updated by the previously experienced state. Surprisingly, this eect again did not depend on the presence or absence of frontal motor cortical structures (Figure 3.11C,D). Finally, we decided to test whether general motor performance was affected by the randomized state of the obstacles. If the animals do not know what state the world will be in, then there will be an increased challenge to their stability when they cross over the unstable obstacles, possibly demanding a quick change in strategy when they learn whether the world is stable or unstable. In order to evaluate the dynamics of crossing, we compared the speed prole of each animal across these dierent conditions (Figure 3.12, see Methods). Interestingly, two of the animals with the largest lesions appeared to be signicantly slowed down on unstable trials, while controls and the animals with the smallest lesions instead tended to accelerate after encountering an unstable obstacle. However, the overall eect for lesions versus controls was not statistically signicant (Figure 3.12C). Nevertheless, we were intrigued by this observation and decided to investigate, in detail, the rst moment in the assay when a perturbation is encountered. In the random protocol, even though the state of the world is unpredictable, the animals know that the obstacles might become unstable. However, the very rst time the environment becomes unstable, 113 4 2 0 2 4 progression (cm) 4 2 0 2 4 height (cm) 0 200 400 p = 0.296 n = 3562 trials 0 500 stable unstable current state A 4 2 0 2 4 progression (cm) 4 2 0 2 4 height (cm) 0 100 p = 4.3e-13 n = 1717 trials 0 200 400 previous stable previous unstable previous state B 4 2 0 2 4 progression (cm) 4 2 0 2 4 height (cm) 0 100 p = 4.87e-06 n = 1018 trials 0 100 200 previous stable previous unstable controls C 4 2 0 2 4 progression (cm) 4 2 0 2 4 height (cm) 0 50 p = 1.12e-09 n = 699 trials 0 100 previous stable previous unstable lesions D Figure 3.11. Animals adjust their posture on a trial-by-trial basis to the expected state of the world. ( A ) Distribution of nose positions on the randomized protocol when stepping on the rst manipulated obstacle, for trials in which the current state was stable (blue) or unstable (orange). ( B ) Distribution of nose positions for trials in which the previous two trials were stable (blue) or unstable (orange). ( C-D ) Same data as in ( B ) split by the control and lesion groups. p values from Student's unpaired t-test are indicated. 114 15 10 5 0 5 10 15 20 25 progression (cm) 20 10 0 10 20 30 speed (cm/s) average speed (Control A) stable unstable 15 10 5 0 5 10 15 20 25 progression (cm) 20 10 0 10 20 30 speed (cm/s) average speed (Lesion B) stable unstable control lesion 100 50 0 50 100 150 200 speedup (cm/s) p = 0.18 speed profile difference A B C Figure 3.12. Encountering dierent states of the randomized obstacles causes the animals to quickly adjust their movement trajectory. ( A ) Example average speed prole across the obstacles for stable (blue) and unstable (orange) trials in the randomized sessions of a control animal (see text). The shaded area around each line represents the 95% condence interval. ( B ) Respectively for one of the largest lesions. ( C ) Summary of the average dierence between the speed proles for stable and unstable trials across the two groups of animals. Error bars show standard error of the mean. p value from Student's unpaired t-test is indicated. the collapse of the obstacles is completely unexpected and demands an entirely novel motor response. A detailed analysis of the responses to the rst collapse of the steps revealed a striking dierence in the strategies deployed by the lesion and control animals. Upon the rst encounter with the manipulated steps, we observed three types of behavioural responses from the animals (Video 3.6): investigation, in which the animals immediately stop their progression and orient towards, whisk, and physically manipulate the altered obstacle; compensation, in which the animals rapidly adjust their behaviour to negotiate the unexpected instability; and halting, in which the ongoing motor program ceases and the animals' behaviour simply comes to a stop for several seconds. Remarkably, these responses depended on the presence or absence of motor cortex (Figure 3.13). Animals with the largest motor cortical lesions, upon their rst encounter with the novel environmental 115 0.0 0.5 1.0 1.5 2.0 2.5 3.0 tim elfrom lfirst lcont act l(s) Lk Lj Li Lh Lg Lf Le Ld Lc Lb La Ck Cj Ci Ch Cg Cf Ce Cd Cc Cb Ca et hogram loflfirst lcont act lwit hlm anipulat edlrail Controls Lesions FirstlContact investigation compensation halting normallmotion Δt AB Figure 3.13. Responses to an unexpected change in the environment. ( A ) Response types observed across individuals upon rst encountering an unpredicted instability in the state of the centre obstacles. ( B ) Ethogram of behavioural responses classied according to the three criteria described in ( A ) and aligned (0.0) on rst contact with the newly manipulated obstacle. Black dashes indicate when the animal exhibits a pronounced ear ick. White indicates that the animal has crossed the obstacle course. obstacle, halted for several seconds, whereas animals with an intact motor cortex, and those with the smallest lesions, were able to rapidly react with either an investigatory or compensatory response (Video 3.7,3.8). The response of animals with extended lesions was even more striking. In two of these animals, there was a failure to recognize that a change had occurred at all (Video 3.9). Instead, they kept walking across the now unstable steps for several trials, never stopping to assess the new situ- 116 ation. One of them gradually noticed the manipulation and stopped his progression, while the other one only fully realized the change after inadvertently hitting the steps with its snout (Video 3.9: Extended Lesion A). This was the rst time we ever observed this behaviour, as all animals with or without cortical lesions always displayed a clear switch in behavioural state following the rst encounter with the manipulation. In the remaining animals with extended lesions, two of them clearly halted their progression following the collapse of the obstacles, in a way similar to the large motor cortex ibotenic lesions (Video 3.10). The third animal (Extended Lesion B) actually collapsed upon contact with the manipulated step, falling over its paw and digits awkwardly and hitting the obstacles with its snout. Shortly after this there was a switch to an exploratory behaviour state, in a way similar to Extended Lesion A. Towards a neurobiological basis of robust responses In order to investigate the neurophysiological correlates of these robust responses in the motor cortex, in three animals we implanted exible surface electrode grids above the dura in one hemisphere of the intact brain (Figure 3.15A, also see Methods). Each step of the obstacle course was outtted with a load cell sensor to measure the precise timing of contact and the amount of weight placed on each limb during locomotion. The entire electrocorticography (ECoG) system was synchronized on a frame-by-frame basis with the high-speed video acquisition so we could reconstruct the detailed behaviour of the animal at any point of the physiological trace as well as relate the continuous load prole on individual steps with dierent phases in the locomotion cycle (Figure 3.14). We rst asked whether there were responses in the ECoG signal over forelimb motor cortex that were modulated by stepping behaviour. Aligning the ECoG traces to the event of stepping on a permanently stable step with the contralateral paw revealed the distinct presence of an evoked po- 117 0.0 0.1 0.2 0.3 0.4 0.5 0.6 time (s) 0 1 2 3 4 5 6 load (A.U.) Figure 3.14. Example load cell activation prole during stepping on a rung. tential on the anterior grid channels that was absent when stepping with the ipsilateral paw (Figure 3.15B, top trace). On close inspection, it could be seen that the beginning of the negative deection slightly precedes the time of contact with the step, suggesting a non-sensory contribution to the evoked response. Synaptic activity in the long and thick apical dendrites of pyramidal cells are thought to be one of the main contributors to cortically recorded extracellular eld potentials (Buzsáki, Anastassiou & Koch, 2012). In the cat, a sizeable proportion of pyramidal tract neurons in the motor cortex have been found to discharge rhythmically during unimpeded locomotion (Armstrong & Drew, 1984; Drew, Jiang, Kably & Lavoie, 1996), a phenomenon that is very likely to be coupled with observable synaptic activity in the potential traces and could account for the step-aligned evoked responses that we observed during locomotion of rats in the stable obstacle course. 118 Next, we asked whether there was any modulation of the evoked response when navigating the unstable obstacle course. In order to try and maximize the number of trials in which the encounter with the unstable step is unexpected, we adjusted the behavioural protocol at the transition between the stable and unstable test periods. This time, instead of permanently switching the centre steps to the unstable conguration, we decided to immediately revert the steps back to the stable state after the rst exposure to the instability. After 20 subsequent trials in the stable state, the steps were again made unstable, and this pattern was repeated for several days. Surprisingly, when we aligned the ECoG traces to contralateral paw steps on the manipulated obstacle in unstable trials, we observed a second evoked negativity, delayed in time relative to the previously observed stable step evoked response, and with a much larger amplitude across the channels in the anterior grid (Figure 3.15B, middle left trace). Remarkably, even in the presence of such a small number of trials, the consistency of the response in every trial provided a good enough signal-to-noise ratio for the average response to be clearly visible. Interestingly, this negativity was found to be rapidly followed by an equally large positive deection in the potential which decayed to baseline with a much larger time constant, a response that was entirely absent from the evoked potential to stepping on a stable step. In contrast, the response to unstable steps with the ipsilateral paw did not reveal such large deections from the baseline, although a consistent negativity could still be seen across the grid around the same time point (Figure 3.15B, middle right trace). The amplitude and timing of evoked responses when stepping with the contralateral paw on the same manipulated step in stable trials was largely identical to the condition where the step was permanently stable, and again was found to be absent when stepping with the ipsilateral paw (Figure 3.15B, bottom trace). 119 McKinney, W. (2010). Data Structures for Statistical Computing in Python. Proceedings of the 9th Python in Science Conference , 5156. Metz, G. A. & Whishaw, I. Q. (2002). Cortical and subcortical lesions impair skilled walking in the ladder rung walking test: a new task to evaluate fore- and hindlimb stepping, placing, and co-ordination. Journal of neuroscience methods , 115 (2), 16979. Meyer, P. M. & Meyer, D. R. (1971). Neurosurgical procedures with special reference to aspiration lesions. In R. D. Myers (Ed.), Methods in psychobiology, vol. i (pp. 91130). London: Academic Press. Miller, M. W. (1987). The origin of corticospinal projection neurons in rat. Exp Brain Res , 67 (2), 339351. doi:10.1007/BF00248554 Otchy, T. M., Wol, S. B. E., Rhee, J. Y., Pehlevan, C., Kawai, R., Kempf, A., Gobes, S. M. H. & Ölveczky, B. P. (2015). Acute o-target eects of neural circuit manipulations. Nature . doi:10.1038/nature16442 Phillips, C. G. (1969). The Ferrier Lecture, 1968: Motor Apparatus of the Baboon's Hand. Proceedings of the Royal Society B: Biological Sciences , 173 (1031), 141174. doi:10.1098/rspb.1969.0044 Schindelin, J., Arganda-Carreras, I., Frise, E., Kaynig, V., Longair, M., Pietzsch, T., Preibisch, S., Rueden, C., Saalfeld, S., Schmid, B., Tinevez, J.-Y., White, D. J., Hartenstein, V., Eliceiri, K., Tomancak, P. & Cardona, A. (2012). Fiji: an open-source platform for biologicalimage analysis. Nature methods , 9 (7), 67682. doi:10.1038/nmeth. 2019 Schwarcz, R., Hökfelt, T., Fuxe, K., Jonsson, G., Goldstein, M. & Terenius, L. (1979). Ibotenic acid-induced neuronal degeneration: A morphological and neurochemical study. Experimental Brain Research , 37 (2), 199216. doi:10.1007/BF00237708 van der Walt, S., Colbert, S. C. & Varoquaux, G. (2011). The NumPy Array: A Structure for Ecient Numerical Computation. Computing in Science & Engineering , 13 (2), 2230. doi:10.1109/MCSE.2011.37 126 Watson, B. D., Dietrich, W. D., Busto, R., Wachtel, M. S. & Ginsberg, M. D. (1985). Induction of reproducible brain infarction by photochemically initiated thrombosis. Annals of Neurology , 17 (5), 497 504. doi:10.1002/ana.410170513 Whishaw, I. Q. (2000). Loss of the innate cortical engram for action patterns used in skilled reaching and the development of behavioral compensation following motor cortex lesions in the rat. Neuropharmacology , 39 (5), 788805. doi:10.1016/S0028-3908(99)00259-2 127 Chapter 4 Extended Discussion Let us take a couple of examples from physical culture and sports. Downhill skiing and slalom make high demands on a skier's dexterity. What is the dierence between slalom and plain cross-country skiing, which does not require any particular dexterity? It is in a conglomerate of unexpected, unique complications in the external situation, in a quick succession of motor tasks that are all unlike each other. Nicholai A. Bernstein , Dexterity and its Development (1996) 129 4.1 Chapter Summary We propose a new role for motor cortex: extending the robustness of subcortical movement systems, specically to unexpected situations demanding rapid motor responses adapted to environmental context. The implications of this idea for current and future research are discussed. 130 4.2 A challenge from robotics Is robust control a problem worthy of high level cortical input? Recovering from a perturbation, to maintain balance or minimize the impact of a fall, is a role normally assigned to our lower level postural control systems. The corrective responses embedded in our spinal cord (Sherrington, 1893, 1910), brainstem (Arshian et al., 2014) and midbrain (Grillner & Shik, 1973) are clearly important components of this stabilizing network, but are they sucient to maintain robust movement in the dynamic environments that we encounter on a daily basis? Some insight into the requirements for a robust control system can be gained from engineering attempts to build robots that navigate in natural environments. In the eld of robotics, feats of precision and ne movement control (the most commonly prescribed role for motor cortex), are not a major source of diculty. Industrial robots have long since exceeded human performance in both accuracy and execution speed (Senoo et al., 2009). More recently, using reinforcement learning methods, they are now able to automatically learn ecient movement strategies, given a human-dened goal and many repeated trials for ne-tuning (Coates, Abbeel & Ng, 2008). What then are the hard problems in robotic motor control? Why are most robots still conned to factories, i.e. controlled, predictable environments? The reason is that as soon as a robot encounters natural terrain, a vast number of previously unknown situations arise. The resulting perturbations are dealt with poorly by the statistical machine learning models that are currently used to train robots in controlled settings. Let's consider a familiar example: You are up early on a Sunday morning and head outside to collect the newspaper. It is cold out, so you put on a robe and some slippers, open the front door, and descend the steps leading down to the street in front of your house. Unbeknownst to you, a thin layer of ice has formed overnight and your foot is now quickly sliding 131 out from underneath you. You are about to fall. What do you do? Well, this depends. Is there a railing you can grab to catch yourself? Were you carrying a cup of coee? Did you notice the frost on the lawn and step cautiously, anticipating a slippery surface? Avoiding a dangerous fall, or recovering gracefully, requires a rich knowledge of the world, knowledge that is not immediately available to spinal or even brainstem circuits. This rich context relevant for robust movement is readily available in cortex, and cortex alone. Imagine now that you are tasked with building a robot to collect your morning newspaper. This robot, in order to avoid a catastrophic and costly failure, would need to have all of this contextual knowledge as well. It would need to know about the structure of the local environment (e.g. hand railings that can support its weight), hot liquids and their viscosities, and even the correlation of frozen dew with icy surfaces. To be a truly robust movement machine, a robot must understand the physical structure of the world. Moreover, it needs to understand it in about 100 ms after its foot starts to slip. Reaching to stop a fall while holding a cup of coee is not exactly the kind of feat for which we praise our athletes and sports champions, and this might explain why the diculty of such feats of robustness is often overlooked. However, it would not be the rst time that we nd ourselves humbled by the daunting complexity of a problem that we naively assumed was trivial. Vision, for example, has remained an impressively hard task for a machine to solve at human-level performance, yet it was originally proposed as an undergraduate summer project (Papert, 1966). Perhaps a similar misestimate has clouded our designation of the hard motor control problems worthy of cortical input. Inspired by the challenges confronting roboticists, as well as our rodent behavioural results, we are now in a position to posit a new role for motor cortex. 132 4.3 A primordial role for motor cortex We are seeking a role for motor cortex in non-primate mammals, animals that do not require this structure for overt movement production. The struggles of roboticists highlight the diculty of building movement systems that robustly adapt to unexpected perturbations, and the results we report in this study suggest that this is, indeed, the most conspicuous decit for rats lacking motor cortex. So let us propose that, in rodents, motor cortex is primarily responsible for extending the robustness of the subcortical movement systems. It is not required for control in stable, predictable, non-perturbing environments, but instead specically exerts its inuence when unexpected challenges arise. This, we propose, was the original selective pressure for evolving a motor cortex, and thus, its primordial role. This role persists in all mammals, mediated via a modulation of the subcortical motor system (as is emphasized in studies of cat locomotion), and has evolved in primates to include direct control of the skeletal musculature. Our proposal of a robust teleology for motor cortex has a number of interesting implications. 4.4 Implications for non-primate mammals One of the most impressive traits of mammals is the vast range of environmental niches that they occupy. While most other animals adapt to change over evolutionary time scales, mammals excel in their exibility, quickly evaluating and responding to unexpected situations, and taking risks even when faced with challenges that have never been previously encountered (Spinka, Newberry & Beko, 2001). This success requires more than precision, it requires resourcefulness: the ability to quickly come up with a motor solution for any situation and under any condition (Bernstein, 1996). The Russian neurophysiologist Bernstein referred to this ability with an 133 unconventional denition of dexterity, which he considered to be distinct from a simple harmony and precision of movements. In his words, dexterity is required only when there is `a conglomerate of unexpected, unique complications in the external situations, [such as] in a quick succession of motor tasks that are all unlike each other' (Bernstein, 1996). If Bernstein's robust dexterity is the primary role for motor cortex, then it becomes clear why the eects of lesions have thus far been so hard to characterize: assays of motor behaviour typically evaluate situations that are repeated over many trials in a stable environment. Such repeated tasks were useful, as they oer improved statistical power for quantication and comparison. However, we propose that these conditions specically exclude the scenarios for which motor cortex originally evolved. It is not easy to repeatedly produce conditions that animals have not previously encountered, and the challenges in analysing these unique situations are considerable. The assay reported here represents our rst attempt at such an experiment, and it has already revealed that such conditions may indeed be necessary to isolate the role of motor cortex in rodents. We thus propose that neuroscience should pursue similar assays, emphasizing unexpected perturbations and novel challenges, and we have developed new hardware and software tools to make their design and implementation much easier (Chapter 2). 4.5 Implications for primate studies In contrast to other mammals, primates require motor cortex for the direct control of movement. However, do they also retain its role in generating robust responses? The general paresis, or even paralysis, that results from motor cortical lesions in these species obscures the involvement of cortex in directing rapid responses to perturbations. Yet there is evidence that a 134 role in robust control is still present in primates, including humans. For example, stroke patients with partial lesions to the distributed motor cortical system will often recover the ability to move the aected musculature. However, even after recovering movement, stroke patients are still prone to severe impairments in robust control: unsupported falls are one of the leading causes of injury and death in patients surviving motor cortical stroke (Jacobs, 2014). We thus suggest that stroke therapy, currently focused on regaining direct movement control, should also consider strategies for improving robust responses. Even if we acknowledge that a primordial role of motor cortex is still apparent in primate movement control, it remains to be explained why the motor cortex of these species acquired direct control of basic movements in the rst place. This is an open question. 4.6 Some speculation on the role of direct cortical control What happens when cortex acquires direct control of movement? First, it must learn how to use this inuence, bypassing or modifying lower movement controllers. While functional corticospinal tract connections may be established prenatally (Eyre, Miller, Clowry, Conway & Watts, 2000), the renement of corticospinal dependent movements, which must override the lower motor system, takes much longer and coincides with the lengthy maturation period of corticospinal termination patterns (Lawrence & Hopkins, 1976). Humans require years of practice to produce and rene basic locomotion and grasping (Thelen, 1985; von Hofsten, 1989), motor behaviours that are available to other mammals almost immediately after birth. This may be the cost of giving cortex direct control of movementit takes more time to gure out how to move the bodybut what is the benet? 135