-
Notifications
You must be signed in to change notification settings - Fork 32
Home
TrakEM2 is an ImageJ plugin for morphological data mining, three-dimensional modeling and image stitching, registration, editing and annotation.
See TrakEM2 snapshots for an overview.
- Segmentation: manually draw areas across stacks, and sketch structures with balls and pipes. Skeletonize entire neuronal arborizations and represent synapses with relational connector objects.
- Measurements: volumes, surfaces, lengths, and also measurements via ImageJ ROIs.
- Image Registration: register floating image tiles to each other using SIFT and global optimization algorithms.
- 3D Visualization: interacting with the 3D Viewer plugin, TrakEM2 displays image volumes and 3D meshes of all kinds.
- Image Annotation: floating text labels.
- Semantic segmentation: order segmentations in tree hierarchies, whose template is exportable for reuse in other, comparable projects.
- Create new projects from "File - New - TrakEM2 (blank)"
- Open an existing project by dragging its .xml file onto the toolbar, or via "File - Open".
- How to
- Manual
- TrakEM2 tutorials with video tutorials.
- Examples of scripting in TrakEM2.
- Writing plugins for TrakEM2.
The following configuration has been tested in a machine with 8 CPU cores and 16 Gb of RAM, running Ubuntu 8.04 "Hardy", with a 1.6.0_16 or newer JVM:
./ImageJ-linux64 -Xms10g -Xmx10g -Xincgc -XX:MaxPermSize=256m -XX:PermSize=256m -XX:NewRatio=5 -XX:CMSTriggerRatio=50 -XX:+UseCompressedOops --
Put all the above in one line.
What the JVM flags mean:
- -Xms10g : use an initial heap size of 10 Gb (i.e. start fiji with 10 Gb of RAM preallocated to it)
- -Xmx10g: use a maximum heap size of 10 Gb. Note it's the same amount as the intial heap size, so that the heap cannot be resized.
- -Xincgc : use the incremental garbage collector. Clean up unused memory in the concurrent mark-sweep generation (i.e. not the super-new generation of allocated objects) using parallel threads.
- -XX:MaxPermSize=256m : set the heap size allocated to objects that don't need to be garbage often to 256 Mb. The default is only 32 Mb, which proves insufficient.
- -XX:PermSize=256m : preallocate the heap for the permanent objects directly to the desired maximum, 256 Mb, so it doesn't ever have to be resized.
- -XX:NewRatio=5 : Set the ratio of ephemeral versus more long-lived objects to 5 (the default is 9 or more in 64-bit Sun JVMs).
- -XX:CMSTriggerRatio=50 : run the parallel garbage collector when the ratio of free versus non-free heap space is 50 % (the default is 92% in 64-bit JVM, which may incur in pauses and undesirable full sweeps).
- -XX:+UseCompressedOops : use 32-bit pointers when possible, in a 64-bit JVM. This can cut the memory footprint by half in many cases.
- The ending double hyphen "--" is to specify all of these are JVM arguments, not fiji/ImageJ arguments.
Right-click on the canvas and choose "Display - Properties...". Then make sure that:
- "snapshots mode" is set to "Disabled", or at most to "Outlines".
- "Prepaint" is not checked, so that it is disabled.
The goal is to avoid generating mipmaps multiple times, which may be very time consuming.
Right-click on the canvas and choose "Display - Properties...". Then make sure that:
- "enable mipmaps" is not checked, so that it is disabled.
Now to correct the contrast, first re-enable mipmaps by going again to "Display - Properties..." and checking the "enable mipmaps" checkbox. Then you have two general (non-exclusive) options:
A. Use the built-in commands from the right-click menu, such as:
- "Adjust images - Enhance contrast layer-wise"
- "Adjust images - Set min and max layer-wise"
import ij.IJ;
IJ.run(imp, "Enhance Local Contrast (CLAHE)", "blocksize=127"
+ " histogram=256 maximum=3 mask=*None* fast_(less_accurate)");
To set the script to all images, save the above to a file named "whatever.bsh" (notice the filename extension ".bsh") and then right-click on the TrakEM2 canvas and choose "Script - Set preprocessor script layer-wise", and choose the whole range of layers. This will set the script to every image of every layer, and trigger mipmap regeneration for every image. When TrakEM2 loads the image, the script will run on the image before TrakEM2 ever sees its contents.
The preprocessor script gives you maximum power: do whatever you want with the image. For example, normalize the image relative to a known good mean and standard deviation for your data set.
The default generation of mipmaps is done with are averaging, and is pretty fast. Still, you may want to consider parallelizing it: go to "Project - Properties...", and set the mipmap threads to the number of cores in your machine, for example 12.
Stop reading if you are satisfied with the default quality of scaled images in TrakEM2.
If you choose to generate mipmaps using Gaussians, go to "Project - Properties...", and set the mipmaps mode to "Gaussian". Then, you must take care of the following:
In TrakEM2 0.9a and later, the mipmaps machinery can use a multi-threaded Gaussian implementation now present in the latest ImageJ. This means that now there are two sets of threads:
- The set of threads, where each thread regenerates the mipmap pyramid of a single image.
- The set of threads that performs Gaussian blurring for downsampling, for each scaling iteration in the generation of the mipmap pyramid.
Two strategies are possible for accelerating Gaussian-based generation of mipmaps:
- Strategy A: your data consists of large images (over 4000x4000). Right-click on the TrakEM2 display and choose "Project - Properties...", and set the mipmap threads to 1 (the default). Now, mipmaps will be regenerated for one single image at a time, using 12 threads (given 12 cores) for computing the Gaussians.
- Strategy B: your data consists of small images (smaller than 4000x4000). Go to the Fiji window and select "Edit - Options - Memory & Threads...", and set the number of threads to 1. Then, go to "Project - Properties...", and set the mipmap threads to 12. Now, mipmaps will be regenerated for 12 images at a time (given 12 cores), using a single thread for each to compute the Gaussians.
If you change the method for generating mipmaps to a non-Gaussian method, the above situation does not occur. Set the number of threads for regenerating mipmaps to the number of cores, or less if your computer doesn't have much RAM.
Use a computer that follows this rule of thumb: take the largest single 2D image in your dataset, then multiply its size by 10, and make sure that every core of your CPU has at least that much RAM available to it.
For example, for a 4096x4096 16-bit image you will need at least 335 Mb per core, so at least 5.4 Gb of RAM for 16 cores. 8 Gb would likely work better. 32 Gb will be a pleasure to use.
As for a graphics card buy the largest you can afford, both in computing power and in internal memory.