Class for making a Shape window for executing a user defined action when a section is clicked on. (When the section mode is selected from the mouse menu.) An argument of 0 will prevent default mapping of the window. If the first arg is a SectionList (then a second arg of 0 will prevent default mapping) then only the sections in the list are drawn. Shape is redrawn automatically whenever length or diameter of a section changes.
Warning
The form of the constructor that takes a SectionList does not currently work in Python.
.size(mleft, mright, mbottom, mtop)
...
Model coordinates for the scene. This is the "whole scene" size. Since, the aspect ratio for shape views is unity, the bounding box expressed by the arguments may not fit exactly on the screen window. The scale factor is decreased so that the first view window displays the entire bounding box with the center of the bounding box in the center of the view.
See Graph.size() for other, more rarely use argument sequences.
Description:
- mode = 0
- displays diameters
- mode = 1
- displays centroid. ie line through all the 3d points.
- mode = 2
- displays schematic. ie line through 1st and last 2d points of each section.
shape.observe()
shape.observe(sectionlist)
In the context of the pyramidal cell demo of neurondemo (launch via neurondemo --python) the following will change the Shape shown in the point process manager to show only the soma and the main part of the primary dendrite.
from neuron import h
sl = h.SectionList()
sl.append(sec=h.soma)
sl.append(sec=h.dendrite_1[8])
h.Shape[0].observe(sl)
.point_mark(objvar, colorindex)
.point_mark(objvar, colorindex, style)
.point_mark(objvar, colorindex, style, size)
draw a little filled circle with indicated color where the point process referenced by objvar is located. Note, if you subsequently relocate the point process or destroy it the proper thing will happen to the mark. (at least after a flush)
The optional arguments specify the style and size as in the Graph.mark() method of Graph. This extension was contributed by Yichun Wei yichunwe@usc.edu.
See also
See also
See also
The following example will work if executed in the context of the pyramidal cell demo of the neurondemo. It colors red the section you click nearest and prints the name and position of the selected section as well as the mouse distance the selection.
from neuron import h
ss = h.Shape[0]
def p(type, x, y, keystate):
if type == 2:
ss.color_all(1)
d = ss.nearest(x, y)
arc = ss.push_selected()
if arc >= 0:
ss.select()
print '%g from %s(%g)' % (d, h.secname(), a)
h.pop_section()
ss.menu_tool('test', p)
ss.exec_menu('test')
Syntax:
arc = shape.push_selected() if arc >= 0: # do something, then end with: h.pop_section()
Note
The pushed section can be read via h.cas().
Note
It is important that a pop_section() be executed if a section is pushed onto the stack.
Warning
The arc position is relevant only if the section was selected using Shape.nearest(). Note, e.g., that Shape.select() does not set the arc position.
shape.rotate()
shape.rotate(xorg, yorg, zorg, xrad, yrad, zrad)