neuron_morphology.snap_polygons.image_outputter module¶
-
class
neuron_morphology.snap_polygons.image_outputter.ImageOutputter(native_geo: neuron_morphology.snap_polygons.geometries.Geometries, result_geo: neuron_morphology.snap_polygons.geometries.Geometries, image_specs: Optional[Sequence[Dict[KT, VT]]], alpha: float = 0.4, color_cycle: Optional[Sequence[T_co]] = None, savefig_kwargs: Optional[Dict[KT, VT]] = None)[source]¶ Bases:
objectMethods
draw_after(self, image, scale)Display the post-fill polygons and surfaces overlaid on an image. draw_before(self, image, scale)Display the pre-fill polygons and surfaces overlaid on an image. write_images(self)For each image specified in this outputter and each overlay type requested for that image, produce and save an overlay. -
DEFAULT_COLOR_CYCLE= ('c', 'm', 'y', 'k', 'r', 'g', 'b')¶
-
OVERLAY_TYPES= {'after': 'draw_after', 'before': 'draw_before'}¶
-
draw_after(self, image: numpy.ndarray, scale: float = 1.0)[source]¶ Display the post-fill polygons and surfaces overlaid on an image.
Parameters: - image : onto which objects will be drawn
- scale : required to transform from object space to image space
Returns: - A matplotlib figure containing the overlay
-
draw_before(self, image: numpy.ndarray, scale: float = 1.0)[source]¶ Display the pre-fill polygons and surfaces overlaid on an image.
Parameters: - image : onto which objects will be drawn
- scale : required to transform from object space to image space
Returns: - A matplotlib figure containing the overlay
-
-
neuron_morphology.snap_polygons.image_outputter.fname_suffix(path: str, suffix: str)[source]¶ Utility for adding a suffix to a path string. The suffix will be inserted before the extension.
-
neuron_morphology.snap_polygons.image_outputter.make_pathpatch(vertices: Sequence[Tuple[float, float]], **patch_kwargs) → matplotlib.patches.PathPatch[source]¶ Utility for building a matplotlib pathpatch from an array of vertices
Parameters: - vertices : Defines the path. May be closed or open
- **patch_kwargs : passed directly to pathpatch constructor
-
neuron_morphology.snap_polygons.image_outputter.read_image(path: str, decimate: int = 1)[source]¶ Read an image. Dispatch to an appropriate library based on that image’s extension.
Parameters: - path : to the image
- decimate : apply a decimation of this factor along each axis of the image