JFilament - how to export snakes as ROI, and parameter definitions

Tags: #<Tag:0x00007fb87db4bbe8> #<Tag:0x00007fb87db4b760>


Hi , I am currently trying to use the JFilament plug-in to track lines of fluorescent intensity across frames of 2D (x,y) images.

I have three questions which I am hoping other users of this plug-in could help answer:

A) Is it possible to export the snakes (line traces) produced via the plug-in as ROI.

B) What do the actual parameters which you set in the plug-in alter? My snakes tend to conform to the fluorescence line well in the first frame but less well as the frames progress. Which parameters need altering to address this issue?

C) What are the units for each of the parameters?

Thanks in advance!



Do you have an example image you could post here for us to try? Also - perhaps give us a description of what you wish to measure, etc. Perhaps there are other workflows/tools you could try?

I haven’t used JFilament much myself (ie - not at all!). But can give it a go… you can also check out their homepage here and the referenced paper.



Hello @Tom_Sharrock

In regards to A.

There is a plugin for exporting snakes to an ROI. It is a separate plugin under JFilament/2D plugins. It currently only uses the last snake, and sets the ROI for current frame if the snake exists.

So what you would do is save the snake(s) to a file, then select the actual image (not the jfilament window but the fiji image window) and run the snakes to ROI plugin. It will ask you to select a snake file, then use the last snake on the current frame.

If you need this to behave a bit differently, I can certainly update the plugin.

B) There are descriptions of parameters on http://athena.physics.lehigh.edu/jfilament/ (same as etarena posted). Maybe you could check out the description there and Ill try to answer any questions after.

Does the snake not conform as well due to changes in the image quality? Or is it because it hasn’t deformed enough to track the shape, and then the next frame it gets a little further away…etc etc.

C) The plugin is mostly unit-less. All of the lengths are in px (in hindsight I would like to improve that).

@etarena Thanks for the heads up, I got the invite on a different email.



Hi Both (@odinsbane & @etarena), and thank you for the responses!

I have been trying to use the plug-in “Snake to ROI” but am unfortunately not having much success.
After saving the snake produced in the Jfilament window as a .txt, I then select the image window and run the snakes to roi plugin.

The image I am running the plug-in on is a duplicate of the one I created the snake with, and when I check the .txt doc the snake is present for this frame. However, no ROI becomes selected in my image or in the ROI manager.
Instead I get the following box shown:

	at Snake_To_ROI.run(Snake_To_ROI.java:30)
	at ij.plugin.filter.PlugInFilterRunner.processOneImage(PlugInFilterRunner.java:265)
	at ij.plugin.filter.PlugInFilterRunner.<init>(PlugInFilterRunner.java:114)
	at ij.IJ.runUserPlugIn(IJ.java:223)
	at ij.IJ.runPlugIn(IJ.java:185)
	at ij.Executer.runCommand(Executer.java:137)
	at ij.Executer.run(Executer.java:66)
	at java.lang.Thread.run(Thread.java:745)

I’m not sure if I am doing something wrong? but any tips would be appreciated.

B) Yep I have read the document, but I’m not sure to what magnitude to change the settings by? I have used the following settings which deforms the snake nice and smoothly.

stretch 100.0
spacing 5.0
background 13182.19692217315
alpha 5.0
weight 5.0
smoothing 1.5
foreground 31741.99124880183
beta 0.2
gamma 10000.0

However, the problem is that between frames the snake does not follow my filament of interest as it moves through X,Y. Instead, if another filament comes close to the snake, the snake snaps to this filament instead.
As in, as the filamentOI moves through space the snake doesn’t move to the same extent. Can this be solved through editing the plug-in parameters or do I need to increase the temporal sampling rate when acquiring the images so the movement between frames is minimised?

Thanks a lot for the help! it’s greatly appreciated.



Hello Tom

So the first part, the error, is because that part of the plugin is not well setup. So, what is happening is that the last snake you have in your file doesn’t exist in the frame you are trying to get an ROI. I can fix this, but it would be on Tuesday. If you want to work around it, you just have to make sure your snake file has only one snake. That is somewhat cumbersome…

The second part, yes either the temporal sampling would need to be increased, or you can use the manual edit tools. Put the deform iterations to be low, like 0, and then when you click track snake, it will just be copied. Once it is copied, you can use the move and rotate to move the snake to a better position, then deform.

Hope this helps.



Hi Matt,

Ah I see now, so currently snakes can only be applied to a series of images by doing it one image/one snake at a time?

If possible I would greatly appreciate if you could edit the plug-in so all snakes saved within the .txt file can be applied to their associated frame at the same time.


3 0 146.77944927730863 277.5642299364881 0
3 1 145.17432811283663 272.71860949223486 0
3 2 144.1979854593845 267.40019639983115 0
3 3 145.8998326706744 263.2024608100114 0
3 4 150.7562780721776 263.0582302379166 0
snake is applied to frame 3

4 0 144.82984398363652 278.1039001710229 0
4 1 144.53443892769693 272.83658906474614 0
4 2 142.8474420262894 267.97191079962477 0
4 3 143.04447373519835 262.6751300741709 0
snake 4 is applied to snake 4

Tuesday is no problem for me. I am planning to analyse quite a large number of movies using your plugin, so this change would really help !

Great, is the move and rotate feature using the mouse? As I can’t finds this feature in the main panel on the Jfilament version I am using?

Thanks again for your help,




Did you install JFilament through the update site? I think the move/rotate is in a menu and has a hot key ctrl m. If you dont find it, check in help/about it will show the version.

As far as the analysis part, a single snake can exist in mutliple frames. So if you had on snake that you tracked through multiple frames, then you could run the snake to roi plugin on each frame from the same file.

What would you like to happen? You have a bunch of snakes on each frame, and wgat output would you like?




I have updated my plugin and the move tool is really useful. Thanks for letting me know about it.

After playing with the plug-in for a while, I think I will actually be okay to use the plug-in as it currently is. Just instead of placing multiple snakes on the same frame. I will re-do the analysis for each different filament I track, and then use a macro to automate the snakes to ROI plugin as you suggest.

Thanks a lot for the help with my questions, It’s really appreciated!



I updated the Snakes_to_ROI plugin so that it goes through all of the snakes and adds an ROI to an ROI manager. It will leave the last snake that exists in the current frame selected. So it should still use the current behaviour but also show an ROI manager.

I am not going to push an update to the update site for a bit, so if you think this new behaviour would help you I can move up the update. If you think it would not affect your workflow in an adverse way, I can make it a second plugin.



Great, that sounds really useful. Yes I would like to give this a try soon if possible, think it would make the workflow much faster. Although having this as a second plugin, such as multiple snakes to ROIs, may be better for other users?



So, I did the plugin, and here is the latest version:

You might be able to save that as a .java file, then compile and run it? Otherwise, I can make an update to the JFilament update site so that you can update it through fiji.



Turns out I also had a bug fix, so I pushed the latest update version, 1.1.3 now.


Cool, I have just tried out the new Snakes to Roi and it works perfectly. Will save me a lot of time,

Thanks for pushing the update.