I am Debanjan and currently using Trackmate for single molecule tracking in live cells in Fiji. I must acknowledge that its an awesome piece of SMT program.
I am transitioning to Matlab for seamless integration with other analysis software package for the tracks, obtained from Trackmate. I am able to analyse SMT with Trackmate inside Matlab using Jean-Yves 's code available in the following weblink http://imagej.net/Using_TrackMate_from_MATLAB
What I’m unable to do is to export those tracks in the ‘model’ as XML file in Matlab. I will really appreciate if you could append few lines of code in the above example that will ExportTracksToXML easily.
@tinevez Thanks for your prompt response. I have probably not made myself very clear. I want to export tracks using ‘ExportTracksToXML’ action in Matlab. The 3rd part in the documentation only elaborates how to import tracks in Matlab. I am running trackmate inside Matlab and have successfully created tracks on images. I want to use save these tracks for record and further analyse them with your ‘@msdanalyser’ and vbSPT in Matlab. If you could append few lines of code where this example end http://imagej.net/Using_TrackMate_from_MATLAB to export the result as XML. I really appreciate your help.
I have run in to another problem today. I have updated the Fiji with Java 8 enabling the use of latest TrackMate 3.4. Fiji is working fine so as TrackMate. But, inside Matlab script, the initializing the ‘model’ for trackmate is giving error that was working fine previously with TrackMate 2.8. Do I need to update the ‘mij.jar’ file in the Matlab too?
model = fiji.plugin.trackmate.Model();
Undefined variable “fiji” or class “fiji.plugin.trackmate.Model”.
Error in TrackMate_MatlabScript (line 19)
model = fiji.plugin.trackmate.Model();
a lot of of these
log4j:WARN No appenders could be found for logger (loci.formats.ClassList).
log4j:WARN Please initialize the log4j system properly.
How do I take care of the errors? And, log4j warning?
@tinevez@imagejan following is what I am doing and the last line is not working. I am running trackmate inside Matlab and have successfully created tracks on images. I want to use save these tracks for record and further analyse them with your ‘@msdanalyser’ and vbSPT in Matlab.
ImagePlus (reader) cannot correctly the dimension order (ie ‘XYZCT’) saved by the Bioformat (OME) metadata. In my case, it is reading the ‘T’ as ‘Z’ and the tracking is obstructed. As soon as I save the same movie file using FIJI’s save command (instead of ‘bfsave’ in Matlab) the TrackMate is working properly. I am trying finding a remedy for that.
Thank you again for your time and help. I really appreciate it.
Are you sure that you are reading in OME format actually?
From this file name, I’d suppose that ImageJ reads the file as plain tif. What happens if you rename the file to .ome.tif instead of .ome-2.tif, or if you explicitly use Bio-Formats to import the image?
@imagejan That was a good point. I have saved the movie again as “Halo-CALM_Cell8-2.ome.tif” and got the same error as follows
Error using TrackMate_MatlabScript (line 147)
Java exception occurred:
java.lang.IllegalArgumentException: Argument out of range: 1
originated from the following code
ok = trackmate.process();
This problem is occurring when I read the movie file by calling ImagePlus inside the Matlab as well as when I open the movie using FIJI’s standard ‘open’ command. During the erroneous image reading in FIJI, TrackMate corrects the order by asking whether the order has been switched between ‘Time’ and ‘Plane’. But interestingly this problem goes away when I open the same movie file thru BioFormat. In that case, the order is read correctly and no further warning is given by TrackMate function. That is why I think the ImagePlus function in not correctly reading the .ome.tif file. I have also noticed someone else complained about a similar problem couple of years ago (not 100% sure though). http://forum.image.sc/t/bioformats-export-as-ome-tiff-scale-bug/2625 https://github.com/scifio/scifio-ome-xml/issues/8.
Whereas, the same movie file when opened using BioFormat and then saved using FIJI’s ‘save’ function, can then be used to track particles using TrackMate.
Let me know if it make sense or I am doing something wrong in the following image reading. Image properties switched between ‘T’ and ‘Z’.
Thanks for looking in to it. It has already been quite bit of help.
I am encountering similar problem when files (time-series movie) that are saved using Bio-Format’s bfsave as .ome.tif can’t be read accurately using ImagePlus function. The dimension order is switched between ‘Time’ and ‘Z-stack’. I think the ImagePlus function in not correctly reading the .ome.tif file format and metadata. I can reproduce the same problem even when I save .ome.tif file using Fiji’s 'saveas' followed by opening the file using FIJI’s standard 'open' function.
I highly appreciate any help on this matter.
PS. I am following up on this topic after a long time because I was unable to post in this forum ‘502 bad gateway’ error
ok, I’ve also sometimes used programmatically trackmate to do just detection; not in matlab but in jython.
I’ve noticed that if you export using a model with only the detection part without the tracking the XML is someway not fine.
my solution is to just put a fake tracker adding it to the model, even if you don’t need it.
then my XML were good.
at the moment I am writing you using a smartphone… so I cannot easily put you down a snippet.
just add a tracker and try to recover the nspots in matlab.
I tried a stack that I generated that is just one spot, 10pixels in diameter, moving 10px/frame, using the first template from https://imagej.net/Using_TrackMate_from_MATLAB, changing just the radius to 5px, and the threshold to 10, and then added the lines