Commit 3de80ad8 authored by Turnhout, M.C. van's avatar Turnhout, M.C. van
Browse files

Merge branch 'testing' of gitlab.tue.nl:STEM/DMAlab into testing

parents 00c7a7d0 db2d6354
......@@ -15,28 +15,30 @@ As = cell2mat({rp.Area});
ncel = 0;
for r = 1:numel(rp)
% % check size
% if rp(sidx(r)).Area < param.cellminA(ch) % too small
% break % next ones will also be too small
% end
% mean object intensity
oi = mean(raw(rp(sidx(r)).PixelIdxList)); % object intensity
if param.cellminIrel > 0, oi = oi/bi; end % relative object intensity
% quick check size
if rp(sidx(r)).Area < param.cellminA(ch) % too small
break % next ones will also be too small
end
% first check intensity
if oi >= param.cellminI(ch)
% next, proper check for size
if rp(sidx(r)).Area >= param.cellminA(ch) && ...
rp(sidx(r)).Area <= param.cellmaxA(ch)
% this is a potential cell
bwg(rp(sidx(r)).PixelIdxList) = 0.7;
% next, check for size
if rp(sidx(r)).Area >= param.cellminA(ch) && ...
rp(sidx(r)).Area <= param.cellmaxA(ch)
% mean object intensity for next check
oi = mean(raw(rp(sidx(r)).PixelIdxList)); % object intensity
if param.cellminIrel > 0, oi = oi/bi; end % relative object intensity
% finally check intensity
if oi >= param.cellminI(ch)
% yep, this is a cell
ncel = ncel + 1;
mi(ncel, :) = [mean(raw(rp(sidx(r)).PixelIdxList)), ...
rp(sidx(r)).Centroid, rp(sidx(r)).Area];
bwg(rp(sidx(r)).PixelIdxList) = 1;
bwg(rp(sidx(r)).PixelIdxList) = 1;
end
end
......
......@@ -35,6 +35,7 @@ for f = 1:size(list, 1)
% do your thang...
if bfo == 0
DMA_analyseFoV(list(f).name, param);
DMA_analyseevents(list(f).name, param);
else % brightfield only (bfo) processing
DMA_analyseBF(list(f).name, param);
end
......
......@@ -75,9 +75,9 @@ fr = plot(fx, fy, '--', 'linewidth', 2, 'color', [.7 .7 .7]);
%%% GUI elements
ssz = get(0, 'ScreenSize');
guih = figure('units', 'pixel', 'position', [ssz(3)-625 680 580 780], 'Visible', ...
'on', 'Name', sprintf('Set up cell detection in %s', param.dir), ...
'NumberTitle', 'off');
guih = figure('units', 'pixel', 'position', [ssz(3)-625 680 580 780], ...
'Visible', 'on', 'Name', sprintf('Set up cell detection in %s', ...
param.dir), 'NumberTitle', 'off');
% guino = guih.Number;
panelpos = [10 535+160 550 80];
......@@ -257,33 +257,39 @@ slidB = uicontrol('Parent', threshpanel, 'Style', 'Slider', 'Visible', 'on', ...
guitextB = uicontrol('Parent', threshpanel, 'Style', 'edit', 'Position', ...
numpos, 'String', param.cellthresh(ch), 'Callback', @updatethresh);
% set selection panel
panelpos = updatepanelpos(panelpos);
selectpanel = uipanel( ...
'Title', sprintf('bwg(grey) = (BW >= %i && BW <= %i)', ...
param.cellminA(ch), param.cellmaxA(ch)), 'BackgroundColor', ...
'white', 'units', 'pixel', 'Position', panelpos);
slidsmin = uicontrol('Parent', selectpanel, 'Style', 'Slider', ...
'Visible', 'on', 'Position', lslidpos, 'Min', 1, 'Max', 1e5+1, ...
'Value', param.cellminA(ch), 'sliderstep', [.0005 .001], ...
'Callback', @updateselectmin);
textsmin = uicontrol('Parent', selectpanel, 'Style', 'edit', ...
'Position', lnumpos, 'String', param.cellminA(ch), 'Callback', ...
@updateselectmin);
slidsmax = uicontrol('Parent', selectpanel, 'Style', 'Slider', ...
'Visible', 'on', 'Position', rslidpos, 'Min', 1, 'Max', 1e5+1, ...
'Value', param.cellmaxA(ch), 'sliderstep', [.0005 .001], ...
'Callback', @updateselectmax);
textsmax = uicontrol('Parent', selectpanel, 'Style', 'edit', ...
'Position', numpos, 'String', param.cellmaxA(ch), 'Callback', ...
@updateselectmax);
% set intensity panel
panelpos = updatepanelpos(panelpos);
minIpanel = uipanel( ...
'Title', sprintf('bwg(grey) = mean(intensity(BW)) >= %1.2f*mean(intensity(~BW))', param.cellminI(ch)), ...
'Title', sprintf(['bwg(white) = bwg & mean(intensity(BW)) ', ...
'>= %1.2f*mean(intensity(~BW))'], param.cellminI(ch)), ...
'BackgroundColor', 'white', 'units', 'pixel', 'Position', panelpos);
slidC = uicontrol('Parent', minIpanel, 'Style', 'Slider', 'Visible', 'on', ...
'Position', slidpos, 'Min', 0, 'Max', 500, 'Value', ...
slidC = uicontrol('Parent', minIpanel, 'Style', 'Slider', 'Visible', ...
'on', 'Position', slidpos, 'Min', 0, 'Max', 500, 'Value', ...
param.cellminI(ch), 'sliderstep', [.01 .05], 'Callback', @updateminI);
guitextC = uicontrol('Parent', minIpanel, 'Style', 'edit', 'Position', ...
numpos, 'String', param.cellminI(ch), 'Callback', @updateminI);
% set selection panel
panelpos = updatepanelpos(panelpos);
selectpanel = uipanel( ...
'Title', sprintf('bwg(white) = bwg(grey) && (BW >= %i && BW <= %i)', param.cellminA(ch), param.cellmaxA(ch)), ...
'BackgroundColor', 'white', 'units', 'pixel', 'Position', panelpos);
slidsmin = uicontrol('Parent', selectpanel, 'Style', 'Slider', 'Visible', 'on', ...
'Position', lslidpos, 'Min', 1, 'Max', 1e5+1, 'Value', param.cellminA(ch), ...
'sliderstep', [.0005 .001], 'Callback', @updateselectmin);
textsmin = uicontrol('Parent', selectpanel, 'Style', 'edit', 'Position', ...
lnumpos, 'String', param.cellminA(ch), 'Callback', @updateselectmin);
slidsmax = uicontrol('Parent', selectpanel, 'Style', 'Slider', 'Visible', 'on', ...
'Position', rslidpos, 'Min', 1, 'Max', 1e5+1, 'Value', param.cellmaxA(ch), ...
'sliderstep', [.0005 .001], 'Callback', @updateselectmax);
textsmax = uicontrol('Parent', selectpanel, 'Style', 'edit', 'Position', ...
numpos, 'String', param.cellmaxA(ch), 'Callback', @updateselectmax);
% set absolute / relative intensity panel
[lpanelpos, rpanelpos] = updatepanelpos(panelpos);
% set absolute/relative intensity panel
......@@ -796,7 +802,7 @@ if gwaan == 1, DMA_processdir(param); end
% update text & title
set(textsmin, 'String', sprintf('%i', param.cellminA(ch)))
set(selectpanel, 'Title', ...
sprintf('bwg(white) = bwg(grey) && (BW >= %i && BW <= %i)', ...
sprintf('bwg(grey) = (BW >= %i && BW <= %i)', ...
param.cellminA(ch), param.cellmaxA(ch)))
% update slider
set(slidsmin, 'Value', param.cellminA(ch))
......@@ -821,7 +827,7 @@ if gwaan == 1, DMA_processdir(param); end
% update text & title
set(textsmax, 'String', sprintf('%i', param.cellmaxA(ch)))
set(selectpanel, 'Title', ...
sprintf('bwg(white) = bwg(grey) && (BW >= %i && BW <= %i)', ...
sprintf('bwg(grey) = (BW >= %i && BW <= %i)', ...
param.cellminA(ch), param.cellmaxA(ch)))
% update slider
set(slidsmax, 'Value', param.cellmaxA(ch))
......@@ -879,18 +885,18 @@ if gwaan == 1, DMA_processdir(param); end
% update intensity panel
set(guitextC, 'String', sprintf('%1.2f', param.cellminI(ch)))
set(minIpanel, 'Title', ...
sprintf('bwg(grey) = mean(intensity(BW)) >= %1.2f*mean(intensity(~BW))',...
param.cellminI(ch)))
sprintf(['bwg(white) = bwg & mean(intensity(BW)) >= ', ...
'%1.2f*mean(intensity(~BW))'], param.cellminI(ch)))
set(slidC, 'Value', param.cellminI(ch))
% update size panel
set(textsmin, 'String', sprintf('%i', param.cellminA(ch)))
set(selectpanel, 'Title', ...
sprintf('bwg(white) = bwg(grey) && (BW >= %i && BW <= %i)', ...
sprintf('bwg(grey) = (BW >= %i && BW <= %i)', ...
param.cellminA(ch), param.cellmaxA(ch)))
set(slidsmin, 'Value', param.cellminA(ch))
set(textsmax, 'String', sprintf('%i', param.cellmaxA(ch)))
set(selectpanel, 'Title', ...
sprintf('bwg(white) = bwg(grey) && (BW >= %i && BW <= %i)', ...
sprintf('bwg(grey) = (BW >= %i && BW <= %i)', ...
param.cellminA(ch), param.cellmaxA(ch)))
set(slidsmax, 'Value', param.cellmaxA(ch))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment