Files
hartman-server/qhtcp-workflow/apps/matlab/easy/NCdisplayGui.m

459 lines
13 KiB
Matlab
Executable File

%% CALLED WHEN ACCESSING 'CurveFit Display' %%
function [scLst, row, col] = NCdisplayGui(projectScansDir)
xPos=0.05;
btnWid=0.10;
btnHt=0.05;
spacing=0.02; % Spacing between the button and the next command's label
% Figure
% The ADD Groups button
btnNumber=1;
yPos=0.85-(btnNumber-1)*(btnHt+spacing);
btnPos=[xPos yPos-spacing btnWid btnHt];
row=1;
hedit=uicontrol(...
'Style', 'edit',...
'String',row,...
'Units','normalized',...
'Position', btnPos,... % [.002 .70 .08 .10],...
'callback',{@editRowNum}); % 'Position', [5 100 60 20])
function editRowNum(source,~)
user_entry=str2double(get(source,'string'));
if (isnan(user_entry)||(user_entry<0)||(user_entry>17) )
errordlg('Enter a Row between 1 and 16','Bad Input','modal')
return
end
row=user_entry;
end
btnNumber=2;
yPos=0.85-(btnNumber-1)*(btnHt+spacing);
btnPos=[xPos yPos-spacing btnWid btnHt];
col=1;
hedit=uicontrol(...
'Style', 'edit',...
'String',col,...
'Units','normalized',...
'Position', btnPos,... % [.002 .70 .08 .10],...
'callback',{@entryColNum}); % 'Position', [5 100 60 20])
function entryColNum(source,~)
user_entry=str2double(get(source,'string'));
if (isnan(user_entry)||(user_entry<0)||(user_entry>25))
errordlg('Enter a Column between 1 and 24','Bad Input','modal')
return
end
col=user_entry;
end
% Read in numeric folder names
nlist=dir(fullfile(projectScansDir,'*'));
nnn=0;
for n=1:size(nlist,1)
if (~isempty(str2num(nlist(n).name)))
nnn=nnn+1;
PnumLst(nnn)=(str2num(nlist(n).name));
slst(nnn,1)={nlist(n).name};
slst(nnn,1)={(nlist(n).name)};
end
end
hListbox=uicontrol(...
'Style', 'listbox',...
'String',sort(slst),...
'value',[],...
'max',1000,...
'min',1,...
'Units','normalized',...
'Position', [.40 .40 .10 .60],...
'callback',{@load_listbox}); %'uiresume(gcbf)'); 'Position', [5 100 60 20])
function load_listbox(source,~)
userIndx=(get(source,'value'));
userStr=(get(source,'string'));
%scLstIndx=str2num(char(strrep(userStr(userIndx), 'Scan', '')))
user_entry=userStr(userIndx);
scLst=user_entry;
end
btnNumber=10;
yPos=0.85-(btnNumber-1)*(btnHt+spacing);
btnPos=[xPos yPos-spacing btnWid btnHt];
hedit8=uicontrol(...
'Style', 'pushbutton',...
'String',{'Continue'},...
'Units','normalized',...
'Position', btnPos,...
'callback','uiresume(gcbf)');
% Labels
xLPos=0.175;
yPos=0;
btnWid=0.20;
lblNumber=1;
yPos=0.85-(lblNumber-1)*(btnHt+spacing);
btnPos=[xLPos yPos-spacing btnWid btnHt];
htxt=uicontrol(...
'Style', 'text',...
'String','Row',...
'Units','normalized',...
'Position', btnPos);
lblNumber=2;
yPos=0.85-(lblNumber-1)*(btnHt+spacing);
btnPos=[xLPos yPos-spacing btnWid btnHt];
htxt=uicontrol(...
'Style', 'text',...
'String','Column',...
'Units','normalized',...
'Position', btnPos);
% Not needed for Ncode ImRobot
uiwait(gcf);
end %function end $$$$$[/INST]
%}
%{
%-------------------333333-----------
lblNumber=3;
yPos=0.85-(lblNumber-1)*(btnHt+spacing);
btnPos=[xLPos yPos-spacing btnWid btnHt];
htxt=uicontrol(...
'Style', 'text',...
'String','BG Threshold (%above) Detection',...
'Units','normalized',...
'Position', btnPos);
%-------------------4-----------
lblNumber=4;
yPos=0.85-(lblNumber-1)*(btnHt+spacing);
btnPos=[xLPos yPos-spacing btnWid btnHt];
htxt=uicontrol(...
'Style', 'text',...
'String','SpotDetThres(1-60%)',...
'Units','normalized',...
'Position', btnPos);
%-------------------55555-----------
lblNumber=5;
yPos=0.85-(lblNumber-1)*(btnHt+spacing);
btnPos=[xLPos yPos-spacing btnWid btnHt];
htxt=uicontrol(...
'Style', 'text',...
'String','Radius',... %'String','Width',...
'Units','normalized',...
'Position', btnPos);
%-------------------66666-----------
lblNumber=6;
yPos=0.85-(lblNumber-1)*(btnHt+spacing);
btnPos=[xLPos yPos-spacing btnWid btnHt];
htxt=uicontrol(...
'Style', 'text',...
'String','Dither',...
'Units','normalized',...
'Position', btnPos);
%-------------------77777-----------
lblNumber=7;
yPos=0.85-(lblNumber-1)*(btnHt+spacing);
btnPos=[xLPos yPos-spacing btnWid btnHt];
htxt=uicontrol(...
'Style', 'text',...
'String','SearchRange',...
'Units','normalized',...
'Position', btnPos);
%-------------------88888-----------
%{
lblNumber=8;
yPos=0.85-(lblNumber-1)*(btnHt+spacing);
btnPos=[xLPos yPos-spacing btnWid btnHt];
htxt=uicontrol(...
'Style', 'text',...
'String','Blank2',...
'Units','normalized',...
'Position', btnPos);
%----------------------------------------
%}
%}
%{
%-------------------66666-----------
btnNumber=6;
yPos=0.85-(btnNumber-1)*(btnHt+spacing);
btnPos=[xPos yPos-spacing btnWid btnHt];
srcExtendFactor=ImParMat(7);
hedit=uicontrol(...
'Style', 'edit',...
'String',srcLoIntensThres,...
'Units','normalized',...
'Position', btnPos,...
'callback',{@entryExtendFactor});
function entryExtendFactor(source,eventdata)
user_entry=str2double(get(source,'string'));
if (isnan(user_entry)||(user_entry<1.8)||(user_entry>4.0))
errordlg('You must enter a numeric value between 1.8 and 2.1','Bad Input','modal')
return
end
ExtendFactor=user_entry
ImParMat(7)= ExtendFactor
ExtendFactor
end
%}
%{
%-------------------333333-----------
btnNumber=3;
yPos=0.85-(btnNumber-1)*(btnHt+spacing);
btnPos=[xPos yPos-spacing btnWid btnHt];
srcBGthreshold=ImParMat(3);
hedit=uicontrol(...
'Style', 'edit',...
'String',srcBGthreshold,...
'Units','normalized',...
'Position', btnPos,... % [.002 .70 .08 .10],...
'callback',{@entryBGthreshold}); % 'Position', [5 100 60 20])
function entryBGthreshold(source,eventdata)
user_entry=str2double(get(source,'string'));
if (isnan(user_entry)||(user_entry<1)||(user_entry>100))
errordlg('Enter a numeric value between 1 and 100 percent to produce a Background Threshold value as a percent above the time series average background for each spot.','Bad Input','modal')
return
end
BGthresInput=user_entry
ImParMat(3)= BGthresInput
BGthresInput
end
%-------------------444444-----------
btnNumber=4; %Enter spot detection threshold (lock-in Image frame)
yPos=0.85-(btnNumber-1)*(btnHt+spacing);
btnPos=[xPos yPos-spacing btnWid btnHt];
srcSpotThres=ImParMat(4);
hedit=uicontrol(...
'Style', 'edit',...
'String',srcSpotThres,...
'Units','normalized',...
'Position', btnPos,...
'callback',{@entrySpotThres});
function entrySpotThres(source,eventdata)
user_entry=str2double(get(source,'string'));
if (isnan(user_entry)||(user_entry<1)||(user_entry>60))
errordlg('You must enter a numeric value between 1 and 60','Bad Input','modal')
return
end
spotThres=user_entry
ImParMat(4)= spotThres
spotThres
end
%
%---------555555 Radius Entry After Sept.2014---------------------------------**
btnNumber=5;
yPos=0.85-(btnNumber-1)*(btnHt+spacing);
btnPos=[xPos yPos-spacing btnWid btnHt];
srcRadius=ImParMat(10);
hedit=uicontrol(...
'Style', 'edit',...
'String',srcRadius,...
'Units','normalized',...
'Position', btnPos,... % [.002 .70 .08 .10],...
'callback',{@entryRadius}); % 'Position', [5 100 60 20])
function entryRadius(source,eventdata)
user_entry=str2double(get(source,'string'));
if (isnan(user_entry)||(user_entry<12)||(user_entry>17))
errordlg('You must enter a numeric value between 12 and 17','Bad Input','modal')
return
end
Radius=user_entry
ImParMat(10)= Radius
Radius
end
%---------555555 Width Entry prior the Sept.2014---------------------------------**
%{
btnNumber=5;
yPos=0.85-(btnNumber-1)*(btnHt+spacing);
btnPos=[xPos yPos-spacing btnWid btnHt];
srcWidth=ImParMat(5);
hedit=uicontrol(...
'Style', 'edit',...
'String',srcWidth,...
'Units','normalized',...
'Position', btnPos,... % [.002 .70 .08 .10],...
'callback',{@entryWidth}); % 'Position', [5 100 60 20])
function entryWidth(source,eventdata)
user_entry=str2double(get(source,'string'));
if (isnan(user_entry)||(user_entry<5)||(user_entry>41))
errordlg('You must enter a numeric value between 5 and 40','Bad Input','modal')
return
end
Width=user_entry
ImParMat(5)= Width
Width
end
%}
%-------------------66666 Dither unnecessary after Sept.2014-----------
btnNumber=6;
yPos=0.85-(btnNumber-1)*(btnHt+spacing);
btnPos=[xPos yPos-spacing btnWid btnHt];
srcDither= ImParMat(6);
hedit=uicontrol(...
'Style', 'edit',...
'String',srcDither,...
'Units','normalized',...
'Position', btnPos,...
'callback',{@entryDither});
function entryDither(source,eventdata)
user_entry=str2double(get(source,'string'));
if (isnan(user_entry)||(user_entry<0)||(user_entry>5))
errordlg('You must enter a numeric value between 1 and 4','Bad Input','modal')
return
end
Dither=user_entry
ImParMat(6)= Dither
Dither
end
%-------------------77777----------- Added July 7,2015 to allow Search Range constraint
btnNumber=7;
yPos=0.85-(btnNumber-1)*(btnHt+spacing);
btnPos=[xPos yPos-spacing btnWid btnHt];
try
srchRange=ImParMat(12);
searchRangeNum=ImParMat(12)
catch %Legacy default value was 18 before being made a user input variable (ImParMat(12)). A preferable value now might be 12 or 14.
srchRange=18;
ImParMat(12)=18
searchRangeNum=ImParMat(12)
end
%{
if size(scLst)>1
srchRange=ImParMat(12);
else
try
srchRange=CSearchRange(str2double(scLst))
catch
srchRange=ImParMat(12);
end
end
%}
hSearchRange=uicontrol(...
'Style', 'edit',...
'String',srchRange,...
'Units','normalized',...
'Position', btnPos,...
'callback',{@CsearchRange});
function CsearchRange(source,eventdata)
user_entry=str2double(get(source,'string'));
if (isnan(user_entry)||(user_entry<1)||(user_entry>50)) %originally 18; 19_0729 increased
errordlg('You must enter a numeric value between 1 and 18 12->18 recommended. (ImParMat(12)))','Bad Input','modal')
return
end
searchRangeNum=user_entry
end
%-------------------77777-----------
%{
btnNumber=7;
yPos=0.85-(btnNumber-1)*(btnHt+spacing);
btnPos=[xPos yPos-spacing btnWid btnHt];
srcExtend=ImParMat(7);
hedit=uicontrol(...
'Style', 'edit',...
'String',srcExtend,...
'Units','normalized',...
'Position', btnPos,...
'callback',{@entryExtend});
function entryExtend(source,eventdata)
user_entry=str2double(get(source,'string'));
if (isnan(user_entry)||(user_entry<-0.10)||(user_entry>0.4))
errordlg('You must enter a numeric value between 0 and 0.4. 0.10 recommended','Bad Input','modal')
return
end
extend=user_entry
ImParMat(7)= extend
extend
end
%-------------------888888-----------
btnNumber=8;
yPos=0.85-(btnNumber-1)*(btnHt+spacing);
btnPos=[xPos yPos-spacing btnWid btnHt];
%ImParMat(8)=1;
srcpointExtend=ImParMat(8);
hedit=uicontrol(...
'Style', 'edit',...
'String',srcpointExtend,...
'Units','normalized',...
'Position', btnPos,...
'callback',{@entrypointExtend});
function entrypointExtend(source,eventdata)
user_entry=str2double(get(source,'string'));
user_entry= floor(user_entry);
if (isnan(user_entry)||(user_entry<-3)||(user_entry>5))
errordlg('You must enter an integer value between 0 and 5. 1 recommended','Bad Input','modal')
return
end
pointExtend=user_entry
ImParMat(8)= pointExtend
pointExtend
end
%}
%-------------------999999-----------
btnNumber=9;
yPos=0.85-(btnNumber-1)*(btnHt+spacing);
btnPos=[xPos yPos-spacing btnWid btnHt];
hedit=uicontrol(...
'Style', 'popupmenu',...
'String',{'GrowthArea','FixedArea'},...
'Units','normalized',...
'Position', btnPos,...
'callback',{@grwArea});
function grwArea(source,eventdata)
str=get(source, 'String');
val=get(source,'Value');
% Set current data to the selected data set.
switch str{val};
case 'GrowthArea' ;% User selects Peaks.
SWgrowthArea=1
case 'FixedArea' % User selects Membrane.
SWgrowthArea=0
end
end
%}