TrackMate Scripting Examples for ImageJ 2

fiji
imagej
trackmate
python

#1

Dear Tinevez,

I was following the scripting examples for TrackMate on webpage: “https://imagej.net/Scripting_TrackMate” but I encountered issues with the code below from the example “Export spot, edge and track numerical features after tracking”. The code below was missing “import sys” but even after I added this in, it still could not run as expected. Please advise as I will like to use TrackMate scripting for batch processing.

Fiji version: ImageJ 2.0.0-rc-69/1.52i, Java 1.8.0_66 [64-bit]

Thank You and Best Regards,
John

from ij import IJ, ImagePlus, ImageStack
import fiji.plugin.trackmate.Settings as Settings
import fiji.plugin.trackmate.Model as Model
import fiji.plugin.trackmate.SelectionModel as SelectionModel
import fiji.plugin.trackmate.TrackMate as TrackMate
import fiji.plugin.trackmate.Logger as Logger
import fiji.plugin.trackmate.detection.DetectorKeys as DetectorKeys
import fiji.plugin.trackmate.detection.DogDetectorFactory as DogDetectorFactory
import fiji.plugin.trackmate.tracking.sparselap.SparseLAPTrackerFactory as SparseLAPTrackerFactory
import fiji.plugin.trackmate.tracking.LAPUtils as LAPUtils
import fiji.plugin.trackmate.visualization.hyperstack.HyperStackDisplayer as HyperStackDisplayer
import fiji.plugin.trackmate.features.FeatureFilter as FeatureFilter
import fiji.plugin.trackmate.features.FeatureAnalyzer as FeatureAnalyzer
import fiji.plugin.trackmate.features.spot.SpotContrastAndSNRAnalyzerFactory as SpotContrastAndSNRAnalyzerFactory
import fiji.plugin.trackmate.action.ExportStatsToIJAction as ExportStatsToIJAction
import fiji.plugin.trackmate.io.TmXmlReader as TmXmlReader
import fiji.plugin.trackmate.action.ExportTracksToXML as ExportTracksToXML
import fiji.plugin.trackmate.io.TmXmlWriter as TmXmlWriter
import fiji.plugin.trackmate.features.ModelFeatureUpdater as ModelFeatureUpdater
import fiji.plugin.trackmate.features.SpotFeatureCalculator as SpotFeatureCalculator
import fiji.plugin.trackmate.features.spot.SpotContrastAndSNRAnalyzer as SpotContrastAndSNRAnalyzer
import fiji.plugin.trackmate.features.spot.SpotIntensityAnalyzerFactory as SpotIntensityAnalyzerFactory
import fiji.plugin.trackmate.features.track.TrackSpeedStatisticsAnalyzer as TrackSpeedStatisticsAnalyzer
import fiji.plugin.trackmate.util.TMUtils as TMUtils
   
   
# Get currently selected image
#imp = WindowManager.getCurrentImage()
imp = IJ.openImage('http://fiji.sc/samples/FakeTracks.tif')
#imp.show()
   
   
#-------------------------
# Instantiate model object
#-------------------------
   
model = Model()
   
# Set logger
model.setLogger(Logger.IJ_LOGGER)
   
#------------------------
# Prepare settings object
#------------------------
      
settings = Settings()
settings.setFrom(imp)
      
# Configure detector
settings.detectorFactory = DogDetectorFactory()
settings.detectorSettings = {
    DetectorKeys.KEY_DO_SUBPIXEL_LOCALIZATION : True,
    DetectorKeys.KEY_RADIUS : 2.5,
    DetectorKeys.KEY_TARGET_CHANNEL : 1,
    DetectorKeys.KEY_THRESHOLD : 5.,
    DetectorKeys.KEY_DO_MEDIAN_FILTERING : False,
} 
    
# Configure tracker
settings.trackerFactory = SparseLAPTrackerFactory()
settings.trackerSettings = LAPUtils.getDefaultLAPSettingsMap()
settings.trackerSettings['LINKING_MAX_DISTANCE'] = 10.0
settings.trackerSettings['GAP_CLOSING_MAX_DISTANCE']=10.0
settings.trackerSettings['MAX_FRAME_GAP']= 3
   
# Add the analyzers for some spot features.
# You need to configure TrackMate with analyzers that will generate 
# the data you need. 
# Here we just add two analyzers for spot, one that computes generic
# pixel intensity statistics (mean, max, etc...) and one that computes
# an estimate of each spot's SNR. 
# The trick here is that the second one requires the first one to be in
# place. Be aware of this kind of gotchas, and read the docs. 
settings.addSpotAnalyzerFactory(SpotIntensityAnalyzerFactory())
settings.addSpotAnalyzerFactory(SpotContrastAndSNRAnalyzerFactory())
   
# Add an analyzer for some track features, such as the track mean speed.
settings.addTrackAnalyzer(TrackSpeedStatisticsAnalyzer())
   
settings.initialSpotFilterValue = 1
   
print(str(settings))
      
#----------------------
# Instantiate trackmate
#----------------------
   
trackmate = TrackMate(model, settings)
      
#------------
# Execute all
#------------
   
     
ok = trackmate.checkInput()
if not ok:
    sys.exit(str(trackmate.getErrorMessage()))
     
ok = trackmate.process()
if not ok:
    sys.exit(str(trackmate.getErrorMessage()))
     
      
      
#----------------
# Display results
#----------------
   
model.getLogger().log('Found ' + str(model.getTrackModel().nTracks(True)) + ' tracks.')
    
selectionModel = SelectionModel(model)
displayer =  HyperStackDisplayer(model, selectionModel, imp)
displayer.render()
displayer.refresh()
   
# The feature model, that stores edge and track features.
fm = model.getFeatureModel()
   
for id in model.getTrackModel().trackIDs(True):
   
    # Fetch the track feature from the feature model.
    v = fm.getTrackFeature(id, 'TRACK_MEAN_SPEED')
    model.getLogger().log('')
    model.getLogger().log('Track ' + str(id) + ': mean velocity = ' + str(v) + ' ' + model.getSpaceUnits() + '/' + model.getTimeUnits())
       
    track = model.getTrackModel().trackSpots(id)
    for spot in track:
        sid = spot.ID()
        # Fetch spot features directly from spot. 
        x=spot.getFeature('POSITION_X')
        y=spot.getFeature('POSITION_Y')
        t=spot.getFeature('FRAME')
        q=spot.getFeature('QUALITY')
        snr=spot.getFeature('SNR') 
        mean=spot.getFeature('MEAN_INTENSITY')
        model.getLogger().log('\tspot ID = ' + str(sid) + ': x='+str(x)+', y='+str(y)+', t='+str(t)+', q='+str(q) + ', snr='+str(snr) + ', mean = ' + str(mean))

#2

Dear @John_Lim

What is the error message?


#3

Dear @Jean-Yves

Please see two sets of error messages below. 1st set was using example data and 2nd set was using my own data with LogDetector.

1st set:

Exception in thread "TrackMate spot detection thread 3/4" Exception in thread "TrackMate spot detection thread 4/4" Exception in thread "TrackMate spot detection thread 2/4" Exception in thread "TrackMate spot detection thread 1/4" java.lang.ArrayIndexOutOfBoundsException: 2

	at net.imglib2.algorithm.convolution.LineConvolution.requiredSourceInterval(LineConvolution.java:46)

	at net.imglib2.algorithm.convolution.Concatenation.tmpIntervals(Concatenation.java:110)

	at net.imglib2.algorithm.convolution.Concatenation.process(Concatenation.java:60)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:207)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:168)

	at fiji.plugin.trackmate.detection.DogDetector.process(DogDetector.java:84)

	at fiji.plugin.trackmate.TrackMate$1.run(TrackMate.java:377)

java.lang.ArrayIndexOutOfBoundsException: 2

	at net.imglib2.algorithm.convolution.LineConvolution.requiredSourceInterval(LineConvolution.java:46)

	at net.imglib2.algorithm.convolution.Concatenation.tmpIntervals(Concatenation.java:110)

	at net.imglib2.algorithm.convolution.Concatenation.process(Concatenation.java:60)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:207)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:168)

	at fiji.plugin.trackmate.detection.DogDetector.process(DogDetector.java:84)

	at fiji.plugin.trackmate.TrackMate$1.run(TrackMate.java:377)

java.lang.ArrayIndexOutOfBoundsException: 2

	at net.imglib2.algorithm.convolution.LineConvolution.requiredSourceInterval(LineConvolution.java:46)

	at net.imglib2.algorithm.convolution.Concatenation.tmpIntervals(Concatenation.java:110)

	at net.imglib2.algorithm.convolution.Concatenation.process(Concatenation.java:60)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:207)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:168)

	at fiji.plugin.trackmate.detection.DogDetector.process(DogDetector.java:84)

	at fiji.plugin.trackmate.TrackMate$1.run(TrackMate.java:377)

java.lang.ArrayIndexOutOfBoundsException: 2

	at net.imglib2.algorithm.convolution.LineConvolution.requiredSourceInterval(LineConvolution.java:46)

	at net.imglib2.algorithm.convolution.Concatenation.tmpIntervals(Concatenation.java:110)

	at net.imglib2.algorithm.convolution.Concatenation.process(Concatenation.java:60)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:207)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:168)

	at fiji.plugin.trackmate.detection.DogDetector.process(DogDetector.java:84)

	at fiji.plugin.trackmate.TrackMate$1.run(TrackMate.java:377)

Exception in thread "TrackMate spot detection thread 1/4" java.lang.ArrayIndexOutOfBoundsException: 2

	at net.imglib2.algorithm.convolution.LineConvolution.requiredSourceInterval(LineConvolution.java:46)

	at net.imglib2.algorithm.convolution.Concatenation.tmpIntervals(Concatenation.java:110)

	at net.imglib2.algorithm.convolution.Concatenation.process(Concatenation.java:60)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:207)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:168)

	at fiji.plugin.trackmate.detection.DogDetector.process(DogDetector.java:84)

	at fiji.plugin.trackmate.TrackMate$1.run(TrackMate.java:377)

Exception in thread "TrackMate spot detection thread 4/4" Exception in thread "TrackMate spot detection thread 2/4" java.lang.ArrayIndexOutOfBoundsException: 2

	at net.imglib2.algorithm.convolution.LineConvolution.requiredSourceInterval(LineConvolution.java:46)

	at net.imglib2.algorithm.convolution.Concatenation.tmpIntervals(Concatenation.java:110)

	at net.imglib2.algorithm.convolution.Concatenation.process(Concatenation.java:60)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:207)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:168)

	at fiji.plugin.trackmate.detection.DogDetector.process(DogDetector.java:84)

	at fiji.plugin.trackmate.TrackMate$1.run(TrackMate.java:377)

Exception in thread "TrackMate spot detection thread 3/4" java.lang.ArrayIndexOutOfBoundsException: 2

	at net.imglib2.algorithm.convolution.LineConvolution.requiredSourceInterval(LineConvolution.java:46)

	at net.imglib2.algorithm.convolution.Concatenation.tmpIntervals(Concatenation.java:110)

	at net.imglib2.algorithm.convolution.Concatenation.process(Concatenation.java:60)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:207)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:168)

	at fiji.plugin.trackmate.detection.DogDetector.process(DogDetector.java:84)

	at fiji.plugin.trackmate.TrackMate$1.run(TrackMate.java:377)

java.lang.ArrayIndexOutOfBoundsException: 2

	at net.imglib2.algorithm.convolution.LineConvolution.requiredSourceInterval(LineConvolution.java:46)

	at net.imglib2.algorithm.convolution.Concatenation.tmpIntervals(Concatenation.java:110)

	at net.imglib2.algorithm.convolution.Concatenation.process(Concatenation.java:60)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:207)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:168)

	at fiji.plugin.trackmate.detection.DogDetector.process(DogDetector.java:84)

	at fiji.plugin.trackmate.TrackMate$1.run(TrackMate.java:377)

Exception in thread "TrackMate spot detection thread 1/4" Exception in thread "TrackMate spot detection thread 2/4" Exception in thread "TrackMate spot detection thread 3/4" java.lang.ArrayIndexOutOfBoundsException: 2

	at net.imglib2.algorithm.convolution.LineConvolution.requiredSourceInterval(LineConvolution.java:46)

	at net.imglib2.algorithm.convolution.Concatenation.tmpIntervals(Concatenation.java:110)

	at net.imglib2.algorithm.convolution.Concatenation.process(Concatenation.java:60)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:207)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:168)

	at fiji.plugin.trackmate.detection.DogDetector.process(DogDetector.java:84)

	at fiji.plugin.trackmate.TrackMate$1.run(TrackMate.java:377)

java.lang.ArrayIndexOutOfBoundsException: 2

	at net.imglib2.algorithm.convolution.LineConvolution.requiredSourceInterval(LineConvolution.java:46)

	at net.imglib2.algorithm.convolution.Concatenation.tmpIntervals(Concatenation.java:110)

	at net.imglib2.algorithm.convolution.Concatenation.process(Concatenation.java:60)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:207)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:168)

	at fiji.plugin.trackmate.detection.DogDetector.process(DogDetector.java:84)

	at fiji.plugin.trackmate.TrackMate$1.run(TrackMate.java:377)

java.lang.ArrayIndexOutOfBoundsException: 2

	at net.imglib2.algorithm.convolution.LineConvolution.requiredSourceInterval(LineConvolution.java:46)

	at net.imglib2.algorithm.convolution.Concatenation.tmpIntervals(Concatenation.java:110)

	at net.imglib2.algorithm.convolution.Concatenation.process(Concatenation.java:60)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:207)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:168)

	at fiji.plugin.trackmate.detection.DogDetector.process(DogDetector.java:84)

	at fiji.plugin.trackmate.TrackMate$1.run(TrackMate.java:377)

Exception in thread "TrackMate spot detection thread 4/4" java.lang.ArrayIndexOutOfBoundsException: 2

	at net.imglib2.algorithm.convolution.LineConvolution.requiredSourceInterval(LineConvolution.java:46)

	at net.imglib2.algorithm.convolution.Concatenation.tmpIntervals(Concatenation.java:110)

	at net.imglib2.algorithm.convolution.Concatenation.process(Concatenation.java:60)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:207)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:168)

	at fiji.plugin.trackmate.detection.DogDetector.process(DogDetector.java:84)

	at fiji.plugin.trackmate.TrackMate$1.run(TrackMate.java:377)

Exception in thread "TrackMate spot detection thread 1/4" Exception in thread "TrackMate spot detection thread 4/4" Exception in thread "TrackMate spot detection thread 3/4" java.lang.ArrayIndexOutOfBoundsException: 2

	at net.imglib2.algorithm.convolution.LineConvolution.requiredSourceInterval(LineConvolution.java:46)

	at net.imglib2.algorithm.convolution.Concatenation.tmpIntervals(Concatenation.java:110)

	at net.imglib2.algorithm.convolution.Concatenation.process(Concatenation.java:60)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:207)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:168)

	at fiji.plugin.trackmate.detection.DogDetector.process(DogDetector.java:84)

	at fiji.plugin.trackmate.TrackMate$1.run(TrackMate.java:377)

Exception in thread "TrackMate spot detection thread 2/4" java.lang.ArrayIndexOutOfBoundsException: 2

	at net.imglib2.algorithm.convolution.LineConvolution.requiredSourceInterval(LineConvolution.java:46)

	at net.imglib2.algorithm.convolution.Concatenation.tmpIntervals(Concatenation.java:110)

	at net.imglib2.algorithm.convolution.Concatenation.process(Concatenation.java:60)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:207)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:168)

	at fiji.plugin.trackmate.detection.DogDetector.process(DogDetector.java:84)

	at fiji.plugin.trackmate.TrackMate$1.run(TrackMate.java:377)

java.lang.ArrayIndexOutOfBoundsException: 2

	at net.imglib2.algorithm.convolution.LineConvolution.requiredSourceInterval(LineConvolution.java:46)

	at net.imglib2.algorithm.convolution.Concatenation.tmpIntervals(Concatenation.java:110)

	at net.imglib2.algorithm.convolution.Concatenation.process(Concatenation.java:60)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:207)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:168)

	at fiji.plugin.trackmate.detection.DogDetector.process(DogDetector.java:84)

	at fiji.plugin.trackmate.TrackMate$1.run(TrackMate.java:377)

java.lang.ArrayIndexOutOfBoundsException: 2

	at net.imglib2.algorithm.convolution.LineConvolution.requiredSourceInterval(LineConvolution.java:46)

	at net.imglib2.algorithm.convolution.Concatenation.tmpIntervals(Concatenation.java:110)

	at net.imglib2.algorithm.convolution.Concatenation.process(Concatenation.java:60)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:207)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:168)

	at fiji.plugin.trackmate.detection.DogDetector.process(DogDetector.java:84)

	at fiji.plugin.trackmate.TrackMate$1.run(TrackMate.java:377)

Exception in thread "TrackMate spot detection thread 2/4" Exception in thread "TrackMate spot detection thread 4/4" Exception in thread "TrackMate spot detection thread 1/4" Exception in thread "TrackMate spot detection thread 3/4" java.lang.ArrayIndexOutOfBoundsException: 2

	at net.imglib2.algorithm.convolution.LineConvolution.requiredSourceInterval(LineConvolution.java:46)

	at net.imglib2.algorithm.convolution.Concatenation.tmpIntervals(Concatenation.java:110)

	at net.imglib2.algorithm.convolution.Concatenation.process(Concatenation.java:60)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:207)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:168)

	at fiji.plugin.trackmate.detection.DogDetector.process(DogDetector.java:84)

	at fiji.plugin.trackmate.TrackMate$1.run(TrackMate.java:377)

java.lang.ArrayIndexOutOfBoundsException: 2

	at net.imglib2.algorithm.convolution.LineConvolution.requiredSourceInterval(LineConvolution.java:46)

	at net.imglib2.algorithm.convolution.Concatenation.tmpIntervals(Concatenation.java:110)

	at net.imglib2.algorithm.convolution.Concatenation.process(Concatenation.java:60)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:207)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:168)

	at fiji.plugin.trackmate.detection.DogDetector.process(DogDetector.java:84)

	at fiji.plugin.trackmate.TrackMate$1.run(TrackMate.java:377)

java.lang.ArrayIndexOutOfBoundsException: 2

	at net.imglib2.algorithm.convolution.LineConvolution.requiredSourceInterval(LineConvolution.java:46)

	at net.imglib2.algorithm.convolution.Concatenation.tmpIntervals(Concatenation.java:110)

	at net.imglib2.algorithm.convolution.Concatenation.process(Concatenation.java:60)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:207)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:168)

	at fiji.plugin.trackmate.detection.DogDetector.process(DogDetector.java:84)

	at fiji.plugin.trackmate.TrackMate$1.run(TrackMate.java:377)

java.lang.ArrayIndexOutOfBoundsException: 2

	at net.imglib2.algorithm.convolution.LineConvolution.requiredSourceInterval(LineConvolution.java:46)

	at net.imglib2.algorithm.convolution.Concatenation.tmpIntervals(Concatenation.java:110)

	at net.imglib2.algorithm.convolution.Concatenation.process(Concatenation.java:60)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:207)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:168)

	at fiji.plugin.trackmate.detection.DogDetector.process(DogDetector.java:84)

	at fiji.plugin.trackmate.TrackMate$1.run(TrackMate.java:377)

Exception in thread "TrackMate spot detection thread 4/4" Exception in thread "TrackMate spot detection thread 1/4" Exception in thread "TrackMate spot detection thread 2/4" Exception in thread "TrackMate spot detection thread 3/4" java.lang.ArrayIndexOutOfBoundsException: 2

	at net.imglib2.algorithm.convolution.LineConvolution.requiredSourceInterval(LineConvolution.java:46)

	at net.imglib2.algorithm.convolution.Concatenation.tmpIntervals(Concatenation.java:110)

	at net.imglib2.algorithm.convolution.Concatenation.process(Concatenation.java:60)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:207)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:168)

	at fiji.plugin.trackmate.detection.DogDetector.process(DogDetector.java:84)

	at fiji.plugin.trackmate.TrackMate$1.run(TrackMate.java:377)

java.lang.ArrayIndexOutOfBoundsException: 2

	at net.imglib2.algorithm.convolution.LineConvolution.requiredSourceInterval(LineConvolution.java:46)

	at net.imglib2.algorithm.convolution.Concatenation.tmpIntervals(Concatenation.java:110)

	at net.imglib2.algorithm.convolution.Concatenation.process(Concatenation.java:60)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:207)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:168)

	at fiji.plugin.trackmate.detection.DogDetector.process(DogDetector.java:84)

	at fiji.plugin.trackmate.TrackMate$1.run(TrackMate.java:377)

java.lang.ArrayIndexOutOfBoundsException: 2

	at net.imglib2.algorithm.convolution.LineConvolution.requiredSourceInterval(LineConvolution.java:46)

	at net.imglib2.algorithm.convolution.Concatenation.tmpIntervals(Concatenation.java:110)

	at net.imglib2.algorithm.convolution.Concatenation.process(Concatenation.java:60)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:207)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:168)

	at fiji.plugin.trackmate.detection.DogDetector.process(DogDetector.java:84)

	at fiji.plugin.trackmate.TrackMate$1.run(TrackMate.java:377)

java.lang.ArrayIndexOutOfBoundsException: 2

	at net.imglib2.algorithm.convolution.LineConvolution.requiredSourceInterval(LineConvolution.java:46)

	at net.imglib2.algorithm.convolution.Concatenation.tmpIntervals(Concatenation.java:110)

	at net.imglib2.algorithm.convolution.Concatenation.process(Concatenation.java:60)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:207)

	at net.imglib2.algorithm.gauss3.Gauss3.gauss(Gauss3.java:168)

	at fiji.plugin.trackmate.detection.DogDetector.process(DogDetector.java:84)

	at fiji.plugin.trackmate.TrackMate$1.run(TrackMate.java:377)

2nd set:

v = fm.getTrackFeature(0, 'TRACK_MEAN_SPEED')

	at fiji.plugin.trackmate.FeatureModel.getTrackFeature(FeatureModel.java:429)

	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

	at java.lang.reflect.Method.invoke(Method.java:497)

java.lang.NullPointerException: java.lang.NullPointerException

	at org.python.core.Py.JavaError(Py.java:552)

	at org.python.core.Py.JavaError(Py.java:543)

	at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:190)

	at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:206)

	at org.python.core.PyObject.__call__(PyObject.java:515)

	at org.python.core.PyObject.__call__(PyObject.java:519)

	at org.python.core.PyMethod.__call__(PyMethod.java:156)

	at org.python.pycode._pyx32.f$0(C:/Users/LimSY1/Desktop/Emelyne Teo Jia Wei NUS/testData3/20190111_.py:113)

	at org.python.pycode._pyx32.call_function(C:/Users/LimSY1/Desktop/Emelyne Teo Jia Wei NUS/testData3/20190111_.py)

	at org.python.core.PyTableCode.call(PyTableCode.java:171)

	at org.python.core.PyCode.call(PyCode.java:18)

	at org.python.core.Py.runCode(Py.java:1614)

	at org.python.core.__builtin__.eval(__builtin__.java:497)

	at org.python.core.__builtin__.eval(__builtin__.java:501)

	at org.python.util.PythonInterpreter.eval(PythonInterpreter.java:259)

	at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:57)

	at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:31)

	at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)

	at org.scijava.script.ScriptModule.run(ScriptModule.java:160)

	at org.scijava.module.ModuleRunner.run(ModuleRunner.java:168)

	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:127)

	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:66)

	at org.scijava.thread.DefaultThreadService$3.call(DefaultThreadService.java:238)

	at java.util.concurrent.FutureTask.run(FutureTask.java:266)

	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

	at java.lang.Thread.run(Thread.java:745)

Caused by: java.lang.NullPointerException

	at fiji.plugin.trackmate.FeatureModel.getTrackFeature(FeatureModel.java:429)

	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

	at java.lang.reflect.Method.invoke(Method.java:497)

	at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:188)

	... 24 more

Thank You for your time,

John


#4

Your script is correct actually.
There is bug in TrackMate with the DogDetector happening now due to changes in the ImgLib2 library that is now deployed with Fiji.
Check this:

I am having an intense time at work and I could not find the time to focus on this yet. Please be patient.

best
jy


#5

Dear @Jean-Yves,

Noted & Thank you for supporting this software. When you have time, please note “v = fm.getTrackFeature(0, ‘TRACK_MEAN_SPEED’)” may also be affected by the changes in ImgLib2 library.

Best Regards,

John


#6

Normally no, as I just iterate through a track to get the mean. How would that happen?


#7

Hi Jean-Yves,

I got the following error message below for v = fm.getTrackFeature(id, 'TRACK_MEAN_SPEED') when I ran it for both in a loop and only 1st track. I was using settings.detectorFactory = LogDetectorFactory() which was not affected by ImgLib2 for my own test images, other parts of the codes were following given online example. Thank You. Best Regards, John

at fiji.plugin.trackmate.FeatureModel.getTrackFeature(FeatureModel.java:429)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)

java.lang.NullPointerException: java.lang.NullPointerException
	at org.python.core.Py.JavaError(Py.java:552)
	at org.python.core.Py.JavaError(Py.java:543)
	at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:190)
	at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:206)
	at org.python.core.PyObject.__call__(PyObject.java:515)
	at org.python.core.PyObject.__call__(PyObject.java:519)
	at org.python.core.PyMethod.__call__(PyMethod.java:156)
	at org.python.pycode._pyx2.f$0(C:/Users/LimSY1/Desktop/Emelyne Teo Jia Wei NUS/testData3/20190111_.py:115)
	at org.python.pycode._pyx2.call_function(C:/Users/LimSY1/Desktop/Emelyne Teo Jia Wei NUS/testData3/20190111_.py)
	at org.python.core.PyTableCode.call(PyTableCode.java:171)
	at org.python.core.PyCode.call(PyCode.java:18)
	at org.python.core.Py.runCode(Py.java:1614)
	at org.python.core.__builtin__.eval(__builtin__.java:497)
	at org.python.core.__builtin__.eval(__builtin__.java:501)
	at org.python.util.PythonInterpreter.eval(PythonInterpreter.java:259)
	at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:57)
	at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:31)
	at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)
	at org.scijava.script.ScriptModule.run(ScriptModule.java:160)
	at org.scijava.module.ModuleRunner.run(ModuleRunner.java:168)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:127)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:66)
	at org.scijava.thread.DefaultThreadService$3.call(DefaultThreadService.java:238)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

Caused by: java.lang.NullPointerException
	at fiji.plugin.trackmate.FeatureModel.getTrackFeature(FeatureModel.java:429)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:188)
	... 24 more

#8

Hi Jean-Yves,

Very sorry, I missed the line “settings.addTrackAnalyzer(TrackSpeedStatisticsAnalyzer())” in my codes, there is no issue with “fm.getTrackFeature(id, ‘TRACK_MEAN_SPEED’)”

I will be more careful next time.

Thank You for your time,

John