Skip to content
Snippets Groups Projects
Commit 25aa87c8 authored by Sebastien Herbert's avatar Sebastien Herbert
Browse files

Remove backup files.

parent 3e5d11db
No related branches found
No related tags found
No related merge requests found
function displayCombinedMap(tableOutputDeproj,tableOutputBell,contour3D,outputFolder)
% If not specified, the default display is now in real space (not projected)
% For shape descriptor see publication Zdilla et al. 2016
% Usual call is
% displayCombinedMap(tableOutputDeproj,tableOutputBell,dataCells.cellContour3D)
% close all
scriptVersion = 'displayCombinedMap_v0p2';
if nargin==3
outputFolder = uigetdir(pwd,'Select the output folder');
end
cd(outputFolder);
% dataBool.doApical = true;
% dataBool.doNeighbours = true;
% dataBool.doAreaRatioRP = true;
% dataBool.doAreaRatioPB = true;
% dataBool.doPerimeter = true;
% dataBool.doAnisotropy = true;
% dataBool.doCircularity = false; % keep it that way until bug fix!
% dataBool.doRoundness = true;
dataBool.doApical = false;
dataBool.doNeighbours = false;
dataBool.doAreaRatioRP = false;
dataBool.doAreaRatioPB = false;
dataBool.doPerimeter = false;
dataBool.doAnisotropy = false;
dataBool.doCircularity = true;
dataBool.doRoundness = false;
save('displayParameters','scriptVersion','dataBool');
% %% Ask the user for which data to plot => For later...
% prompt = {'Enter the matrix size for x^2:';'Enter the colormap name:'};
% name = 'Please select the variable to display';
% Formats = {};
% Formats(1,1).type = 'list';
% Formats(1,1).style = 'listbox';
% Formats(1,1).items = {'Apical area','Nbr of neighbours','Area ratio (Real/Proj)',...
% 'Area ratio (Proj/Bell)','Perimeter (Real)','Circularity (Real)','Roundness (Real)'};
% Formats(1,1).limits = [0 numel(Formats(1).items)]; % multi-select
% [Answer, Cancelled] = inputsdlg(prompt, name, Formats);
%% Data to plot
% Apical area
if dataBool.doApical
dataVal = tableOutputDeproj.AreaReal;
titleFig = 'Cell apical surface area (Real)';
figName = 'mapApicalArea';
dispMap(dataVal,titleFig,figName,contour3D);
end
% Nbr of neighbours
if dataBool.doNeighbours
dataVal = tableOutputDeproj.NbrNeighbours;
titleFig = 'Nbr of neighbours';
figName = 'mapNbrNeighbours';
dispMap(dataVal,titleFig,figName,contour3D);
end
% Area ratio (real vs proj)
if dataBool.doAreaRatioRP
dataVal = tableOutputDeproj.AreaReal./tableOutputDeproj.AreaProj;
titleFig = 'Cell apical surface area ratio (Real/Proj)';
figName = 'mapAreaRatio_RP';
dispMap(dataVal,titleFig,figName,contour3D);
end
% Area ratio (Proj vs Bell)
if dataBool.doAreaRatioPB
dataVal = tableOutputDeproj.AreaProj./tableOutputBell.AreaBell;
titleFig = 'Cell apical surface area ratio (Proj/Bell)';
figName = 'mapAreaRatio_PB';
dispMap(dataVal,titleFig,figName,contour3D);
end
% Perimeter
if dataBool.doPerimeter
dataVal = tableOutputDeproj.PerimeterReal;
titleFig = 'Cell perimeter (Real)';
figName = 'mapPerimeter';
dispMap(dataVal,titleFig,figName,contour3D);
end
% Anisotropy (Real) (as calculated by Bellaiche lab: 1-1/elongation)
if dataBool.doAnisotropy
dataVal = tableOutputDeproj.AnisotropyReal;
titleFig = 'Cell anisotropy (Real)';
figName = 'mapAnisotropy';
dispMap(dataVal,titleFig,figName,contour3D);
end
% Circularity is a shape descriptor that can mathematically indicate the degree of similarity to a perfect circle
if dataBool.doCircularity % Error in the method
dataVal = (4 * pi * area) ./ (Perimeter .^ 2);
dataVal = (4*pi*(tableOutputDeproj.AreaReal) ./ (tableOutputDeproj.PerimeterReal.^2));
titleFig = 'Cell circularity (Real)';
figName = 'mapCircularity';
dispMap(dataVal,titleFig,figName,contour3D);
end
% Roundness is similar to circularity but is insensitive to irregular borders along the perimeter
if dataBool.doRoundness
dataVal = 4*tableOutputDeproj.AreaReal./(pi*(tableOutputDeproj.semiMajAxReal*2).^2);
titleFig = 'Cell roundness (Real)';
figName = 'mapRoundness';
dispMap(dataVal,titleFig,figName,contour3D);
end
end
function dispMap(dataVal,titleFig,figName,contour3D)
%% Preparing the colormap
dataRange = max(dataVal)-min(dataVal);
greyLvlNbr = 200;
color2plot = round(((dataVal-min(dataVal))/dataRange)*(greyLvlNbr-1)+1);
fprintf('displaying: %s\n',titleFig);
dataColor = parula(greyLvlNbr);
%% Plot the figure
figure
hold on
for bioCell = 1:numel(dataVal)
if isnan(dataVal(bioCell))
fprintf('Warning: A value was not set properly: skipping cell %d\n',bioCell);
continue
else
fill3(contour3D{bioCell}.VerticesOrdered(:,1),...
contour3D{bioCell}.VerticesOrdered(:,2),...
contour3D{bioCell}.VerticesOrdered(:,3),...
dataColor(color2plot(bioCell),:), ...
'LineStyle', 'none');
end
end
%% Set axes and colorbar
h = colorbar;
caxis([min(dataVal) max(dataVal)])
axis equal
title(titleFig);
xlabel('X position (µm)'); ylabel('Y position (µm)');
zlabel('Z position (µm)');
savefig(figName)
end
function [tableOutputDeproj, tableOutputBell] = formatTableOuputSurfaceCombine(dataCells,dataSeg)
% Format the important variables into a table output for simpler handling
tableOutputDeproj = table;
tableOutputBell = table;
%% Cell numbering
tableOutputDeproj.Numbers = dataCells.numbers;
tableOutputBell.Numbers = dataSeg.CELLS.numbers(dataCells.numbers);
%% Cell areas
for bioCell = 1:numel(dataCells.numbers)
areaEllReal(bioCell) = dataCells.cellContour3D{bioCell}.ellipseFlatten.areaEllipse;
areaEllProj(bioCell) = dataCells.cellContour2D{bioCell}.ellipseFlatten.areaEllipse;
end
tableOutputDeproj.AreaReal = cell2mat(dataCells.area.areaRealTot);
tableOutputDeproj.AreaProj = cell2mat(dataCells.area.areaProjTot);
tableOutputDeproj.AreaEllReal = areaEllReal;
tableOutputDeproj.AreaEllProj = areaEllProj;
tableOutputBell.AreaBell = dataSeg.CELLS.areas(dataCells.numbers);
%% Cell neighbours
tableOutputDeproj.nbrNeighbours = dataSeg.CELLS.n_neighbors(dataCells.numbers);
tableOutputBell.nbrNeighbours = dataSeg.CELLS.n_neighbors(dataCells.numbers);
%% Cell anisotropy (Bellaiche style)
for bioCell = 1:numel(dataCells.numbers)
elongationReal(bioCell) = dataCells.cellContour3D{bioCell}.ellipseFlatten.semiMajAx / ...
dataCells.cellContour3D{bioCell}.ellipseFlatten.semiMinAx;
elongationProj(bioCell) = dataCells.cellContour2D{bioCell}.ellipseFlatten.semiMajAx / ...
dataCells.cellContour2D{bioCell}.ellipseFlatten.semiMinAx;
elongationBell(bioCell) = dataSeg.CELLS.anisotropies(dataCells.numbers(bioCell));
end
tableOutputDeproj.anisostropyReal = 1-1./elongationReal';
tableOutputDeproj.anisotropyProj = 1-1./elongationProj';
tableOutputBell.anisotropyBell = elongationBell';
%% Cell longer axis
for bioCell = 1:numel(dataCells.numbers)
semiMajorAxisReal(bioCell) = dataCells.cellContour3D{bioCell}.ellipseFlatten.semiMajAx;
semiMajorAxisProj(bioCell) = dataCells.cellContour2D{bioCell}.ellipseFlatten.semiMajAx;
end
tableOutputDeproj.semiMajAxisReal = semiMajorAxisReal';
tableOutputDeproj.semiMajAxisProj = semiMajorAxisProj';
%% Cell angle (Projected only)
for bioCell = 1:length(dataCells.numbers)
% angleReal(bioCell) =
% dataCells.cellContour3D{bioCell}.ellipseFlatten.alpha; => Not
% calculated yet
angleProj(bioCell) = dataCells.cellContour2D{bioCell}.ellipseFlatten.alpha;
angleBell(bioCell) = dataSeg.CELLS.orientations(dataCells.numbers(bioCell));
end
% tableOutputDeproj.angleReal = angleReal';
tableOutputDeproj.angleProj = angleProj';
tableOutputBell.angleBell = angleBell';
%% Cell perimeters
for bioCell = 1:length(dataCells.numbers)
perimeterReal(bioCell) = dataCells.cellContour3D{bioCell}.perimeter3D;
perimeterProj(bioCell) = dataCells.cellContour2D{bioCell}.perimeterProj;
perimeterEllipseReal(bioCell) = dataCells.cellContour3D{bioCell}.ellipseFlatten.perimeterEllipse;
end
tableOutputDeproj.perimeterReal = perimeterReal';
tableOutputDeproj.perimeterProj = perimeterProj';
tableOutputDeproj.perimeterEllipseReal = perimeterEllipseReal';
tableOutputBell.perimeterBell = dataSeg.CELLS.perimeters(dataCells.numbers);
%% Field naming
tableOutputDeproj.Properties.VariableNames = {'cellID' 'AreaReal' 'AreaProj' 'AreaEllipse' 'NbrNeighbours' 'AnisotropyReal'...
'AnisotropyProj' 'semiMajAxReal' 'semiMajAxProj' 'AngleProj' 'PerimeterReal' 'PerimeterProj'...
'PerimeterEllipseReal'};
tableOutputBell.Properties.VariableNames = {'cellID' 'AreaBell' 'NbrNeighbours' 'AnisotropyBell' 'AngleBell'...
'PerimeterBell'};
end
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment