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

jython
trakem2
java
Tags: #<Tag:0x00007fd5421bcb68> #<Tag:0x00007fd5421bca28> #<Tag:0x00007fd5421bc8e8>

#1

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!


#2

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:
John


#3

Hi @bogovicj,

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

Have a nice day,
Fabienne