Skip to content
PhagoSight edited this page Apr 19, 2018 · 1 revision

Tracking Neutrophils with PhagoSight: 5


Plotting the tracks overlaid on a slice of DIC

To generate an image with one slice of the fish from the DIC and the tracks "going up" you will need to have the data of the handles to generate the tracks and you also need one slice of the DIC, which will be in the dataR files. So yonu need to either load the data or drag and drop at the command line:


Once you have the data, plot the tracks in any of the options that you have, for instance to highlight the fastest tracks, using option "2" in the third parameter:

hplotTracks       = plotTracks(handles,2, handles.distanceNetwork.numHops>35);

Then, we need to draw the DIC image at the bottom of te tracks, that is of course if you have loaded the image of the first time point, if you loaded a different dataR time point you need to modify ZZ by multiplying by the appropriate time (i.e. T00099 --> 99*ones). Meshgrid creates a uniformly spread grid that will be used for the plot of the DIC

[XX,YY]                     = meshgrid((1:handles.cols),(1:handles.rows));
ZZ                          = 1 * ones(handles.rows,handles.cols);

Then select the slice of the DIC you want to plot (in this case it is 6) and use "surf":


Finally adjust the axis, the colormap and the view:

axis([1 handles.cols 1 handles.rows 1 handles.numFrames])

If the DIC comes too dark or bright you can modify this with the colormap, either directly like this


or using


which allows you to manipulate the levels with a graphical user interface.

Plotting the activation points of a track

Sometimes it is interesting to see the points where the tracks start moving towards the wound with a certain constant speed. That is, the neutrophils may be stationary in one point, and at a certain moment they become activated and start moving. By analysing the slope of the track we can determine the moment when this activity begins, and also we can indicate where is the artificial boundary of the wound set.

To do this, type:


or if you have the DIC in the dataR matrix:


This function requires that you have calculated the activation points previously (with effectiveDistance and effectiveTracks), and to do that you need the manually-labelled woundRegion. If you have not calculated that previously, you can pass woundRegion as an argument to the function:


The circles indicate the activation point and the stars the wound boundary.

Plotting the Wound Region on the DIC

In some cases it is useful to overlay the manually-drawn wound region on the DIC data. This can be done in several ways, but one of the easiest is to create a new variable where the DIC and the wound region are combined.

To begin, you need to have two separate matrices: dataR (or dataIn) with the DIC, and woundRegion with the wound. The DIC may be stored as one or more slices within dataR so you need to select the correct slice of the matrix, in this case, the first one (:,:,1):

subplot(121); imagesc (dataR(:,:,1));
subplot(122); imagesc (woundRegion);

If you do not have the wound region defined, you can draw it manually with

woundRegion                                 = roipoly();

as it was described previously.

Next you need to combine both matrices into a new matrix, say dataR_WR, that will combine them.

dataR_WR = dataR(:,:,1).*(1-zerocross(woundRegion));

If the line is to thin, it may seem not to be present, depending on the size of the plot. In those cases, you can dilate it to an adequate thickness with the command imdilate:

dataR_WR = dataR(:,:,1).*(1-imdilate(zerocross(woundRegion),ones(3)));