arboretum/utils.py
def track(localizations: np.ndarray,
          config: dict,
          volume: tuple = ((0,1200),(0,1600),(-1e5,1e5)),
          optimize: bool = True,
          method: BayesianUpdates = BayesianUpdates.EXACT,
          search_radius: int = None,
          min_track_len: int = 2):

    """ track

    Run BayesianTracker with the localizations from the localize function

    """

    n_localizations = localizations.shape[0]
    idx = range(n_localizations)

    # convert the localizations into btrack objects
    from btrack.dataio import  _PyTrackObjectFactory
    factory = _PyTrackObjectFactory()
    objects = [factory.get(localizations[i,:4], label=int(localizations[i,-1])) for i in idx]

    # for obj in objects:
    #     obj.z = obj.z * 10.

    # initialise a tracker session using a context manager
    with btrack.BayesianTracker() as tracker:

        # configure the tracker using a config file, append objects and set vol
        tracker.configure(config)
        tracker.append(objects)

        tracker.volume = volume
        tracker.update_method = method

        if search_radius is not None:
            tracker.max_search_radius = search_radius

        # track them and (optionally) optimize
        tracker.track_interactive(step_size=100)

        if optimize:
            tracker.optimize(options={'tm_lim': int(6e4)})

        # dump all of the data into the frozen state
        frozen_tracker = TrackerFrozenState()
        frozen_tracker.set(tracker)

        frozen_tracker.tracks = [t for t in frozen_tracker.tracks if len(t)>=min_track_len]

    # for track in frozen_tracker.tracks:
    #     for obj in track._data:
    #         obj.z = obj.z / 10.

    return frozen_tracker
 track

    Run BayesianTracker with the localizations from the localize function

    
track
Run BayesianTracker with the localizations from the localize function
track Run BayesianTracker with the localizations from the localize function
def track(localizations: np.ndarray,
          config: dict,
          volume: tuple = ((0,1200),(0,1600),(-1e5,1e5)),
          optimize: bool = True,
          method: BayesianUpdates = BayesianUpdates.EXACT,
          search_radius: int = None,
          min_track_len: int = 2):
    n_localizations = localizations.shape[0]
    idx = range(n_localizations)
    from btrack.dataio import  _PyTrackObjectFactory
    factory = _PyTrackObjectFactory()
    objects = [factory.get(localizations[i,:4], label=int(localizations[i,-1])) for i in idx]
    with btrack.BayesianTracker() as tracker:
        tracker.configure(config)
        tracker.append(objects)
        tracker.volume = volume
        tracker.update_method = method
        if search_radius is not None:
            tracker.max_search_radius = search_radius
        tracker.track_interactive(step_size=100)
        if optimize:
            tracker.optimize(options={'tm_lim': int(6e4)})
        frozen_tracker = TrackerFrozenState()
        frozen_tracker.set(tracker)
        frozen_tracker.tracks = [t for t in frozen_tracker.tracks if len(t)>=min_track_len]
    return frozen_tracker
def track ( localizations : np . ndarray , config : dict , volume : tuple = ( ( 0 , 1200 ) , ( 0 , 1600 ) , ( - 1e5 , 1e5 ) ) , optimize : bool = True , method : BayesianUpdates = BayesianUpdates . EXACT , search_radius : int = None , min_track_len : int = 2 ) : n_localizations = localizations . shape [ 0 ] idx = range ( n_localizations ) from btrack . dataio import _PyTrackObjectFactory factory = _PyTrackObjectFactory ( ) objects = [ factory . get ( localizations [ i , : 4 ] , label = int ( localizations [ i , - 1 ] ) ) for i in idx ] with btrack . BayesianTracker ( ) as tracker : tracker . configure ( config ) tracker . append ( objects ) tracker . volume = volume tracker . update_method = method if search_radius is not None : tracker . max_search_radius = search_radius tracker . track_interactive ( step_size = 100 ) if optimize : tracker . optimize ( options = { 'tm_lim' : int ( 6e4 ) } ) frozen_tracker = TrackerFrozenState ( ) frozen_tracker . set ( tracker ) frozen_tracker . tracks = [ t for t in frozen_tracker . tracks if len ( t ) >= min_track_len ] return frozen_tracker
track
Run BayesianTracker with the localizations from the localize function
track Run BayesianTracker with the localizations from the localize function
""" track

    Run BayesianTracker with the localizations from the localize function

    """ # convert the localizations into btrack objects # for obj in objects: #     obj.z = obj.z * 10. # initialise a tracker session using a context manager # configure the tracker using a config file, append objects and set vol # track them and (optionally) optimize # dump all of the data into the frozen state # for track in frozen_tracker.tracks: #     for obj in track._data: #         obj.z = obj.z / 10.
localizations
np.ndarray
config
dict
volume
tuple
optimize
bool
method
BayesianUpdates
search_radius
int
min_track_len
int