Examplary walkthrough analysis

Set paths

Ensure the current folder is set to QuimP11_MATLAB, or add the QuimP11_MATLAB to to [File->Set Path] so QuimP's functions are useable.
addpath('QuimP11_MATLAB')

Read in the data output by QuimP.

Missing files will be skipped. When prompted, select the folder containing the associated paQP file.
qCells = readQanalysis('example_output_new');
Read Q Analysis Searching in "example_output_new/" ...and its sub directories Found 1 parameter files Reading analysis: QW_channel_2_seg_0.paQP Warning: Map file could not be opened: example_output_new/QW_channel_2_seg_0_fluoCh3.maQP
qCells is a structure. Each element is data for one analysis (i.e. one paQP file). If only one paQP file was located then qCells will be of length of 1.
% we will extract the first analysis into 'c'.
c = qCells(1);
c % type c and you will see a list of the data in the analysis
c = struct with fields:
name: 'QW_channel_2_seg_0' index: 1 PATH: 'example_output_new/' PARAMFILE: 'QW_channel_2_seg_0.paQP' SNAKEFILE: 'QW_channel_2_seg_0.snQP' STATSFILE: 'QW_channel_2_seg_0.stQP.csv' MOTILITYMAPFILE: 'QW_channel_2_seg_0_motilityMap.maQP' FLUOCH1MAPFILE: 'QW_channel_2_seg_0_fluoCh1.maQP' FLUOCH2MAPFILE: 'QW_channel_2_seg_0_fluoCh2.maQP' FLUOCH3MAPFILE: 'QW_channel_2_seg_0_fluoCh3.maQP' CONVEXMAPFILE: 'QW_channel_2_seg_0_convexityMap.maQP' COORDMAPFILE: 'QW_channel_2_seg_0_coordMap.maQP' ORIGINMAPFILE: 'QW_channel_2_seg_0_originMap.maQP' XMAPFILE: 'QW_channel_2_seg_0_xMap.maQP' YMAPFILE: 'QW_channel_2_seg_0_yMap.maQP' outlines: {40×1 cell} fluo: {40×1 cell} R: [3 480 18 254] maxSpeed: [1×40 double] outlineHeaders: {'1.Position' '2.X-coord' '3.Y-coord' '4.Origin' '5.Global origin' '6.Speed'} fluoHeaders: {'1.Intensity' '2.X-coord' '3.Y-coord'} nbFrames: 40 stats: [40×11 double] fluoStats: [40×3×11 double] statHeaders: {'1.Frame' '2.x-Centroid' '3.Y-Centroid' '4.Displacement' '5.Distance Traveled' '6.Directionality' '7.Speed' '8.Perimeter' '9.Elongation' '10.Circularity' '11.Area'} fluoStatHeaders: {'1.Frame' '2.Total Fluo.' '3.Mean Fluo.' '4.Cortex Width' '5.Cyto. Area' '6.Total Cyto. Fluo.' '7.Mean Cyto. Fluo.' '8.Cortex Area' '9.Total Cortex Fluo.' '10.Mean Cortex Fluo.' '11.%age Cortex Fluo.'} SEGTIFF: '/home/baniuk/Documents/NEUBIAS/OSSL/QuimP_full-User_Manual/QW_channel_2_seg.tif' PS: 0.2000 FI: 2 cortexWidth: [1.5000 1.5000 -1] startFrame: 1 endFrame: 40 FLUOCH1TIFF: '/home/baniuk/Documents/NEUBIAS/OSSL/QuimP_full-User_Manual/QW_channel_1_actin.tif' FLUOCH2TIFF: '/home/baniuk/Documents/NEUBIAS/OSSL/QuimP_full-User_Manual/QW_channel_2_neg.tif' FLUOCH3TIFF: '/' frames: [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40] motilityMap: [40×400 double] fluoCh1Map: [40×400 double] fluoCh2Map: [40×400 double] fluoCh3Map: [] coordMap: [40×400 double] originMap: [40×400 double] convexMap: [40×400 double] xMap: [40×400 double] yMap: [40×400 double] forwardMap: [40×400 double] backwardMap: [40×400 double] disMap: []
to access data, for example the fluoMap, type c.fluoMap

Load the image used for channel 1

If this fails, the path c.FLUOCH1TIFF is probably wrong due to it being moved
info = imfinfo(c.FLUOCH1TIFF,'TIFF'); % structure array with data about each image in the stack
im = imread(c.FLUOCH1TIFF, 3, 'Info', info); % load frame 3
figure(1);
imagesc(im);
axis equal
axis off
title('3rd frame of QW\_channel\_1\_actin.tif')

Plot the motility and fluo maps

figure(2);
plotMap(c.motilityMap, 'm', c.FI); % 'm' tells plotMap to format as a motility map.
% c.FI is the frame interval for scaling.
figure(3);
plotMap(c.fluoCh1Map, 'f', c.FI); % 'f' for fluorescence map

Calculate a cross correlation

xFM = xcorrQ( c.motilityMap,c.fluoCh1Map );
figure(4);
imagesc(xFM); title('Motility Map Xcorr with Fluo Map');
colorbar
yticks(0:5:40);
yticklabels(yticks*c.FI);
ylabel('Time (seconds)')
xticks(0:100:400);
xticklabels(xticks./400);
xlabel('Cell outline')
Yellow is strong correlation, blue strong negative correlation. We can also do auto-correlation ( correlate maps with themselves) to search for repetitive patterns of motility/fluorescence.
xMM = xcorrQ( c.motilityMap, c.motilityMap); % calc an auto correlation
figure(5);
imagesc(xMM); title('AutoCorr of Motility Map');
colorbar
yticks(0:5:40);
yticklabels(yticks*c.FI);
ylabel('Time (seconds)')
xticks(0:100:400);
xticklabels(xticks./400);
xlabel('Cell outline')

Plot the cell outlines, stored in c.outlines.

This a cell array. Each cell as the outline for one frame. See c.outlineHeaders for the contents of the columns. We want columns 3 and 4.
c.outlineHeaders
c.outlines{7}(:,3:4) % x and y co-ordinates at frame 7
figure(6);
colours = summer(c.nbFrames); % create a colour chart
hold off;
% plot all the cell outline
for i = 1:c.nbFrames
plotOutline(c.outlines{i}, colours(i,:));
hold on;
end
hold off;
axis equal;
axis(c.R); % set the axis bounds
set(gca,'YDir','reverse'); % flip the Y-axis around so matlab plots (0,0) at the top left

Plot and colour and outline according to membrane speed

The maxMigration value is used to scale the colours
figure(7);
% we take the max velocity across all frames and include negative values
scale = max(abs(c.maxSpeed));
% frame 35. red is expansion, blue contraction
plotMotility(c.outlines{35}, scale, 5);
axis(c.R); % set the axis bounds
axis equal;
% flip the Y-axis around so matlab plots (0,0) at the top left
set(gca,'YDir','reverse');
% this function needs a bit of work to improve its visuals

Plot some global statistics

c.stats is a matrix, rows are frames. See c.statHeaders for column contents.
The cell centroid is computed as the weighted centre of the polygon formed by the cell outline. The measures computed by BOA are as follows (http://pilip.lnx.warwick.ac.uk/docs/master/QuimP_Guide.html):
% path of the cell centroid
figure(8)
plot(c.stats(:,2), c.stats(:,3));
axis equal
title('Path of the cell centroid')
grid on
xlabel('x coordinate')
ylabel('y coordinate')
% change in cell area
figure(9)
plot(c.stats(:,1), c.stats(:,11));
axis equal
title('Change in cell area');
grid on
xticks(0:5:40);
xticklabels(yticks*c.FI);
xlabel('Time (seconds)')
ylabel('Area (\mum^2)')
Fluorescence stats are slightly more complicated, as there are three channels, but is in the same format as c.stats.
c.fluoStats contains all the data. The dimensions are: (Frame, Channel, measure), where measure one of those listed in c.fluostatsHeaders
% for example
c.fluoStats(:,2,7); % for all frame, channel 2, mean cyto fluorescence
c.fluoStats(1:10,1,11); % for the first 10 frames, channel 1, %age cortex fluo.
The measures computed by ANA are as follows (http://pilip.lnx.warwick.ac.uk/docs/master/QuimP_Guide.html):
%plot them against frame number
figure(10);
plot(c.frames, c.fluoStats(:,1,7),c.frames, c.fluoStats(:,1,11));
grid on
legend('Mean cyto fluo','%age Cortex')
title('Cortex fluorescence')
xticks(0:5:40);
xticklabels(yticks*c.FI);
xlabel('Time (seconds)')
ylabel('Pixel intensity')

Tracking through maps

We can track using ECMM data recorded in the co-ordinate and origin maps I have provided all the code to do so
Track forwards.
Typically, the backward tracking gives better results, due to the nature of ECMM mapping.
figure(11);
hold off
plotMap(c.motilityMap, 'm', c.FI); % plot the motility map
trackF = trackForward( c.forwardMap, 1 , 120, 35 );
hold on
plot(trackF(:,2), trackF(:,1), 'r','LineWidth',2);
hold off
Track backwards
trackB = trackBackward( c.backwardMap, 30 , 223, 30 );
hold on
plot(trackB(:,2), trackB(:,1), 'b','LineWidth',2);
hold off
figure(12)
plotMap(c.fluoCh1Map, 'f', c.FI)
trackB2 = trackBackward( c.backwardMap, 40 , 80, 30 );
hold on
plot(trackB2(:,2), trackB2(:,1), 'b','LineWidth',2);
hold off