TrakEM2: Set title of a layer using a Jython/Java script



When creating a new layer in TrakEM2 using a Jython or Java script, is there a way to give the layer a name/title? Or change its name/title later? I only found the Layer.getTitle() method, but no setTitle() method.

Thanks in advance for your help!


Hi @froessler,

Welcome to the forum.

It’s been awhile since I’ve done trakem2 stuff, so I’m not sure about this, but:
LayerThing has a setTitle method, and Layers seem to get their titles from LayerThing’s.

So I’d try something like:

Project project = ...
Layer layer = ...
project.findLayerThing( layer ).setTitle( "my very informative title" );

Hope this does the job… :crossed_fingers:


Hi @bogovicj,

Thank you very much for your help, your solution works perfectly for me. :smiley:

Have a nice day,