Skip to content

add to swap axis if only one time point and several Z#336

Open
gletort wants to merge 3 commits intotrackmate-sc:masterfrom
gletort:loadXML_SwapZT
Open

add to swap axis if only one time point and several Z#336
gletort wants to merge 3 commits intotrackmate-sc:masterfrom
gletort:loadXML_SwapZT

Conversation

@gletort
Copy link
Copy Markdown
Contributor

@gletort gletort commented Feb 10, 2026

Propose to swap Z and T axis in plugin "Load TrackMate file" if there is one time point and several Z. Same function as in the main TrackMate plugin

@tinevez
Copy link
Copy Markdown
Member

tinevez commented Feb 10, 2026

May I suggest going further?

With this approach, the message that the image has only one time-point is shown all the time, regardless of whether the user meant to analyse a 3D image or not. But since we are opening a TrackMate file, we can guess whether the image analyzed was truly 3D or 2D+T, by inspecting the metadata stored in the XML file. For instance:

This would be a true 3D, one time point file:

<Settings>
    <ImageData filename="Celegans-5pc-17timepoints-smoothed.tif" folder="samples/" 
width="240" height="295" nslices="41" nframes="1" pixelwidth="0.1984666072986889"
pixelheight="0.1984666072986889" voxeldepth="1.0" timeinterval="2.0" />

And this would be a 2D+T image file:

  <Settings>
    <ImageData filename="FakeTracks.tif" folder="/Users/tinevez/Development/TrackMateWS/TrackMate/samples/"
width="128" height="128" nslices="1" nframes="50" pixelwidth="1.0" 
pixelheight="1.0" voxeldepth="1.0" timeinterval="1.0" />

Maybe we can read these metadata, check whether they match the dimensionality of the image that was opened, and if not, prompt the user?

@gletort
Copy link
Copy Markdown
Contributor Author

gletort commented Feb 10, 2026

Ok, sure. Should I make it then do the swapping automatically in that case (following the settings in the .xml file), or still ask the user ? The .xml settings should be always correct, no ?

@gletort gletort marked this pull request as draft February 10, 2026 15:30
@tinevez
Copy link
Copy Markdown
Member

tinevez commented Feb 10, 2026

Yes the .xml should have the right metadata: it is taken from the image when the user saved to XML from TrackMate.
So with this PR we could recuperate if they changed the image after loading it, but before running TrackMate.

I would say: prompt the user, if they say yes, flip the image, and then prompts them to fix the dimensionality themselves and resave the image.

@gletort gletort marked this pull request as ready for review February 10, 2026 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants