Format NlmParamRadiusGui.m
This commit is contained in:
@@ -1,281 +1,247 @@
|
|||||||
%% 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;
|
|
||||||
|
|
||||||
if exist(fullfile(resDir,'PTmats','NImParameters.mat'))
|
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'))
|
||||||
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;
|
||||||
|
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,~)
|
||||||
btnNumber=5;
|
user_entry=str2double(get(source,'string'));
|
||||||
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,~)
|
|
||||||
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;
|
||||||
|
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});
|
||||||
|
|
||||||
btnNumber=6;
|
function entryDither(source,~)
|
||||||
yPos=0.85-(btnNumber-1)*(btnHt+spacing);
|
user_entry=str2double(get(source,'string'));
|
||||||
btnPos=[xPos yPos-spacing btnWid btnHt];
|
|
||||||
srcDither= ImParMat(6);
|
|
||||||
hedit = uicontrol(...
|
|
||||||
'Style', 'edit',...
|
|
||||||
'String',srcDither,...
|
|
||||||
'Units','normalized',...
|
|
||||||
'Position', btnPos,...
|
|
||||||
'callback',{@entryDither});
|
|
||||||
|
|
||||||
function entryDither(source,~)
|
|
||||||
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;
|
|
||||||
yPos=0.85-(btnNumber-1)*(btnHt+spacing);
|
|
||||||
btnPos=[xPos yPos-spacing btnWid btnHt];
|
|
||||||
try
|
|
||||||
CSrchRange=ImParMat(12);
|
|
||||||
CSrchRng=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.
|
|
||||||
CSrchRange=18;
|
|
||||||
ImParMat(12)=18;
|
|
||||||
CSrchRng=ImParMat(12);
|
|
||||||
end
|
|
||||||
|
|
||||||
hSearchRange = uicontrol(...
|
|
||||||
'Style', 'edit',...
|
|
||||||
'String',CSrchRange,...
|
|
||||||
'Units','normalized',...
|
|
||||||
'Position', btnPos,...
|
|
||||||
'callback',{@CsearchRange});
|
|
||||||
|
|
||||||
function CsearchRange(source,~)
|
btnNumber=7;
|
||||||
user_entry = str2double(get(source,'string'));
|
yPos=0.85-(btnNumber-1)*(btnHt+spacing);
|
||||||
|
btnPos=[xPos yPos-spacing btnWid btnHt];
|
||||||
|
try
|
||||||
|
CSrchRange=ImParMat(12);
|
||||||
|
CSrchRng=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.
|
||||||
|
CSrchRange=18;
|
||||||
|
ImParMat(12)=18;
|
||||||
|
CSrchRng=ImParMat(12);
|
||||||
|
end
|
||||||
|
|
||||||
|
hSearchRange=uicontrol(...
|
||||||
|
'Style', 'edit',...
|
||||||
|
'String',CSrchRange,...
|
||||||
|
'Units','normalized',...
|
||||||
|
'Position', btnPos,...
|
||||||
|
'callback',{@CsearchRange});
|
||||||
|
|
||||||
|
function CsearchRange(source,~)
|
||||||
|
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',[],...
|
||||||
'max',1000,...
|
'max',1000,...
|
||||||
'min',1,...
|
'min',1,...
|
||||||
'Units','normalized',...
|
'Units','normalized',...
|
||||||
'Position', [.70 .40 .10 .60],...
|
'Position', [.70 .40 .10 .60],...
|
||||||
'callback',{@load_listbox}); %'uiresume(gcbf)'); 'Position', [5 100 60 20])
|
'callback',{@load_listbox}); %'uiresume(gcbf)'); 'Position', [5 100 60 20])
|
||||||
|
|
||||||
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))
|
||||||
set(hSearchRange,'string',num2str(ImParMat(12)))
|
set(hSearchRange,'string',num2str(ImParMat(12)))
|
||||||
else
|
else
|
||||||
try
|
try
|
||||||
CSrchRng=CSearchRange(str2double(scLst));
|
CSrchRng=CSearchRange(str2double(scLst));
|
||||||
set(hSearchRange,'string',CSearchRange(str2double(scLst)))
|
set(hSearchRange,'string',CSearchRange(str2double(scLst)))
|
||||||
catch
|
catch
|
||||||
% CSrchRng=num2str(ImParMat(12))
|
% CSrchRng=num2str(ImParMat(12))
|
||||||
% set(hSearchRange,'string',num2str(ImParMat(12)))
|
% set(hSearchRange,'string',num2str(ImParMat(12)))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
%ImParMat(7)=MPnum
|
|
||||||
|
|
||||||
end
|
|
||||||
scLst;
|
|
||||||
|
|
||||||
%*****************************************************************
|
|
||||||
%-------------------10 10 10 10-----------
|
|
||||||
|
|
||||||
btnNumber=10;
|
scLst;
|
||||||
yPos=0.85-(btnNumber-1)*(btnHt+spacing);
|
|
||||||
btnPos=[xPos yPos-spacing btnWid btnHt];
|
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)');
|
||||||
|
|
||||||
hedit8 = uicontrol(...
|
% Labels
|
||||||
'Style', 'pushbutton',...
|
xLPos=0.175;
|
||||||
'String',{'Continue'},...
|
yPos=0;
|
||||||
'Units','normalized',...
|
btnWid=0.20;
|
||||||
'Position', btnPos,...
|
|
||||||
'callback','uiresume(gcbf)');
|
|
||||||
|
|
||||||
|
|
||||||
%------------------------------
|
|
||||||
|
|
||||||
%***************************************************************
|
|
||||||
%********LABELS******************************
|
|
||||||
% The Labels
|
|
||||||
xLPos=0.175;
|
|
||||||
yPos=0;
|
|
||||||
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;
|
|
||||||
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;
|
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','SearchRange',...
|
'Units','normalized',...
|
||||||
'Units','normalized',...
|
'Position', btnPos);
|
||||||
'Position', btnPos);
|
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
uiwait(gcf);
|
uiwait(gcf);
|
||||||
for i=1:length(scLst)
|
for i=1:length(scLst)
|
||||||
CSearchRange(str2double(scLst(i)))= CSrchRng;
|
CSearchRange(str2double(scLst(i)))=CSrchRng;
|
||||||
ImParMat(12)= CSrchRng;
|
ImParMat(12)=CSrchRng;
|
||||||
end
|
end
|
||||||
|
|
||||||
ImParMat;
|
ImParMat;
|
||||||
CSearchRange;
|
CSearchRange;
|
||||||
try
|
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
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user