SNT resizing .traces file

Hello,

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.

Thanks

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 New_.py at Fri Apr 23 18:19:53 CEST 2021
Traceback (most recent call last):
  File "New_.py", line 3, in <module>
NameError: name 'snt' is not defined

	at org.python.core.Py.NameError(Py.java:290)
	at org.python.core.PyFrame.getname(PyFrame.java:257)
	at org.python.pycode._pyx0.f$0(New_.py:5)
	at org.python.pycode._pyx0.call_function(New_.py)
	at org.python.core.PyTableCode.call(PyTableCode.java:171)
	at org.python.core.PyCode.call(PyCode.java:18)
	at org.python.core.Py.runCode(Py.java:1614)
	at org.python.core.__builtin__.eval(__builtin__.java:497)
	at org.python.core.__builtin__.eval(__builtin__.java:501)
	at org.python.util.PythonInterpreter.eval(PythonInterpreter.java:259)
	at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:57)
	at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:31)
	at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)
	at org.scijava.script.ScriptModule.run(ScriptModule.java:160)
	at org.scijava.module.ModuleRunner.run(ModuleRunner.java:168)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:127)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:66)
	at org.scijava.thread.DefaultThreadService.lambda$wrap$2(DefaultThreadService.java:228)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

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: