pysnt.analysis package#

This module provides convenient access to SNT’s analysis 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")
list_classes()[source]#

Print all available classes organized by tier.

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]

class ConvexHull2D(*args, **kwargs)#

Bases: object

Computes the convex hull of a set of 2D points.

All Methods and Attributes: See ConvexHull2D detailed documentation.

class ConvexHull3D(*args, **kwargs)#

Bases: object

Convex hull analysis in 3D.

All Methods and Attributes: See ConvexHull3D detailed documentation.

class ConvexHullAnalyzer(*args, **kwargs)#

Bases: object

Class for Convex Hull measurements of a Tree.

All Methods and Attributes: See ConvexHullAnalyzer detailed documentation.

class GroupedTreeStatistics(*args, **kwargs)#

Bases: object

Computes statistics from Tree groups.

All Methods and Attributes: See GroupedTreeStatistics detailed documentation.

class MultiTreeColorMapper(*args, **kwargs)#

Bases: object

Class for color coding groups of Trees.

After a mapping property and a color table (LUT) are specified, the mapping proceeds as follows: 1) Each Tree in the group is measured for the mapping property; 2) each measurement is mapped to a LUT entry that is used to color each Tree. Mapping limits can be optionally specified

All Methods and Attributes: See MultiTreeColorMapper detailed documentation.

class MultiTreeStatistics(*args, **kwargs)#

Bases: object

Computes summary and descriptive statistics from univariate properties of Tree groups. For analysis of individual Trees use TreeStatistics.

All Methods and Attributes: See MultiTreeStatistics detailed documentation.

class NodeColorMapper(*args, **kwargs)#

Bases: object

Class for color coding of NodeStatistics results.

All Methods and Attributes: See NodeColorMapper detailed documentation.

class NodeProfiler(*args, **kwargs)#

Bases: object

Command to retrieve node profiles (plots of voxel intensities sampled across Path nodes).

All Methods and Attributes: See NodeProfiler detailed documentation.

class NodeStatistics(*args, **kwargs)#

Bases: object

Computes summary and descriptive statistics from a Collection of nodes, including convenience methods to plot distributions of such data.

All Methods and Attributes: See NodeStatistics detailed documentation.

class PathProfiler(*args, **kwargs)#

Bases: object

Command to retrieve Path profiles (plots of voxel intensities values along a Path)

All Methods and Attributes: See PathProfiler detailed documentation.

class PathStatistics(*args, **kwargs)#

Bases: object

A specialized version of TreeStatistics for analyzing individual paths without considering their connectivity relationships.

PathStatistics provides morphometric analysis of neuronal paths while treating each path as an independent entity, rather than as part of a connected tree structure.

Key differences from TreeStatistics:

No graph conversion - paths are analyzed independently Branch-related metrics are redefined to work with individual paths Supports path-specific measurements like Path ID and number of children Provides individual path measurement capabilities

Example usage: ``` // Analyze a single path PathStatistics stats = new PathStatistics(path); double length = stats.getMetric(“Path length”).doubleValue();

// Analyze multiple paths independently Collection<Path> paths = getPaths(); PathStatistics multiStats = new PathStatistics(paths, “My Analysis”); multiStats.measureIndividualPaths(Arrays.asList(“Path length”, “N. nodes”), true); ```

All Methods and Attributes: See PathStatistics detailed documentation.

class PathStraightener(*args, **kwargs)#

Bases: object

Command to “straighten” an image using Path coordinates.

All Methods and Attributes: See PathStraightener detailed documentation.

class PCAnalyzer(*args, **kwargs)#

Bases: object

Utility class for performing Principal Component Analysis (PCA) on various SNT data structures including Trees, Paths, and collections of SNTPoints.

This class provides methods to compute the principal axes of 3D point data, which represent the directions of maximum variance in the data. This is useful for analyzing the overall orientation and shape characteristics of neuronal structures, meshes, and other 3D geometries.

All Methods and Attributes: See PCAnalyzer detailed documentation.

class PersistenceAnalyzer(*args, **kwargs)#

Bases: object

Performs persistent homology analysis on neuronal Trees.

This class implements the algorithm described in Kanari, L. et al. “A Topological Representation of Branching Neuronal Morphologies” (Neuroinformatics 16, 3–13, 2018) to extract topological features from neuronal morphologies.

Core Concepts

Filter Functions: Mathematical functions that assign scalar values to each node in the tree based on various morphological properties (distance from root, branch order, spatial coordinates, etc.).

Persistence Diagram: A collection of 2D points (birth, death) representing when topological features (branches) appear and disappear during a filtration process. Each point corresponds to a branch in the neuronal tree.

Persistence: The “lifespan” of a topological feature, calculated as death - birth. High persistence indicates morphologically significant branches, while low persistence may represent noise or minor branches.

Supported Filter Functions

Geodesic: Path distance from node to root along the tree structure Radial: Euclidean (straight-line) distance from node to root Centrifugal: Reverse Strahler number (branch order from tips) Path Order: SNT path order hierarchy X, Y, Z: Spatial coordinates for directional analysis

Usage Example ``` // Create analyzer for a neuronal tree PersistenceAnalyzer analyzer = new PersistenceAnalyzer(tree);

// Get persistence diagram using geodesic distance List<List<Double>> diagram = analyzer.getDiagram(“geodesic”);

// Each inner list contains [birth, death] values for (List<Double> pair : diagram) {

double birth = pair.get(0); double death = pair.get(1); double persistence = death - birth; System.out.println(“Branch: birth=” + birth + “, death=” + death + “, persistence=” + persistence);

}

// Get persistence landscape double[] landscape = analyzer.getLandscape(“geodesic”, 5, 100); ```

All Methods and Attributes: See PersistenceAnalyzer detailed documentation.

class RootAngleAnalyzer(*args, **kwargs)#

Bases: object

Class to perform Root angle analysis on a Tree according to Bird and Cuntz 2019, PMID 31167149.

All Methods and Attributes: See RootAngleAnalyzer detailed documentation.

class ShollAnalyzer(*args, **kwargs)#

Bases: object

Class to retrieve Sholl metrics from a Tree.

All Methods and Attributes: See ShollAnalyzer detailed documentation.

class SkeletonConverter(*args, **kwargs)#

Bases: object

Class for generation of Trees from a skeletonized ImagePlus.

All Methods and Attributes: See SkeletonConverter detailed documentation.

class SNTChart(*args, **kwargs)#

Bases: object

Extension of ChartPanel modified for scientific publications and convenience methods for plot annotations.

All Methods and Attributes: See SNTChart detailed documentation.

class SNTTable(*args, **kwargs)#

Bases: object

Extension of DefaultGenericTable with (minor) scripting conveniences.

All Methods and Attributes: See SNTTable detailed documentation.

class StrahlerAnalyzer(*args, **kwargs)#

Bases: object

Class to perform Horton-Strahler analysis on a Tree.

All Methods and Attributes: See StrahlerAnalyzer detailed documentation.

class TreeColorMapper(*args, **kwargs)#

Bases: object

Class for color coding Trees.

All Methods and Attributes: See TreeColorMapper detailed documentation.

class TreeStatistics(*args, **kwargs)#

Bases: object

Computes summary and descriptive statistics from properties of Paths and Nodes in a Tree, including convenience methods to plot distributions of such data. For analysis of groups of Trees have a look at MultiTreeStatistics and GroupedTreeStatistics.

All Methods and Attributes: See TreeStatistics detailed documentation.

Subpackages#