SNT resizing .traces file


is it possible to resize the .traces file?
I messed up the scaling on the z-axis and now when I want to open the reconstruction from the .traces file, it does not overlay with the original image.


Welcome to the forum @Oli!

The quickest way would be the following:

  1. Load the traces file as usual
  2. Once the file is loaded, Run Scripts → New…, choose Python and paste the following snippet on the newly opened Script Editor window:
#@SNTService snt

tree = snt.getTree()   # retrieve all paths as a single 'Tree' object
tree.scale(1, 1, 2.5)   # Scale the paths using scaling factors in X, Y, Z
snt.getPlugin().updateAllViewers()  # update rendering of paths

(You will have to adjust the scaling factors to your particular case. In the script above, all the paths will be scaled by 2.5x in Z).

  1. Export everything using File → Export As → TRACES… (it may be wise to not override the original file, just in case)

Thank you for your quick response!

I tried the script out and changed the Z proper to my case after opening the original image and the tracing, but I get an error. It is the first time working with scripts for me. Do I have to add something in the brackets of the script?

I get the following error:

Started at Fri Apr 23 18:19:53 CEST 2021
Traceback (most recent call last):
  File "", line 3, in <module>
NameError: name 'snt' is not defined

	at org.python.core.Py.NameError(
	at org.python.core.PyFrame.getname(
	at org.python.pycode._pyx0.f$0(
	at org.python.pycode._pyx0.call_function(
	at org.python.core.Py.runCode(
	at org.python.core.__builtin__.eval(
	at org.python.core.__builtin__.eval(
	at org.python.util.PythonInterpreter.eval(
	at org.python.jsr223.PyScriptEngine.eval(
	at org.python.jsr223.PyScriptEngine.eval(
	at javax.script.AbstractScriptEngine.eval(
	at org.scijava.thread.DefaultThreadService.lambda$wrap$2(
	at java.util.concurrent.ThreadPoolExecutor.runWorker(
	at java.util.concurrent.ThreadPoolExecutor$

I hope you can help me out!

It seems you forgot to include the first line containing #@SNTService snt?
That first line is a Script parameter that defines the SNTService that will access all the data.

No I included all the lines.
I tried the procedure with MacOS and with Windows, just to be sure.

Oh. Then it is very strange. Are you subscribed to the Neuroanatomy update site? Could you please confirm you are running SNT 3.2.4 by running from within SNT Help → About…

I am not subscribed to the update site.
I am using v3.1.6, because it was the one included in my Fiji Plugin list by default when I downloaded it.

Oh, then yes, please subscribe to the Neuroanatomy update site, Most things won’t work without it. I had assumed you were already doing so. All of these tools are being served from there. I am actually not sure how you can access SNT without it. See e.g., this announcement for details.

Now I updated to SNT 3.2.4 and I think the script works but I have to get used to the new Layout of SNT in general. I will have to invest some time to check all the new features of this version!
Why didn’t I use this Version from the beginning…

Thanks for your time! :slight_smile: