SNT : access to tags programmatically

Hello everybody and in particular @tferr,

I tagged a few branches of a neuron reconstruction:
image

I want to read the tags from the branches programmatically (and filter the ones tagged spinefor instance - but they may contain several). I looked at the API and at the github repo, and I can’t find how I can read these tags.

I started may script in groovy like this:

tree = new Tree(swc_filepath.getAbsolutePath())

for (branch : tree.list()){
	// how to filter by tag ?
        println(i)
	println(branch.getLength())
}

How should I replace the commented line to filter with a tag ?

Thanks!

So one way if using myPath.getName() but is it the only way ?

hi @NicoKiaru,

Yes. So far tags are only implemented as Strings retrieved from the Path’s name. This is mainly historical: When we started supporting tags we did not want to disrupt much the old Simple_Neurite_Tracer code, so we injected tags (surrounded by “{” “}” inside the name String.
In the current API, the following methods are public in PathManagerUI:

Are you scripting PathManagerUI? Are these sufficient for you, or you feel some functionality is missing?

2 Likes

I just want to analyze some specific Paths that were manually annotated. These functionalities and methods are thus definitely sufficient for my use case. Thanks!