I calculated voltage spread along the branched dendritic tree in Matlab, so I have data for voltage on each branch as a function of space and time. I would like to visualise these data in Neuron as Shape Shape plot (colorcoded). I have branched tree geometry that I used in my calculations in Matlab in the form of .hoc file.
Is there any way I can do it?
Many thanks.
Calculation in Matlab  Visualisation in Neuron

 Posts: 40
 Joined: Wed May 18, 2005 10:23 pm
 Location: Yale University School of Medicine
 Contact:
try this for setting the voltage
Let's say you just had two compartments a soma and a dend
Then your program could say
soma.v(0.5)=10
dend.v(0.5)= 20
You might want to write matlab code that writes hoc code similar to above.
So you probably get the idea of what to do with your matlab values. If not please ask more.
Then your program could say
soma.v(0.5)=10
dend.v(0.5)= 20
You might want to write matlab code that writes hoc code similar to above.
So you probably get the idea of what to do with your matlab values. If not please ask more.
Re: try this for setting the voltage
It is not excatly what my problem is.tom_morse wrote:Let's say you just had two compartments a soma and a dend
Then your program could say
soma.v(0.5)=10
dend.v(0.5)= 20
You might want to write matlab code that writes hoc code similar to above.
So you probably get the idea of what to do with your matlab values. If not please ask more.
Say, I have a data file  voltage on each branch of a dendritic tree as a function of time (so it is M by N(i) matrix for each branch i). I would like to visualise (plot) these data in Neuron as Shape Shape plot for some fixed time assuming that I upload the corresponding to these data morphology.
Thanks.

 Site Admin
 Posts: 5702
 Joined: Wed May 18, 2005 4:50 pm
 Location: Yale University School of Medicine
 Contact:
In very broad outline, here's how:
Set up a passive model in NEURON and discover where its internal nodes are located.
Use your Matlab program to compute the time course of v at points that correspond to the
internal nodes of your NEURON passive model. If it can't do that, you'll need to interpolate.
To each internal node in your NEURON model, attach an SEClamp and set up Vector play
so that the Matlabcomputed time course of v will drive the potential at that point.
"The details are left as an exercise to the reader."
Set up a passive model in NEURON and discover where its internal nodes are located.
Use your Matlab program to compute the time course of v at points that correspond to the
internal nodes of your NEURON passive model. If it can't do that, you'll need to interpolate.
To each internal node in your NEURON model, attach an SEClamp and set up Vector play
so that the Matlabcomputed time course of v will drive the potential at that point.
"The details are left as an exercise to the reader."

 Posts: 40
 Joined: Wed May 18, 2005 10:23 pm
 Location: Yale University School of Medicine
 Contact:
code sample
The following code sample displays a shapeshape plot by playing vectors into the voltage of the sections. It is better to voltage clamp the sections but this will probably work for you. The shp.ses file was created by saving the shape shape plot as a session file and is included after the long dashed line. You might want to lower 1e6 for a slower processor, raise for a faster processor. Start with "nrngui shapeshape.hoc" File shapeshape.hoc:
 shp.ses:
Code: Select all
create soma
create dend
soma connect dend(0), 1
objref v1, v2
num_of_time_pts = tstop/dt+1 // if tstop was 1 ms and dt=1ms, you have two pts t=0, 1
v1 = new Vector(num_of_time_pts)
v2 = new Vector(num_of_time_pts)
volt1=120
volt2=40
// make one section go up, the other go down
v1.indgen(volt1, volt2 , (volt2volt1)/(num_of_time_pts1))
v2.indgen(volt2, volt1 , (volt1volt2)/(num_of_time_pts1)).mul(1)
v1.play(&soma.v(0.5), dt)
v2.play(&dend.v(0.5), dt)
access soma
load_file("shp.ses")
PlotShape[0].exec_menu("Shape Plot")
x=0 // needed initialization
init()
while (t<=tstop) {
step()
flushPlot()
for i=1,1e6 { x=x+11 } // add delay to see graph
}
Code: Select all
{load_file("nrngui.hoc")}
objectvar save_window_, rvp_
objectvar scene_vector_[3]
objectvar ocbox_, ocbox_list_, scene_, scene_list_
{ocbox_list_ = new List() scene_list_ = new List()}
{pwman_place(0,0,0)}
{
save_window_ = new PlotShape(0)
save_window_.size(221.75,421.75,321.237,321.237)
save_window_.variable("v")
scene_vector_[2] = save_window_
{save_window_.view(221.75, 321.237, 643.5, 642.474, 251, 173, 200.64, 200.32)}
fast_flush_list.append(save_window_)
save_window_.save_name("fast_flush_list.")
}
{
xpanel("RunControl", 0)
v_init = 65
xvalue("Init","v_init", 1,"stdinit()", 1, 1 )
xbutton("Init & Run","run()")
xbutton("Stop","stoprun=1")
runStopAt = 5
xvalue("Continue til","runStopAt", 1,"{continuerun(runStopAt) stoprun=1}", 1, 1 )
runStopIn = 1
xvalue("Continue for","runStopIn", 1,"{continuerun(t + runStopIn) stoprun=1}", 1, 1 )
xbutton("Single Step","steprun()")
t = 1.55
xvalue("t","t", 2 )
tstop = 5
xvalue("Tstop","tstop", 1,"tstop_changed()", 0, 1 )
dt = 0.025
xvalue("dt","dt", 1,"setdt()", 0, 1 )
steps_per_ms = 40
xvalue("Points plotted/ms","steps_per_ms", 1,"setdt()", 0, 1 )
screen_update_invl = 0.05
xvalue("Scrn update invl","screen_update_invl", 1,"", 0, 1 )
realtime = 0
xvalue("Real Time","realtime", 0,"", 0, 1 )
xpanel(768,134)
}
objectvar scene_vector_[1]
{doNotify()}