Basic instructions for using JFilament2D

Installation instructions are on the download page

Getting Started

When you start the program this is what you will see. Boxes show the different regions explained below.

Fresh open without an image

Open an image stack in ImageJ and start the plugin.

Fresh open without an image

The parameters values can be changed. By clicking on the values, you will disable all other functions until you have entered a value by entering a number and then pressing enter.

To create a snake, click the Add Snake button, then left click on the image where you want to begin your snake. You should see a line tracking your snake around. Left click to add more points, and finish your snake by right clicking where you want your snake to end.

Press Deform Snake to deform the snake

Action Buttons

Previous Image / Next Image If your image is an image stack then these buttons will move through the image.

Add Snake Add a snake to the image.

Delete Snake This will delete the current snake (the red one) in all frames.

Deform Snake Causes the snake to deform to match the filament shape on the image. If the snake becomes too short it will be removed from the current frame.

Track Snake This takes the current snake and copies it into the next frame. Link snakes from frame to frame.

Delete End Fix Trims the end using two left clicks. The first click determines where you want to cut the snake and the second click removes the snake at the end nearest to the second click. You can clear a snake from the current frame by clicking on both ends.

Delete Middle Fix Deletes a segment between two points determined by two left clicks and replaces it by a straight line.

Deform Fix Similar to Delete Middle Fix exept that a third left click adds a new point.

Stretch Fix Extends the snake from the nearest end by adding a straight line.

Zoom In A first left click determines the upper left corner of a zoom in box. The bottom right corner of the box is determined by a right click.

Zoom Out Reset to the original view.

Track All Frames Takes the current snake and copies it into the next frame. This is repeated until the last frame.

Track Backwards Same as Track Snake but going one frame backwards.

Deform All Frames Applies "Deform Snake" to all frames for selected snake.

Surprise Provides estimates for foreground and background based on selected snake .


Alpha This is the stretching stiffness of the snake.

Beta This is the bending stiffness. Not always nescessary.

Gamma This determines the step size. A large Gamma will cause the snake to deform slowly and smoothly. This is one of the first values to change if the snake does not act properly.

Weight This is the weight that the image has. It relates the image gradients to the snake internal energy.

Stretch Force Determines the magnitude of the stretching force. If the snake is growing or shrinking without bounds, than you probably need to adjust the foreground/background values.

Deform Iterations The number of deform iterations.

Point Spacing A snake is represented by a number of points. This value determines how many pixels separate two successive points.

Image Smoothing The image can be smoothed with a Gaussian kernel when deforming. This is the standard deviation of the Gaussian.

Foreground Intensity value of a point on the filament.

Background Background intensity. The snake will shrink/grow when the tip of the snake is at a point whose intensity is less/greater than the mean of the Foreground and Background intensities.

Curve Type Snake type. "Open" is an open snake that is being stretched by an external force. "Contour" is a closed curve.


Problem: Snake shrinks and goes away or snake grows without bounds.

Solution: Get the foreground and background intensities by using the get button.

Problem: Snake gets locally tangled and then an error message pops up saying snake is too long (see below).

snake gone wild

Solution: Increase Gamma. This is caused by large deformations per iteration step. Changing other parameters may help too.

Problem: Error message that says snake is too long.

Solution: Change entry in the "data" menu to set the maximum snake length.

Solution for versions prior to 0.8: Your snake has too many points. Increasing the point spacing will cause the snake to have less points, so you can manage longer snakes. If you want small point spacing and long snakes you can change the max length parameter by including the following in the ImageJ configuration file:


Thus your snakes maximum number of points is 3000. Note this number is not reflected in the error message, so if you set the length and you still get the error message...your snake is still too long.


Check the credits to see who to contact. Any feedback would be appreciated.

lehigh university crest