Changeset 851 for trunk/src/series/civ_input.m
- Timestamp:
- Jan 19, 2015, 9:29:28 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series/civ_input.m
r850 r851 60 60 set(hObject,'WindowButtonDownFcn',{'mouse_down'}) % allows mouse action with right button (zoom for uicontrol display) 61 61 set(hObject,'WindowKeyPressFcn',{@keyboard_callback,handles})%set keyboard action function 62 %set(hObject,'KeyPressFcn',{@KeyPressFcn,handles})%set keyboard action function 62 63 set(handles.ref_i,'KeyPressFcn',{@ref_i_KeyPressFcn,handles})%set keyboard action function 64 set(handles.ref_j,'KeyPressFcn',{@ref_i_KeyPressFcn,handles})%set keyboard action function 63 65 %set(hObject,'WindowKeyPressFcn',{'keyboard_callback',handles})%set keyboard action function 64 66 hseries=findobj(allchild(0),'Tag','series');% find the parent GUI 'series' … … 106 108 ind_opening=0;%default 107 109 NomTypeNc=''; 110 NomTypeImaA=NomTypeInput; 111 iview_image=1;%line # for the input images 108 112 switch FileType 109 113 case {'image','multimage','video','mmreader','netcdf'} 110 NomTypeImaA=NomTypeInput;111 iview_image=1;%line # for the input images114 % NomTypeImaA=NomTypeInput; 115 % iview_image=1;%line # for the input images 112 116 case 'civdata' 113 117 if ~strcmp(Param.Action.ActionName,'civ_series') 114 118 msgbox_uvmat('ERROR','bad input data file: open an image or a nc file from civ_series') 115 %return119 return 116 120 end 117 121 NomTypeNc=NomTypeInput; … … 122 126 set(handles.ListCompareMode,'Value',1) 123 127 end 124 % FileInput=SeriesData.RefFile{1};125 128 [Data,tild,tild,errormsg]=nc2struct(FileInfo.FileName,[]); 126 129 if ~isempty(errormsg) … … 128 131 return 129 132 end 130 [PathCiv1_ImageA,Civ1_ImageA,FileExtA]=fileparts(Data.Civ1_ImageA); 131 [PathCiv1_ImageB,Civ1_ImageB,FileExtA]=fileparts(Data.Civ1_ImageB); 133 [PathCiv1_ImageA,Civ1_ImageA,FileExtA]=fileparts(Data.Civ1_ImageA);%look for the source image A 134 [PathCiv1_ImageB,Civ1_ImageB,FileExtA]=fileparts(Data.Civ1_ImageB);%look for the source image B 132 135 if isfield(Data,'Civ2_ImageA') 133 136 [PathCiv2_ImageA,Civ2_ImageA,FileExtA]=fileparts(Data.Civ2_ImageA); … … 147 150 return 148 151 end 149 % if isfield(SeriesData,'FileType') && numel(SeriesData.FileType)>=2 && strcmp(SeriesData.FileType{end-1},'image') && strcmp(SeriesData.FileType{end},'image')150 % set(handles.ListCompareMode,'Value',3)% we compare two image series term to term ('shift')151 % set(handles.PairIndices,'Visible','off')152 % end153 152 154 153 %% reinitialise menus … … 195 194 end 196 195 end 197 % CivInputData.MaxIndex_i=MaxIndex_i;198 % CivInputData.MaxIndex_j=MaxIndex_j;199 % CivInputData.MinIndex_i=MinIndex_i;200 % CivInputData.MinIndex_j=MinIndex_j;201 196 if ~isfield(Param.IndexRange,'first_j')||isequal(MaxIndex_j,MinIndex_j)% no possibility of j pairs 202 197 set(handles.ListPairMode,'Value',1) … … 227 222 TimeUnit=Param.IndexRange.TimeUnit; 228 223 end 229 if isfield(SeriesData,'TimeSource')230 set(handles.ImaDoc,'String',SeriesData.TimeSource)231 end224 % if isfield(SeriesData,'TimeSource') 225 % set(handles.TimeSource,'String',SeriesData.TimeSource) 226 % end 232 227 if isfield(SeriesData,'GeometryCalib') 233 228 tsai=SeriesData.GeometryCalib; … … 250 245 MaxIndex_i=min(size(time,1),MaxIndex_i);%possibly adjust the max index according to time data 251 246 MaxIndex_j=min(size(time,2),MaxIndex_j); 252 else 253 set(handles.ImaDoc,'String',''); %xml file not used for timing 247 set(handles.TimeSource,'String',Param.IndexRange.TimeSource); 248 else 249 set(handles.TimeSource,'String',''); %xml file not used for timing 254 250 TimeUnit='frame'; 255 251 time=ones(MaxIndex_j-MinIndex_j+1,1)*(MinIndex_i:MaxIndex_i); … … 264 260 set(handles.SearchRange,'UserData', pxcm_search); 265 261 262 % indicate the min and max indices i and j on the GUI 263 set(handles.MinIndex_i,'String',num2str(MinIndex_i)) 264 set(handles.MaxIndex_i,'String',num2str(MaxIndex_i)) 265 set(handles.MinIndex_j,'String',num2str(MinIndex_j)) 266 set(handles.MaxIndex_j,'String',num2str(MaxIndex_j)) 267 268 269 %% set the civ_input options, depending on the input file content if a nc file has been opened 270 ListOptions={'CheckCiv1', 'CheckFix1' 'CheckPatch1', 'CheckCiv2', 'CheckFix2', 'CheckPatch2'}; 271 checkbox=zeros(size(ListOptions));%default 272 checkrefresh=0; 273 if ind_opening==0 %case of image opening, start with Civ1 274 for index=1:numel(ListOptions) 275 checkbox(index)=get(handles.(ListOptions{index}),'Value'); 276 end 277 index_max=find(checkbox, 1, 'last' ); 278 if isempty(index_max),index_max=1;end 279 for index=1:index_max 280 set(handles.(ListOptions{index}),'Value',1)% select all operations starting from CIV1 281 end 282 else %case of netcdf file opening, start with the stage read in the file if the input file is being refreshed 283 if isequal(get(hhseries.REFRESH,'BackgroundColor'),[1 1 0]) && ~isfield(Param.ActionInput,'ConfigSource') 284 answer=msgbox_uvmat('INPUT_Y-N',['import the civ parameters from the netcdf file']); 285 if strcmp(answer,'Yes') 286 for index = 1:min(ind_opening,5) 287 set(handles.(ListOptions{index}),'value',0) 288 fill_civ_input(Data,handles); %fill civ_input with the parameters retrieved from an input Civ file 289 end 290 set(handles.ConfigSource,'String',FileInfo.FileName); 291 set(handles.(ListOptions{min(ind_opening+1,6)}),'value',1) 292 for index = ind_opening+2:6 293 set(handles.(ListOptions{index}),'value',0) 294 end 295 checkrefresh=1; 296 end 297 end 298 if ind_opening>=3 299 set(handles.iterate,'Visible','on')% make visible the switch 'iterate/repet' for Civ2. 300 else 301 set(handles.iterate,'Visible','off') 302 end 303 end 304 266 305 %% introduce the stored Civ parameters if available (from previous input or ImportConfig in series) 267 if isfield(Param,'ActionInput')&& strcmp(Param.ActionInput.Program,Param.Action.ActionName)% the program fits with the stored data306 if ~checkrefresh && isfield(Param,'ActionInput')&& strcmp(Param.ActionInput.Program,Param.Action.ActionName)% the program fits with the stored data 268 307 fill_GUI(Param.ActionInput,hObject);%fill the GUI with the parameters retrieved from the input Param 269 308 hcheckgrid=findobj(handles.civ_input,'Tag','CheckGrid'); … … 283 322 end 284 323 end 285 % indicate the min and max indices i and j on the GUI286 set(handles.MinIndex_i,'String',num2str(MinIndex_i))287 set(handles.MaxIndex_i,'String',num2str(MaxIndex_i))288 set(handles.MinIndex_j,'String',num2str(MinIndex_j))289 set(handles.MaxIndex_j,'String',num2str(MaxIndex_j))290 291 %% set the civ_input options, depending on the input file content if a nc file has been opened292 ListOptions={'CheckCiv1', 'CheckFix1' 'CheckPatch1', 'CheckCiv2', 'CheckFix2', 'CheckPatch2'};293 checkbox=zeros(size(ListOptions));%default294 if ind_opening==0 %case of image opening, start with Civ1295 for index=1:numel(ListOptions)296 checkbox(index)=get(handles.(ListOptions{index}),'Value');297 end298 index_max=find(checkbox, 1, 'last' );299 if isempty(index_max),index_max=1;end300 for index=1:index_max301 set(handles.(ListOptions{index}),'Value',1)% select all operations starting from CIV1302 end303 else %case of netcdf file opening, start with the stage read in the file304 for index = 1:min(ind_opening,5)305 set(handles.(ListOptions{index}),'value',0)306 fill_civ_input(Data,handles); %fill civ_input with the parameters retrieved from an input Civ file307 end308 set(handles.ConfigSource,'String',FileInfo.FileName);309 set(handles.(ListOptions{min(ind_opening+1,6)}),'value',1)310 for index = ind_opening+2:6311 set(handles.(ListOptions{index}),'value',0)312 end313 end314 324 315 325 %% set the reference indices from the input file indices 326 if ~isfield(Param.ActionInput,'ConfigSource') 316 327 update_CivOptions(handles,ind_opening)% fill the menu of possible pairs 328 end 317 329 318 330 %% list the possible index pairs, depending on the option set in ListPairMode … … 346 358 delete(handles.civ_input); 347 359 end 360 361 %------------------------------------------------------------------------ 362 % --- Executes on button press in SetDefaultParam. 363 %------------------------------------------------------------------------ 364 function SetDefaultParam_Callback(hObject, eventdata, handles) 365 366 hseries=findobj(allchild(0),'Name','series');% look for the GUI series 367 hhseries=guidata(hseries);%handles of elements in the GUI series 368 SeriesData=get(hseries,'UserData');%read parameters on the GUI series 369 if isfield (SeriesData,'ActionInput') 370 SeriesData=rmfield(SeriesData,'ActionInput');% remove recorded civ parameters 371 end 372 set(hseries,'UserData',SeriesData) 373 series('ActionName_Callback',hObject,eventdata,hhseries); % 348 374 349 375 % ----------------------------------------------------------------------- … … 438 464 function update_CivOptions(handles,opening) 439 465 %------------------------------------------------------------------------ 466 if opening>0 467 set(handles.CheckCiv2,'UserData',opening)% store the info on the current status of the civ processing 468 end 440 469 checkbox=zeros(1,6); 441 470 checkbox(1)=get(handles.CheckCiv1,'Value'); … … 445 474 checkbox(5)=get(handles.CheckFix2,'Value'); 446 475 checkbox(6)=get(handles.CheckPatch2,'Value'); 447 % ind_selected=find(checkbox,1);448 %set(handles.PairIndices,'Visible','on')% make the frame PaiIndices visible, choice of the index pairs fo civ449 476 if opening==0 450 477 errormsg=find_netcpair_civ(handles,1); % select the available netcdf files … … 453 480 end 454 481 end 455 if max(checkbox(4:6)) % case of civ2 pair choice needed482 if max(checkbox(4:6))>0% case of civ2 pair choice needed 456 483 set(handles.TitlePairCiv2,'Visible','on') 457 484 set(handles.ListPairCiv2,'Visible','on') … … 465 492 set(handles.ListPairCiv2,'Visible','off') 466 493 end 494 if max(checkbox(1:3))==0 && get(handles.CheckCiv2,'UserData')==6,% no operation asked before Civ2 and input file ready for civ3 495 set(handles.iterate,'Visible','on') 496 else 497 set(handles.iterate,'Visible','off') 498 end 499 500 %% set the visibility of the different panels 467 501 options={'Civ1','Fix1','Patch1','Civ2','Fix2','Patch2'}; 468 502 for ilist=1:length(options) … … 479 513 %------------------------------------------------------------------------ 480 514 481 handles.output.ActionInput=read_GUI(handles.civ_input); 515 ActionInput=read_GUI(handles.civ_input); 516 517 %% correct inpput inconsistencies 518 if isfield(ActionInput,'Civ1') 519 checkeven=(mod(ActionInput.Civ1.CorrBoxSize,2)==0); 520 ActionInput.Civ1.CorrBoxSize(checkeven)=ActionInput.Civ1.CorrBoxSize(checkeven)+1;% set correlation box sizes to odd values 521 ActionInput.Civ1.SearchBoxSize=max(ActionInput.Civ1.SearchBoxSize,ActionInput.Civ1.CorrBoxSize+10);% insure that the search box size is large enough 522 checkeven=(mod(ActionInput.Civ1.SearchBoxSize,2)==0); 523 ActionInput.Civ1.SearchBoxSize(checkeven)=ActionInput.Civ1.SearchBoxSize(checkeven)+1;% set search box sizes to odd values 524 end 525 if isfield(ActionInput,'Civ2') 526 checkeven=(mod(ActionInput.Civ2.CorrBoxSize,2)==0); 527 ActionInput.Civ2.CorrBoxSize(checkeven)=ActionInput.Civ2.CorrBoxSize(checkeven)+1;% set correlation box sizes to odd values 528 ActionInput.Civ2.SearchBoxSize=max(ActionInput.Civ2.SearchBoxSize,ActionInput.Civ2.CorrBoxSize+10); 529 checkeven=(mod(ActionInput.Civ2.SearchBoxSize,2)==0); 530 ActionInput.Civ2.SearchBoxSize(checkeven)=ActionInput.Civ2.SearchBoxSize(checkeven)+1;% set search box sizes to odd values 531 end 532 533 handles.output.ActionInput=ActionInput; 482 534 % correct mask or grid name for Windows system (replace '\' by '/') 483 535 if isfield(handles.output.ActionInput,'Civ1') … … 500 552 uiresume(handles.civ_input); 501 553 502 % %------------------------------------------------------------------------503 % % --- determine the list of index pairs of processing file504 % function [i1_civ1,i2_civ1,j1_civ1,j2_civ1,i1_civ2,i2_civ2,j1_civ2,j2_civ2]=...505 % find_pair_indices(handles,ref_i,ref_j,mode)506 % %------------------------------------------------------------------------507 %508 % list_civ1=get(handles.ListPairCiv1,'String');509 % index_civ1=get(handles.ListPairCiv1,'Value');510 % str_civ1=list_civ1{index_civ1};%string defining the image pairs for civ1511 % if isempty(str_civ1)||isequal(str_civ1,'')512 % msgbox_uvmat('ERROR','no image pair selected for civ1')513 % return514 % end515 % list_civ2=get(handles.ListPairCiv2,'String');516 % index_civ2=get(handles.ListPairCiv2,'Value');517 % if index_civ2>length(list_civ2)518 % list_civ2=list_civ1;519 % index_civ2=index_civ1;520 % end521 % str_civ2=list_civ2{index_civ2};%string defining the image pairs for civ2522 %523 % if isequal (mode,'series(Di)')524 % lastfield=str2double(get(handles.MaxIndex_i,'String'));525 % i1_civ1=ref_i-floor(index_civ1/2)*ones(size(ref_i));% set of first image numbers526 % i2_civ1=ref_i+ceil(index_civ1/2)*ones(size(ref_i));527 % j1_civ1=ref_j;528 % j2_civ1=ref_j;529 % i1_civ2=ref_i-floor(index_civ2/2)*ones(size(ref_i));530 % i2_civ2=ref_i+ceil(index_civ2/2)*ones(size(ref_i));531 % j1_civ2=ref_j;532 % j2_civ2=ref_j;533 %534 % % adjust the first and last field number535 % lastfield=str2double(get(handles.MaxIndex_i,'String'));536 % if isnan(lastfield)537 % indsel=find((i1_civ1 >= 1)&(i1_civ2 >= 1));538 % else539 % indsel=find((i2_civ1 <= lastfield)&(i2_civ2 <= lastfield)&(i1_civ1 >= 1)&(i1_civ2 >= 1));540 % end541 % if length(indsel)>=1542 % firstind=indsel(1);543 % lastind=indsel(end);544 % set(handles.MinIndex_i,'String',num2str(ref_i(firstind)))%update the display of first and last fields545 % set(handles.last_i,'String',num2str(ref_i(lastind)))546 % ref_i=ref_i(indsel);547 % i1_civ1=i1_civ1(indsel);548 % i1_civ2=i1_civ2(indsel);549 % i2_civ1=i2_civ1(indsel);550 % i2_civ2=i2_civ2(indsel);551 % end552 % elseif isequal (mode,'series(Dj)')553 % lastfield_j=str2double(get(handles.MaxIndex_j,'String'));554 % i1_civ1=ref_i;% set of first image numbers555 % i2_civ1=ref_i;556 % j1_civ1=ref_j-floor(index_civ1/2)*ones(size(ref_j));557 % j2_civ1=ref_j+ceil(index_civ1/2)*ones(size(ref_j));558 % i1_civ2=ref_i;559 % i2_civ2=ref_i;560 % j1_civ2=ref_j-floor(index_civ2/2)*ones(size(ref_j));561 % j2_civ2=ref_j+ceil(index_civ2/2)*ones(size(ref_j));562 % % adjust the first and last field number563 % if isnan(lastfield_j)564 % indsel=find((j1_civ1 >= 1)&(j1_civ2 >= 1));565 % else566 % indsel=find((j2_civ1 <= lastfield_j)&(j2_civ2 <= lastfield_j)&(j1_civ1 >= 1)&(j1_civ2 >= 1));567 % end568 % if length(indsel)>=1569 % firstind=indsel(1);570 % lastind=indsel(end);571 % set(handles.MinIndex_j,'String',num2str(ref_j(firstind)))%update the display of first and last fields572 % set(handles.last_j,'String',num2str(ref_j(lastind)))573 % ref_j=ref_j(indsel);574 % j1_civ1=j1_civ1(indsel);575 % j2_civ1=j2_civ1(indsel);576 % j1_civ2=j1_civ2(indsel);577 % j2_civ2=j2_civ2(indsel);578 % end579 % elseif isequal(mode,'pair j1-j2') %case of bursts (png_old or png_2D)580 % displ_num=get(handles.ListPairCiv1,'UserData');581 % i1_civ1=ref_i;582 % i2_civ1=ref_i;583 % j1_civ1=displ_num(1,index_civ1);584 % j2_civ1=displ_num(2,index_civ1);585 % i1_civ2=ref_i;586 % i2_civ2=ref_i;587 % j1_civ2=displ_num(1,index_civ2);588 % j2_civ2=displ_num(2,index_civ2);589 % elseif isequal(mode,'displacement')590 % i1_civ1=ref_i;591 % i2_civ1=ref_i;592 % j1_civ1=ref_j;593 % j2_civ1=ref_j;594 % i1_civ2=ref_i;595 % i2_civ2=ref_i;596 % j1_civ2=ref_j;597 % j2_civ2=ref_j;598 % end599 554 600 555 %------------------------------------------------------------------------ … … 794 749 function ListPairCiv2_Callback(hObject, eventdata, handles) 795 750 %------------------------------------------------------------------------ 796 % index_pair=get(handles.ListPairCiv2,'Value');%get the selected position index in the menu 797 % 798 % %update MinIndex_i and last_i according to the chosen image pairs 799 % mode_list=get(handles.ListPairMode,'String'); 800 % mode_value=get(handles.ListPairMode,'Value'); 801 % mode=mode_list{mode_value}; 802 % if isequal(mode,'series(Di)') 803 % first_i=str2double(get(handles.MinIndex_i,'String')); 804 % last_i=str2double(get(handles.MaxIndex_i,'String')); 805 % incr_i=str2double(get(handles.incr_i,'String')); 806 % num_i=first_i:incr_i:last_i; 807 % % lastfield=str2double(get(handles.MaxIndex_i,'String')); 808 % if ~isnan(last_i) 809 % test_find=(num_i-floor(index_pair/2)*ones(size(num_i))>0)& ... 810 % (num_i+ceil(index_pair/2)*ones(size(num_i))<=last_i); 811 % num_i=num_i(test_find); 812 % end 813 % set(handles.MinIndex_i,'String',num2str(num_i(1))); 814 % set(handles.MaxIndex_i,'String',num2str(num_i(end))); 815 % elseif isequal(mode,'series(Dj)') 816 % first_j=str2double(get(handles.MinIndex_j,'String')); 817 % last_j=str2double(get(handles.last_j,'String')); 818 % incr_j=str2double(get(handles.incr_j,'String')); 819 % num_j=first_j:incr_j:last_j; 820 % lastfield2=str2double(get(handles.MaxIndex_j,'String')); 821 % if ~isnan(lastfield2) 822 % test_find=(num_j-floor(index_pair/2)*ones(size(num_j))>0)& ... 823 % (num_j+ceil(index_pair/2)*ones(size(num_j))<=lastfield2); 824 % num_j=num_j(test_find); 825 % end 826 % set(handles.MinIndex_j,'String',num2str(num_j(1))); 827 % set(handles.last_j,'String',num2str(num_j(end))); 828 % end 751 829 752 830 753 %------------------------------------------------------------------------ … … 839 762 errormsg=find_netcpair_civ( handles,2); 840 763 end 841 if ~isempty(errormsg) 764 if isempty(errormsg) 765 set(handles.ref_i,'BackgroundColor',[1 1 1]) 766 else 842 767 msgbox_uvmat('ERROR',errormsg) 843 end 844 845 %------------------------------------------------------------------------ 846 function ref_j_Callback(hObject, eventdata, handles) 847 %------------------------------------------------------------------------ 848 mode_list=get(handles.ListPairMode,'String'); 849 mode_value=get(handles.ListPairMode,'Value'); 850 mode=mode_list{mode_value}; 851 errormsg=''; 852 if isequal(get(handles.CheckCiv1,'Value'),0)|| isequal(mode,'series(Dj)') 853 errormsg=find_netcpair_civ(handles,1);% update the menu of pairs depending on the available netcdf files 854 end 855 if isequal(mode,'series(Dj)') || ... 856 (get(handles.CheckCiv2,'Value')==0 && get(handles.CheckCiv1,'Value')==0 && get(handles.CheckFix1,'Value')==0 && get(handles.CheckPatch1,'Value')==0) 857 errormsg=find_netcpair_civ(handles,2); 858 end 859 if ~isempty(errormsg) 860 msgbox_uvmat('ERROR',errormsg) 861 end 862 768 end 769 770 function ref_i_KeyPressFcn(hObject, eventdata, handles) 771 set(hObject,'BackgroundColor',[1 0 1]) 772 773 % %------------------------------------------------------------------------ 774 % function ref_j_Callback(hObject, eventdata, handles) 775 % %------------------------------------------------------------------------ 776 % mode_list=get(handles.ListPairMode,'String'); 777 % mode_value=get(handles.ListPairMode,'Value'); 778 % mode=mode_list{mode_value}; 779 % errormsg=''; 780 % if isequal(get(handles.CheckCiv1,'Value'),0)|| isequal(mode,'series(Dj)') 781 % errormsg=find_netcpair_civ(handles,1);% update the menu of pairs depending on the available netcdf files 782 % end 783 % if isequal(mode,'series(Dj)') || ... 784 % (get(handles.CheckCiv2,'Value')==0 && get(handles.CheckCiv1,'Value')==0 && get(handles.CheckFix1,'Value')==0 && get(handles.CheckPatch1,'Value')==0) 785 % errormsg=find_netcpair_civ(handles,2); 786 % end 787 % if ~isempty(errormsg) 788 % msgbox_uvmat('ERROR',errormsg) 789 % end 790 % 791 % function ref_j_KeyPressFcn(hObject, eventdata, handles) 792 % set(handles.ref_j,'BackgroundColor',[1 0 1]) 863 793 %------------------------------------------------------------------------ 864 794 % determine the menu for checkciv1 pairs depending on existing netcdf file at the middle of … … 1096 1026 index=get(handles.ListPairCiv1,'Value'); 1097 1027 pair_string=list_pair{index}; 1098 time=get(handles. ImaDoc,'UserData'); %get the set of times1028 time=get(handles.TimeSource,'UserData'); %get the set of times 1099 1029 pxcm=get(handles.SearchRange,'UserData'); 1100 1030 mode_list=get(handles.ListPairMode,'String'); … … 1143 1073 end 1144 1074 1075 %------------------------------------------------------------------------ 1076 % --- Executes on button press in CheckMask. 1077 function num_CorrSmooth_Callback(hObject, eventdata, handles) 1078 set(hObject,'BackgroundColor',[1 0 1]) 1079 set(handles.configSource,'String','NEW') 1080 1081 %------------------------------------------------------------------------ 1082 1145 1083 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1146 1084 % Callbacks in the uipanel Fix1 1147 1085 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1148 1086 %------------------------------------------------------------------------ 1149 % --- Executes on button press in CheckMask. 1150 function get_mask_fix1_Callback(hObject, eventdata, handles) 1087 % % --- Executes on button press in CheckMask. 1088 % function get_mask_fix1_Callback(hObject, eventdata, handles) 1089 % %------------------------------------------------------------------------ 1090 % maskval=get(handles.CheckMask,'Value'); 1091 % if isequal(maskval,0) 1092 % set(handles.Mask,'String','') 1093 % else 1094 % mask_displ='no mask'; %default 1095 % filebase=get(handles.RootPath,'String'); 1096 % [nbslice, flag_mask]=get_mask(filebase,handles); 1097 % if isequal(flag_mask,1) 1098 % mask_displ=[num2str(nbslice) 'mask']; 1099 % elseif get(handles.ListCompareMode,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series 1100 % filebase_a=get(handles.RootFile_1,'String'); 1101 % [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); 1102 % if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice) 1103 % mask_displ='no mask'; 1104 % end 1105 % end 1106 % if isequal(mask_displ,'no mask') 1107 % [FileName, PathName, filterindex] = uigetfile( ... 1108 % {'*.png', ' (*.png)'; 1109 % '*.png', '.png files '; ... 1110 % '*.*', 'All Files (*.*)'}, ... 1111 % 'Pick a mask file *.png',filebase); 1112 % mask_displ=fullfile(PathName,FileName); 1113 % if ~exist(mask_displ,'file') 1114 % mask_displ='no mask'; 1115 % end 1116 % end 1117 % if isequal(mask_displ,'no mask') 1118 % set(handles.CheckMask,'Value',0) 1119 % set(handles.CheckMask,'Value',0) 1120 % set(handles.CheckMask,'Value',0) 1121 % else 1122 % %set(handles.CheckMask,'Value',1) 1123 % set(handles.CheckMask,'Value',1) 1124 % end 1125 % set(handles.Mask,'String',mask_displ) 1126 % set(handles.Mask,'String',mask_displ) 1127 % set(handles.Mask,'String',mask_displ) 1128 % end 1129 1130 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1131 % Callbacks in the uipanel Civ2 1132 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1133 %------------------------------------------------------------------------ 1134 % --- Executes on button press in CheckMask: select box for mask option 1135 function get_mask_civ2_Callback(hObject, eventdata, handles) 1151 1136 %------------------------------------------------------------------------ 1152 1137 maskval=get(handles.CheckMask,'Value'); … … 1180 1165 set(handles.CheckMask,'Value',0) 1181 1166 set(handles.CheckMask,'Value',0) 1182 set(handles.CheckMask,'Value',0)1183 else1184 %set(handles.CheckMask,'Value',1)1185 set(handles.CheckMask,'Value',1)1186 end1187 set(handles.Mask,'String',mask_displ)1188 set(handles.Mask,'String',mask_displ)1189 set(handles.Mask,'String',mask_displ)1190 end1191 1192 %------------------------------------------------------------------------1193 % --- Executes on button press in CheckMask: select box for mask option1194 function get_mask_civ2_Callback(hObject, eventdata, handles)1195 %------------------------------------------------------------------------1196 maskval=get(handles.CheckMask,'Value');1197 if isequal(maskval,0)1198 set(handles.Mask,'String','')1199 else1200 mask_displ='no mask'; %default1201 filebase=get(handles.RootPath,'String');1202 [nbslice, flag_mask]=get_mask(filebase,handles);1203 if isequal(flag_mask,1)1204 mask_displ=[num2str(nbslice) 'mask'];1205 elseif get(handles.ListCompareMode,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series1206 filebase_a=get(handles.RootFile_1,'String');1207 [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles);1208 if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice)1209 mask_displ='no mask';1210 end1211 end1212 if isequal(mask_displ,'no mask')1213 [FileName, PathName, filterindex] = uigetfile( ...1214 {'*.png', ' (*.png)';1215 '*.png', '.png files '; ...1216 '*.*', 'All Files (*.*)'}, ...1217 'Pick a mask file *.png',filebase);1218 mask_displ=fullfile(PathName,FileName);1219 if ~exist(mask_displ,'file')1220 mask_displ='no mask';1221 end1222 end1223 if isequal(mask_displ,'no mask')1224 set(handles.CheckMask,'Value',0)1225 set(handles.CheckMask,'Value',0)1226 1167 else 1227 1168 set(handles.CheckMask,'Value',1) 1228 1169 end 1229 1170 set(handles.Mask,'String',mask_displ) 1230 set(handles.Mask,'String',mask_displ) 1231 end 1232 1233 %------------------------------------------------------------------------ 1234 % --- Executes on button press in CheckMask. 1235 function get_mask_fix2_Callback(hObject, eventdata, handles) 1236 %------------------------------------------------------------------------ 1237 maskval=get(handles.CheckMask,'Value'); 1238 if isequal(maskval,0) 1239 set(handles.Mask,'String','') 1240 else 1241 mask_displ='no mask'; %default 1242 filebase=get(handles.RootPath,'String'); 1243 [nbslice, flag_mask]=get_mask(filebase,handles); 1244 if isequal(flag_mask,1) 1245 mask_displ=[num2str(nbslice) 'mask']; 1246 elseif get(handles.ListCompareMode,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series 1247 filebase_a=get(handles.RootFile_1,'String'); 1248 [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); 1249 if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice) 1250 mask_displ='no mask'; 1251 end 1252 end 1253 if isequal(mask_displ,'no mask') 1254 [FileName, PathName, filterindex] = uigetfile( ... 1255 {'*.png', ' (*.png)'; 1256 '*.png', '.png files '; ... 1257 '*.*', 'All Files (*.*)'}, ... 1258 'Pick a mask file *.png',filebase); 1259 mask_displ=fullfile(PathName,FileName); 1260 if ~exist(mask_displ,'file') 1261 mask_displ='no mask'; 1262 end 1263 end 1264 if isequal(mask_displ,'no mask') 1265 set(handles.CheckMask,'Value',0) 1266 end 1267 set(handles.Mask,'String',mask_displ) 1268 end 1171 end 1172 1173 % %------------------------------------------------------------------------ 1174 % % --- Executes on button press in CheckMask. 1175 % function get_mask_fix2_Callback(hObject, eventdata, handles) 1176 % %------------------------------------------------------------------------ 1177 % maskval=get(handles.CheckMask,'Value'); 1178 % if isequal(maskval,0) 1179 % set(handles.Mask,'String','') 1180 % else 1181 % mask_displ='no mask'; %default 1182 % filebase=get(handles.RootPath,'String'); 1183 % [nbslice, flag_mask]=get_mask(filebase,handles); 1184 % if isequal(flag_mask,1) 1185 % mask_displ=[num2str(nbslice) 'mask']; 1186 % elseif get(handles.ListCompareMode,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series 1187 % filebase_a=get(handles.RootFile_1,'String'); 1188 % [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); 1189 % if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice) 1190 % mask_displ='no mask'; 1191 % end 1192 % end 1193 % if isequal(mask_displ,'no mask') 1194 % [FileName, PathName, filterindex] = uigetfile( ... 1195 % {'*.png', ' (*.png)'; 1196 % '*.png', '.png files '; ... 1197 % '*.*', 'All Files (*.*)'}, ... 1198 % 'Pick a mask file *.png',filebase); 1199 % mask_displ=fullfile(PathName,FileName); 1200 % if ~exist(mask_displ,'file') 1201 % mask_displ='no mask'; 1202 % end 1203 % end 1204 % if isequal(mask_displ,'no mask') 1205 % set(handles.CheckMask,'Value',0) 1206 % end 1207 % set(handles.Mask,'String',mask_displ) 1208 % end 1269 1209 1270 1210 %------------------------------------------------------------------------ … … 1475 1415 end 1476 1416 end 1417 set(hObject,'BackgroundColor',[1 0 1]) 1418 set(handles.configSource,'String','NEW') 1477 1419 1478 1420 %------------------------------------------------------------------------ … … 1491 1433 hhseries=guidata(hseries); 1492 1434 InputTable=get(hhseries.InputTable,'Data'); 1493 1435 ind_A=1;% line index of the (first) image series 1494 1436 if strcmp(InputTable{1,5},'.nc'); 1495 1437 ind_A=2; 1496 1438 end 1497 [nbslice, flag_mask]=get_mask(InputTable{ind_A,1},handles);% look for a mask with appropriate name 1439 [nbslice, flag_mask]=get_mask(InputTable{ind_A,1},handles);% look for a mask with appropriate name 1498 1440 if isequal(flag_mask,1) 1499 1441 filemask=[num2str(nbslice) 'mask']; 1500 1442 testmask=1; 1501 else % browse for a mask 1502 filemask=get(hObject,'UserData');%look for previous mask name stored as UserData1503 if exist(filemask,'file')1504 filebase=filemask;1505 end1506 filemask= uigetfile_uvmat('pick a mask image file:',InputTable{ind_A,1},'image'); 1443 else % browse for a mask 1444 % filemask=get(hObject,'UserData');%look for previous mask name stored as UserData 1445 % if exist(filemask,'file') 1446 % filebase=filemask; 1447 % end 1448 filemask= uigetfile_uvmat('pick a mask image file:',InputTable{ind_A,1},'image'); 1507 1449 set(hObject,'UserData',filemask);%store for future use 1508 1450 if ~isempty(filemask) … … 1512 1454 end 1513 1455 if testmask 1514 % if strcmp(parent_tag,'Civ1') 1515 set(handles.Mask,'Visible','on') 1516 set(handles.Mask,'String',filemask) 1456 set(handles.Mask,'Visible','on') 1457 set(handles.Mask,'String',filemask) 1517 1458 set(handles.CheckMask,'Value',1) 1518 % end1519 1459 else 1520 1460 set(hObject,'Value',0); 1521 1461 set(handle_txtbox,'Visible','off') 1522 1462 end 1523 1524 %------------------------------------------------------------------------ 1525 % --- Executes on button press in get_gridpatch1. 1526 function get_gridpatch1_Callback(hObject, eventdata, handles) 1527 %------------------------------------------------------------------------ 1528 filebase=get(handles.RootPath,'String'); 1529 [FileName, PathName, filterindex] = uigetfile( ... 1530 {'*.grid', ' (*.grid)'; 1531 '*.grid', '.grid files '; ... 1532 '*.*', 'All Files (*.*)'}, ... 1533 'Pick a file',filebase); 1534 filegrid=fullfile(PathName,FileName); 1535 set(handles.grid_patch1,'string',filegrid); 1536 1537 1538 %------------------------------------------------------------------------ 1539 % --- Executes on button press in get_gridpatch2. 1540 function get_gridpatch2_Callback(hObject, eventdata, handles) 1541 %------------------------------------------------------------------------ 1542 1463 set(hObject,'BackgroundColor',[1 0 1]) 1464 set(handles.configSource,'String','NEW') 1465 1466 % %------------------------------------------------------------------------ 1467 % % --- Executes on button press in get_gridpatch1. 1468 % function get_gridpatch1_Callback(hObject, eventdata, handles) 1469 % %------------------------------------------------------------------------ 1470 % filebase=get(handles.RootPath,'String'); 1471 % [FileName, PathName, filterindex] = uigetfile( ... 1472 % {'*.grid', ' (*.grid)'; 1473 % '*.grid', '.grid files '; ... 1474 % '*.*', 'All Files (*.*)'}, ... 1475 % 'Pick a file',filebase); 1476 % filegrid=fullfile(PathName,FileName); 1477 % set(handles.grid_patch1,'string',filegrid); 1478 % set(hObject,'BackgroundColor',[1 0 1]) 1543 1479 1544 1480 %------------------------------------------------------------------------ … … 1742 1678 set(obj,'Visible','off') 1743 1679 end 1744 1680 set(hObject,'BackgroundColor',[1 0 1]) 1681 set(handles.configSource,'String','NEW') 1745 1682 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1746 1683 %%%%%%%%%%%%%% TEST functions … … 1872 1809 end 1873 1810 1874 1811 %------------------------------------------------------------------------ 1875 1812 % --- Executes on button press in TestCiv2. 1813 %------------------------------------------------------------------------ 1876 1814 function TestCiv2_Callback(hObject, eventdata, handles) 1815 drawnow 1816 if get(handles.TestCiv2,'Value') 1817 set(handles.TestCiv2,'BackgroundColor',[1 1 0])% paint TestCiv1 button to yellow to confirm civ launch 1818 % TO UPDATE TO UPDATE TO UPDATE TO UPDATE 1819 [Data,Param.Civ2]=get_param_civ2(handles); 1820 Grid=civ_matlab(Param);% get the grid of x, y positions set for PIV 1821 hview_field=view_field(Data); %view the image in the GUI view_field 1822 set(0,'CurrentFigure',hview_field) 1823 hhview_field=guihandles(hview_field); 1824 set(hview_field,'CurrentAxes',hhview_field.PlotAxes) 1825 ViewData=get(hview_field,'UserData'); 1826 ViewData.CivHandle=handles.civ_input;% indicate the handle of the civ GUI in view_field 1827 ViewData.PlotAxes.B=imread(Param.Civ1.ImageName_B);%store the second image in the UserData of the GUI view_field 1828 ViewData.PlotAxes.X=Grid.Civ1_X; %keep the set of points in memeory 1829 ViewData.PlotAxes.Y=Grid.Civ1_Y; 1830 set(hview_field,'UserData',ViewData) 1831 corrfig=findobj(allchild(0),'tag','corrfig');% look for a current figure for image correlation display 1832 if isempty(corrfig) 1833 corrfig=figure; 1834 set(corrfig,'tag','corrfig') 1835 set(corrfig,'name','image correlation') 1836 set(corrfig,'DeleteFcn',{@closeview_field})% 1837 % end 1838 set(handles.TestCiv1,'BackgroundColor',[1 0 0]) 1839 else 1840 set(handles.TestCiv1,'BackgroundColor',[1 0 0])% paint button to red 1841 corrfig=findobj(allchild(0),'tag','corrfig');% look for a current figure for image correlation display 1842 if ~isempty(corrfig) 1843 delete(corrfig) 1844 end 1845 hview_field=findobj(allchild(0),'tag','view_field');% look for view_field 1846 if ~isempty(hview_field) 1847 delete(hview_field) 1848 end 1849 end 1850 else 1851 hview_field=findobj(allchild(0),'Tag','view_field'); %view the image in the GUI view_field 1852 if ~isempty(hview_field) 1853 delete(hview_field) 1854 end 1855 end 1877 1856 1878 1857 … … 2040 2019 end 2041 2020 2042 2043 % % --- Executes on key press with focus on civ_input and none of its controls.2044 function keyboard_callback(hObject,eventdata,handles)2045 set(handles.ConfigSource,'String','NEW')% indicate that param have been modified2046 2021 2047 2022 %------------------------------------------------------------------------ … … 2104 2079 par_civ1.ImageName_B=ImageName_B; 2105 2080 2081 %------------------------------------------------------------------------ 2106 2082 % --- Executes on button press in InportParam. 2083 %------------------------------------------------------------------------ 2107 2084 function InportParam_Callback(hObject, eventdata, handles) 2108 2085 hseries=findobj(allchild(0),'Tag','series'); … … 2146 2123 end 2147 2124 2148 2149 2125 % --- Executes on selection change in iterate. 2150 2126 function iterate_Callback(hObject, eventdata, handles) 2151 2127 2128 %------------------------------------------------------------------------ 2129 % --- Executes on key press with selection of a uicontrol 2130 %------------------------------------------------------------------------ 2131 function keyboard_callback(hObject,eventdata,handles) 2132 2133 ListExclude={'CheckCiv1','CheckFix1','CheckPatch1','CheckCiv2','CheckFix2','CheckPatch2','ref_i'}; 2134 if isempty(find(strcmp(get(gco,'Tag'),ListExclude),1))% if the selected uicontrol is not in the Exclude list 2135 set(gco,'BackgroundColor',[1 0 1]) 2136 drawnow 2137 set(handles.ConfigSource,'String','NEW')% indicate that the configuration is new 2138 end
Note: See TracChangeset
for help on using the changeset viewer.