Page history Edit this page How do I edit this website?
This page describes content relating to the Fiji distribution of ImageJ. Click the logo for details.

Using TrackMate from MATLAB

This page shows how to use and control TrackMate directly from within MATLAB. This is great and made possible thanks to the great ImageJ-MATLAB extension, made starting in 2016 by Mark Hiner. It makes the Fiji classes visible from MATLAB. Check this page first if you have not already.

Apart from that, the collections of examples that follow just look like several scripts. Which is actually the case: We use the MATLAB interpreter as a scripting interface for TrackMate, as we did in the Scripting TrackMate page. We separated this page to highlight MATLAB specificities and to exploit its capabilities better.

A simple tracking example

Here we open an image though Fiji (not through MATLAB) and track its content. The results are displayed in a Fiji window as well. MATLAB is used here only to control TrackMate and does not really plays a role in the process. This example is actually the same that in the first Scripting TrackMate example.

Why is this greater than it seems?

Because your just ran a MATLAB script that uses and benefits from multithreading without relying on any toolbox! Here is how to tune the number of threads used by TrackMate:

% ... Do initialization before.
trackmate = TrackMate(model, settings);
trackmate.setNumThreads(3); % As many threads as you want.