pysnt package#

PySNT: Python interface for SNT

This package provides convenient Python access to SNT’s Java classes, including core classes.

get_available_classes() List[str][source]#

Get list of all available classes.

This includes both curated classes (always loaded) and extended classes (loaded on-demand). Extended classes are discovered if not already loaded.

Returns:

List of available class names.

Return type:

List[str]

get_class(class_name: str) Any[source]#

Get a specific class by name.

This method provides access to both curated and extended classes. Extended classes are discovered and loaded on first access.

Supports inner class access using dot notation (e.g., “CircularModels.VonMisesFit”).

Parameters:

class_name (str) – Name of the class to retrieve. Can include inner class notation using dots (e.g., “CircularModels.VonMisesFit”).

Returns:

The requested SNT class or inner class.

Return type:

Java class

Raises:
  • KeyError – If the class is not available.

  • RuntimeError – If the JVM has not been started.

Examples

>>> # Get a regular class
>>> CircModels = pysnt.analysis.get_class("CircularModels")
>>> # Get an inner class
>>> VonMisesFit = pysnt.analysis.get_class("CircularModels.VonMisesFit")
get_curated_classes() List[str][source]#

Get list of curated classes that are always available for direct import.

Returns:

List of curated class names.

Return type:

List[str]

get_extended_classes() List[str][source]#

Get list of extended classes available via get_class().

This will trigger discovery if not already done.

Returns:

List of extended class names.

Return type:

List[str]

list_classes()[source]#

Print all available classes organized by tier.

class SNTService(*args, **kwargs)#

Bases: object

Service for accessing and scripting the active instance of SNT.

All Methods and Attributes: See SNTService detailed documentation.

class SNTUtils(*args, **kwargs)#

Bases: object

Static utilities for SNT

All Methods and Attributes: See SNTUtils detailed documentation.

class Tree(*args, **kwargs)#

Bases: object

Utility class to access a Collection of Paths (typically a complete reconstruction). A Tree is the preferred way to group, access and manipulate Paths that share something in common, specially when scripting SNT. Note that a “Tree” here is literally a collection of Paths. Very few restrictions are imposed on its topology, although it is generally assumed that the Collection of paths describes a single-rooted structure with no loops.

All Methods and Attributes: See Tree detailed documentation.

class Path(*args, **kwargs)#

Bases: object

This class represents a traced segment (i.e., a Path) in a reconstruction. It has methods to manipulate its points (nodes) with sup-pixel accuracy, including drawing them onto threePane-style canvases, etc.

Paths are non-branching sequences of adjacent points (including diagonals) in the image. Branches and joins are supported by attributes of paths that specify that they begin on (or end on) other paths.

In SNT, a Path can exist in two versions or flavors: itself and a fitted version generated by PathFitter. Because fitting may fail around certain nodes, the fitted version may have a different number of nodes relatively to its non-fitted version

All Methods and Attributes: See Path detailed documentation.

Subpackages#

Submodules#