Tree Class Documentation#
Package: sc.fiji.snt
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.
Methods#
Utilities Methods#
- clone()#
Creates a deep copy of this Tree.
This method creates a complete copy of the tree including all paths and their relationships. Each path is cloned individually, and then the parent-child relationships are reconstructed in the cloned tree. This ensures that the cloned tree maintains the same structure as the original while being completely independent.
Getters Methods#
- get(int)#
Returns the Path at the specified position.
- getApproximatedSurface()#
Retrieves an approximate estimate of Tree’s surface are by approximating the surface area of each path, and summing to total. The surface of each path is computed assuming the lateral surface area of a conical frustum between nodes.
- getApproximatedVolume()#
Retrieves an approximate estimate of Tree’s volume by approximating the volume of each path, and summing to total. The volume of each path is computed assuming the volume of each of inter-node segment to be that of a truncated cone (Frustum).
- getAssignedValue()#
Retrieves the numeric property assigned to this Tree.
- getBPs()#
Gets the branch points (junctions) of the graph. This is simply an alias for DirectedWeightedGraph.getBPs().
- getBoundingBox(boolean)#
Gets the bounding box associated with this tree.
- getColor()#
Gets the color assigned to this Tree.
- getConvexHull()#
Retrieves the convex hull of this tree.
- getGraph()#
Assembles a DirectedGraph from this Tree.
- getImpContainer(int, int)#
Gets an empty image capable of holding the skeletonized version of this tree.
- getLabel()#
Returns the identifying label of this tree. When importing files, the label typically defaults to the imported filename,
- getNodes()#
Gets all the nodes (path points) forming this tree.
- getNodesAsSWCPoints()#
- getNodesCount()#
Gets the total number of nodes across all paths in this Tree.
- getProperties()#
Returns the Properties instance holding the persistent set of properties. Useful to associate metadata to this tree. E.g.
`
getProperties().setProperty(Tree.KEY_SPATIAL_UNIT, "um");
String unit = getProperties().getProperty(Tree.KEY_SPATIAL_UNIT);
getProperties().setProperty(Tree.KEY_COMPARTMENT, Tree.DENDRITIC);
`
- getRoot()#
Gets the first node of the main primary path of this tree
- static getSWCTypeMap()
Returns the SWC Type flags used by SNT.
- getSWCTypeNames(boolean)#
Gets the set of SWC type labels present in this tree with optional soma inclusion in a readable form.
- getSWCTypes(boolean)#
Gets the set of SWC types present in this tree with optional soma inclusion.
- getSkeleton()#
Retrieves the rasterized skeleton of this tree at 1:1 scaling.
- getSkeleton2D(int)#
Retrieves a 2D projection of the rasterized skeleton of this tree at 1:1 scaling.
- getSomaNodes()#
Gets the list of all nodes tagged as Path.SWC_SOMA.
- getTips()#
Gets the end points (tips) of the graph. This is simply an alias for DirectedWeightedGraph.getTips().
- is3D()#
Assesses whether this Tree has depth.
- isAnnotated()#
Checks if the nodes of this Tree have been assigned BrainAnnotations (neuropil labels).
- isEmpty()#
Checks if this Tree is empty.
I/O Operations Methods#
- static fromFile(String)
Script-friendly method for loading a Tree from a reconstruction file.
- static listFromDir(String, String, String;)
Retrieves a list of Trees from reconstruction files stored in a common directory matching the specified criteria.
Other Methods#
- add(Path)#
Adds a new Path to this Tree.
- applyCanvasOffset(double, double, double)#
Specifies the offset to be used when rendering this Tree in a TracerCanvas. Path coordinates remain unaltered.
- applyProperties(Tree)#
Applies properties from another Tree to this Tree.
- assignImage(Dataset)#
Assigns spatial calibration from a Dataset to this Tree.
- static assignUniqueColors(Collection)
Assigns distinct colors to a collection of Trees.
- assignValue(double)#
Assigns a numeric property to this Tree.
- downSample(double)#
- downsample(double)#
Downsamples the tree, i.e., reduces the density of its nodes by increasing internode spacing.
Note that 1) upsampling is not supported (cf. {upsample(double)}, and 2) the position of nodes at branch points and tips remains unaltered during downsampling, as per Path.downsample(double).
- indexOf(Path)#
Returns the index of the specified Path in this Tree.
- list()#
Gets all the paths from this tree.