neuron_morphology.snap_polygons.types module

neuron_morphology.snap_polygons.types.ensure_linestring(candidate: Union[str, Sequence[Sequence[float]], shapely.geometry.linestring.LineString]) → shapely.geometry.linestring.LineString[source]

Convert from one of many line representations to LineString

neuron_morphology.snap_polygons.types.ensure_path(candidate: Union[str, Sequence[Sequence[float]]], num_dims: int = 2) → Sequence[Sequence[float]][source]

Ensure that an input path, which might be a “x,y,x,y” string, is represented as a list of lists instead.

Parameters:
candidate : input coordinate sequence
num_dims : how manu elements define a coordinate
Returns:
Contents of inputs, with each coordinate a list of float
neuron_morphology.snap_polygons.types.ensure_polygon(candidate: Union[str, Sequence[Sequence[float]], shapely.geometry.polygon.Polygon, shapely.geometry.polygon.LinearRing]) → shapely.geometry.polygon.Polygon[source]

Convert from one of many polygon representations to Polygon

neuron_morphology.snap_polygons.types.split_pathstring(pathstring: str, num_dims: int = 2, sep: str = ', ') → Sequence[Sequence[float]][source]

Converts a pathstring (“x,y,x,y…”) to a num_points X num_dims list of lists of float

Parameters:
pathstring : input coordinate sequence
num_dims : how manu elements define a coordinate
sep : character separating elements
Returns:
Contents of pathstring, with each coordinate a list of float