Ejemplo n.º 1
0
def runTrackMate(imp, targetChannel, dt, radius, threshold, frameGap,
                 linkingMax, closingMax):
    # Get the number of channels
    nChannels = imp.getNChannels()
    IJ.log("->Detection threshold used: " + str(threshold))
    IJ.log("->Number of frames is: " + str(imp.getStackSize()))
    IJ.log("->Target channel is: " + str(targetChannel))
    IJ.log('->Number of channels to measure %d' % nChannels)
    # Setup settings for TrackMate
    settings = Settings()
    settings.setFrom(imp)
    settings.dt = dt

    # Spot analyzer: we want the multi-C intensity analyzer.
    settings.addSpotAnalyzerFactory(SpotMultiChannelIntensityAnalyzerFactory())

    # Spot detector.
    settings.detectorFactory = LogDetectorFactory()
    settings.detectorSettings = settings.detectorFactory.getDefaultSettings()
    settings.detectorSettings['RADIUS'] = radius
    settings.detectorSettings['THRESHOLD'] = threshold
    settings.detectorSettings['TARGET_CHANNEL'] = targetChannel

    # Spot tracker.
    #settings.trackerFactory = SparseLAPTrackerFactory()
    settings.trackerFactory = LAPTrackerFactory()
    settings.trackerSettings = LAPUtils.getDefaultLAPSettingsMap()
    settings.trackerSettings['MAX_FRAME_GAP'] = frameGap
    settings.trackerSettings['LINKING_MAX_DISTANCE'] = linkingMax
    settings.trackerSettings['GAP_CLOSING_MAX_DISTANCE'] = closingMax
    settings.trackerSettings['ALLOW_TRACK_MERGING'] = False

    settings.trackerSettings['ALLOW_GAP_CLOSING'] = False
    settings.trackerSettings['ALLOW_TRACK_SPLITTING'] = False
    settings.trackerSettings['ALLOW_TRACK_MERGING'] = False
    settings.trackerSettings['ALTERNATIVE_LINKING_COST_FACTOR'] = 0.5
    settings.trackerSettings['BLOCKING_VALUE'] = 1.0
    settings.trackerSettings['CUTOFF_PERCENTILE'] = 1.0

    #settings.trackerSettings['SPLITTING_MAX_DISTANCE'] = 16.0
    # Run TrackMate and store data into Model.

    model = Model()
    trackmate = TrackMate(model, settings)

    if not trackmate.checkInput() or not trackmate.process():
        IJ.log('Could not execute TrackMate: ' +
               str(trackmate.getErrorMessage()))
    else:
        return model, nChannels
import ij.IJ as IJ
import java.io.File as File
import java.util.ArrayList as ArrayList

# Swap Z and T dimensions if T=1
dims = imp.getDimensions()  # default order: XYCZT
if (dims[4] == 1):
    imp.setDimensions(dims[2, 4, 3])

# Get the number of channels
nChannels = imp.getNChannels()

# Setup settings for TrackMate
settings = Settings()
settings.setFrom(imp)
settings.dt = 0.05

# Spot analyzer: we want the multi-C intensity analyzer.
settings.addSpotAnalyzerFactory(SpotMultiChannelIntensityAnalyzerFactory())

# Spot detector.
settings.detectorFactory = LogDetectorFactory()
settings.detectorSettings = settings.detectorFactory.getDefaultSettings()
settings.detectorSettings['RADIUS'] = radius
settings.detectorSettings['THRESHOLD'] = threshold

# Spot tracker.
settings.trackerFactory = SparseLAPTrackerFactory()
settings.trackerSettings = LAPUtils.getDefaultLAPSettingsMap()
settings.trackerSettings['MAX_FRAME_GAP'] = frameGap
settings.trackerSettings['LINKING_MAX_DISTANCE'] = linkingMax
Ejemplo n.º 3
0
import ij. IJ as IJ
import java.io.File as File
import java.util.ArrayList as ArrayList

# Swap Z and T dimensions if T=1
dims = imp.getDimensions() # default order: XYCZT
if (dims[4] == 1):
	imp.setDimensions( dims[2,4,3] )

# Get the number of channels 
nChannels = imp.getNChannels()

# Setup settings for TrackMate
settings = Settings()
settings.setFrom( imp )
settings.dt = 0.05

# Spot analyzer: we want the multi-C intensity analyzer.
settings.addSpotAnalyzerFactory( SpotMultiChannelIntensityAnalyzerFactory() )

# Spot detector.
settings.detectorFactory = LogDetectorFactory()
settings.detectorSettings = settings.detectorFactory.getDefaultSettings()
settings.detectorSettings['RADIUS'] = radius
settings.detectorSettings['THRESHOLD'] = threshold

# Spot tracker.
settings.trackerFactory = SparseLAPTrackerFactory()
settings.trackerSettings = LAPUtils.getDefaultLAPSettingsMap()
settings.trackerSettings['MAX_FRAME_GAP']  = frameGap
settings.trackerSettings['LINKING_MAX_DISTANCE']  = linkingMax