forked from mporter-gre/mtools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cellPropsToXLS.m
81 lines (65 loc) · 3.08 KB
/
cellPropsToXLS.m
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
function cellPropsToXLS(cellProps, imageName)
% Copyright (C) 2013-2014 University of Dundee & Open Microscopy Environment.
% All rights reserved.
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License along
% with this program; if not, write to the Free Software Foundation, Inc.,
% 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
global savePath
numCells = length(cellProps);
rowCounter = 1;
cellData = {};
%cellData = {'Image Name', 'Cell Num', 'Num Neighbours', 'Num Foci', 'Neighbour Distance'};
cellData = {'Image name', 'Cell', 'Size', 'Length', 'Num foci', 'Num Neighbours', 'Neighbours with foci', '% Neighbours with foci'};
for thisCell = 1:numCells
props = cellProps{thisCell};
cellData = [cellData; {imageName, thisCell, props.numPx, props.props.MajorAxisLength, props.numFoci, props.numNeighbours, props.neighboursWithFoci, props.perCentNeighboursWithFoci}];
end
neighbourData = {'Image name', 'Cell', 'Distance to neighbours'};
for thisCell = 1:numCells
props = cellProps{thisCell};
numNeighbours = props.numNeighbours;
if numNeighbours > 0
for thisNeighbour = 1:numNeighbours
neighbourData = [neighbourData; {imageName, thisCell, props.neighbourDist(thisNeighbour)}];
end
else
neighbourData = [neighbourData; {imageName, thisCell, 0}];
end
end
focusData = {'Image name', 'Cell', 'Focus', 'Focus size', 'Focus Px in cell', 'Focus Px outside cell', 'Focus location %length'};
for thisCell = 1:numCells
props = cellProps{thisCell};
numFoci = props.numFoci;
for thisFocus = 1:numFoci
focusData = [focusData; {imageName, thisCell, thisFocus, props.numFocusPx(thisFocus), props.numFocusPxInCell(thisFocus), props.numFocusPxOutsideCell(thisFocus), props.focusPosition(thisFocus)}];
end
end
focusNeighbourData = {'Image name', 'Cell', 'Focus', 'Focus distance to closest neighbour point'};
for thisCell = 1:numCells
props = cellProps{thisCell};
numFoci = props.numFoci;
numNeighbours = props.numNeighbours;
for thisFocus = 1:numFoci
if numNeighbours > 0
for thisNeighbour = 1:numNeighbours
focusNeighbourData = [focusNeighbourData; {imageName, thisCell, thisFocus, props.proxToFocusDist(thisFocus, thisNeighbour)}];
end
end
end
end
xlswrite([savePath '\' imageName '.xls'], cellData, 'Cell Data');
xlswrite([savePath '\' imageName '.xls'], neighbourData, 'Neighbour Data');
xlswrite([savePath '\' imageName '.xls'], focusData, 'Focus Data');
xlswrite([savePath '\' imageName '.xls'], focusNeighbourData, 'Focus Neighbour Data');
end