Format NlmParamRadiusGui.m

This commit is contained in:
2024-07-25 15:03:45 -04:00
parent d1b7c87d0b
commit a3fa3f510e

View File

@@ -1,78 +1,72 @@
%% CALLED BY par4Gbl_Main8c.m %% %% CALLED BY par4Gbl_Main8c.m %%
function NImParamRadiusGui(expDir) %, numOfPrtTimes) 122111replace removed function NImParamRadiusGui(expDir)
global SWsingleSc global SWsingleSc
global SWgrowthArea global SWgrowthArea
%global selScan %global selScan
global scan global scan
global scLst global scLst
global ImParMat global ImParMat
%global CSearchRange %global CSearchRange
global CSrchRng global CSrchRng
global defImParMat global defImParMat
global fhImRun global fhImRun
global fhconsole global fhconsole
global resDir global resDir
global ExpOutmat global ExpOutmat
global numRows; global numRows;
global numCols; global numCols;
global scanSize global scanSize
global scanMax global scanMax
defImParMat=[1, 1, 15, 34, 24, 1,0,0,1,14,1,18]; %Ncode ImRobot adaptation
if ImParMat(3)==0 || ImParMat(4)==0 ||ImParMat(5)==0 || ImParMat(10)==0 ||ImParMat(11)==0
ImParMat=defImParMat;
end
if size(ImParMat,2)<12
ImParMat(12)=18; %Default before user input CsearchRange value
msg= 'Data made before SearchRange user entry added (ImParMat(12). 18 was the set value and the current default.)';
end
%ImParMat=defImParMat; %Activate for INITIAL USE only
MPnum=1;
destPerMP=1;
selScan=1;
SWgrowthArea=1;
defImParMat=[1, 1, 15, 34, 24, 1,0,0,1,14,1,18]; %Ncode ImRobot adaptation
if ImParMat(3)==0 || ImParMat(4)==0 ||ImParMat(5)==0 || ImParMat(10)==0 ||ImParMat(11)==0
ImParMat=defImParMat;
end
if size(ImParMat,2)<12
ImParMat(12)=18; %Default before user input CsearchRange value
msg='Data made before SearchRange user entry added (ImParMat(12). 18 was the set value and the current default.)';
end
% ImParMat=defImParMat; %Activate for INITIAL USE only
MPnum=1;
destPerMP=1;
selScan=1;
SWgrowthArea=1;
if exist(fullfile(resDir,'PTmats','NImParameters.mat')) if exist(fullfile(resDir,'PTmats','NImParameters.mat'))
load(fullfile(resDir,'PTmats','NImParameters')); load(fullfile(resDir,'PTmats','NImParameters'));
else else
load NImParameters load NImParameters
end end
ImParMat; ImParMat;
%end %if ~exist('CSearchRange','var') || isempty(CSearchRange)
%if ~exist('CSearchRange','var') || isempty(CSearchRange)
if ~isequal(exist(fullfile(resDir,'Fotos','CSearchRange.mat')),0) if ~isequal(exist(fullfile(resDir,'Fotos','CSearchRange.mat')),0)
load(fullfile(resDir,'Fotos','CSearchRange')) load(fullfile(resDir,'Fotos','CSearchRange'))
CSearchRange; CSearchRange;
end end
% yInitPos=0.30;
% yInitPos=0.30;
xPos=0.05; xPos=0.05;
btnWid=0.10; btnWid=0.10;
btnHt=0.05; btnHt=0.05;
spacing=0.02;% Spacing between the button and the next command's label spacing=0.02;% Spacing between the button and the next command's label
%====================================
% The ADD Groups button % The ADD Groups button
btnNumber=1; btnNumber=1;
yPos=0.85-(btnNumber-1)*(btnHt+spacing); yPos=0.85-(btnNumber-1)*(btnHt+spacing);
btnPos=[xPos yPos-spacing btnWid btnHt]; btnPos=[xPos yPos-spacing btnWid btnHt];
fhImParm=gcf; fhImParm=gcf;
if exist('resDir','var')&& ~isempty(resDir) if exist('resDir','var')&& ~isempty(resDir)
set(fhImParm,'NumberTitle','off') set(fhImParm,'NumberTitle','off')
set(fhImParm,'Name',strcat('ImageAnalysis- ',char(resDir))) set(fhImParm,'Name',strcat('ImageAnalysis- ',char(resDir)))
else else
set(fhImParm,'NumberTitle','off') set(fhImParm,'NumberTitle','off')
set(fhImParm,'Name','EASYconsole -Exp. Analysis NOT selected.') set(fhImParm,'Name','EASYconsole -Exp. Analysis NOT selected.')
end end
btnNumber=5;
btnNumber=5;
yPos=0.85-(btnNumber-1)*(btnHt+spacing); yPos=0.85-(btnNumber-1)*(btnHt+spacing);
btnPos=[xPos yPos-spacing btnWid btnHt]; btnPos=[xPos yPos-spacing btnWid btnHt];
srcRadius=ImParMat(10); srcRadius=ImParMat(10);
hedit = uicontrol(... hedit=uicontrol(...
'Style', 'edit',... 'Style', 'edit',...
'String',srcRadius,... 'String',srcRadius,...
'Units','normalized',... 'Units','normalized',...
@@ -80,22 +74,21 @@ hedit = uicontrol(...
'callback',{@entryRadius}); % 'Position', [5 100 60 20]) 'callback',{@entryRadius}); % 'Position', [5 100 60 20])
function entryRadius(source,~) function entryRadius(source,~)
user_entry = str2double(get(source,'string')); user_entry=str2double(get(source,'string'));
if (isnan(user_entry)||(user_entry<12)||(user_entry>17)) if (isnan(user_entry)||(user_entry<12)||(user_entry>17))
errordlg('You must enter a numeric value between 12 and 17','Bad Input','modal') errordlg('You must enter a numeric value between 12 and 17','Bad Input','modal')
return return
end end
Radius=user_entry; Radius=user_entry;
ImParMat(10)= Radius; ImParMat(10)=Radius;
Radius; Radius;
end end
btnNumber=6; btnNumber=6;
yPos=0.85-(btnNumber-1)*(btnHt+spacing); yPos=0.85-(btnNumber-1)*(btnHt+spacing);
btnPos=[xPos yPos-spacing btnWid btnHt]; btnPos=[xPos yPos-spacing btnWid btnHt];
srcDither= ImParMat(6); srcDither=ImParMat(6);
hedit = uicontrol(... hedit=uicontrol(...
'Style', 'edit',... 'Style', 'edit',...
'String',srcDither,... 'String',srcDither,...
'Units','normalized',... 'Units','normalized',...
@@ -103,17 +96,17 @@ hedit = uicontrol(...
'callback',{@entryDither}); 'callback',{@entryDither});
function entryDither(source,~) function entryDither(source,~)
user_entry = str2double(get(source,'string')); user_entry=str2double(get(source,'string'));
if (isnan(user_entry)||(user_entry<0)||(user_entry>5)) if (isnan(user_entry)||(user_entry<0)||(user_entry>5))
errordlg('You must enter a numeric value between 1 and 4','Bad Input','modal') errordlg('You must enter a numeric value between 1 and 4','Bad Input','modal')
return return
end end
Dither=user_entry; Dither=user_entry;
ImParMat(6)= Dither; ImParMat(6)=Dither;
Dither; Dither;
end end
%-------------------77777----------- Added July 7,2015 to allow Search Range constraint
btnNumber=7; btnNumber=7;
yPos=0.85-(btnNumber-1)*(btnHt+spacing); yPos=0.85-(btnNumber-1)*(btnHt+spacing);
btnPos=[xPos yPos-spacing btnWid btnHt]; btnPos=[xPos yPos-spacing btnWid btnHt];
try try
@@ -125,7 +118,7 @@ btnNumber=7;
CSrchRng=ImParMat(12); CSrchRng=ImParMat(12);
end end
hSearchRange = uicontrol(... hSearchRange=uicontrol(...
'Style', 'edit',... 'Style', 'edit',...
'String',CSrchRange,... 'String',CSrchRange,...
'Units','normalized',... 'Units','normalized',...
@@ -133,29 +126,28 @@ hSearchRange = uicontrol(...
'callback',{@CsearchRange}); 'callback',{@CsearchRange});
function CsearchRange(source,~) function CsearchRange(source,~)
user_entry = str2double(get(source,'string')); user_entry=str2double(get(source,'string'));
if (isnan(user_entry)||(user_entry<1)||(user_entry>50)) %originally 18; 19_0729 increased 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') errordlg('You must enter a numeric value between 1 and 18 12->18 recommended. (ImParMat(12)))','Bad Input','modal')
return return
end end
CSrchRng=user_entry; CSrchRng=user_entry;
end end
%Ncode 12_0120 for reading in numeric folder names % Ncode 12_0120 for reading in numeric folder names
nlist=dir(fullfile(expDir,'*')); nlist=dir(fullfile(expDir,'*'));
nnn=0; nnn=0;
for n=1:size(nlist,1) for n=1:size(nlist,1)
if (~isempty(str2num(nlist(n).name))) if (~isempty(str2num(nlist(n).name)))
nnn=nnn+1; nnn=nnn+1;
PnumLst(nnn)= (str2num(nlist(n).name)); PnumLst(nnn)=(str2num(nlist(n).name));
sl(nnn,1)={(nlist(n).name)}; sl(nnn,1)={(nlist(n).name)};
end end
end end
scanSize= size(sl,1); scanSize=size(sl,1);
scanMax= max(str2double(sl)); scanMax=max(str2double(sl));
hListbox = uicontrol(... hListbox=uicontrol(...
'Style', 'listbox',... 'Style', 'listbox',...
'String',sort(sl),... 'String',sort(sl),...
'value',[],... 'value',[],...
@@ -168,11 +160,11 @@ hListbox = uicontrol(...
function load_listbox(source,~) function load_listbox(source,~)
%global CSrchRng %global CSrchRng
%global CSrearchRange %global CSrearchRange
userIndx = (get(source,'value')); userIndx=(get(source,'value'));
userStr = (get(source,'string')); userStr=(get(source,'string'));
%scLstIndx= str2num(char(strrep(userStr(userIndx), 'Scan', ''))) %scLstIndx=str2num(char(strrep(userStr(userIndx), 'Scan', '')))
user_entry=userStr(userIndx); user_entry=userStr(userIndx);
scLst=user_entry; scLst=user_entry;
if size(scLst,1)>1 if size(scLst,1)>1
%CSrchRng=num2str(ImParMat(12)) %CSrchRng=num2str(ImParMat(12))
@@ -186,96 +178,70 @@ user_entry=userStr(userIndx);
% set(hSearchRange,'string',num2str(ImParMat(12))) % set(hSearchRange,'string',num2str(ImParMat(12)))
end end
end end
%ImParMat(7)=MPnum
end end
scLst; scLst;
%***************************************************************** btnNumber=10;
%-------------------10 10 10 10-----------
btnNumber=10;
yPos=0.85-(btnNumber-1)*(btnHt+spacing); yPos=0.85-(btnNumber-1)*(btnHt+spacing);
btnPos=[xPos yPos-spacing btnWid btnHt]; btnPos=[xPos yPos-spacing btnWid btnHt];
hedit8=uicontrol(...
hedit8 = uicontrol(...
'Style', 'pushbutton',... 'Style', 'pushbutton',...
'String',{'Continue'},... 'String',{'Continue'},...
'Units','normalized',... 'Units','normalized',...
'Position', btnPos,... 'Position', btnPos,...
'callback','uiresume(gcbf)'); 'callback','uiresume(gcbf)');
% Labels
%------------------------------
%***************************************************************
%********LABELS******************************
% The Labels
xLPos=0.175; xLPos=0.175;
yPos=0; yPos=0;
btnWid=0.20; btnWid=0.20;
%-------------------55555-----------
lblNumber=5; lblNumber=5;
yPos=0.85-(lblNumber-1)*(btnHt+spacing); yPos=0.85-(lblNumber-1)*(btnHt+spacing);
btnPos=[xLPos yPos-spacing btnWid btnHt]; btnPos=[xLPos yPos-spacing btnWid btnHt];
htxt=uicontrol(...
htxt = uicontrol(...
'Style', 'text',... 'Style', 'text',...
'String','Radius',... %'String','Width',... 'String','Radius',... %'String','Width',...
'Units','normalized',... 'Units','normalized',...
'Position', btnPos); 'Position', btnPos);
%-------------------66666-----------
lblNumber=6; lblNumber=6;
yPos=0.85-(lblNumber-1)*(btnHt+spacing); yPos=0.85-(lblNumber-1)*(btnHt+spacing);
btnPos=[xLPos yPos-spacing btnWid btnHt]; btnPos=[xLPos yPos-spacing btnWid btnHt];
htxt=uicontrol(...
htxt = uicontrol(...
'Style', 'text',... 'Style', 'text',...
'String','Dither',... 'String','Dither',...
'Units','normalized',... 'Units','normalized',...
'Position', btnPos); 'Position', btnPos);
%-------------------77777-----------
lblNumber=7; lblNumber=7;
yPos=0.85-(lblNumber-1)*(btnHt+spacing); yPos=0.85-(lblNumber-1)*(btnHt+spacing);
btnPos=[xLPos yPos-spacing btnWid btnHt]; btnPos=[xLPos yPos-spacing btnWid btnHt];
htxt=uicontrol(...
htxt = uicontrol(...
'Style', 'text',... 'Style', 'text',...
'String','SearchRange',... 'String','SearchRange',...
'Units','normalized',... 'Units','normalized',...
'Position', btnPos); 'Position', btnPos);
uiwait(gcf);
for i=1:length(scLst)
CSearchRange(str2double(scLst(i)))=CSrchRng;
ImParMat(12)=CSrchRng;
end
uiwait(gcf); ImParMat;
for i=1:length(scLst) CSearchRange;
CSearchRange(str2double(scLst(i)))= CSrchRng; try
ImParMat(12)= CSrchRng;
end
ImParMat;
CSearchRange;
try
save('NImParameters','ImParMat') save('NImParameters','ImParMat')
% save('CSearchRange','CSearchRange') % save('CSearchRange','CSearchRange')
catch catch
save(fullfile('\','NImParameters'),'ImParMat') save(fullfile('\','NImParameters'),'ImParMat')
%save(fullfile('\','CSearchRange'),'CSearchRange') % save(fullfile('\','CSearchRange'),'CSearchRange')
end
save((fullfile(resDir,'PTmats','NImParameters')), 'ImParMat');
save((fullfile(resDir,'Fotos','CSearchRange')),'CSearchRange');
close
return
end end
save((fullfile(resDir,'PTmats','NImParameters')), 'ImParMat');
save((fullfile(resDir,'Fotos','CSearchRange')),'CSearchRange');
close
return
end