Commit 8c566911 authored by Turnhout, M.C. van's avatar Turnhout, M.C. van
Browse files

add matlabs threshold value to GUI

parent dab01614
......@@ -10,11 +10,13 @@ Many thanks for the critical review of v0.02 by Ayla Hokke, Lars Houben, and Nik
* [feature] add contrast stretching for fluorescence analysis (thanks to Ayla and Lars for their feedback)
* [feature] set fluorescence cell detection parameters per channel (thanks to Ayla and Lars for their feedback)
* [feature] parse results to find which cell died, when (DMA_analyseevents.m)
* [feature] open dialogue box in DMA_setfluoparam.m for missing droplet data
* [feature] copy new settings in DMA_labconfig to existing DMAlab_param-files to improve backward compatibility (DMA_checkparam.m)
* [feature] parse results to find which cell died, when (DMA_analyseevents.m)
* [update] split droplet detection from DMA_analyseFoV.m into dedicated script DMA_analyseBF.m
* [update] write ncel data as integers (DMA_analyseFoV.m, slower, but smaller and cleaner)
* [update] write ncel&dcel data as integers (DMA_analyseFoV.m & DMA_analyseevents.m, slower, but smaller and cleaner)
* [update] change the order of size and intensity checks in DMA_countfluo.m (size first, faster; changes interpretation of bwg image)
* [update] add Matlabs automatic threshold value to GUI (DMA_setfluoparam.m)
* [fix] fix plotting of zero detected circles in DMA_setBFparam.m
* [fix] proper handling of existing DMAlab_param-files when selecting a target with uigetfile
* [fix] proper handling of new FoV selection in DMA_setfluoparam.m
......
function [raw, A, BW, cs] = DMA_preprocessfluo(F, mask, ch, param)
%[raw, A, BW, cs] = DMA_preprocessfluo(F, mask, ch, param)
function [raw, A, BW, cs, mth] = DMA_preprocessfluo(F, mask, ch, param)
%[raw, A, BW, cs, mth] = DMA_preprocessfluo(F, mask, ch, param)
% Detailed explanation goes here
% get bounding box from mask
......@@ -22,6 +22,10 @@ else
BW = im2bw(A, param.cellthresh(ch));
end
if nargout > 4
mth = graythresh(A);
end
% part of DMAlab: https://gitlab.tue.nl/STEM/DMAlab
end
......@@ -248,6 +248,7 @@ guitextA = uicontrol('Parent', tophatpanel, 'Style', 'edit', 'Position', ...
% set threshholdpanel
panelpos = updatepanelpos(panelpos);
mth = 0;
threshpanel = uipanel( ...
'Title', sprintf('BW = im2bw(A, %1.2f)', param.cellthresh(ch)), ...
'BackgroundColor', 'white', 'units', 'pixel', 'Position', panelpos);
......@@ -352,7 +353,7 @@ if gwaan == 1, DMA_processdir(param); end
bfd(drop, 2+5*(frame-1):4+5*(frame-1)) );
% identified cells
[raw, A, bw, cs] = DMA_preprocessfluo(F, mask, c, param);
[raw, A, bw, cs, mth(c)] = DMA_preprocessfluo(F, mask, c, param);
if param.cellminIraw > 0
[~, ~, C] = DMA_countfluo(raw, bw, c, param);
else
......@@ -381,7 +382,10 @@ if gwaan == 1, DMA_processdir(param); end
set(textB, 'Position', [4 3*size(raw, 1)+7 0])
set(textC, 'Position', [4 4*size(raw, 1)+7 0])
end
% update threshold text (possible new value of mth)
updatethreshgui
end
%%%% FoV GUI elements & control %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
......@@ -636,8 +640,6 @@ if gwaan == 1, DMA_processdir(param); end
% update GUI elements to current channel values
updatetophatgui;
% BW threshold
updatethreshgui;
% minimum intensity
update_minIGUI;
% minimum area
......@@ -747,17 +749,19 @@ if gwaan == 1, DMA_processdir(param); end
param.cellthresh(param.cellthresh < -0.1) = -0.1;
param.cellthresh(param.cellthresh > 1) = 1;
updatethreshgui
update_plot
end
function updatethreshgui
% update text & title
set(guitextB, 'String', sprintf('%1.2f', param.cellthresh(ch)))
if param.cellthresh(ch) < 0
set(threshpanel, 'Title', 'BW = im2bw(A, graythresh(A))')
set(threshpanel, 'Title', ...
sprintf('BW = im2bw(A, graythresh(A)); %% (matlab: %1.4f)', ...
mth(ch)))
else
set(threshpanel, 'Title', ...
sprintf('BW = im2bw(A, %1.2f)', param.cellthresh(ch)))
sprintf('BW = im2bw(A, %1.2f); %% (matlab: %1.4f)', ...
param.cellthresh(ch), mth(ch)))
end
% update slider
......@@ -872,33 +876,12 @@ if gwaan == 1, DMA_processdir(param); end
param.cellthresh(param.cellthresh < 0) = -0.1;
% update tophat panel
set(guitextA, 'String', sprintf('%i', param.celltophat(ch)))
set(tophatpanel, 'Title', ...
sprintf('A = imtophat(cs, strel(''disk'', %i))', ...
param.celltophat(ch)))
set(slidA, 'Value', param.celltophat(ch))
% update thresh panel
set(guitextB, 'String', sprintf('%1.2f', param.cellthresh(ch)))
set(threshpanel, 'Title', ...
sprintf('BW = im2bw(A, %1.2f)', param.cellthresh(ch)))
set(slidB, 'Value', param.cellthresh(ch))
updatetophatgui
% update intensity panel
set(guitextC, 'String', sprintf('%1.2f', param.cellminI(ch)))
set(minIpanel, 'Title', ...
sprintf(['bwg(white) = bwg & mean(intensity(BW)) >= ', ...
'%1.2f*mean(intensity(~BW))'], param.cellminI(ch)))
set(slidC, 'Value', param.cellminI(ch))
update_minIGUI
% update size panel
set(textsmin, 'String', sprintf('%i', param.cellminA(ch)))
set(selectpanel, 'Title', ...
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(grey) = (BW >= %i && BW <= %i)', ...
param.cellminA(ch), param.cellmaxA(ch)))
set(slidsmax, 'Value', param.cellmaxA(ch))
updateselectmingui
updateselectmaxgui
update_plot
end
......
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