Skip to content

Commit

Permalink
Return a MamutImagePlusProject when importing a TrackMate file.
Browse files Browse the repository at this point in the history
This results in offering to resave the image as BDV file when
saving the project.
  • Loading branch information
tinevez committed Nov 11, 2024
1 parent 4eee646 commit 17f6460
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@
import org.mastodon.properties.DoublePropertyMap;
import org.mastodon.properties.IntPropertyMap;

import ij.IJ;
import ij.ImagePlus;

/**
* Importer for TrackMate (http://imagej.net/TrackMate) files.
* <p>
Expand Down Expand Up @@ -162,7 +165,18 @@ public MamutProject createProject() throws IOException
imageFile = makDummyImage( imageDataEl );
}
}
final MamutProject project = MamutProjectIO.fromBdvFile( imageFile );
final MamutProject project;
if ( imageFile.getAbsolutePath().endsWith( ".xml" ) )
{
// Point to a XML file -> it's a MaMuT file
project = MamutProjectIO.fromBdvFile( imageFile );
}
else
{
// Everything else: we assume it's an IJ image.
final ImagePlus imp = IJ.openImage( imageFile.getAbsolutePath() );
project = MamutProjectIO.fromImagePlus( imp );
}

// Set project time and space units
final Element modelEl = root.getChild( MODEL_TAG );
Expand Down

0 comments on commit 17f6460

Please sign in to comment.