Code: Select all
from neuron import h
import sys
def instantiate_swc(filename):
"""load an swc file and instantiate it"""
# load the NEURON library (just in case h is defined otherwise elsewhere)
# a helper library, included with NEURON
h.load_file('import3d.hoc')
# load the data. Use Import3d_SWC_read for swc, Import3d_Neurolucida3 for
# Neurolucida V3, Import3d_MorphML for MorphML (level 1 of NeuroML), or
# Import3d_Eutectic_read for Eutectic. (There is also an
# Import3d_Neurolucida_read for old Neurolucida files, but I've never seen one
# in practice; try Import3d_Neurolucida3 first.)
cell = h.Import3d_SWC_read()
cell.input(filename)
# easiest to instantiate by passing the loaded morphology to the Import3d_GUI
# tool; with a second argument of 0, it won't display the GUI, but it will allow
# use of the GUI's features
i3d = h.Import3d_GUI(cell, 0)
i3d.instantiate(None)
def main(filename):
instantiate_swc(filename)
if __name__ == '__main__':
filename = sys.argv[1]
main(filename)
Code: Select all
NEURON -- VERSION 7.4 (1316:353c7c3ecd8d) 2015-04-03
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2015
See http://www.neuron.yale.edu/neuron/credits
NEURON: hoc_sf_ not declared at the top level
in import3d/read_swc.hoc near line 10
external hoc_sf_
^
xopen("import3d/r...")
xopen("import3d.hoc")
execute1("{xopen("im...")
load_file("import3d.hoc")
Command terminated