Introduction

Our ability to touch and feel is usually considered a simple task in daily life. However, there is a complex process behind our sense of touch, from the sensory receptors within the skin to the brain’s neuronal activity. When we interact with an object, the activation of different kinds of mechanoreceptors in the skin send various signals regarding object characteristics such as texture, shape, and size. Single-unit recordings of tactile afferents have been used to discover how tactile information is encoded1,2. One of the main findings is that stimulus information is distributed over a population of fibers in the form of spike trains. However, our understanding of population-level coding is still basic and only a few models have tried to address this important representation3,4,5. Indeed, tactile processing involves neural mechanisms that extract high-level features of a stimulus, such as an edge orientation, by integrating information from many low-level inputs6,7. The low-level inputs originate from the cutaneous mechanoreceptors which are located in the skin throughout the body and convert skin deformation into spiking responses. The density of mechanoreceptors varies across the body. For example, the density of cutaneous afferents that innervate the human fingertip is about 240 units/cm2, whereas in the palm it is only 58 units/cm28,9. In general, the hands and lips for primates have the highest density of mechanoreceptors while the legs and back contain the lowest. One of the main features of these first-order neurons is that they have complex receptive fields. Indeed, the afferent’s distal axons which innervate the skin form many transduction sites4,10. This innervation pattern is a critical peripheral nerve mechanism that allows individual afferents to encode geometric information about tactile stimuli. To the best of our knowledge, the spatial complexity and heterogeneity of innervation patterns have not been integrated in models, such as in the excellent work by Saal et al.3.

The first stage of the tactile processing pathway consists of the cutaneous mechanoreceptors which are broadly categorized as two cell types with different response characteristics: (1) slowly adapting (SA) mechanoreceptors which produce sustained firing activity in response to a static indentation of the skin, (2) and rapidly adapting (RA) mechanoreceptors which mainly fire at the onset and offset of indentation. The SA-I and SA-II afferents innervate Merkel discs and Ruffini endings, respectively. The RA-I and RA-II afferents innervate Meissner and Pacinian corpuscles, respectively11. In this study, we consider SA-I and RA-I afferents which are essential for edge orientation detection8. The second stage in the tactile processing pathway is the cuneate nucleus (CN) within the medulla in the midbrain. The CN neurons incorporate lateral inhibition which filters neuronal firing. In this study, we investigate the role of lateral inhibition for edge detection at the population-level in the CN model12 by modulating the CN inhibitory currents. A mechanical skin stimulus activates several cuneate neurons, however, each cuneate neuron responds to a unique combination of inputs13. The spiking response of the second stage is transmitted (via the thalamus) to the cortical neurons in the somatosensory cortex of the brain (third stage) which are sensitive to edge-orientations and hence the stimuli are perceived14,15. Indentation at different skin locations evokes activity in different areas of the somatosensory cortex, with some overlap between neighboring skin regions16. Even though the collective response of the cortical neurons to the contact events looks very similar to the population response of afferents, tactile information is processed during transmission from the peripheral nerves to the cortical neurons. Indeed, cortical neurons have complex receptive fields with excitatory and inhibitory subfields and have properties that are largely absent in the tactile afferents17. These properties include feature selectivity to edge orientation18 and motion direction19 and nonlinear integration of inputs6,20,21,22,23,24. The three stages of the tactile processing pathway are summarized in Fig. S1. In this study, a three-layer biophysical model using a spiking neural network is proposed to functionally simulate the tactile processing pathway. This model takes into account the recent physiological evidence4,12,17,18. For the first layer, the SA-I and RA-I afferents are modeled as they branch into the skin and innervate overlapping receptive fields which provides spatial and temporal information about the tactile stimuli4,9. We propose a dynamic model for the SA-I afferents which consists of a Merkel-cell component (input current) and a neurite component (a derivative of input current). This novel model also shows better adaptability than the static one which only considers the Merkel-cell component. In our model, the first-order tactile neurons randomly innervate the mechanoreceptors available at the fingertip4. The second layer of the proposed spiking neural network models the projection neurons (PN) and interneurons (IN) to simulate the CN structure. The primary sensory afferents make excitatory synaptic connections with both PN and IN, while IN makes only inhibitory connections with the PN12. The third layer models a population of pyramidal neurons (PY) and cortical interneurons (c-IN). We focus on the somatosensory cortex area 3b which has previously been identified by linear spatial receptive fields with spatially separated excitatory and inhibitory regions on the skin25. In this case, the PY and c-IN receive excitatory synaptic connections from the PN. Additionally, the c-IN also have inhibitory synaptic connections to the PY. For simplicity, in our simulations, the cortical receptive fields consist of two subfield regions on the skin (excitatory and inhibitory) that are adjacent and tuned for a specific orientation. The receptive fields for each cortical neuron are distributed across the skin; consequently, edge orientation is recognized accurately and rapidly by the firing responses of the cortical neurons independent of the edge stimulus location. Finally, we explore the effect of afferent receptive field size on the encoding of the scanned and indented edge stimuli, based on the first spikes emitted by the cortical neurons (PYs). The entire spiking neural network model was built using the Brian2 simulator with Python version 3.6526.

Results

The primary objective of this study is to simulate the tactile pathway from the glabrous skin of the fingertip to the cortical neurons in the somatosensory cortex area 3b in response to edge orientation stimuli. In this way, we discover how the receptive field size modulates information about edge orientation in the spiking pattern of cortical neurons. In the first layer, the SA-I and RA-I afferents are simulated which innervate their mechanoreceptors in a random sampling pattern. Edge stimuli activate a population of mechanoreceptors that send tactile information to the upper layers. The next layer, the CN, integrates and categorizes the coming information. We examine the role of lateral inhibition in the PN population and demonstrate how insufficient inhibitory currents lead to a failure in suppressing skin hypersensitivity. In the last layer, modeling the excitatory and inhibitory receptive fields of the somatosensory cortical neurons shows the classification of edge orientation independent of stimulus location. Two experiments are done; (i) Indented edge experiment: the stimulus vertically indents the simulated patch of skin. (ii) Scanned edge experiment: the stimulus indents and moves across the skin in a specific direction.

First-order neurons

In the first layer, we simulated two afferent populations, namely, SA-I and RA-I. These afferents densely and randomly innervate the skin mechanoreceptors of the human fingertips and encode tactile information through their spike rates and spatiotemporal spiking patterns (Fig. 1A). A set of indentations are applied as the inputs to each afferent model (Fig. 1B) to produce spiking responses (Fig. 1C). The stimulus is the edge at different orientations (from 5°–80°, in 5° increments) indented on the mechanoreceptor grid of the fingertip. The different weights of mechanoreceptors make it possible for afferents to have spatially complex receptive fields (Fig. 1D). Recently, it has been proposed that random innervation of afferents might be a peripheral neural mechanism for extracting geometric features of the touched objects4.

The SA-I dynamic model

Myelinated SA-I afferents innervate the skin through unmyelinated fibers (neurites) to form synaptic-like connections with Merkel cells. Indeed, SA-I afferent’s end organ is considered as a Merkel cell-neurite complex27. When the skin is stimulated mechanically, Merkel cell-neurite complexes produce activation currents in unmyelinated neurites. Recent computational models have attempted to determine how structural mechanisms of Merkel cell-neurite complexes modulate the SA-I firing characteristics28, but it is still unknown how Merkel cells and neurites individually contribute to producing responses in the SA-I afferent. It is difficult to experimentally measure currents generated by the Merkel cells and neurites in response to a mechanical stimulation27. Nevertheless, recent biological data illustrate evidence for a two-component model. In this way, the Merkel cell-neurite complex includes (1) Merkel cells which are essential for sustained firing in SA-I afferents, and (2) neurites that produce rapidly adapting firing to mechanical stimulation29,30,31. Here, we propose a biologically plausible and functional model to mimic the Merkel cell and neurite response to mechanical indentation stimuli. Unlike previous studies which suggest that the SA-I model responds only to the hold phase of mechanical stimuli32,33,34, the new model is composed of a Merkel-cell component (input current) and a neurite component (a derivative of input current). The effect of the SA-I dynamic model on the performance of cortical neurons using spike count analysis is illustrated in Fig. 2. Considering indentation noise in different trials, it is found that the classification performance has a stable characteristic when a biomimetic decoder35 (see Methods) is used (Fig. 2A) and consequently it has more robustness. Afferent responses are assessed using Principal Component Analysis (PCA). In this way, considering the first 3-principal components of the feature space (spike count), simulations show that the K-nearest neighbor classifier (KNN) has higher performance for the SA-I dynamic model in comparison with the SA-I static model (Fig. 2B). Furthermore, the RA-I afferent responses against indentation noise are also reported in Fig. 2B. Noteworthy, the number of RA-I afferents is almost double of the SA-I ones (see Methods) and its performance is slightly superior. This figure also illustrates that the initial spiking responses of the SA-I model make rapid and accurate orientation detection.

Decoding the indented and scanned edge orientation

In the indentation experiment, we investigated how edge orientation could be decoded and extracted from the SA-I and RA-I population responses. We consider 2 or 3 principal components obtained by applying PCA to the spike counts calculated from firing patterns. In our simulations, the Pacinian afferents have not been considered because they are known to contribute more to texture and vibrotactile encoding3,8. In Fig. 3A, as the orientation changes, the edge stimulus lands on the receptive field of different afferents, therefore, information is encoded in the spatiotemporal pattern of activation. Results show that contact stimuli are encoded in the first emitted spikes, and 2-principal components are as informative as 3-principal components which are extracted from the feature space (Fig. 3B). At the population level, the performance of RA-I is higher than SA-I given the fact that the number of RA-I afferents is greater than SA-I which improves the spatial encoding. Based on the experimental evidence, each type of afferent extracts particular geometric features, and therefore, the combination of both afferents improves the recognition performance. We also simulated the responses of two afferent populations to the scanned edge stimulus on the simulated patch of skin for 16 different orientations (Fig. 4A). The goal is to classify the edge orientation based on the responses at the population-level considering both spike count (number of spikes) and temporal spiking pattern (spike timing). Indeed, afferents randomly innervate the mechanoreceptors and create highly sensitive areas that are non-uniformly distributed within the receptive field4. This arrangement acts as a peripheral neural mechanism that allows individual neurons to extract distinct features of the touched objects. When skin is deformed, each afferent produces unique responses and facilitates edge stimulus discrimination. To calculate the temporal distance between spike trains, Victor-Purpura distance (VPd) has been used36.

Figure 4B shows the neural response when an edge stimulus is moving across the receptive fields of two sampled tactile afferents. In Fig. 4C, as can be seen, the RA-I responses rapidly show the orientation stimuli with high accuracy compared to the SA-I responses. Figure 4C shows the comparative performance analysis for decoding the orientation of the scanned edge to variable time windows. Both spike count (spatial activation pattern) and spike timing-based features are used for orientation detection. Although the classification accuracy for both methods, spike count and spike timing, eventually saturates, the performance curves of the spike timing method (dashed lines) have a delay with respect to the performance curve of the spike count method (solid lines). This interestingly shows the spatial activation pattern (which is specified by counting the number of spikes) of the early spikes conveys more information compared to the temporal patterns of the afferent responses.

To assess the behavior of the afferents at a single-unit level, one afferent (SA-I and RA-I) is considered which has its receptive field (Fig. 5A). During the experiment, the receptive fields are scanned by 16 edge orientations and each stimulus is repeated 6 times (96 trials in total). Since RA-I afferents have larger receptive fields in comparison to SA-I, the obtained spiking responses are more diverse (Fig. 5B). Figure 5C shows the cross-correlations between the input current of afferents. As can be seen in Fig. 5C, for the SA-I afferents, in lower angles of orientation, correlation coefficients are more similar. Thus, angle discrimination using correlation coefficients in RA-I is easier than SA-I. Figure 5D illustrates the spike timing analysis by computing the VPd metric which illustrates that the RA-I spike responses are more informative than SA-I. Employing the extracted features from Fig. 5C,D, the classification accuracy to classify the edge orientation is reported in Table 1.

Second-order neurons (cuneate nucleus)

The second layer of the proposed functional neuronal model considers the projection neurons (PN) and interneurons (IN) to simulate the cuneate nucleus (CN) structure in tactile sensing. The CN neurons mainly contribute to tactile information processing through lateral inhibition which leads to the firing rate filtering12. The INs make inhibitory synaptic connections with the PNs (Fig. 6A). We have hypothesized that the lateral inhibition in the CN model prevents the accumulation of noise and preserves spatial information which in turn facilitates the edge detection process. In this way, the impact of CN lateral inhibition on the performance of orientation detection is explored when the edge indents the simulated mechanoreceptor grid. Indeed, we tune the network for the best performance of edge orientation detection. With maximum lateral inhibition, input currents of some PNs decrease significantly. On the other hand, reducing the amount of inhibitory current from INs to the PNs (Fig. 6B,C), leads to an increase in the firing rate of the cortical neurons. A biomimetic decoder is considered by employing the winner-take-all algorithm (a cortical neuron with a maximum firing rate is the winner neuron) (see Methods). Figure 6D illustrates that diminishing the amount of lateral inhibition leads to a decrease in the recognition accuracy of the indented orientations. Indeed, lateral inhibition preserves spatial information and thus facilitates the edge detection process. Firing responses of all tactile processing stages are plotted in Fig. 7A,B, when two edge orientation stimuli indent the mechanoreceptor grid at two levels of inhibition in the CN.

Cortical neurons in the somatosensory area

In the last layer, the responses of cortical neurons to orientation stimuli are simulated. The obtained results are in agreement with the experimental results reported in the literature35,37 when an edge indents the skin. For simplicity, in our simulations, cortical receptive fields consist of two sub-regions on the skin (excitatory and inhibitory), and they are located close to each other and are tuned for a specific orientation. These receptive fields are distributed over the skin, therefore, edge orientation can be recognized accurately and rapidly by the cortical neurons even when the position of the edge stimulus on the skin is changing. Indeed, cortical neurons in area 3b are sensitive to specific orientations. Specifically, when an edge indents the skin, the input currents of orientation-tuned cortical neurons are raised based on the spatial coincidence between the receptive field sensitive zones of cortical neurons and the edge orientation on the skin. To better understand the function of the cortical neurons, the excitatory and inhibitory currents are plotted (Fig. 8A). It is evident that edge orientation can quickly be decoded using the winner-take-all algorithm. As shown in Fig. 8A, the current amplitudes of the orientation-tuned cortical neurons are increased after $$20 ms$$ to distinguish edge stimuli, which is compatible with the conduction delay to the cortex in neurophysiological observations37. To investigate how the biomimetic decoder recognizes edge orientations indented at different skin positions, we considered three locations with 1.2 mm spacing along the y-axis on the simulated patch of skin. For each trial, the stimulus was applied randomly to one of these locations. The orientation is decoded based on the “winner-take-all” approach (biomimetic decoder). Furthermore, to compare the performance with a common machine learning algorithm, the PCA for feature reduction and the KNN as the classifier are used. The spike count is used as the input features. To explore the evolution of decoding performance over time, the procedure was repeated for 60 progressively expanding time windows, ranging from $$0$$ to $$180 ms$$ after stimulus onset (Fig. 8B). As can be seen in Fig. 8B, the biomimetic decoder has better performance and achieves 97% accuracy around $$180 ms$$. Confusion matrices for both decoders are shown for the $$180 ms$$ time window (Fig. 8C). Another interesting simulation is to explore the effect of afferents’ receptive field size on the orientation recognition by the cortical neurons. The procedure for forming the receptive fields has been described in the Methods section. Here, we examine how the scanned and indented edge stimuli are encoded by the population of cortical spiking neurons when the standard deviation (SD) of the mechanoreceptor distribution is changed (Fig. 8D). Interestingly, it is observed that the larger receptive fields of afferents convey more information about the scanned edge in the first spikes of population-level of cortical neurons for both spike timing and spike count protocols (Fig. 8E). Conversely, in the indented edge experiment, the larger receptive fields make the orientation detection worse (Fig. 8F). The responses of all layers to an edge indentation stimulus are shown and summarized in Movie S1. Figure 9A illustrates sample receptive fields with excitatory and inhibitory sub-regions on the skin. An excitatory (inhibitory) sub-region indicates that any indentation at that location gives rise to an increase (decrease) in neuronal firing. This figure shows that the intensity of neural firing indicates the edge orientation. In this way, as the degree of spatial coincidence between the neuron sensitive zones and tissue deformations caused by edge indentation increases, the neural firing also increases. For a given neuron, some edge orientations show more spatial coincidence than others and therefore yield stronger responses (Fig. 9B and Movie S2). Raster plots of cortical neurons are depicted for two edge orientations (10° and 40°); the input stimulus is recognized by the highest spiking rate (Fig. 9C).

Conclusion

The functional modeling of the tactile pathway from the cutaneous mechanoreceptors (first layer), to the cuneate nucleus (second layer) up to the somatosensory area 3b (third layer), provides a mechanistic tool for understanding the role of different neuronal networks in tactile information processing. The current research highlights the importance of each stage in neuronal population coding in the detection of edge orientation. It also provides a deeper understanding of how the response of cortical neurons to edge stimuli changes as the mechanoreceptor innervation mechanisms and receptive fields are changed. The simulated spiking neural networks are functionally compatible with physiological observations across a wide range of conditions sampled from literature. Indeed, many recent neurophysiological findings have been embedded in the proposed model and its performance—based on spiking responses of cortical neurons—has been demonstrated for decoding of edge orientations.

One of the key features of the human fingertip is its ability to recognize edge orientation. In this way, it was illustrated that the random innervation of the mechanoreceptors by the primary afferents allows the encoding of orientation information through the spatiotemporal spiking pattern. This structure organizes a peripheral neural mechanism for extraction and then transmission of geometric features of the touched objects. The proposed hierarchical spiking neural network successfully discriminated edge orientation stimuli irrespective of edge location. It was shown that using the first spikes of cortical neurons; the orientation of stimuli (scanned or indented edge) was recognizable. The effect of afferent receptive field size was compared in two different experiments (scanned and indented edge). Orientation detection of the scanned edge stimuli in the first spikes of cortical neurons was improved when the afferents’ receptive field size was increased. Nevertheless, for the indented edge experiment, the situation was reversed and increasing the size of the afferents receptive field resulted in the reduction of correct detection. The findings showed that the importance of receptive field size depends on the specific tasks and experiments. Recent studies have shown that the main connections in neuronal pathways are formed during the developmental process38,39,40. However, the exact cortical dynamics and function have not been studied yet. Here, we investigated edge orientation detection through the cortical neurons as a biomimetic classifier. We showed that the intensity of a neuron’s response would signal edge orientation because its firing rate would increase with the degree of spatial coincidence between the neuron’s highly sensitive zones (excitatory region of receptive field) and the local skin deformations formed by edge indentation. That is, for a given neuron, some edge orientations exhibit more spatial coincidence than others and thus stronger responses are produced.

Also, the role of the inhibitory current which forms the lateral inhibition within the cuneate nucleus was studied. Indeed, the simulation results suggest that when lateral inhibition has increased the process of spike filtering is amplified. This leads to the reduction in “noise” within the system and hence the third-order neurons are activated by a strong and consistent signal. This also increases the spatial resolution of the receptive fields and gives them a more distinct border which improves discrimination between two separate points of simultaneous stimulation. Although other forms of lateral inhibition are also observed, the “feedforward” type of lateral inhibition is likely the most significant41. Various aspects of tactile sensitivity have been related to different forms of neuronal inhibitory function. Impaired reactions to tactile stimuli in children with autism spectrum disorder (ASD) are frequently reported symptoms. Indeed, impairments in filtering of or adaptation to tactile inputs have been described in ASD42. Under the assumption that the inhibitory mechanism is altered in ASD43,44, it can be suggested that dysfunction in lateral inhibition of the second layer of tactile processing or malfunction in the formation of the inhibitory sub-regions of the cortical neurons may also have a role. Understanding the specific mechanisms underlying sensory symptoms in ASD is still under investigation which may allow for more specific therapeutic approaches in the future.

The main limitation of the proposed spiking model is the lack of neural recordings for all network layers. Nevertheless, the model is based on the significant literature and published data for model building and validation. The proposed spiking network for a tactile system can be employed in the design and implementation of sensory neuroprostheses applications45,46,47,48. Additionally, the broad significance of this work is that the biomimetic tactile sensing and edge encoding are useful in robotic applications for shape recognition and object grasping and palpation49,50,51.

Methods

Mechanoreceptor and afferent models

To simulate the mechanoreceptor grid, the physiological information from the literature was considered. The SA-I fibers constitute about 25% of all tactile fibers innervating the hand. They are divided into multiple branches near the skin surface to reach the Merkel discs, which are distributed over different fingerprint ridges. This branching and innervation create a receptive field covering an area of about 10 $${mm}^{2}$$ on average for each SA-I afferent8. Afferent parameters are reported in Table 2. In response to a skin indentation, the activated Merkel discs within the receptive field send their partial information via the SA-I fibers which produce sustained spiking responses that slowly decrease over time (Fig. 1E). The RA-I afferents form around 40% of all tactile fibers innervating the hand. They are split into branches to relay signals from multiple Meissner corpuscles. Typically, the RA-I receptive field size is a bit larger than the SA-I receptive field. They respond to mechanoreceptor gird deformation52,53, therefore when the skin does not move, no spike is generated.

For modeling and simulation of the tactile afferents, we considered a grid of mechanoreceptors (80*80) as a patch of skin in which individual mechanoreceptors are located at 0.15 mm intervals5. A population of 296 first-order neurons were modeled according to biological observations and were consisted of 100 SA-I and 196 RA-I with overlapping innervation territories. Each primary afferent innervates 28 mechanoreceptors on average11 and is randomly weighted between 0.1 and 1. This branching leads to having complex receptive fields with multiple hotspots. To create the receptive field of SA-I afferents, we mapped a 10*10 network (100 SA-I neurons) on the 80*80 mechanoreceptor grid to cover all areas. The center of each section from the 10*10 mapped network is considered as a middle point of an individual receptive field. Then, 28 mechanoreceptors were chosen randomly using a Gaussian distribution in the $$x$$-axis and $$y$$-axis ($${\sigma }_{d}$$ in Table 2) and randomly weighted between 0.1 and 1. For RA-I afferents, we mapped a 14*14 network (196 RA-I neurons) on the 80*80 mechanoreceptor grid. The RA-I receptive field was generated similarly to the SA-I afferents. In total, 100 and 196 matrices with dimensions of 80 by 80 for SA-I and RA-I afferents were created, respectively.

The applied force distribution over the skin patch is modeled using a two-dimensional Gaussian function, and thus the output of the individual mechanoreceptor at location $$\left(x.y\right)$$ is shown as follows54:

$$\mathrm{f}\left(\mathrm{x},\mathrm{y}\right)=\mathrm{F}*\mathrm{exp}\left(-\left(\frac{{\left(\mathrm{x}-{\mathrm{x}}_{0}\right)}^{2}}{2*{\sigma }_{x}^{2}}+\frac{{\left(\mathrm{y}-{\mathrm{y}}_{0}\right)}^{2}}{2*{\sigma }_{y}^{2}}\right)\right)$$
(1)

where F is amplitude, (x0, y0) is center of pressure, and $$f\left(x,y\right)$$ is the perceived force for each mechanoreceptor at the location $$\left(x,y\right)$$. $${\sigma }_{x}= {\sigma }_{y}=0.05$$ are standard deviation. The output of Eq. (1) is shown in Fig. S2A.

The Izhikevich model was used to reproduce the adaptation dynamics of the mechanoreceptors55. Indeed, this neuron model is easily able to generate different spiking patterns by simple parameter adjustment56. For the Izhikevich model, the membrane potential, v, and the adaptation variable, u, were updated via the following differential equations which were discretized using Euler’s method with the discretizing step = $$0.1 ms$$:

$$\frac{dv}{dt}=0.04{v}^{2}+5v+140-u+{k}_{SA}{I}_{SA}+{k}_{RA}{I}_{RA}$$
(2)
$$\frac{du}{dt}=a(bv-u)$$
(3)
$$if\, v\ge 30 mV.\, then \left\{\begin{array}{c} v \leftarrow c\\ u \leftarrow u+d\end{array}\right.$$
(4)

The values of the parameters a, b, c, and d are reported in Table 3. In Eq. (2), for the SA-I model $${k}_{SA}=1 \mathrm{and }{k}_{RA}=0$$ and for the RA-I model $${k}_{SA}=0 \mathrm{and }{k}_{RA}=1$$.

For the static SA-I model:

$${I}_{SA}={k}_{1}{I}_{in}$$
(5)

For the dynamic SA-I model:

$${\tau }_{d\_SA}\frac{d{I}_{SA}}{dt}=x-{I}_{SA}$$
(6)
$${\tau }_{r\_SA}\frac{dx}{dt}=({k}_{2}\frac{d{I}_{in}}{dt}+{k}_{1}{I}_{in}-x)$$
(7)

For the RA-I model:

$${\tau }_{RA}\frac{d{I}_{RA}}{dt}={k}_{3}|\frac{d{I}_{in}}{dt}|-{I}_{RA}$$
(8)

where $${\tau }_{r\_SA}$$ and $${\tau }_{d\_SA}$$ are the rise and decay time of the proposed SA-I model, respectively. $$x$$ is an auxiliary variable that is used in the proposed SA-I model.$${I}_{in}$$ is the input current to the network and, $${\tau }_{RA}$$ is the time constant for the RA-I model.

Considering neurophysiological observation, the proposed spiking neuronal network of CN is comprised of two subpopulations of PNs and INs. Individual sub-populations are modeled by a random recurrent connection of spiking neurons with a connection probability of 0.2. Primary afferents (PA) make excitatory connections to both PN and IN spiking neuronal networks. Specifically, if a primary afferent excites a PN, neighboring afferents will excite INs to inhibit the activated PN (Fig. 5A). In this way, the concept of lateral inhibition is modeled. The simulated network model has 296 sensory input channels (PAs) that innervate each CN (PN and IN subpopulation). It should be pointed out that this number of afferents is less than the biological observation, which is around 1000s of PAs per CN57. To make the decoding problem more biologically relevant, in the simulations, we added intrinsic noise in the simulated pathways and considered the conduction velocities based on the synaptic delay for each layer.

Relying on prior neurophysiological findings, the local circuit in the somatosensory cortex area 3b was modeled by a neuronal network of 320 (160 PYs and 160 c-INs) spiking neurons. The cortical spiking network receives input from the PN subpopulation in the CN and is composed of a subpopulation of c-INs and a subpopulation of PYs. A different group of neurons in the cortical neuronal network are selective to different orientations. For each group, 10 PY and 10 c-IN was considered.

Synaptic inputs

The CN and cortical neurons were also modeled using the Izhikevich model. The dynamic equation of excitatory (AMPA) and inhibitory (GABA) currents are as follow:

$${\tau }_{dA}\frac{d{I}_{AMPA}}{dt}=-{I}_{AMPA}+{x}_{A}$$
(9)
$${\tau }_{rA}\frac{d{x}_{A}}{dt}=-{x}_{A}+{W}_{k\_ex}\sum_{PAs}\delta \left(t-{t}_{ex}^{*}-{\tau }_{L}\right)$$
(10)
$${\tau }_{dG}\frac{d{I}_{GABA}}{dt}=-{I}_{GABA}+{x}_{G}$$
(11)
$${\tau }_{rG}\frac{d{x}_{G}}{dt}=-{x}_{G}+{W}_{k-in}\sum_{in}\delta (t-{t}_{in}^{*}-{\tau }_{L})$$
(12)

where $${I}_{AMPA}$$ $$and {I}_{GABA}$$ are the excitatory and inhibitory synaptic currents received by the post-synaptic neuron, respectively. $${t}_{ex}^{*}$$ and $${t}_{in}^{*}$$ are the spike time received from pre-synaptic to the post-synaptic neuron. The latency of the post-synaptic currents is $${\tau }_{L}=1 ms$$58. Synaptic constant times are $${\tau }_{dA}=0.4 ms$$, $${\tau }_{rA}=2 ms$$, $${\tau }_{dG}=0.25 ms$$, $${\tau }_{rG}=5 ms$$58. In our simulations, these values are multiplied by 7. $${W}_{k}$$ is the synaptic weight of the connection between a pair of neurons.

Cortical receptive fields

Cortical neurons have specific receptive fields that are feature selective. The cortical receptive fields consist of complex spatial excitatory and inhibitory sub-regions on the skin. To create a receptive field for individual PYs, the synaptic plasticity of the selected neuron is activated to strengthen excitatory and inhibitory connections related to the tuned orientation. After that, synaptic weights are fixed for all experiments. For each neuron in the cortical layer, the cumulative spike counts of all afferents are weighted based on their receptive fields and then are summed to determine the cortical neuron response35. We allocated a group of 10 neurons per orientation in the cortical neuronal network and their receptive fields were distributed across the skin. Since we simulated 16 different angles, 160 spiking neurons were used for modeling the cortical area. When the excitatory (inhibitory) sub-region is activated on the skin, PY connections become stronger (c-IN inhibits the PYs).

Biomimetic decoder

The biomimetic decoder mimics the behavior of neuronal circuits in the somatosensory cortex17. The decoded orientation corresponds to the highest firing neuronal group. The biomimetic decoder gives a scalar value by counting the spikes of each cortical neurons within the neuronal group.

Experiment simulation

Simulated edges are indented at the center of the patch of skin for $$300 ms$$, including a $$50 ms$$ on-ramp, a $$200 ms$$ hold phase, and a $$50 ms$$ off-ramp. Equation (13) simulates an edge to define specific orientation which is determined by parameter $$\theta$$. The simulated edge vertically indents the simulated patch of skin (80*80 mechanoreceptor grid):

$$Edge(\theta )=\mathrm{exp}(-{(x*\mathrm{sin}\left(\theta \right)+y*\mathrm{cos}(\theta )}^{2})/(2*{w}^{2}))$$
(13)

$$x and y$$ are coordination of mesh grid (80*80) and each axis is between − 1 and 1. $$w=0.05$$ is the edge width and finally, $$\theta$$ is the orientation of the simulated edge. The output of Eq. (13) is shown in Fig. S2B for $$\theta =45^\circ$$. To simulate the dynamics of a scanned edge, the speed of moving edge across the patch of skin is $$24 mm/s$$ (12 $$mm$$ in 500 $$ms$$).

Noise

To improve the biological plausibility of the spiking neural model, a random fluctuation in the membrane potential is added (as intrinsic noise) to the neuron responses3. In this way, background activity is included in the population of neurons for each layer. The random noise is specified by a stochastic differential equation using a Gaussian random variable with mean 0 and standard deviation 1. Furthermore, to mimic the small variations in the presentation of stimulus and movement of skin in different trials, jitter in the depth (1 mm ± 0.5 mm SD) has been included. The numbers are used from3.

Spike timing analysis at the population level

To address how much spike timing is informative to decode edge orientation, we used the spike train distance metric as defined by VPd which fully has been explained in59.

PCA and classification

Principal component analysis60 is used to reduce the dimensionality of a feature space (using sklearn in Python). The feature space of simulated neural responses has high dimensionality and therefore is impossible to visualize. PCA gives the best possible representation of a p-dimensional dataset in $$\mathrm{z}$$ dimensions $$(\mathrm{z}<\mathrm{p})$$ by maximizing variance in $$\mathrm{z}$$ dimensions. In our simulations z = 3. Spiking responses are categorized across different time windows, starting from the first spike. For classification of the orientations, a KNN classifier with $$k=5$$ was used and decoding performance was evaluated using fivefold cross-validation. In this way, the process was repeated five times, and each of the five sets was used as the validation set once.