trackmate-sc / TrackMate

TrackMate is your buddy for your everyday tracking.
https://imagej.net/plugins/trackmate
GNU General Public License v3.0
169 stars 76 forks source link

NullPointerException on loading TrackMate .xml file, that exported by headless Groovy script #275

Closed hzqfox closed 1 year ago

hzqfox commented 1 year ago

Loading error on the TrackMate xml file exported by the headless Groovy script. The xml file exported also looks different from the one exported from within TrackMate plugin run.

The error message from Fiji: java.lang.NullPointerException at fiji.plugin.trackmate.io.TmXmlReader.getVersion(TmXmlReader.java:520) at fiji.plugin.trackmate.LoadTrackMatePlugIn.run(LoadTrackMatePlugIn.java:105) at ij.IJ.runUserPlugIn(IJ.java:237) at ij.IJ.runPlugIn(IJ.java:203) at ij.Executer.runCommand(Executer.java:152) at ij.Executer.run(Executer.java:70) at java.lang.Thread.run(Thread.java:748)

tinevez commented 1 year ago

Hello @hzqfox Funny it fails on determining the version number. Can you post the XML file in question, as well as a link to the Groovy script?

hzqfox commented 1 year ago

link to the Groovy script

The XML file looks like the following (to attach the file here, I changed the extension to txt): FakeTracks.txt

I suspect on line 62, the static export function from fiji.plugin.trackmate.action.ExportTracksToXML might be the cause. Could it be, this function doesn't mean to export a TrackMate XML file? How can one make use of this export function then?

tinevez commented 1 year ago

Ah! But ExportTracksToXML does not do what you need. It converts the tracks into a simpler XML format, made to be read by other software in the context of the ISBI challenge. It does not generate a TrackMate file.

For this you need to play with the TmXmlWriter class: https://github.com/trackmate-sc/TrackMate/blob/master/src/main/java/fiji/plugin/trackmate/io/TmXmlWriter.java

The XML generated by this class can then be loaded in TrackMate.