morph_tool.converter

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

Functions

choose_target_soma_type(neuron, output_ext)

Choose a target soma type based on the given output extension.

contour2centroid(mean, points)

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

contour_to_cylinders(neuron)

Convert the simple contour into a cylinder.

contourcenter(xyz)

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

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

Run the appropriate converter.

convert_soma(neuron, output_ext[, ...])

Convert the soma of the given neuron to the required soma type.

cylinder_stack_to_cylindrical_contour(neuron)

Convert the cylinder into a simple contour that represents the same sphere.

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[, ensure_NRN_area])

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.choose_target_soma_type(neuron, output_ext)

Choose a target soma type based on the given output extension.

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.contour_to_cylinders(neuron)

Convert the simple contour into a cylinder.

morph_tool.converter.contourcenter(xyz)

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

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

Run the appropriate converter.

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

  • output_file (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

  • ensure_NRN_area (bool) – to ensure area is preserved in NEURON from swc point soma

morph_tool.converter.convert_soma(neuron, output_ext, ensure_NRN_area=False)

Convert the soma of the given neuron to the required soma type.

morph_tool.converter.cylinder_stack_to_cylindrical_contour(neuron)

Convert the cylinder into a simple contour that represents the same sphere.

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, ensure_NRN_area=False)

Convert from ASC/H5.

morph_tool.converter.from_swc(neuron, output_ext, ensure_NRN_area=False)

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, ensure_NRN_area=False)

Single point soma to contour soma.

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

With ensure_NRN_area=True, we perform a search on radius to ensure an equivalent soma surface area, as measured by NEURON with morph_tool.neuron_surface.get_NEURON_surface.

morph_tool.converter.soma_to_single_point(soma)

Surface preserving cylindrical soma to a single point sphere.