Apply extracellular stimulation using electric field
Apply extracellular stimulation using electric field
Hi, ted
I am interested in the effects of brain stimulation to pyramidal cell. So, previously, I calculated stimulus-induced potential fields using FEM and then applied it to each compartment of pyramidal cells using e_extracellular(x).
Similarly, I want to apply extracellular stimulation using electric field (mV/mm) not potential field (mV).
For example, I calculate stimulus-induced electric field (Ex, Ey, Ez; mV/mm) at each segment of each compartments of pyramidal cell.
Is there any way to apply extracellular stimulation by electric field?
For solving this problem, I read the paper McIntyre 2002. It seems that it calculates current density norm and then applies intracellular stimulation at each segment with just modifying(different) amplitude. Am I understand properly?
Then, is it okay that calculating current density norm(A/m2) at each segment and then apply it as intracellular stimulation?
Best regards,
Angela
I am interested in the effects of brain stimulation to pyramidal cell. So, previously, I calculated stimulus-induced potential fields using FEM and then applied it to each compartment of pyramidal cells using e_extracellular(x).
Similarly, I want to apply extracellular stimulation using electric field (mV/mm) not potential field (mV).
For example, I calculate stimulus-induced electric field (Ex, Ey, Ez; mV/mm) at each segment of each compartments of pyramidal cell.
Is there any way to apply extracellular stimulation by electric field?
For solving this problem, I read the paper McIntyre 2002. It seems that it calculates current density norm and then applies intracellular stimulation at each segment with just modifying(different) amplitude. Am I understand properly?
Then, is it okay that calculating current density norm(A/m2) at each segment and then apply it as intracellular stimulation?
Best regards,
Angela
-
- Site Admin
- Posts: 6300
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: Apply extracellular stimulation using electric field
Modeling is all about trying to gain insight to how complex physical systems work by studying simpler model systems that involve approximations. The modeler needs to have good reason for believing that the approximations are "acceptable" i.e. allow the model to produce results that are "good enough" for the problem that is being investigated. Also, the modeler must be able to convince others that the results are good enough.
The approach used by McIntyre et al. in 2002 is based on the activating function, which Frank Rattay first introduced years before as a means for approximating the effects of extracellular fields on neurons. It would be a good idea to read about the approximations that are inherent in the activating function--you'll find a short but informative discussion of those in this paper by Joucla and Yvert
Modeling extracellular electrical neural stimulation:
From basic understanding to MEA-based applications
Journal of Physiology - Paris 106 (2012) 146–158
http://www.elsevier.com/locate/jphysparis
My own preference is to use actual extracellular potential, but you need to make your own decision based on your own model cells etc..
The approach used by McIntyre et al. in 2002 is based on the activating function, which Frank Rattay first introduced years before as a means for approximating the effects of extracellular fields on neurons. It would be a good idea to read about the approximations that are inherent in the activating function--you'll find a short but informative discussion of those in this paper by Joucla and Yvert
Modeling extracellular electrical neural stimulation:
From basic understanding to MEA-based applications
Journal of Physiology - Paris 106 (2012) 146–158
http://www.elsevier.com/locate/jphysparis
My own preference is to use actual extracellular potential, but you need to make your own decision based on your own model cells etc..
Re: Apply extracellular stimulation using electric field
Thank you for your answer and the recommended paper was very helpful.
Since the solution field by transcranial magnetic stimulation (TMS) is electric field, I am decided to use activating function approach.
For this, I reference the Pashut 2011 paper and code https://senselab.med.yale.edu/ModelDB/S ... del=138321.
In this paper, they approximate the additional membrane current in each section by below code
Then it is applied by
Then the unit of "DEDA_xtra(x)/ri(x)" is ms/m2; my question is I don't know why they multiply L/nseg (unit: micrometer).
(In this paper, the unit of rx_xtra is ms/m2)
Since the solution field by transcranial magnetic stimulation (TMS) is electric field, I am decided to use activating function approach.
For this, I reference the Pashut 2011 paper and code https://senselab.med.yale.edu/ModelDB/S ... del=138321.
In this paper, they approximate the additional membrane current in each section by below code
Code: Select all
x_xtra(xr:xrf)=int(xint.x[ii]):xint.x[ii+1] //[micrometer]
y_xtra(xr:xrf)=int(yint.x[ii]):yint.x[ii+1]
DX_xtra(xr:xrf)=xint.x[ii+1]-xint.x[ii]:xint.x[ii+1]-xint.x[ii] //[micrometer]
DY_xtra(xr:xrf)=yint.x[ii+1]-yint.x[ii]:yint.x[ii+1]-yint.x[ii]
Exs_xtra(xr:xrf)=Ex.x[x_xtra(xr)][0]:Ex.x[x_xtra(xrf)][0] //[V ms/m A microm]
BB=(Exs_xtra(xrf)-Exs_xtra(xr))*DX_xtra(xr)/(DX_xtra(xr)^2+DY_xtra(xr)^2)
Code: Select all
rx_xtra(x)=-1*(L/nseg)*DEDA_xtra(x)/ri(x) // [ms/m2] the L/nseg is to convert the calculation
// to the entire segment.
(In this paper, the unit of rx_xtra is ms/m2)
-
- Site Admin
- Posts: 6300
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: Apply extracellular stimulation using electric field
I hoped it would help you decide that direct control of the model's extracellular potential was better than the activating function approach, because the latter depends on an approximation that can cause very large errors.Hyeon wrote:Thank you for your answer and the recommended paper was very helpful.
Yes, Pashut et al. (2011) is an interesting paper, but it uses the activating function approximation. Besides, you already know your own model's extracellular field, so you can use that to calculate extracellular potential, and then you can apply that potential directly to the outer surface of your model cell. See viewtopic.php?f=28&t=168.
Don't be shy--send the authors an email and ask them.my question is I don't know why they multiply L/nseg (unit: micrometer).
(In this paper, the unit of rx_xtra is ms/m2)
You might also ask about whether they would like to say anything about this statement on page 3 of their article
which is misleading. Indeed, it should have been caught by the reviewers even if they didn't see any code. Why? Because saying there is a "nonspecific leak current" with "zero reversal potential" means that there is current flowing through a nonselective ion channel in the membrane, and that this current is the product of channel conductance and transmembrane potential. The authors couldn't possibly have meant that magnetic stimulation causes the appearance of nonselective channels in cell membranes, or that introducing such channels into a model is electrically equivalent to the effects of magnetic stimulation on a neuron--but that's exactly what they said.To simulate MS of a
neuron with arbitrary morphology, this current was added to each
segment of the neuron as a nonspecific leak current with a zero
reversal potential
Re: Apply extracellular stimulation using electric field
I ask my question to the authors, but unfortunately they don't give the answer; because they cannot remember it as it is done almost five years ago.
There are some ambiguous things to me, so I will be very pleased if you let me know the answers.
First, electric field induced by transcranial magnetic stimulation (TMS) is calculated, and then
they calculate the approximation of additional membrane current in each section of neuronal model as
In the code, they multiply -1*(L/nseg)/ri(x) to gradient of E-field; I understand that ri(x) is axial resistance but I don't know the role of (L/nseg)..
Then, I think that I can apply it to control peak value of temporal function which is an under-damped current of an RLC circuit induced by TMS;
I try to find other papers to understand how it goes, but I have a trouble to figure out.
There are some ambiguous things to me, so I will be very pleased if you let me know the answers.
First, electric field induced by transcranial magnetic stimulation (TMS) is calculated, and then
they calculate the approximation of additional membrane current in each section of neuronal model as
where r_a is the axial resistance per unit length.I_m = -1*(gradient of E-field)/r_a
In the code, they multiply -1*(L/nseg)/ri(x) to gradient of E-field; I understand that ri(x) is axial resistance but I don't know the role of (L/nseg)..
Then, I think that I can apply it to control peak value of temporal function which is an under-damped current of an RLC circuit induced by TMS;
However, they defined stimulus injected to the neuronal model by I_m*(differentiation of I(t)).I(t) = i_peak*sin(w t)*exp(-t/tau)
I try to find other papers to understand how it goes, but I have a trouble to figure out.
-
- Site Admin
- Posts: 6300
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: Apply extracellular stimulation using electric field
It sounds like the authors are too busy to bother answering your question. That's strange and short-sighted on their part. A lot of work went into that paper, and they clearly wanted other neuroscientists to know what they did and how they did it--why else would they submit the paper for publication, or deposit their source code into ModelDB for attributed reuse?Hyeon wrote:I ask my question to the authors, but unfortunately they don't give the answer; because they cannot remember it as it is done almost five years ago[emphasis added].
Those authors are all smart, so if they did something, it's probably correct. Even so, one of them should answer your question, or they're dropping the ball. It's a simple technical question, but it's key to their method, and method is a big part of their paper.
Please understand that I am not responsible for the technical or scientific content of anyone else's papers but my own. I didn't develop the method those authors used to represent the effects of TMS, I didn't write their code, didn't write their paper, didn't get academic credit for publishing their paper, received no support from their institutions or the grants that funded their work, and I have never been involved in wet-lab or computational research on transcranial magnetic stimulation. Consequently I can only provide you with answers that I already know or that do not require significant time or effort to derive.There are some ambiguous things to me, so I will be very pleased if you let me know the answers.
In NEURON, L and nseg would be the anatomical length and discretization parameter of the currently accessed section. L/nseg would be the length of a segment.In the code, they multiply -1*(L/nseg)/ri(x) to gradient of E-field; I understand that ri(x) is axial resistance but I don't know the role of (L/nseg).
Unless you're trying to develop a model that involves TMS, much of their code will not be relevant to your particular application. For electrical stimulation of brain, it is technically more sound to control e_extracellular directly, as in the example code that I mentioned in my previous post. Also, this direct approach avoids the limitations of the activating function approach. Finally, the direct approach can be used even if you are trying to develop a model that involves TMS--all you need is the detailed time course of extracellular potential at locations that correspond to segment centers. If you need to modify my code in order to control the detailed time course of the stimulus waveform, that I can help you with. Even though I have not formally published that code in an article, I do take responsibility for my own work.
Re: Apply extracellular stimulation using electric field
Dear Hyeon,
We also tried to use Pashut et al. (2011) TMS model. After few days working with model posted on modeldb, I have found two horrible bugs in the 2D code.
The first is that: matlab part of this model generates two matrices 4001x4001 points of Ex and Ey components of electric field. Matlab code writes these matrices into text files. NEURON code reads matrices of size 4000x4000 from these files. As a result each line in electric field matrices is shifted by one element in NEURON model. That creates very strong, unreal gradient of electric field.
The second is connected to NEURON's representation of compartments. Authors add artificial long axon to multi-compartment model of pyramidal neuron. Unfortunately they used 'parent' cordinats for each axon segments. NEURON sorts this out and draws this axon as line, because compartments connect to each other. However in magnetism.hoc, authors use vertices position to calculate current induced by magnetic field. That means all axon compartments are located in the same position in the vector field (you can find this if scan 3d vertices of the axon's compartments). This place is exactly the place where 'artificial' gradient in electric field appears. As a result, strong axial current in axon is generated by these two bugs.
Unfortunately, when I fixed these bugs, I couldn't get anything useful from this model.
Figure below shows: how it should be(left) and how it actually is (right) in the model from model DB
We also tried to use Pashut et al. (2011) TMS model. After few days working with model posted on modeldb, I have found two horrible bugs in the 2D code.
The first is that: matlab part of this model generates two matrices 4001x4001 points of Ex and Ey components of electric field. Matlab code writes these matrices into text files. NEURON code reads matrices of size 4000x4000 from these files. As a result each line in electric field matrices is shifted by one element in NEURON model. That creates very strong, unreal gradient of electric field.
The second is connected to NEURON's representation of compartments. Authors add artificial long axon to multi-compartment model of pyramidal neuron. Unfortunately they used 'parent' cordinats for each axon segments. NEURON sorts this out and draws this axon as line, because compartments connect to each other. However in magnetism.hoc, authors use vertices position to calculate current induced by magnetic field. That means all axon compartments are located in the same position in the vector field (you can find this if scan 3d vertices of the axon's compartments). This place is exactly the place where 'artificial' gradient in electric field appears. As a result, strong axial current in axon is generated by these two bugs.
Unfortunately, when I fixed these bugs, I couldn't get anything useful from this model.
Figure below shows: how it should be(left) and how it actually is (right) in the model from model DB
Re: Apply extracellular stimulation using electric field
Thanks for kind explanation.
I studied the NEURON book and related paper for this issue, and understand what is the problem of Pashut code that ted mentioned before (apply MS as a nonspecific leak current .. part).
What I am trying to do is, I calculate potential/electrical field using finite element head model and then apply this potential/electric field to the neuronal model.
When I studied electrical stimulation I used 'e_extracellular' function directly, because the solution of electrical stimulation is potential field.
However, for magnetic stimulation, I got electrical field at each node point of finite element head mesh.
If this electric field is converted to potential field, I can easily apply 'e_extracellular' function; but as I use complicated head mesh, it was not easy to convert it to potential field.
That's why I search the way how to apply electric field to the neuronal model.
Therefore, the previous research related to magnetic stimulation calculated transmembrane current induced by each compartment by differentiation of electric field.
Then they injected it into each compartment to simulate the effect of magnetic stimulation.
so my question is, I don't know how additional transmembrane current at each compartment applied..
I read NMODL part of NEURON book and I try to make it similar way.
But I don't know how to do this. is it proper to use point process? and this current can be designed by NONSPECIFIC_CURRENT or ELECTRODE_CURRENT?
Best regards,
Angela
I studied the NEURON book and related paper for this issue, and understand what is the problem of Pashut code that ted mentioned before (apply MS as a nonspecific leak current .. part).
What I am trying to do is, I calculate potential/electrical field using finite element head model and then apply this potential/electric field to the neuronal model.
When I studied electrical stimulation I used 'e_extracellular' function directly, because the solution of electrical stimulation is potential field.
However, for magnetic stimulation, I got electrical field at each node point of finite element head mesh.
If this electric field is converted to potential field, I can easily apply 'e_extracellular' function; but as I use complicated head mesh, it was not easy to convert it to potential field.
That's why I search the way how to apply electric field to the neuronal model.
Therefore, the previous research related to magnetic stimulation calculated transmembrane current induced by each compartment by differentiation of electric field.
Then they injected it into each compartment to simulate the effect of magnetic stimulation.
so my question is, I don't know how additional transmembrane current at each compartment applied..
I read NMODL part of NEURON book and I try to make it similar way.
But I don't know how to do this. is it proper to use point process? and this current can be designed by NONSPECIFIC_CURRENT or ELECTRODE_CURRENT?
Best regards,
Angela
-
- Site Admin
- Posts: 6300
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: Apply extracellular stimulation using electric field
If that's what you have to do, that's what you have to do.Hyeon wrote:for magnetic stimulation, I got electrical field at each node point of finite element head mesh.
If this electric field is converted to potential field, I can easily apply 'e_extracellular' function; but as I use complicated head mesh, it was not easy to convert it to potential field.
That's why I search the way how to apply electric field to the neuronal model.
Therefore, the previous research related to magnetic stimulation calculated transmembrane current induced by each compartment by differentiation of electric field.
Then they injected it into each compartment to simulate the effect of magnetic stimulation.
BTW, these references are supposed to contain critiques of the activating function approach:
IEEE Trans Biomed Eng. 2001 Feb;48(2):173-84.
Analysis of a linear model for electrical stimulation of axons--critical remarks on the "activating function concept".
Zierhofer CM
PMID:
11296873
Prog Biophys Mol Biol. 2005 Jan;87(1):17-31.
Simple models of stimulation of neurones in the brain by electric fields.
Iles JF
PMID:
15471588
IEEE Trans Biomed Eng. 1994 Jun;41(6):601-6.
Focal magnetic stimulation of an axon.
Basser PJ
PMID:
7927380
First answer this question, and I will tell you the best approach: does the orientation of the field remain constant during a simulation? That is, can the field E(x,y,z,t) be written as the product u(x,y,z)*F(t) where u is a unit vector that specifies the orientation of the field and depends only on position, and F is a scalar that depends only on time?I don't know how additional transmembrane current at each compartment applied..
I read NMODL part of NEURON book and I try to make it similar way.
Re: Apply extracellular stimulation using electric field
Yes, the u(x,y,z) is assigned by axial direction at each center point of each compartment of neuronal model and F is a scalar that depends only on time which is calculated in finite element head model.
And thanks for recommended papers and I have to keep in mind.
And thanks for recommended papers and I have to keep in mind.
-
- Site Admin
- Posts: 6300
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: Apply extracellular stimulation using electric field
So the extracellular potential at some point (x,y,z) in a conductive medium depends on the shape of the cell? We have to resolve this before proceeding further. Imagine two different cells whose axons cross at right angles at some point p, where one runs parallel to the direction of the current induced by the magnetic field, and the other is oriented orthogonally to that current. Clearly they can't have different extracelluar potentials at p--the potential at p must depend on the geometry and electrical properties of the medium, and the geometry and time course of the magnetic field.Hyeon wrote:Yes, the u(x,y,z) is assigned by axial direction at each center point of each compartment of neuronal model
Re: Apply extracellular stimulation using electric field
Sorry, I did not answer properly.
At each center point of each compartment, applied membrane current is a scalar value.
This membrane current is determined by u(x,y,z) which represents axial direction and F(x,y,z) which is electric field at some point p(x,y,z).
Then, this membrane current (scalar) will be multiplied with time component.
Therefore, even in the same point p, it has different membrane current according to cell morphology.
At each center point of each compartment, applied membrane current is a scalar value.
This membrane current is determined by u(x,y,z) which represents axial direction and F(x,y,z) which is electric field at some point p(x,y,z).
Then, this membrane current (scalar) will be multiplied with time component.
Therefore, even in the same point p, it has different membrane current according to cell morphology.
-
- Site Admin
- Posts: 6300
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: Apply extracellular stimulation using electric field
OK, except (1) F depends on both location and time, and (2) this discussion is drifting away from the point that I was originally trying to make.Hyeon wrote:At each center point of each compartment, applied membrane current is a scalar value.
This membrane current is determined by u(x,y,z) which represents axial direction and F(x,y,z) which is electric field at some point p(x,y,z).
Then, this membrane current (scalar) will be multiplied with time component.
Which is this: the current you have to inject into any particular compartment of your model can be written as the product of two terms. One term depends on time, and the other term depends on things that remain constant during the simulation:
is = k*f(t)
where f depends only on the time course of the current that flows through the coil,
and k depends only on things that remain constant during a simulation (the geometry and electrical properties of the conductive medium, the orientation of the longitudinal axis of the compartment, and the location of the center of the compartment).
And you can calculate both f(t) and each compartment's k in advance, save them in files, and use them when you want to run a simulation. If you know f(t) and each compartment's k, it is very easy to make this happen during a simulation (in pseudocode):
Code: Select all
at each new time step:
for each compartment in the model cell {
calculate this compartment's is as the product k*f(t)
where f(t) is the same for all compartments, and each compartment has its own value of k
add is to this compartment's charge balance equation
}
}
Code: Select all
COMMENT
mag.mod, based on xtra.mod
An auxiliary mechanism used to implement an activating-function-like
representation of magnetic stimulation. Assumes that the current
that must be injected to any given compartment can be written as
is = k*f(t)
where each compartment has its own value of k
and all compartments get the same value of f(t)
ENDCOMMENT
NEURON {
SUFFIX mag
NONSPECIFIC_CURRENT is
RANGE k, is
GLOBAL f
}
UNITS {
(mA) = (milliamp)
}
PARAMETER {
f = 0 (1)
k = 0 (mA/cm2)
}
ASSIGNED {
is (mA/cm2)
}
BEFORE BREAKPOINT { : before each cy' = f(y,t) setup
is = k*f
}
Now create a pair of Vectors called fvec and tvec where
fvec contains the sampled time course of f, and
tvec contains the corresponding time values
(you can do this by reading precalculated values from a file).
Then execute this statement
fvec.play(&f_mag, tvec)
and the waveform, whose time course is stored in fvec and tvec, will be used as a forcing function that drives f_mag during a simulation, and the mag mechanism will make sure that each compartment gets the correct injected current. If you are not familiar with the Vector class's play method, please read about it in the Programmers' Reference.
Re: Apply extracellular stimulation using electric field
Thanks for your kind explanation, ted.
I have one more question.
I found that the NMODL code is similar with 'a passive leak current' in 9.2 Example in book.
Since tms pulse has opposite direction with leak current, is it reasonable to multiply is = (-1)*k*f rather than is = k*f?
I have one more question.
I found that the NMODL code is similar with 'a passive leak current' in 9.2 Example in book.
Since tms pulse has opposite direction with leak current, is it reasonable to multiply is = (-1)*k*f rather than is = k*f?
-
- Site Admin
- Posts: 6300
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: Apply extracellular stimulation using electric field
You could do that, or you could do something that makes more sense than what I did when I wrote the declaration
NONSPECIFIC_CURRENT is
That really should have been
ELECTRODE_CURRENT is
Then is>0 would mean that is depolarizes the cell, and you wouldn't have to change
is = k*f
to
is = -k*f
Also, an ELECTRODE_CURRENT is not included in the calculation that NEURON does when it calculates i_membrane, and that makes sense too because it's not actually generated by current flowing through an ion channel, membrane capacitance, or transport mechanism like an ion pump or exchanger.
NONSPECIFIC_CURRENT is
That really should have been
ELECTRODE_CURRENT is
Then is>0 would mean that is depolarizes the cell, and you wouldn't have to change
is = k*f
to
is = -k*f
Also, an ELECTRODE_CURRENT is not included in the calculation that NEURON does when it calculates i_membrane, and that makes sense too because it's not actually generated by current flowing through an ion channel, membrane capacitance, or transport mechanism like an ion pump or exchanger.