Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import TrackMate files in Mastodon #345

Merged
merged 4 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/org/mastodon/app/MastodonIcons.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public class MastodonIcons
new ImageIcon( MastodonIcons.class.getResource( "icon-tag-32x32.png" ) );

public static final ImageIcon MAMUT_IMPORT_ICON_MEDIUM =
new ImageIcon( MastodonIcons.class.getResource( "icon-mamut-import-32x32.png" ) );
new ImageIcon( MastodonIcons.class.getResource( "icon-mamut-import-32x32-2.png" ) );

public static final ImageIcon MAMUT_EXPORT_ICON_MEDIUM =
new ImageIcon( MastodonIcons.class.getResource( "icon-mamut-export-32x32.png" ) );
Expand Down
12 changes: 10 additions & 2 deletions src/main/java/org/mastodon/feature/Dimension.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public enum Dimension
*/
TIME( "Time" ),
/**
* Units of angles. We alway pick radians for units.
* Units of angles. We always pick radians for units.
*/
ANGLE( "Angle" ),
/**
Expand All @@ -89,7 +89,11 @@ public enum Dimension
/**
* Non numerical quantities.
*/
STRING( "NA" ); // for non-numeric features
STRING( "NA" ),
/**
* Area.
*/
AREA( "Area" );

public static final String COUNTS_UNITS = "Counts";

Expand Down Expand Up @@ -127,6 +131,8 @@ public String getUnits( final String spaceUnits, final String timeUnits )
{
case ANGLE:
return RADIANS_UNITS;
case ANGLE_RATE:
return RADIANS_UNITS + "/" + timeUnits;
case INTENSITY:
return COUNTS_UNITS;
case INTENSITY_SQUARED:
Expand All @@ -146,6 +152,8 @@ public String getUnits( final String spaceUnits, final String timeUnits )
return spaceUnits + "/" + timeUnits;
case RATE:
return "/" + timeUnits;
case AREA:
return spaceUnits + "²";
default:
case STRING:
return null;
Expand Down
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 Expand Up @@ -523,6 +537,8 @@ private static final Dimension dimensionToDimension( final String dimension )
return Dimension.COST;
case "ANGLE_RATE":
return Dimension.ANGLE_RATE;
case "AREA":
return Dimension.AREA;

default:
throw new IllegalArgumentException( "Unkown dimension " + dimension );
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/mastodon/mamut/launcher/LauncherGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public LauncherGUI( final Consumer< String > projectOpener )
sidePanel.add( btnImportMamut, c );

c.gridx = 1;
sidePanel.add( new JLabel( "import MaMuT" ), c );
sidePanel.add( new JLabel( "<html>import TrackMate<br>&amp; MaMuT</html>" ), c );

c.gridx = 0;
c.gridy++;
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading