Closed JoOkuma closed 10 months ago
Hello @JoOkuma Thanks for your interest in Mastodon.
The file you link is not a BDV file. It is a TrackMate or a MaMuT file:
<?xml version="1.0" ?>
<TrackMate version="3.7.0">
<Model>
<AllTracks>
<Track TRACK_ID="1" NUMBER_SPOTS="11" NUMBER_GAPS="0" TRACK_START="112" TRACK_STOP="122" name="Track_1">
<Edge SPOT_SOURCE_ID="113001015" SPOT_TARGET_ID="114001213" EDGE_TIME="112.5"/>
<Edge SPOT_SOURCE_ID="114001213" SPOT_TARGET_ID="115001100" EDGE_TIME="113.5"/>
<Edge SPOT_SOURCE_ID="115001100" SPOT_TARGET_ID="116001183" EDGE_TIME="114.5"/>
MaMuT and Mastodon are two different software, and do not use the same file format.
Totally forget @JoOkuma : Happy new year!!! Do you want to use MAstodon or MaMuT? Frankly, if you deal with very large amount a data items I would stick with Mastodon. I still maintain MaMuT but do not develop it further.
Hi @tinevez ,
I'm using Mastodon, but I'm using the option to import a MaMuT file to start my Mastodon project. Is this a valid use case?
Thanks for the quick response.
No it's totally valid. My bad! I could reproduce the error and am working on it. Sorry!
Thanks @tinevez ,
I'm fine with adding any missing metadata to my tracks .XML file.
I wrote my own Python trackmate writer here. I'm open to any comments to improve or extend it to make it compatible with Mastodon directly.
Ok found it.
The importer has expectations for the XML file.
The key for the name of the spot must be name
, and not NAME
.
For instance:
<Spot ID="2138" name="ID2138" ... />
is good, but in the file you sent you have:
<Spot ID="233000705" NAME="233000705" .../>
As a consequence, the spots imported in Mastodon all receive null
as label, which causes the error you have seen.
If I do a big batch replace in the XML file it works:
https://github.com/mastodon-sc/mastodon/assets/3583203/b9b86b07-a838-44ac-802d-0df903c47544
(Cool dataset btw).
I am seeing your python writer just now. If you are interested @lxenard in the team has built a full IO package for TrackMate in Python.
The line to change in your writer is this one: https://github.com/royerlab/ultrack/blob/main/ultrack/core/export/trackmate.py#L150
Thanks a lot, @tinevez!
I am seeing your python writer just now. If you are interested @lxenard in the team has built a full IO package for TrackMate in Python.
I would love to use it on my package, what's its name?
I'm back 😅.
I have a similar issue when saving the previously loaded MaMuT file as a Mastodon project.
The error is
Exception in thread "Thread-115" java.lang.NullPointerException
at java.io.ObjectOutputStream$BlockDataOutputStream.getUTFLength(ObjectOutputStream.java:2136)
at java.io.ObjectOutputStream$BlockDataOutputStream.writeUTF(ObjectOutputStream.java:2007)
at java.io.ObjectOutputStream.writeUTF(ObjectOutputStream.java:869)
at org.mastodon.mamut.importer.trackmate.TrackMateImportedFeaturesSerializer.serialize(TrackMateImportedFeaturesSerializer.java:61)
at org.mastodon.mamut.importer.trackmate.TrackMateImportedFeaturesSerializer.serialize(TrackMateImportedFeaturesSerializer.java:46)
at org.mastodon.mamut.feature.MamutRawFeatureModelIO.write(MamutRawFeatureModelIO.java:238)
at org.mastodon.mamut.feature.MamutRawFeatureModelIO.serialize(MamutRawFeatureModelIO.java:84)
at org.mastodon.mamut.ProjectManager.saveProject(ProjectManager.java:556)
at org.mastodon.mamut.ProjectManager$1$3.lambda$run$0(ProjectManager.java:504)
at java.lang.Thread.run(Thread.java:748)
I changed some of the Spot Features to see if it would be fixed, but I'm unfamiliar with Java and the code base.
Do you know what it could be?
I think I found it:
Your <Spot>
elements miss the feature POSITION_T
. The MaMuT importer kind of expects it, since it is declared in the <FeatureDeclaration>
section.
Could you regenerate a tracks.xml
file and add a POSITION_T
to each spot? This feature is supposed to give the time in physical units.
<Spot ID="2001" name="ID2001" POSITION_T="0.0" ... />
Hi @tinevez , thanks for the help.
I fixed that, but I still get the same error. I updated the shared dataset to reflect these changes. It can be found here
Must every element have the features declared on their respective Feature Declaration section? This isn't the current case.
Which features are required, MaMuT and Mastodon?
I really appreciate your help. I'm happy to have a quick chat if that is easier for you.
Most likely it is the same reason: some features are declared in the <FeatureDeclaration>
part, but are not set in the <Spot>
elements. Can you try this by either specifying all features are removing superfluous ones from the declaration?
I think you already have all the required features in the <Spot>
elements.
Thanks for the help @tinevez.
The suggested fix didn't work.
What did the trick was adding this to the <Model>
element
<Model spatialunits="pixels" timeunits="frames">
I appreciate the help. It made debugging easier.
Hey @JoOkuma
Well done. I was wondering: are you using the MaMuT (TrackMate) file format as a means to exchange data from ultrack to Mastodon? Is there a general tracking file format you would like to use instead? Does such a file format exist? If not, what should it contains?
@tinevez Yes, that's my use case. We're using it to correct a few tracks.
I'm not aware of any general tracking file format. Unfortunately, there's no standardized graph library, even within the Python context :(
My current option is that it should be a graph in JSON so we can communicate between different languages. Each node should contain (ID, T, (Z), Y, X, PARENT_ID) and optional arbitrary features.
The adjacency could be formulated more generally than an index to a parent node to support non-forest graphs.
I'm happy to talk more about this.
Hi, happy new years.
I'm trying to open a MaMuT file (shared at http://public.czbiohub.org/royerlab/ultrack/misc/tracks.xml) and I'm getting the error below. Do you know can I fix it?
I converted my tracks to this .xml using my own script, I'm assuming it's correct because MaMuT can open it, but I might be missing something.
The image is too big to share, I'm happy to have a quick call to debug this.
Thanks in advance.