0001 function [centroids, areas, orientations, majorAxisLengths, minorAxisLengths] = get_DT_cell_location(R,C,cell_list)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 mask = zeros(R,C);
0020 if (size(cell_list,1)~=0)
0021 for num = 1:size(cell_list,1)
0022 row = cell_list(num,1);
0023 col = cell_list(num,2);
0024 mask(row,col) = 1;
0025 end
0026
0027 mask= bwlabel(mask,4);
0028
0029 s = regionprops(mask,'Centroid','Area',...
0030 'Orientation','MajorAxisLength','MinorAxisLength');
0031 centroids = cat(1, s.Centroid);
0032 areas = cat(1,s.Area);
0033 orientations = cat(1,s.Orientation);
0034 majorAxisLengths = cat(1,s.MajorAxisLength);
0035 minorAxisLengths = cat(1,s.MinorAxisLength);
0036
0037
0038
0039
0040
0041
0042 temp = centroids(:,1);
0043 centroids(:,1) = centroids(:,2);
0044 centroids(:,2) = temp;
0045
0046 else
0047 centroids = [];
0048 areas = [];
0049
0050 orientations =[];
0051 majorAxisLengths = [];
0052 minorAxisLengths =[];
0053 end
0054
0055 end