-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cell size analysis scaling for z-resolution
- Loading branch information
1 parent
40a2402
commit abd851a
Showing
3 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
*.pptx | ||
*.asv | ||
*.mat | ||
*.lnk | ||
ResultTables/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
%load 'Z:\DanielS\old\pancreatic_islets\ResultsTable_3rdSet_3D.mat' | ||
%load 'Z:\DanielS\old\pancreatic_islets\ResultsTable.mat' | ||
% load 'Z:\DanielS\old\pancreatic_islets\ResultsTable3D.mat' | ||
load 'Z:\YuvalDor\mouse islet z-stacks\code\ResultTables\ResultsTable_3rdSet_3D.mat' | ||
unique(ResultsTable.Stack) | ||
|
||
% Store the z-resolution that each stack was imaged at | ||
stack_z_resolutions = containers.Map; | ||
stack_z_resolutions('Cont23') = 0.15; % microns | ||
stack_z_resolutions('Cont24') = 0.05; % microns | ||
stack_z_resolutions('Cont25') = 0.1; % microns | ||
stack_z_resolutions('Wash20') = 0.15; % microns | ||
stack_z_resolutions('Wash22') = 0.1; % microns | ||
stack_z_resolutions('Tor21') = 0.15; % microns | ||
stack_z_resolutions('Tor20') = 0.12; % microns | ||
stack_z_resolutions('Tor22') = 0.15; % microns | ||
max_z_resolution = max(cell2mat(stack_z_resolutions.values)); | ||
|
||
% Filter out bad cells (upper and lower outliers) | ||
subsetTable=ResultsTable(ResultsTable.CellSize<prctile(ResultsTable.CellSize,80),:); | ||
|
||
% Scale cell sizes according to z-resolution (this does not calculate actual volume) | ||
stack_names = unique(subsetTable.Stack,'stable'); | ||
for i=1:length(stack_names) | ||
stack_names(i) | ||
stack_size_scale_factor = max_z_resolution/stack_z_resolutions(char(stack_names(i))) | ||
temp = subsetTable(strcmp(subsetTable.Stack,stack_names(i)),:); | ||
subsetTable.CellSize(strcmp(subsetTable.Stack,stack_names(i))) = temp.CellSize / stack_size_scale_factor; | ||
end | ||
|
||
% Bar chart (per stack) | ||
Means = grpstats(subsetTable.CellSize,subsetTable.Stack,'mean'); | ||
Stds = grpstats(subsetTable.CellSize,subsetTable.Stack,'std'); | ||
Lngth = grpstats(subsetTable.CellSize,subsetTable.Stack,'numel'); | ||
figure | ||
bar(Means) | ||
hold on | ||
errorbar(Means,Stds./sqrt(Lngth),'.r') | ||
ylabel('Cell Area (pixel count)', 'FontSize', 21); | ||
for i=1:length(Means) | ||
text(i+0.06,Means(i)+30,int2str(Means(i)),'FontSize',20); | ||
end | ||
set(gca,'FontSize',19,'XTickLabel',unique(subsetTable.Stack,'stable')) | ||
|
||
% Bar chart (experimental classes) | ||
Means = grpstats(subsetTable.CellSize,subsetTable.Experiment,'mean'); | ||
Stds = grpstats(subsetTable.CellSize,subsetTable.Experiment,'std'); | ||
Lngth = grpstats(subsetTable.CellSize,subsetTable.Experiment,'numel'); | ||
figure | ||
bar(Means) | ||
hold on | ||
errorbar(Means,Stds./sqrt(Lngth),'.r') | ||
ylabel('Cell Area (pixel count)', 'FontSize', 21); | ||
for i=1:length(Means) | ||
text(i+0.06,Means(i)+30,int2str(Means(i)),'FontSize',20); | ||
end | ||
set(gca,'FontSize',19,'XTickLabel',unique(subsetTable.Experiment,'stable')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
function normalized = normalize0to1(mat) | ||
if length(mat)==1 | ||
% one sample can't be normalized | ||
normalized = mat; | ||
else | ||
normalized = (mat-min(mat(:)))./(max(mat(:))-min(mat(:))); | ||
end | ||
end |