282 baris
7.6 KiB
Matlab
Executable File
282 baris
7.6 KiB
Matlab
Executable File
%% CALLED BY par4Gbl_Main8c.m %%
|
|
function NImParamRadiusGui(expDir) %, numOfPrtTimes) 122111replace removed
|
|
global SWsingleSc
|
|
global SWgrowthArea
|
|
%global selScan
|
|
global scan
|
|
global scLst
|
|
global ImParMat
|
|
%global CSearchRange
|
|
global CSrchRng
|
|
global defImParMat
|
|
global fhImRun
|
|
global fhconsole
|
|
global resDir
|
|
global ExpOutmat
|
|
global numRows;
|
|
global numCols;
|
|
global scanSize
|
|
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'))
|
|
load(fullfile(resDir,'PTmats','NImParameters'));
|
|
else
|
|
load NImParameters
|
|
end
|
|
ImParMat;
|
|
%end
|
|
%if ~exist('CSearchRange','var') || isempty(CSearchRange)
|
|
if ~isequal(exist(fullfile(resDir,'Fotos','CSearchRange.mat')),0)
|
|
load(fullfile(resDir,'Fotos','CSearchRange'))
|
|
CSearchRange;
|
|
end
|
|
|
|
|
|
% yInitPos=0.30;
|
|
xPos=0.05;
|
|
btnWid=0.10;
|
|
btnHt=0.05;
|
|
spacing=0.02;% Spacing between the button and the next command's label
|
|
|
|
|
|
%====================================
|
|
% The ADD Groups button
|
|
btnNumber=1;
|
|
yPos=0.85-(btnNumber-1)*(btnHt+spacing);
|
|
btnPos=[xPos yPos-spacing btnWid btnHt];
|
|
fhImParm=gcf;
|
|
if exist('resDir','var')&& ~isempty(resDir)
|
|
set(fhImParm,'NumberTitle','off')
|
|
set(fhImParm,'Name',strcat('ImageAnalysis- ',char(resDir)))
|
|
else
|
|
set(fhImParm,'NumberTitle','off')
|
|
set(fhImParm,'Name','EASYconsole -Exp. Analysis NOT selected.')
|
|
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,~)
|
|
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
|
|
|
|
|
|
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,~)
|
|
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
|
|
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
|
|
errordlg('You must enter a numeric value between 1 and 18 12->18 recommended. (ImParMat(12)))','Bad Input','modal')
|
|
return
|
|
end
|
|
CSrchRng=user_entry;
|
|
|
|
end
|
|
|
|
%Ncode 12_0120 for reading in numeric folder names
|
|
nlist=dir(fullfile(expDir,'*'));
|
|
nnn=0;
|
|
for n=1:size(nlist,1)
|
|
if (~isempty(str2num(nlist(n).name)))
|
|
nnn=nnn+1;
|
|
PnumLst(nnn)= (str2num(nlist(n).name));
|
|
sl(nnn,1)={(nlist(n).name)};
|
|
end
|
|
end
|
|
scanSize= size(sl,1);
|
|
scanMax= max(str2double(sl));
|
|
|
|
hListbox = uicontrol(...
|
|
'Style', 'listbox',...
|
|
'String',sort(sl),...
|
|
'value',[],...
|
|
'max',1000,...
|
|
'min',1,...
|
|
'Units','normalized',...
|
|
'Position', [.70 .40 .10 .60],...
|
|
'callback',{@load_listbox}); %'uiresume(gcbf)'); 'Position', [5 100 60 20])
|
|
|
|
function load_listbox(source,~)
|
|
%global CSrchRng
|
|
%global CSrearchRange
|
|
userIndx = (get(source,'value'));
|
|
userStr = (get(source,'string'));
|
|
%scLstIndx= str2num(char(strrep(userStr(userIndx), 'Scan', '')))
|
|
|
|
user_entry=userStr(userIndx);
|
|
scLst=user_entry;
|
|
if size(scLst,1)>1
|
|
%CSrchRng=num2str(ImParMat(12))
|
|
set(hSearchRange,'string',num2str(ImParMat(12)))
|
|
else
|
|
try
|
|
CSrchRng=CSearchRange(str2double(scLst));
|
|
set(hSearchRange,'string',CSearchRange(str2double(scLst)))
|
|
catch
|
|
% CSrchRng=num2str(ImParMat(12))
|
|
% set(hSearchRange,'string',num2str(ImParMat(12)))
|
|
end
|
|
end
|
|
|
|
%ImParMat(7)=MPnum
|
|
|
|
end
|
|
scLst;
|
|
|
|
%*****************************************************************
|
|
%-------------------10 10 10 10-----------
|
|
|
|
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******************************
|
|
% The Labels
|
|
xLPos=0.175;
|
|
yPos=0;
|
|
btnWid=0.20;
|
|
|
|
|
|
%-------------------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);
|
|
|
|
|
|
uiwait(gcf);
|
|
for i=1:length(scLst)
|
|
CSearchRange(str2double(scLst(i)))= CSrchRng;
|
|
ImParMat(12)= CSrchRng;
|
|
end
|
|
|
|
ImParMat;
|
|
CSearchRange;
|
|
try
|
|
save('NImParameters','ImParMat')
|
|
% save('CSearchRange','CSearchRange')
|
|
catch
|
|
save(fullfile('\','NImParameters'),'ImParMat')
|
|
%save(fullfile('\','CSearchRange'),'CSearchRange')
|
|
end
|
|
save((fullfile(resDir,'PTmats','NImParameters')), 'ImParMat');
|
|
save((fullfile(resDir,'Fotos','CSearchRange')),'CSearchRange');
|
|
|
|
close
|
|
|
|
return
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|