Skip to content, Skip to search


TrakEM2 Scripting

12 bytes removed, 05:30, 1 November 2016
update java3d package names to org.scijava.vecmath
= Generate 3D meshes =
In TrakEM2, 3D meshes are generated as a list of [ Point3f] for each object. Then the list is wrapped into any of the subclasses of [ CustomMesh] of the 3D Viewer library, such as a [ CustomTriangleMesh] or a [ CustomLineMesh]. Then these mesh objects are encapsulated into a [ Content] object and added to an instance of the [ Image3DUniverse], which is the main window of the 3D Viewer.
Of course, via scripting many of these steps may be skipped. Below are several examples on how to generate meshes programmatically and save them in [ Wavefront] format.
<source lang="python">
from ini.trakem2.display import Display
from javaxorg.scijava.vecmath import Color3f
from customnode import WavefrontExporter, CustomTriangleMesh
from import StringWriter
The [ AreaTree]'s generateMesh returns a [ MeshData] object with the list of vertices and the list of colors of each vertex. The <i>generateTriangles</i> method of an [ AreaTree] returns a list of [ Point3f] that are ready for creating a [ CustomLineMesh] (in PAIRWISE mode) to represent the skeleton.
= Save the project while running a task =
Bureaucrat, emailconfirmed, incoming, administrator, uploaders