Page 1 of 1
forsec on external object?
Posted: Thu May 07, 2009 3:02 pm
by mctavish
I am trying to write a non-cellular object that operates on other cell objects, gathering information of the sections in the cell. The routines should operate on any generic cell. I simply want to call forall or forsec, but just on whatever cell object I am using. This works fine if the code that gathers the information on the cell is not an object itself (i.e., it is not a template). When the code that gathers the information is also an object, however, I cannot get it to work. Any ideas?
Thanks,
Tom
Re: forsec on external object?
Posted: Fri May 08, 2009 11:09 am
by ted
Are you dealing with cell classes that have properly defined "all" subsets? If so, your non-cell class object foo could contain a public proc bar like this
proc bar() {
forsec $o1.all { . . . }
}
and
foo.bar(somecellobjref)
would iterate over just somecellobjref's sections.
Re: forsec on external object?
Posted: Mon Jun 01, 2009 2:38 pm
by mctavish
This is a general method, and while I can define "all" in my own cells, I'd like to deal with other cell models that do not have "all" defined. Is there another way?
Thanks,
Tom
Re: forsec on external object?
Posted: Mon Jun 01, 2009 9:26 pm
by ted
Beats me. First thing I'd do with any cell class that lacks an all set would be to . . . define an all set. Maybe Michael Hines has a different trick up his sleeve.
Re: forsec on external object?
Posted: Tue Jun 02, 2009 7:06 am
by hines
If you can get any section of an object as the currently accessed section, then you can create a whole cell section list with
http://www.neuron.yale.edu/neuron/stati ... #wholetree
(Of course this won't work in the case an object holds more than one tree , e.g. after multisplit)
WIthout knowing anything about internal section names, sectionlists, or connectivity, the only way I can think of offhand to
create an "all" sectionlist is to use a top level object reference and a top level procedure as in:
Code: Select all
// example cell template
begintemplate Cell
public soma, axon
create soma, axon
endtemplate Cell
// 5 of them for our test
objref cells[5]
for i=0,4 cells[i] = new Cell()
// use the built-in hoc_obj_[0] to create the
// sectionlist. Any global objref would do.
proc cellall() {
hoc_obj_[0] = new SectionList()
object_push($o1)
forall {
execute("hoc_obj_[0].append()")
}
object_pop()
// for testing
forsec hoc_obj_[0] { print secname() }
}
// test
cellall(cells[1])
cellall(cells[3])
Re: forsec on external object?
Posted: Wed Jun 03, 2009 12:40 am
by mctavish
Thanks! I did not know about wholecell(). I've combined both of these approaches to give me a SectionList in root-to-leaf order without accessing globals:
Code: Select all
objref sl
sl = new SectionList()
object_push(cellObj)
forall {
execute("sl.wholetree()")
break // Stop after the first section
}
object_pop()
// for testing
forsec sl { print secname() }