Extracting coordinates in stylized geometry

Anything that doesn't fit elsewhere.

Extracting coordinates in stylized geometry

Postby dinkc » Sat Mar 18, 2017 6:24 pm

Hello all,

I made 10 neurons with a soma,1 axon and 10 dendrites using 'template' function. The code works well and I could see my neurons in my shape plot. But now, I am trying to extract the coordinates for each of the section of my neurons which I created with stylized geometry using n3d(), x3d(), y3d() etc available in neuron syntax. The exact code I wrote for it is :
Code: Select all
forall {
   print secname()
   for i=0,n3d()-1 print i, x3d(i), y3d(i), z3d(i), diam3d(i)
}

Although it might look really easy, I got stuck in it since last few days. I only get the name of the section printed after executing this code. However, I do not get any coordinates which I wanted to have. When I just gave the command n3d() to check it, it returned me the value 0. I couldn't understand how the number of 3d locations could be 0? Could somebody kindly look into my code (the complete code with neuron model is attached below) and suggest me what went wrong? I would highly appreciate your help.

Sincerely,
Dina
Code: Select all
load_file("nrngui.hoc")

begintemplate Neuron
public soma, dend, axon

create soma, axon, dend[1]

proc init() {

    ndend = 10

    create soma, axon, dend[ndend]

    soma {
      nseg = 1
      diam = 80
      L = 80
      Ra = 123.0
      insert hh
      gnabar_hh=0.25
      gl_hh = .0001666
      el_hh = -60.0
    }

    axon {
      nseg = 100
      diam = 15
      L = 200
      Ra = 123
      insert hh
      gnabar_hh=0.25
      gl_hh = .0001666
      el_hh = -60.0
    }

   
  for i=0, ndend-1 dend[i] {
      nseg = 20
      diam = 1.0
      L = 100
      Ra = 123
      insert pas
      g_pas = .0001666
      e_pas = -60.0
    }

    // Connect things together
    connect axon(0), soma(0)
    for i=0, ndend-1 {
    connect dend[i](0), soma(1)
    }

    }
endtemplate Neuron


ndend = 10
nNeurons = 10

objectvar Neurons[nNeurons]

for i = 0, nNeurons-1 {
    Neurons[i] = new Neuron()
}


for i = 0, nNeurons-1 {
    Neurons[i].soma psection()
   
}

// This is where I have problem
forall {
   print secname()
   for i=0,n3d()-1 print i, x3d(i), y3d(i), z3d(i), diam3d(i)
}

access Neurons[0].soma


dinkc
 
Posts: 10
Joined: Mon Nov 28, 2016 1:38 pm

Re: Extracting coordinates in stylized geometry

Postby ted » Sun Mar 19, 2017 11:11 pm

Nothing went wrong. You used the stylized method (L, diam) to specify the geometry of your model's sections, but didn't do anything that would force generation of corresponding 3d data, so there are no 3d data. You'll want to read about define_shape(), or consider whether you want to create an instance of the ShapePlot class--see their entries in the Programmer's Reference.
ted
Site Admin
 
Posts: 4875
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine

Re: Extracting coordinates in stylized geometry

Postby dinkc » Mon Mar 20, 2017 5:32 pm

Dear Ted,

Thank you so much! I did as you said and it worked. Thanks a lot for your suggestion!

Yours sincerely,
Dina
dinkc
 
Posts: 10
Joined: Mon Nov 28, 2016 1:38 pm

Re: Extracting coordinates in stylized geometry

Postby ted » Mon Mar 20, 2017 9:18 pm

Here are a couple of suggestions.

1. Use the CellBuilder to generate cell class templates after you have set up topology (including definition of subsets), specified geometry (including specification of spatial discretization method), and biophysics (including algorithmic specification of spatial variation of channel densities), go to the Management page and click on Cell Type, specify the class name, and finally click on the button "Save hoc code in a file" (you may have to drag the bottom margin of the CellBuilder down to expose that button). The resulting code will be very nicely organized, human readable, and will contain useful procedures like the one that can be used to position each cell instance at the xyz location of your choice, and another that discretizes the cell according to the d_lambda rule (assuming that you selected the d_lambda rule as the discretization strategy). The file is also fully customizable by revising with a plain text editor; for example, instead of using the stylized (L, diam) specification of cell geometry, you can use the 3d specification which gives you complete control over section lengths and orientations as well as diameter variation over the length of any or all sections. For that matter, you could even generate the topology and geometry of the cell algorithmically.

2. When writing 3d a section's 3d specification, it is useful to treat the 0 end of each section as being located at 0,0,0, and specify the remaining 3d points of the section using relative coordinates (i.e. relative to the section's 0 end). After all connect statements have been executed, just call define_shape() and all sections will be translated so that the first point of each section has the same coordinates as the coordinates of the point in the parent section to which it is attached. This works as long as each non-root section is connected to the 0 or 1 end of its parent. (the root section of a model cell is the section that has no parent).
ted
Site Admin
 
Posts: 4875
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine


Return to Other questions

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest

cron