Previous (Tracking Neutrophils with Matlab 7) / Index

Tracking Neutrophils with Matlab: 8


Videos of the tracking process

The ultimate visualisation technique is to watch the neutrophils moving about and the tracks displayed next to them!

In some cases it is useful to generate a video of the datasets that have been tracked. It will show you the segmented neutrophils and a series of lines that represent the tracks, from the starting to the end of the track. The colours of the tracks are related to the velocity of each track, blue corresponds to slowest ones, red and brown to the fastest ones and yellow-green to intermediate ones. To generate the videos you need to use the plotNeutrophilMovie. You can call the function without input or output arguments:


The code will open a window to find the correct folder where the handles are stored, or conversely, you can directly pass the folder name:

   F = plotNeutrophilMovie('NeutropTest_mat_Ha');

This command will read the handles and the reduced data or the labelled data to produce each frame of the video. The video will be automatically save in a new folder with the extension _mat_VI, one video will be saved as an uncompressed "AVI" movie file, and a second will be saved as an animaged "GIF". The movie in matlab format is passed to the variable "F" in case you need to manipulate the data further or you want to save it with a different name or in a different location.

This particular video has only 9 frames, so it does not look particularly good, here is an example with more frames:

Display options

plotNeutrophilMovie has several different options to generate the movies. First, you can select if you want to display the intensity of the neutrophils or the segmented neutrophils. For the intensity, there are 2 options, one displays the neutrophils in green/red colour over a black background, and the other displays them in MATLAB's "jet" colourmap (dark blue - cyan - green - yellow - orange - red - brown, from low to high intensities). You can also select if you want to display a slice of DIC and the tracks and neutrophils overlaid on it. There are 7 combinations in total:

  1. Neutrophil intensity in green/red plus tracks
  2. Neutrophil intensity in green/red plus a slice of DIC plus tracks
  3. Neutrophil intensity in JET plus tracks
  4. Neutrophil intensity in JET plus a slice of DIC plus tracks
  5. Neutrophil Labels in JET plus tracks
  6. Neutrophil Labels in JET plus a slice of DIC plus tracks
  7. Neutrophil intensity in green/red without tracks
  8. Neutrophil intensity in green/red plus a slice of DIC without tracks

Of course, you need to have DIC to be able to use the options 2, 4,and 6. To select any of the previous options, you have to use a second argument when you call plotNeutrophil movie. plotNeutrophilMovie detects the green/red colours of the neutrophils plus the presence of DIC as described by the field handles.ChannelDistribution, so you do not need to do anything in particular to get the green/red colours.

The difference are shown in the following examples where the first frame of the sequence is displayed:

[F1]=plotNeutrophilMovie ('Example1_mat_Ha',1);

[F2]=plotNeutrophilMovie ('Example1_mat_Ha',2);

[F3]=plotNeutrophilMovie ('Example1_mat_Ha',3);

[F4]=plotNeutrophilMovie ('Example1_mat_Ha',4);

[F5]=plotNeutrophilMovie ('Example1_mat_Ha',5);

[F6]=plotNeutrophilMovie ('Example1_mat_Ha',6);

[F6]=plotNeutrophilMovie ('Example2_mat_Ha',3);

[F6]=plotNeutrophilMovie ('Example3_mat_Ha',7);

Displaying only a subset of the tracks

In some cases, especially when you have a large number of tracks to display, it may be useful to display only a subset of the tracks. plotNeutrophilMovie accepts a third input parameter that allows the function to select a few tracks only. This option may be interesting if you want to analyse just a few neutrophils and their behaviour. For instance, you may be interested in the tracks of two neutrophils, say 1 and 3, so you can pass the following parameters:

[F6]=plotNeutrophilMovie ('Example2_mat_Ha',5,[1 3]);

Compare that with one of the previous examples, we only selected two tracks from the subset. When you do not know which track is which, you can address the handles (see Advanced Matrix Manipulation in the Introduction and handles structure) to select a subset with particular characteristics, for instance you may be interested in displaying only those tracks that span more than a certain number of time frames. In a case like that the third parameter is extracted from handles.distanceNetwork.numHops and the length you desire:

[F6]=plotNeutrophilMovie ('Example2_mat_Ha',1, find(handles.distanceNetwork.numHops>10));

The previous line of code would select only those tracks that have more than 10 hops. Notice that you need to use find to address the matrix correctly.

Finally, If you do not know the folder where your data is located, you can call the function without any parameters and a window will open allowing you to browse through your files to locate the folder you want.

Previous (Tracking Neutrophils with Matlab 7) / Index