11/**
22 * file: Spacing_Analysis.groovy
33 * author: Tiago Ferreira
4- * version: 2026.04.21
4+ * version: 2026.07.31
55 * info: Demonstrates how to compute geodesic (along-the-path) distances
66 * between consecutive detections from PeripathDetector. The script
77 * detects intensity maxima (varicosities, synaptic puncta, etc.)
2424#@ SNTService snt
2525
2626// Ensure SNT is up-to-date and is not busy with another operation
27- snt. requireVersion(" 5.0.7 " )
28- if (snt. isActive() && snt. getUI() && ! snt. getUI(). isReady()) {
27+ snt. requireVersion(" 5.0.14 " )
28+ if (snt. isActive() && snt. getUI() && ! snt. isStreamMode() && ! snt . getUI(). isReady()) {
2929 print (" Please complete current operation before running this script!" )
3030 return
3131}
@@ -39,6 +39,15 @@ def getImageAndPaths(fileImg, fileTree) {
3939 for (tree in Tree . listFromFile(fileTree. getAbsolutePath()))
4040 paths. addAll(tree. list())
4141 } else {
42+ // The demo re-initializes SNT with its own classic (in-core) image, which would
43+ // replace/reconfigure an existing Stream ("SNT Stream") session, which is unexpected
44+ if (snt. isStreamMode()) {
45+ snt. getUI(). error(" The demo image requires re-initializing SNT with a classic "
46+ + " (non-streamed) image, which would replace the current Stream-mode "
47+ + " session. Please supply your own image/reconstruction files above, or "
48+ + " switch to Standard mode to run the demo." )
49+ return Tuple . tuple(null , null )
50+ }
4251 // demo mode: CIL:810 hippocampal neuron (Ch1: N-cadherin; Ch2: V-glut; Ch3: NMDAR)
4352 // see Peripath_Detection_Demo.groovy template script
4453 imp = snt. demoImage(" cil810" )
@@ -54,6 +63,9 @@ def getImageAndPaths(fileImg, fileTree) {
5463}
5564
5665(imp, paths) = getImageAndPaths(imageFile, tracesFile)
66+ if (imp == null || paths == null ) {
67+ return
68+ }
5769
5870// 2) Fit radii. PeripathDetector uses per-node radii to define the search
5971// annulus. Without fitted radii, a fallback (2x voxel size) is used
0 commit comments