Open the "Plugins - Scripting - Jython Interpreter" (see [[Scripting Help]]) and make sure there is a TrakEM2 project open, with a display open. Then type or paste the examples below.
= Introduction to scripting TrakEM2 =
See also the complete [http://www.ini.uzh.ch/~acardona/api TrakEM2 API documentation]
To run a script, follow
isntructions as indicated in the [[Scripting Help]].
=== Get the instance of a selected image ===
for d in Display.getFront().
=== Setting and getting member objects in jython ===
>>> aff.scale(2.0, 2.0)
More convenient are the methods <i>scale</i>, <i>translate</i>, <i>rotate</i> and particularly <i>preTransform</i>, for the manipulation of a [http://www.ini.uzh.ch/~acardona/api/ini/trakem2/display/Displayable.html Displayable]'s affine transform (see [http://java.sun.com/javase/6/docs/api/java/awt/geom/AffineTransform.html AffineTransform]) and that of its linked Displayables (any transform propagates to the linked ones).
If you change the affine transform of a Displayable directly (by calling <i>getAffineTransform()</i> and then manipulating it), keep in mind that you will most likely screw up the internal cached maps for fast location of the Displayable object. To solve that, be sure to
all <i>updateBucket()</i> on the affected Displayable object.
= Manipulating Displayable objects =
The bucket is the region of the 2D world where the Patch lives. Picture the world as a checkerboard, where a given image, wrapped in a Patch object, belongs to each of the square that it intersects. Failing to update the bucket will result in improper canvas repaints--the Patch cannot be found.
= Adding images =
= Enrich the GUI of TrakEM =
frame = display. getFrame() split = frame.getContentPane().getComponent(0) left = split.getComponent(0) tabs = left.getComponent( 2)
# Check that it's not there already
title = "Reconstruct toolbar"
*[[Jython Scripting]] in fiji.
*[http://www.jython.org Jython webpage].
== Jython scripts for TrakEM2 ==
All the following are included in Fiji's plugins/Examples/TrakEM2_Example_Scripts/ folder:
[http://pacific.mpi-cbg.de/cgi-bin/gitweb.cgi?p=fiji .git;a=blob;f=plugins/Examples/TrakEM2_Example_Scripts/extract_stack_under_arealist.py ;hb= HEAD Extract stack under AreaList ] in TrakEM2.* [http://pacific.mpi-cbg.de/cgi-bin/gitweb.cgi?p=fiji .git;a=blob;f=plugins/Examples/TrakEM2_Example_Scripts/T2_set_all_transforms_to_identity.py ;hb= HEAD Set all transforms to identity ] for TrakEM2 objects.* [http:// pacific.mpi-cbg.de/ cgi-bin/gitweb. cgi?p= fiji. git;a= blob;f=plugins/Examples/TrakEM2_Example_Scripts/ T2_Select_All.py ;hb= HEAD Select All] objects in TrakEM2.*[http:// pacific. mpi-cbg. de/ cgi-bin/ gitweb. cgi?p=fiji. git;a=blob;f=plugins/ Examples/ TrakEM2_Example_Scripts/ Measure_AreaLists. py;hb=HEAD Measure AreaList] in TrakEM2.