Skip to content, Skip to search

Changes

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 [http://downloadjavadoc.javaimagej.net/mediaJava3D/java3d/javadoc/1.5index.2-latesthtml?org/javaxscijava/vecmath/Point3f.html Point3f] for each object. Then the list is wrapped into any of the subclasses of [http://fiji.sc/javadoc/customnode/CustomMesh.html CustomMesh] of the 3D Viewer library, such as a [http://fiji.sc/javadoc/customnode/CustomTriangleMesh.html CustomTriangleMesh] or a [http://fiji.sc/javadoc/customnode/CustomLineMesh.html CustomLineMesh]. Then these mesh objects are encapsulated into a [http://fiji.sc/javadoc/ij3d/Content.html Content] object and added to an instance of the [http://fiji.sc/javadoc/ij3d/Image3DUniverse.html 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 [http://www.martinreddy.net/gfx/3d/OBJ.spec Wavefront] format.
<source lang="python">
from ini.trakem2.display import Display
from javaxorg.scijava.vecmath import Color3f
from customnode import WavefrontExporter, CustomTriangleMesh
from java.io import StringWriter
</source>
The [http://fiji.sc/javadoc/ini/trakem2/display/AreaTree.html AreaTree]'s generateMesh returns a [http://fiji.sc/javadoc/ini/trakem2/display/Tree.MeshData.html MeshData] object with the list of vertices and the list of colors of each vertex. The <i>generateTriangles</i> method of an [http://fiji.sc/javadoc/ini/trakem2/display/AreaTree.html AreaTree] returns a list of [http://downloadjavadoc.javaimagej.net/mediaJava3D/java3d/javadoc/1.5index.2-latesthtml?org/javaxscijava/vecmath/Point3f.html Point3f] that are ready for creating a [http://fiji.sc/javadoc/customnode/CustomLineMesh.html CustomLineMesh] (in PAIRWISE mode) to represent the skeleton.
= Save the project while running a task =
Bureaucrat, emailconfirmed, incoming, administrator, uploaders
707
edits