Class ComponentReconnector<T extends net.imglib2.type.numeric.RealType<T>>
- Type Parameters:
T- pixel type
After auto-tracing (e.g., via GWDTTracer), neurites with dim or
fragmented signal may produce disconnected components. Rather than discarding
them, this class attempts to reconnect each orphan component to the main tree
by running A* searches between nearby endpoints and validating the resulting
paths.
Validation criteria (all configurable):
- Tortuosity: bridge contraction must exceed a minimum (rejects meandering paths through noise)
- Direction compatibility: the bridge must approach existing branches at a compatible angle
- Mean intensity: the bridge must pass through sufficiently bright signal
- Length: the bridge must not exceed the maximum gap distance
Adapted from NeuTube's chain connection logic (Locseg_Chain_Connection_Test).
- Author:
- Tiago Ferreira
-
Constructor Summary
ConstructorsConstructorDescriptionComponentReconnector(net.imglib2.RandomAccessibleInterval<T> source, double[] spacing) Creates a new ComponentReconnector. -
Method Summary
Modifier and TypeMethodDescriptionintextendTips(DirectedWeightedGraph graph, SWCPoint root, double backgroundThreshold) Extends leaf tips of the tree across multi-voxel gaps by scanning for bright signal in each leaf's tangent direction and A*-bridging to it.intreconnect(DirectedWeightedGraph graph, SWCPoint root, double backgroundThreshold) Attempts to reconnect disconnected components in the graph back to the main tree (the component containing the root).voidsetCostFunction(Cost cost) Sets the cost function for A* searches.voidSets the heuristic for A* searches.voidsetMaxAngleDeg(double degrees) Sets the maximum angle (in degrees) between the bridge tangent and the existing branch direction at connection points.voidsetMaxBridgeDistVoxels(double dist) Sets the maximum Euclidean distance (in voxels) between candidate endpoints.voidsetMinContraction(double contraction) Sets the minimum contraction (Euclidean distance / path length) for accepting a bridge.voidsetMinMeanIntensity(double intensity) Sets the minimum mean intensity along the bridge path.voidsetTimeoutPerSearch(int seconds) Sets the A* search timeout per candidate pair, in seconds.voidsetVerbose(boolean verbose) Enables or disables verbose logging.
-
Constructor Details
-
ComponentReconnector
Creates a new ComponentReconnector.- Parameters:
source- the grayscale image used for tracingspacing- voxel dimensions [x, y, z] in physical units
-
-
Method Details
-
setMaxBridgeDistVoxels
public void setMaxBridgeDistVoxels(double dist) Sets the maximum Euclidean distance (in voxels) between candidate endpoints. Pairs farther apart are not considered. Default: 20. -
setMinContraction
public void setMinContraction(double contraction) Sets the minimum contraction (Euclidean distance / path length) for accepting a bridge. Values close to 1.0 require near-straight bridges; lower values tolerate more tortuous paths. Default: 0.6. -
setMaxAngleDeg
public void setMaxAngleDeg(double degrees) Sets the maximum angle (in degrees) between the bridge tangent and the existing branch direction at connection points. Default: 60. -
setMinMeanIntensity
public void setMinMeanIntensity(double intensity) Sets the minimum mean intensity along the bridge path. Set toDouble.NaNto use the auto-traced threshold. Default: NaN. -
setTimeoutPerSearch
public void setTimeoutPerSearch(int seconds) Sets the A* search timeout per candidate pair, in seconds. Default: 5. -
setCostFunction
Sets the cost function for A* searches. If not set, defaults toReciprocalusing the source image intensity range. -
setHeuristic
Sets the heuristic for A* searches. If not set, defaults toEuclidean. -
setVerbose
public void setVerbose(boolean verbose) Enables or disables verbose logging. -
reconnect
Attempts to reconnect disconnected components in the graph back to the main tree (the component containing the root).- Parameters:
graph- the directed weighted graph to modify in placeroot- the root node of the main treebackgroundThreshold- intensity threshold used during tracing (used as fallback for minMeanIntensity if not set)- Returns:
- the number of components successfully reconnected
-
extendTips
Extends leaf tips of the tree across multi-voxel gaps by scanning for bright signal in each leaf's tangent direction and A*-bridging to it.Unlike
reconnect(sc.fiji.snt.analysis.graph.DirectedWeightedGraph, sc.fiji.snt.util.SWCPoint, double), which bridges disconnected components already present in the graph, this method discovers unreached foreground signal beyond the Fast Marching frontier (which stops at multi-voxel gaps) and traces through the gap to reach it.- Parameters:
graph- the directed weighted graph to modify in placeroot- the root node of the main treebackgroundThreshold- intensity threshold used during tracing- Returns:
- the number of tips successfully extended
-