morph_tool.converter

A morphology converter that tries to keep the soma surface equal.

Functions

contour2centroid(mean, points)

This follows the function in lib/hoc/import3d/import3d_gui.hoc.

contourcenter(xyz)

Python implementation of NEURON code lib/hoc/import3d/import3d_sec.hoc.

convert(input_file, outputfile[, recenter, ...])

Run the appropriate converter.

cylinder_to_cylindrical_contour(neuron)

We convert the cylinder into a circular contour that represents the same sphere.

from_h5_or_asc(neuron, output_ext)

Convert from ASC/H5.

from_swc(neuron, output_ext)

Convert to SWC.

get_sides(points, major, minor)

Circular permutation of the points.

make_convex(sides, rads)

Keep only points that make path convex.

single_point_sphere_to_circular_contour(neuron)

Single point soma to contour soma.

soma_to_single_point(soma)

Surface preserving cylindrical soma to a single point sphere.

morph_tool.converter.contour2centroid(mean, points)

This follows the function in lib/hoc/import3d/import3d_gui.hoc.

Most of the comments are from there, so if you want to follow along, it should break up the function the same way.

morph_tool.converter.contourcenter(xyz)

Python implementation of NEURON code lib/hoc/import3d/import3d_sec.hoc.

morph_tool.converter.convert(input_file, outputfile, recenter=False, nrn_order=False, single_point_soma=False, sanitize=False)

Run the appropriate converter.

Parameters:
  • input_file (str) – path to input file

  • outputfile (str) – path to output file

  • recenter (bool) – whether to recenter the morphology based on the

  • soma (center of gravity of the) –

  • nrn_order (bool) – whether to traverse the neuron in the NEURON fashion

  • single_point_soma (bool) – For SWC only

  • sanitize (bool) – whether to sanitize the morphology

morph_tool.converter.cylinder_to_cylindrical_contour(neuron)

We convert the cylinder into a circular contour that represents the same sphere.

morph_tool.converter.from_h5_or_asc(neuron, output_ext)

Convert from ASC/H5.

morph_tool.converter.from_swc(neuron, output_ext)

Convert to SWC.

morph_tool.converter.get_sides(points, major, minor)

Circular permutation of the points.

So that the point with the largest coordinate along the major axis becomes the last point tobj = major.c.mul(d.x[i]) ###### unneeded? line 1191

morph_tool.converter.make_convex(sides, rads)

Keep only points that make path convex.

morph_tool.converter.single_point_sphere_to_circular_contour(neuron)

Single point soma to contour soma.

Transform a single point soma that represents a sphere into a circular contour that represents the same sphere.

morph_tool.converter.soma_to_single_point(soma)

Surface preserving cylindrical soma to a single point sphere.