Skip to content

Commit

Permalink
Example exporting tables to CSV programmatically.
Browse files Browse the repository at this point in the history
  • Loading branch information
tinevez committed Aug 6, 2023
1 parent 3867904 commit 319d284
Showing 1 changed file with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package fiji.plugin.trackmate.visualization.table;

import java.io.File;
import java.io.IOException;

import fiji.plugin.trackmate.Model;
import fiji.plugin.trackmate.gui.displaysettings.DisplaySettings;
import fiji.plugin.trackmate.io.TmXmlReader;

public class ExportTableToCSVExample
{

public static void main( String[] args ) throws IOException
{
final TmXmlReader reader = new TmXmlReader( new File( "samples/FakeTracks.xml" ) );
final Model model = reader.getModel();
// final SelectionModel selectionModel = new SelectionModel( model );
final DisplaySettings ds = reader.getDisplaySettings();

// Export all spots.
File allSpotsCSVFile = new File( "samples/AllSpotsCSVExport.csv" );
AllSpotsTableView.createSpotTable( model, ds ).exportToCsv( allSpotsCSVFile );

// Export spots in tracks.
File spotsInTracksTableCSVFile = new File( "samples/SpotsInTracksCSVExport.csv" );
TrackTableView.createSpotTable( model, ds ).exportToCsv( spotsInTracksTableCSVFile );

// Export tracks.
File trackTableCSVFile = new File("samples/TracksCSVExport.csv");
TrackTableView.createTrackTable( model, ds ).exportToCsv( trackTableCSVFile );

// Export edges.
File edgeTableCSVFile = new File( "samples/EdgesCSVExport.csv" );
TrackTableView.createEdgeTable( model, ds ).exportToCsv( edgeTableCSVFile );

}

}

0 comments on commit 319d284

Please sign in to comment.