1010# analysis. It is derived from a Groovy script by Jan Eglinger, and uses
1111# the ImageJ2 scripting framework to offer a basic UI / LCI interface
1212# for the user.
13- #
14- # You absolutely need the `TrackMate_extras-x.y.z.jar` to be in Fiji plugins
15- # or jars folder for this to work. Check here to download it:
16- # https://imagej.net/TrackMate#Downloadable_jars
13+
1714
1815import fiji .plugin .trackmate .Spot as Spot
16+ import fiji .plugin .trackmate .Spot .frameComparator as frameComparator
1917import fiji .plugin .trackmate .Model as Model
2018import fiji .plugin .trackmate .Settings as Settings
2119import fiji .plugin .trackmate .TrackMate as TrackMate
2220
2321import fiji .plugin .trackmate .detection .LogDetectorFactory as LogDetectorFactory
2422
25- import fiji .plugin .trackmate .tracking .LAPUtils as LAPUtils
26- import fiji .plugin .trackmate .tracking .sparselap .SparseLAPTrackerFactory as SparseLAPTrackerFactory
27- import fiji .plugin .trackmate .extra .spotanalyzer .SpotMultiChannelIntensityAnalyzerFactory as SpotMultiChannelIntensityAnalyzerFactory
23+ import fiji .plugin .trackmate .tracking .jaqaman .SparseLAPTrackerFactory as SparseLAPTrackerFactory
24+ import fiji .plugin .trackmate .features .spot .SpotIntensityMultiCAnalyzerFactory as SpotIntensityMultiCAnalyzerFactory
2825
2926import ij . IJ as IJ
3027import java .io .File as File
4340settings .dt = 0.05
4441
4542# Spot analyzer: we want the multi-C intensity analyzer.
46- settings .addSpotAnalyzerFactory ( SpotMultiChannelIntensityAnalyzerFactory () )
43+ settings .addSpotAnalyzerFactory ( SpotIntensityMultiCAnalyzerFactory () )
4744
4845# Spot detector.
4946settings .detectorFactory = LogDetectorFactory ()
5350
5451# Spot tracker.
5552settings .trackerFactory = SparseLAPTrackerFactory ()
56- settings .trackerSettings = LAPUtils . getDefaultLAPSettingsMap ()
53+ settings .trackerSettings = settings . trackerFactory . getDefaultSettings ()
5754settings .trackerSettings ['MAX_FRAME_GAP' ] = frameGap
5855settings .trackerSettings ['LINKING_MAX_DISTANCE' ] = linkingMax
5956settings .trackerSettings ['GAP_CLOSING_MAX_DISTANCE' ] = closingMax
8077 tm = model .getTrackModel ()
8178 trackIDs = tm .trackIDs ( True )
8279 for trackID in trackIDs :
80+
8381 spots = tm .trackSpots ( trackID )
84-
85- # Let's sort them by frame.
86- ls = ArrayList ( spots );
87- ls .sort ( Spot .frameComparator )
82+ # Sort spots by frame.
83+ sorted_spots = sorted ( spots , key = lambda s : s .getFeature (Spot .FRAME ))
8884
89- for spot in ls :
85+ for spot in sorted_spots :
9086 values = [ spot .ID (), trackID , spot .getFeature ('FRAME' ), \
9187 spot .getFeature ('POSITION_X' ), spot .getFeature ('POSITION_Y' ), spot .getFeature ('POSITION_Z' ) ]
9288 for i in range ( nChannels ):
93- values .append ( spot .getFeature ( 'MEAN_INTENSITY%02d ' % (i + 1 ) ) )
89+ values .append ( spot .getFeature ( 'MEAN_INTENSITY_CH%d ' % (i + 1 ) ) )
9490
9591 IJ .log ( rowStr % tuple ( values ) )
96-
97-
92+
0 commit comments