Changeset 774
- Timestamp:
- May 10, 2014, 12:50:36 AM (11 years ago)
- Location:
- trunk/src/series
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series/civ_input.m
r771 r774 56 56 guidata(hObject, handles); % Update handles structure 57 57 set(hObject,'WindowButtonDownFcn',{'mouse_down'}) % allows mouse action with right button (zoom for uicontrol display) 58 hseries=findobj(allchild(0),'Tag','series'); 59 hhseries=guidata(hseries); 60 %SeriesData.ParentHandle=hseries; 61 SeriesData=get(hseries,'UserData'); 62 % relevant data in gcbf:.FileType,.FileInfo,.Time,.TimeUnit,.GeometryCalib{1}; 58 set(hObject,'WindowKeyPressFcn',{@keyboard_callback,handles})%set keyboard action function 59 set(handles.ref_i,'KeyPressFcn',{@ref_i_KeyPressFcn,handles})%set keyboard action function 60 %set(hObject,'WindowKeyPressFcn',{'keyboard_callback',handles})%set keyboard action function 61 hseries=findobj(allchild(0),'Tag','series');% find the parent GUI 'series' 62 hhseries=guidata(hseries); %handles of the elements in 'series' 63 SeriesData=get(hseries,'UserData');% info stored in the GUI series 63 64 64 65 %% set visibility options: 65 66 if strcmp(Param.Action.ActionName,'civ_series') 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 67 % set(handles.Program,'String','civ_series') 68 set(handles.num_MaxDiff,'Visible','on') 69 set(handles.num_MaxVel,'Visible','on') 70 set(handles.title_MaxVel,'Visible','on') 71 set(handles.title_MaxDiff,'Visible','on') 72 set(handles.num_Nx,'Visible','off') 73 set(handles.num_Ny,'Visible','off') 74 set(handles.title_Nx,'Visible','off') 75 set(handles.title_Ny,'Visible','off') 76 set(handles.num_CorrSmooth,'Style','popupmenu') 77 set(handles.num_CorrSmooth,'Value',1) 78 set(handles.num_CorrSmooth,'String',{'1';'2'}) 79 set(handles.CheckThreshold,'Visible','on') 80 set(handles.CheckDeformation,'Value',0)% desactivate (work in progress) 81 set(handles.CheckDecimal,'Value',0)% desactivate (work in progress) 81 82 end 82 83 83 84 %% input file info 84 % RootPath=Param.InputTable{1,1};85 % %set(handles.RootPath,'String',RootPath)86 % RootFile=Param.InputTable{1,3};87 % SubDir=Param.InputTable{1,2};88 85 NomTypeInput=Param.InputTable{1,4}; 89 % FileExt=Param.InputTable{1,5};90 86 FileType='image';%fdefault 91 87 FileInfo=[]; 92 88 if isfield(SeriesData,'FileType')&&isfield(SeriesData,'FileInfo') 93 89 FileType=SeriesData.FileType{1};%type of the first input file series 94 FileInfo=SeriesData.FileInfo{1}; 95 else 96 set(hhseries.REFRESH,'BackgroundColor',[1 0 1]) 97 % msgbox_uvmat('ERROR','please refresh the input file series') 98 % return 99 end 100 101 102 %% case of netcdf file as input, get the processing stage and look for corresponding images 103 % imageinput=fileinput;%default 104 % TODO: insert image input in the GUI series 90 FileInfo=SeriesData.FileInfo{1};% info on the first input file series 91 else 92 set(hhseries.REFRESH,'BackgroundColor',[1 0 1])% indicate that the file input in series needs to be refreshed 93 end 94 95 %% case of netcdf file as input, read the processing stage and look for corresponding images 105 96 ind_opening=0;%default 106 97 NomTypeNc=''; … … 118 109 if isempty(regexp(NomTypeInput,'[ab|AB|-]', 'once')) 119 110 set(handles.ListCompareMode,'Value',2) %mode displacement advised if the nomencalture does not involve index pairs 120 % set(handles.RootFile_1,'Visible','On');121 111 else 122 112 set(handles.ListCompareMode,'Value',1) 123 113 end 124 imageinput=''; 125 FileInput=SeriesData.RefFile{1}; 126 Data=nc2struct(FileInput,'ListGlobalAttribute','Civ2_ImageA','Civ1_ImageA','Civ2_ImageB','Civ1_ImageB'); 114 % FileInput=SeriesData.RefFile{1}; 115 [Data,tild,tild,errormsg]=nc2struct(FileInfo.FileName,[]); 116 if ~isempty(errormsg) 117 msgbox_uvmat('ERROR',['error in netcdf input file: ' errormsg]) 118 return 119 end 127 120 [PathCiv1_ImageA,Civ1_ImageA,FileExtA]=fileparts(Data.Civ1_ImageA); 128 121 [PathCiv1_ImageB,Civ1_ImageB,FileExtA]=fileparts(Data.Civ1_ImageB); 129 if ~isempty(Data.Civ2_ImageA)122 if isfield(Data,'Civ2_ImageA') 130 123 [PathCiv2_ImageA,Civ2_ImageA,FileExtA]=fileparts(Data.Civ2_ImageA); 131 124 [PathCiv2_ImageB,Civ2_ImageB,FileExtA]=fileparts(Data.Civ2_ImageB); … … 133 126 if size(Param.InputTable,1)==1 134 127 series('display_file_name',hhseries,Data.Civ1_ImageA,'append');%append the image series to the input list 135 end136 if isfield(Data,'Txt')137 errormsg=Data.Txt;138 return139 %TODO: introduce the image in the input table of series140 128 end 141 129 [RootPath,SubDir,RootFile,i1,i2,j1,j2,FileExt,NomTypeImaA]=fileparts_uvmat(Data.Civ1_ImageA); … … 153 141 set(handles.PairIndices,'Visible','off') 154 142 end 155 156 %% TODO: get corresponding image in nc case157 143 158 144 %% reinitialise menus … … 166 152 %% prepare the GUI with input parameters 167 153 set(handles.ListCompareMode,'Visible','on') 168 169 %display the parameters stored on the GUI series170 154 set(handles.ref_i,'String',num2str(Param.IndexRange.first_i)) 171 155 if isfield(Param.IndexRange,'first_j') … … 173 157 end 174 158 175 %% set the civ_input options depending on the input file content when a nc file has been opened176 ListOptions={'CheckCiv1', 'CheckFix1' 'CheckPatch1', 'CheckCiv2', 'CheckFix2', 'CheckPatch2'};177 checkbox=zeros(size(ListOptions));%default178 if ind_opening==0%case of image opening, start with Civ1179 for index=1:numel(ListOptions)180 checkbox(index)=get(handles.(ListOptions{index}),'Value');181 end182 index_max=find(checkbox, 1, 'last' );183 if isempty(index_max),index_max=1;end184 for index=1:index_max185 set(handles.(ListOptions{index}),'Value',1)% select all operations starting from CIV1186 end187 else188 for index = 1:min(ind_opening,5)189 set(handles.(ListOptions{index}),'value',0)190 end191 set(handles.(ListOptions{min(ind_opening+1,6)}),'value',1)192 for index = ind_opening+2:6193 set(handles.(ListOptions{index}),'value',0)194 end195 end196 197 198 159 %% set the menus of image pairs and default selection for civ_input %%%%%%%%%%%%%%%%%%% 199 MaxIndex_i=Param.IndexRange.MaxIndex_i(iview_image); 200 MinIndex_i=Param.IndexRange.MinIndex_i(iview_image); 201 MaxIndex_j=1;%default 202 MinIndex_j=1; 203 if isfield(Param.IndexRange,'MaxIndex_j')&&isfield(Param.IndexRange,'MinIndex_j')... 204 && numel(Param.IndexRange.MaxIndex_j')>=iview_image &&numel(Param.IndexRange.MinIndex_j')>=iview_image 205 MaxIndex_j=Param.IndexRange.MaxIndex_j(iview_image); 206 MinIndex_j=Param.IndexRange.MinIndex_j(iview_image); 207 end 160 161 %% display the min and max indices for the whole file series 162 if size(SeriesData.i1_series{iview_image},2)==2 && min(min(SeriesData.i1_series{iview_image}(:,1,:)))==0 163 MinIndex_j=1;% index j set to 1 by default 164 MaxIndex_j=1; 165 MinIndex_i=find(SeriesData.i1_series{iview_image}(1,2,:), 1 )-1;% min ref index i detected in the series (corresponding to the first non-zero value of i1_series, except for zero index) 166 MaxIndex_i=find(SeriesData.i1_series{iview_image}(1,2,:),1,'last' )-1;%max ref index i detected in the series (corresponding to the last non-zero value of i1_series) 167 else 168 ref_i=squeeze(max(SeriesData.i1_series{iview_image}(1,:,:),[],2));% select ref_j index for each ref_i 169 ref_j=squeeze(max(SeriesData.j1_series{iview_image}(1,:,:),[],3));% select ref_i index for each ref_j 170 MinIndex_i=min(find(ref_i))-1; 171 MaxIndex_i=max(find(ref_i))-1; 172 MaxIndex_j=max(find(ref_j))-1; 173 MinIndex_j=min(find(ref_j))-1; 174 end 175 % MaxIndex_i=Param.IndexRange.MaxIndex_i(iview_image); 176 % MinIndex_i=Param.IndexRange.MinIndex_i(iview_image); 177 % MaxIndex_j=1;%default 178 % MinIndex_j=1; 179 % if isfield(Param.IndexRange,'MaxIndex_j')&&isfield(Param.IndexRange,'MinIndex_j')... 180 % && numel(Param.IndexRange.MaxIndex_j')>=iview_image &&numel(Param.IndexRange.MinIndex_j')>=iview_image 181 % MaxIndex_j=Param.IndexRange.MaxIndex_j(iview_image); 182 % MinIndex_j=Param.IndexRange.MinIndex_j(iview_image); 183 % end 208 184 CivInputData.MaxIndex_i=MaxIndex_i; 209 185 CivInputData.MaxIndex_j=MaxIndex_j; … … 274 250 set(handles.CoordUnit,'String',CoordUnit) 275 251 set(handles.SearchRange,'UserData', pxcm_search); 276 277 %% set the reference indices from the input file indices 278 num_ref_i=str2num(get(handles.ref_i,'String')); 279 num_ref_j=str2num(get(handles.ref_j,'String')); 280 281 update_CivOptions(handles,ind_opening) 282 283 %% list the possible index pairs, depending on the option set in ListPairMode 284 ListPairMode_Callback([], [], handles) 285 ListPairCiv1_Callback(hObject, eventdata, handles) 286 287 %% introduce the stored parameters if relevant 252 % indicate the min and max indices i and j on the GUI 253 set(handles.MinIndex_i,'String',num2str(MinIndex_i)) 254 set(handles.MaxIndex_i,'String',num2str(MaxIndex_i)) 255 set(handles.MinIndex_j,'String',num2str(MinIndex_j)) 256 set(handles.MaxIndex_j,'String',num2str(MaxIndex_j)) 257 258 %% introduce the stored Civ parameters if available (from previous input or ImportConfig in series) 288 259 if isfield(Param,'ActionInput') 289 260 fill_GUI(Param.ActionInput,hObject);%fill the GUI with the parameters retrieved from the input Param 290 261 hcheckgrid=findobj(handles.civ_input,'Tag','CheckGrid'); 291 262 for ilist=1:numel(hcheckgrid) 292 if get(hcheckgrid(ilist),'Value') 263 if get(hcheckgrid(ilist),'Value')% if a grid is used, do not show Dx and Dy for an automatic grid 293 264 hparent=get(hcheckgrid(ilist),'parent');%handles of the parent panel 294 265 hchildren=get(hparent,'children'); 295 %handle_txtbox=findobj(hchildren,'tag','Grid');% look for the grid name box in the same panel296 266 handle_dx=findobj(hchildren,'tag','num_Dx'); 297 267 handle_dy=findobj(hchildren,'tag','num_Dy'); … … 305 275 end 306 276 end 307 % indicate max and min indices updated from input file series (not stored in Param.ActionInput) 308 set(handles.MaxIndex_i,'String',num2str(MaxIndex_i)); 309 set(handles.MinIndex_i,'String',num2str(MinIndex_i)); 310 set(handles.MaxIndex_j,'String',num2str(MaxIndex_i)); 311 set(handles.MinIndex_j,'String',num2str(MinIndex_i)); 277 278 %% set the civ_input options, depending on the input file content if a nc file has been opened 279 ListOptions={'CheckCiv1', 'CheckFix1' 'CheckPatch1', 'CheckCiv2', 'CheckFix2', 'CheckPatch2'}; 280 checkbox=zeros(size(ListOptions));%default 281 if ind_opening==0 %case of image opening, start with Civ1 282 for index=1:numel(ListOptions) 283 checkbox(index)=get(handles.(ListOptions{index}),'Value'); 284 end 285 index_max=find(checkbox, 1, 'last' ); 286 if isempty(index_max),index_max=1;end 287 for index=1:index_max 288 set(handles.(ListOptions{index}),'Value',1)% select all operations starting from CIV1 289 end 290 else %case of netcdf file opening, start with the stage read in the file 291 for index = 1:min(ind_opening,5) 292 set(handles.(ListOptions{index}),'value',0) 293 fill_civ_input(Data,handles); %fill civ_input with the parameters retrieved from an input Civ file 294 end 295 set(handles.ConfigSource,'String',FileInfo.FileName); 296 set(handles.(ListOptions{min(ind_opening+1,6)}),'value',1) 297 for index = ind_opening+2:6 298 set(handles.(ListOptions{index}),'value',0) 299 end 300 end 301 302 %% set the reference indices from the input file indices 303 update_CivOptions(handles,ind_opening)% fill the menu of possible pairs 304 305 %% list the possible index pairs, depending on the option set in ListPairMode 306 ListPairMode_Callback([], [], handles) 307 ListPairCiv1_Callback(hObject, eventdata, handles) 312 308 313 309 %% set the GUI to modal: wait for OK to close … … 316 312 uiwait(handles.civ_input); 317 313 318 319 320 %Program_Callback([],[], handles)321 314 322 315 %------------------------------------------------------------------------ … … 341 334 end 342 335 343 344 345 336 % ----------------------------------------------------------------------- 346 337 % ----------------------------------------------------------------------- … … 348 339 function MenuHelp_Callback(hObject, eventdata, handles) 349 340 % ----------------------------------------------------------------------- 350 path_civ=fileparts(which ('civ')); 351 helpfile=fullfile(path_civ,'uvmat_doc','uvmat_doc.html'); 352 if isempty(dir(helpfile)) 353 msgbox_uvmat('ERROR','Please put the help file uvmat_doc.html in the sub-directory /uvmat_doc of the UVMAT package') 354 else 355 addpath (fullfile(path_civ,'uvmat_doc')) 356 web([helpfile '#civ']) 357 end 358 359 360 %------------------------------------------------------------------------ 361 % --- general function activated for an input file series 362 function errormsg=display_file_name(handles,fileinput) 363 %------------------------------------------------------------------------ 364 365 %% scan the image file series 366 [FilePath,FileName,ImaExt]=fileparts(imageinput); 367 % detect the file type, get the movie object if relevant, and look for the corresponding file series: 368 % the root name and indices may be corrected by including the first index i1 if a corresponding xml file exists 369 switch Param.FileType{1} 370 case {'image','multimage','video','mmreader'} 371 otherwise 372 errormsg='invalid input file: enter an image, a movie or civ .nc file'; 373 return 374 end 375 set(handles.RootPath,'String',RootPath) 376 set(handles.Civ1_ImageA,'String',SubDirImages) 377 set(handles.Civ2_ImageB,'String',RootFile) 378 if strcmp(ExtInput,'.nc') 379 SubDirCiv=regexprep(SubDir,['^' SubDirImages],'');%suppress the root SuddirImages; 380 else 381 SubDirCiv= '.civ'; 382 end 383 set(handles.Civ1_ImageB,'String',SubDirCiv) 384 set(handles.Civ2_ImageA,'String',SubDirCiv) 385 browse=get(handles.RootPath,'UserData'); 386 browse.incr_pair=[0 0];%default 387 388 %% scan the images if a civ_input file has been opened 389 MinIndex_i=min(i1_series(i1_series>0)); 390 MinIndex_j=min(j1_series(j1_series>0)); 391 MaxIndex_i=max(i1_series(i1_series>0)); 392 MaxIndex_j=max(j1_series(j1_series>0)); 393 394 %% look for an image documentation file 395 XmlFileName=find_imadoc(RootPath,SubDir,RootFile,ImaExt); 396 if isempty(XmlFileName) 397 if (strcmp(FileType,'video') || strcmp(FileType,'mmreader')) 398 ext_imadoc=ImaExt;% the timing from the video movie is used 399 else 400 ext_imadoc=''; 401 end 402 else 403 [tild,tild,ext_imadoc]=fileparts(XmlFileName); 404 end 405 set(handles.ImaDoc,'String',ext_imadoc)% display the extension name for the image documentation file used 406 407 408 409 %% update i and j index range if a nc file has been opened or pb withmin max image indices: 410 % then set first and last to the inputfile index by default 411 first_i=str2num(get(handles.MinIndex_i,'String')); 412 last_i=str2num(get(handles.last_i,'String')); 413 if isempty(first_i) || isempty(last_i)||isempty(MinIndex_i)||isempty(MaxIndex_i)||ind_opening~=0 || isempty(first_i) || isempty(last_i)|| first_i<MinIndex_i || last_i>MaxIndex_i 414 first_i=num_ref_i; 415 last_i=num_ref_i; 416 set(handles.MinIndex_i,'String',num2str(first_i)); 417 set(handles.last_i,'String',num2str(last_i));% 418 end 419 420 %j index range 421 first_j=str2num(get(handles.MinIndex_j,'String')); 422 last_j=str2num(get(handles.last_j,'String')); 423 if isempty(first_j) || isempty(last_j)||isempty(MinIndex_j)||isempty(MaxIndex_j)||ind_opening~=0 || first_j<MinIndex_j || last_j>MaxIndex_j 424 first_j=num_ref_j; 425 last_j=num_ref_j; 426 set(handles.MinIndex_j,'String',num2str(first_j)); 427 set(handles.last_j,'String',num2str(last_j));% 428 end 429 if num_ref_i>last_i || num_ref_i<first_i 430 num_ref_i=round((first_i+last_i)/2); 431 end 432 if num_ref_j>last_j || num_ref_j<first_j 433 num_ref_j=round((first_j+last_j)/2); 434 end 435 set(handles.ref_i,'String',num2str(num_ref_i)) 436 set(handles.ref_j,'String',num2str(num_ref_j)) 437 438 439 440 %% scan files to update the subdirectory list display 441 listot=dir(RootPath);%directory of RootPath 442 idir=0; 443 listdir={''};%default 444 % get the list of existing civ_input subdirectories in the path of theinput root file 445 for ilist=1:length(listot) 446 if listot(ilist).isdir 447 name=listot(ilist).name; 448 if ~isequal(name,'.') && ~isequal(name,'..') 449 idir=idir+1; 450 listdir{idir,1}=listot(ilist).name; 451 end 452 end 453 end 454 455 %% store info 456 %set(handles.RootPath,'UserData',browse)% store the nomenclature type 457 458 %% list the possible index pairs, depending on the option set in ListPairMode 459 ListPairMode_Callback([], [], handles) 341 web('http://servforge.legi.grenoble-inp.fr/projects/soft-uvmat/wiki/UvmatHelp#Civ') 460 342 461 343 %------------------------------------------------------------------------ … … 476 358 % set(handles.ListSubdirCiv2,'Value',ilist) 477 359 else % if Civ1 data already exist 478 errormsg=find_netcpair_civ(handles,1); %update the list of available pairs from netcdf files in the new directory360 errormsg=find_netcpair_civ(handles,1); %update the list of available index pairs in the new directory 479 361 if ~isempty(errormsg) 480 362 msgbox_uvmat('ERROR',errormsg) … … 550 432 checkbox(5)=get(handles.CheckFix2,'Value'); 551 433 checkbox(6)=get(handles.CheckPatch2,'Value'); 552 ind_selected=find(checkbox,1);553 set(handles.PairIndices,'Visible','on') 434 % ind_selected=find(checkbox,1); 435 set(handles.PairIndices,'Visible','on')% make the frame PaiIndices visible, choice of the index pairs fo civ 554 436 if opening==0 555 437 errormsg=find_netcpair_civ(handles,1); % select the available netcdf files … … 715 597 set(handles.ListPairMode,'String',{'series(Di)'}) 716 598 ListPairMode_Callback(hObject, eventdata, handles) 717 % set(handles.RootFile_1,'Visible','Off');718 % set(handles.sub_txt,'Visible','off')719 % set(handles.RootFile_1,'String',[]);720 % mode_store=get(handles.ListCompareMode,'UserData');721 % set(handles.ListPairMode,'Visible','on')722 % set(handles.ListPairMode,'Value',1)723 % set(handles.ListPairMode,'String',{'series(Di)'})724 % set(handles.CheckStereo,'Value',0)725 % set(handles.last_j,'String',get(handles.MaxIndex_j,'String'))% select the whole volume scan by default726 % set(handles.incr_i,'String',num2str(2))%727 599 case 'displacement' 728 600 OriginIndex='on';%define a frame origin for displacement … … 1014 886 nbpair=200;%default 1015 887 select=ones(size(1:nbpair));%flag for displayed pairs =1 for display 1016 testpair=0;1017 888 nbpair=200; %default 1018 889 1019 890 %% determine the menu display in .ListPairCiv1 1020 testpair=0; %TODO: check 1021 if isequal(mode,'series(Di)') 1022 if testpair 1023 displ_pair{1}=['Di= ' num2str(-floor(browse.incr_pair(1)/2)) '|' num2str(ceil(browse.incr_pair(1)/2))]; 1024 else 891 switch mode 892 case 'series(Di)' 1025 893 for ipair=1:nbpair 1026 894 if select(ipair) 1027 895 displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2))]; 1028 if ~checkframe1029 if size(Time,1)>=ref_i+1+ceil(ipair/2) && size(Time,2)>=ref_j+1&& ref_i-floor(ipair/2)>=0 && ref_j>=01030 dt=Time(ref_i+1+ceil(ipair/2),ref_j+1)-Time(ref_i+1-floor(ipair/2),ref_j+1);%Time interval dtref_j+11031 displ_pair{ipair}=[displ_pair{ipair} ' :dt= ' num2str(dt*1000)];1032 end896 if ~checkframe 897 if size(Time,1)>=ref_i+1+ceil(ipair/2) && size(Time,2)>=ref_j+1&& ref_i-floor(ipair/2)>=0 && ref_j>=0 898 dt=Time(ref_i+1+ceil(ipair/2),ref_j+1)-Time(ref_i+1-floor(ipair/2),ref_j+1);%Time interval dtref_j+1 899 displ_pair{ipair}=[displ_pair{ipair} ' :dt= ' num2str(dt*1000)]; 900 end 1033 901 else 1034 902 dt=ipair/1000; 1035 1036 end903 displ_pair{ipair}=[displ_pair{ipair} ' :dt= ' num2str(ipair)]; 904 end 1037 905 else 1038 906 displ_pair{ipair}='...'; %pair not displayed in the menu 1039 907 end 1040 908 end 1041 end 1042 elseif isequal(mode,'series(Dj)') 1043 if testpair 1044 displ_pair{1}=['Dj= ' num2str(-floor(browse.incr_pair(1)/2)) '|' num2str(ceil(browse.incr_pair(1)/2))]; 1045 else 909 case 'series(Dj)' 1046 910 for ipair=1:nbpair 1047 911 if select(ipair) 1048 912 displ_pair{ipair}=['Dj= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2))]; 1049 if ~checkframe1050 if size(Time,2)>=ref_j+1+ceil(ipair/2) && size(Time,1)>=ref_i+1 && ref_j-floor(ipair/2)>=0 && ref_i>=01051 dt=Time(ref_i+1,ref_j+1+ceil(ipair/2))-Time(ref_i+1,ref_j+1-floor(ipair/2));%Time interval dtref_j+11052 displ_pair{ipair}=[displ_pair{ipair} ' :dt= ' num2str(dt*1000)];1053 end913 if ~checkframe 914 if size(Time,2)>=ref_j+1+ceil(ipair/2) && size(Time,1)>=ref_i+1 && ref_j-floor(ipair/2)>=0 && ref_i>=0 915 dt=Time(ref_i+1,ref_j+1+ceil(ipair/2))-Time(ref_i+1,ref_j+1-floor(ipair/2));%Time interval dtref_j+1 916 displ_pair{ipair}=[displ_pair{ipair} ' :dt= ' num2str(dt*1000)]; 917 end 1054 918 else 1055 919 dt=ipair/1000; 1056 920 displ_pair{ipair}=[displ_pair{ipair} ' :dt= ' num2str(dt*1000)]; 1057 end921 end 1058 922 else 1059 923 displ_pair{ipair}='...'; %pair not displayed in the menu 1060 924 end 1061 925 end 1062 end1063 elseif isequal(mode,'pair j1-j2')%case of pairs 1064 MinIndex_j=CivInputData.MinIndex_j;1065 MaxIndex_j=min(CivInputData.MaxIndex_j,10);%limitate the number of pairs to 10x101066 index_pair=0;1067 %get all the Time intervals in bursts1068 for numod_a=MinIndex_j:MaxIndex_j-1 %nbfield2 always >=2 for 'pair j1-j2' mode1069 for numod_b=(numod_a+1):MaxIndex_j1070 index_pair=index_pair+1;1071 displ_pair{index_pair}=['j= ' num2stra(numod_a,nom_type_ima) '-' num2stra(numod_b,nom_type_ima)];1072 dt(index_pair)=numod_b-numod_a;%default dt1073 if size(Time,1)>ref_i && size(Time,2)>numod_b % && ~checkframe1074 dt(index_pair)=Time(ref_i+1,numod_b+1)-Time(ref_i+1,numod_a+1);% Time interval dt1075 displ_pair{index_pair}=[displ_pair{index_pair} ' :dt= ' num2str(dt(index_pair)*1000)];926 case 'pair j1-j2'%case of pairs 927 MinIndex_j=CivInputData.MinIndex_j; 928 MaxIndex_j=min(CivInputData.MaxIndex_j,10);%limitate the number of pairs to 10x10 929 index_pair=0; 930 %get all the Time intervals in bursts 931 for numod_a=MinIndex_j:MaxIndex_j-1 %nbfield2 always >=2 for 'pair j1-j2' mode 932 for numod_b=(numod_a+1):MaxIndex_j 933 index_pair=index_pair+1; 934 displ_pair{index_pair}=['j= ' num2stra(numod_a,nom_type_ima) '-' num2stra(numod_b,nom_type_ima)]; 935 dt(index_pair)=numod_b-numod_a;%default dt 936 if size(Time,1)>ref_i && size(Time,2)>numod_b % && ~checkframe 937 dt(index_pair)=Time(ref_i+1,numod_b+1)-Time(ref_i+1,numod_a+1);% Time interval dt 938 displ_pair{index_pair}=[displ_pair{index_pair} ' :dt= ' num2str(dt(index_pair)*1000)]; 939 end 1076 940 end 1077 end 1078 1079 end 1080 [dtsort,indsort]=sort(dt); 1081 displ_pair=displ_pair(indsort); 1082 elseif isequal(mode,'displacement') 1083 displ_pair={'Di=Dj=0'}; 941 942 end 943 [tild,indsort]=sort(dt); 944 displ_pair=displ_pair(indsort); 945 case 'displacement' 946 displ_pair={'Di=Dj=0'}; 1084 947 end 1085 948 if index==1 1086 set(handles.ListPairCiv1,'String',displ_pair');949 set(handles.ListPairCiv1,'String',displ_pair'); 1087 950 end 1088 951 … … 1823 1686 % end 1824 1687 1688 1689 1690 %------------------------------------------------------------------------ 1691 %----function introduced for the correlation window figure, activated by deleting this window 1692 function closeview_field(gcbo,eventdata) 1693 %------------------------------------------------------------------------ 1694 hview_field=findobj(allchild(0),'tag','view_field');% look for view_field 1695 if ~isempty(hview_field) 1696 delete(hview_field) 1697 end 1698 1699 %------------------------------------------------------------------------ 1700 % --- Executes on button press in CheckThreshold. 1701 function CheckThreshold_Callback(hObject, eventdata, handles) 1702 %------------------------------------------------------------------------ 1703 huipanel=get(hObject,'parent'); 1704 obj(1)=findobj(huipanel,'Tag','num_MinIma'); 1705 obj(2)=findobj(huipanel,'Tag','num_MaxIma'); 1706 obj(3)=findobj(huipanel,'Tag','title_Threshold'); 1707 if get(hObject,'Value') 1708 set(obj,'Visible','on') 1709 else 1710 set(obj,'Visible','off') 1711 end 1712 1713 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1714 %%%%%%%%%%%%%% TEST functions 1715 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1825 1716 %------------------------------------------------------------------------ 1826 1717 % --- Executes on button press in TestCiv1: prepare the image correlation function 1827 % activated by mouse motion1718 % activated by mouse motion 1828 1719 function TestCiv1_Callback(hObject, eventdata, handles) 1829 1720 %------------------------------------------------------------------------ … … 1831 1722 if get(handles.TestCiv1,'Value') 1832 1723 set(handles.TestCiv1,'BackgroundColor',[1 1 0])% paint TestCiv1 button to yellow to confirm civ launch 1833 ref_i=str2double(get(handles.ref_i,'String'));% read reference i index 1834 if strcmp(get(handles.ref_j,'Visible'),'on') 1835 ref_j=str2double(get(handles.ref_j,'String'));% read reference j index if relevant 1836 else 1837 ref_j=1;%default j index 1838 end 1839 % [filecell,i1,i2]=set_civ_filenames(handles,ref_i,ref_j,[1 0 0 0 0 0]);% get the corresponding file name and indices 1840 Data.ListVarName={'ny','nx','A'}; 1841 Data.VarDimName= {'ny','nx',{'ny','nx'}}; 1842 hseries=findobj(allchild(0),'Tag','series'); 1843 hhseries=guidata(hseries); 1844 InputTable=get(hhseries.InputTable,'Data'); 1845 ind_A=1; 1846 if strcmp(InputTable{1,5},'.nc'); 1847 ind_A=2; 1848 end 1849 list_pair=get(handles.ListPairCiv1,'String');%get the menu of image pairs 1850 PairString=list_pair{get(handles.ListPairCiv1,'Value')}; 1851 [ind1,ind2,mode]=find_pair_indices(PairString,ref_i,ref_j);%,MinIndex_i,MaxIndex_i,MinIndex_j,MaxIndex_j) 1852 switch mode 1853 case 'Di' 1854 i1=ref_i-ind1; 1855 i2=ref_i+ind2; 1856 j1=ref_j; 1857 j2=ref_j; 1858 case 'Dj' 1859 i1=ref_i; 1860 i2=ref_i; 1861 j1=ref_j-ind1; 1862 j2=ref_j+ind2; 1863 case 'burst' 1864 i1=ref_i; 1865 i2=ref_i; 1866 j1=ind1; 1867 j2=ind2; 1868 end 1869 ImageName_A=fullfile_uvmat(InputTable{ind_A,1},InputTable{ind_A,2},InputTable{ind_A,3},InputTable{ind_A,5},InputTable{ind_A,4},... 1870 i1,[],j1); 1871 ImageName_B=fullfile_uvmat(InputTable{ind_A,1},InputTable{ind_A,2},InputTable{ind_A,3},InputTable{ind_A,5},InputTable{ind_A,4},... 1872 i2,[],j2); 1873 Data.A=imread(ImageName_A); % read the first image 1874 if ndims(Data.A)==3 %case of color image 1875 Data.VarDimName= {'ny','nx',{'ny','nx','rgb'}}; 1876 end 1877 Data.ny=[size(Data.A,1) 1]; 1878 Data.nx=[1 size(Data.A,2)]; 1879 Data.CoordUnit='pixel';% used to set equal scaling for x and y in image dispa=ly 1880 par_civ1=read_GUI(handles.Civ1); 1881 par_civ1.FileTypeA=get_file_type(ImageName_A); 1882 par_civ1.ImageWidth=size(Data.A,2); 1883 par_civ1.ImageHeight=size(Data.A,1); 1884 par_civ1.Mask='all';% will provide only the grid set for PIV, no image correlation 1885 par_civ1.FrameIndexA=num2str(i1); 1886 par_civ1.FrameIndexB=num2str(i2); 1887 Param.Civ1=par_civ1; 1724 [Data,Param.Civ1]=get_param_civ1(handles); 1888 1725 Grid=civ_matlab(Param);% get the grid of x, y positions set for PIV 1889 1726 hview_field=view_field(Data); %view the image in the GUI view_field … … 1893 1730 ViewData=get(hview_field,'UserData'); 1894 1731 ViewData.CivHandle=handles.civ_input;% indicate the handle of the civ GUI in view_field 1895 ViewData.PlotAxes.B=imread( ImageName_B);%store the second image in the UserData of the GUI view_field1732 ViewData.PlotAxes.B=imread(Param.Civ1.ImageName_B);%store the second image in the UserData of the GUI view_field 1896 1733 ViewData.PlotAxes.X=Grid.Civ1_X; %keep the set of points in memeory 1897 1734 ViewData.PlotAxes.Y=Grid.Civ1_Y; … … 1916 1753 end 1917 1754 end 1918 end 1919 1920 %------------------------------------------------------------------------ 1921 %----function introduced for the correlation window figure, activated by deleting this window 1922 function closeview_field(gcbo,eventdata) 1923 %------------------------------------------------------------------------ 1924 hview_field=findobj(allchild(0),'tag','view_field');% look for view_field 1925 if ~isempty(hview_field) 1926 delete(hview_field) 1927 end 1928 1929 %------------------------------------------------------------------------ 1930 % --- Executes on button press in CheckThreshold. 1931 function CheckThreshold_Callback(hObject, eventdata, handles) 1932 %------------------------------------------------------------------------ 1933 huipanel=get(hObject,'parent'); 1934 obj(1)=findobj(huipanel,'Tag','num_MinIma'); 1935 obj(2)=findobj(huipanel,'Tag','num_MaxIma'); 1936 obj(3)=findobj(huipanel,'Tag','title_Threshold'); 1937 if get(hObject,'Value') 1938 set(obj,'Visible','on') 1939 else 1940 set(obj,'Visible','off') 1941 end 1942 1943 1755 else 1756 hview_field=findobj(allchild(0),'Tag','view_field'); %view the image in the GUI view_field 1757 if ~isempty(hview_field) 1758 delete(hview_field) 1759 end 1760 end 1761 1762 % -------------------------------------------------------------------- 1763 % --- Executes on button press in TestPatch1. 1764 % -------------------------------------------------------------------- 1765 function TestPatch1_Callback(hObject, eventdata, handles) 1766 1767 if get(handles.TestPatch1,'Value') 1768 if get(handles.CheckCiv1,'Value') 1769 if ~get(handles.CheckFix1,'Value') 1770 msgbox_uvmat('ERROR','perform FIX1 before testing Patch1') 1771 return 1772 end 1773 set(handles.TestPatch1,'BackgroundColor',[1 1 0]) 1774 drawnow 1775 [Data,Param.Civ1]=get_param_civ1(handles); 1776 Param.Fix1=read_GUI(handles.Fix1); 1777 [Data,errormsg]=civ_matlab(Param);% get the civ1 results 1778 errormsg=struct2nc('test_civ1.nc',Data); 1779 InputFile='test_civ1.nc'; 1780 if ~isempty(errormsg) 1781 msgbox_uvmat('ERROR',['error in temporary file writing: ' errormsg]) 1782 return 1783 end 1784 else 1785 hseries=findobj(allchild(0),'Tag','series'); 1786 hhseries=guidata(hseries); 1787 InputTable=get(hhseries.InputTable,'Data'); 1788 if ~strcmp(InputTable{1,5},'.nc'); 1789 msgbox_uvmat('ERROR', 'To test patch, first perform Civ1 and Fix1, then open the resulting netcdf file with ''series''') 1790 return 1791 end 1792 set(handles.TestPatch1,'BackgroundColor',[1 1 0]) 1793 drawnow 1794 ref_i=str2double(get(handles.ref_i,'String')); 1795 if strcmp(get(handles.ref_j,'Visible'),'on') 1796 ref_j=str2double(get(handles.ref_j,'String')); 1797 else 1798 ref_j=1;%default 1799 end 1800 PairString=get(hhseries.PairString,'Data'); 1801 [i1,i2,j1,j2] = get_file_index(ref_i,ref_j,PairString{1}); 1802 InputFile=fullfile_uvmat(InputTable{1,1},InputTable{1,2},InputTable{1,3},InputTable{1,5},InputTable{1,4},... 1803 i1,i2,j1,j2); 1804 end 1805 Param=[]; 1806 Param.Patch1=read_GUI(handles.Patch1); 1807 Param.Patch1.CivFile=InputFile; 1808 SmoothingParam=(Param.Patch1.FieldSmooth/10)*2.^(1:7);%scan the smoothing param from 1/10 to 12.8 current value 1809 Data=nc2struct(InputFile); 1810 NbGood=numel(find(Data.Civ1_FF==0)); 1811 for irho=1:7 1812 Param.Patch1.FieldSmooth=SmoothingParam(irho); 1813 [Data,errormsg]=civ_matlab(Param);% get the grid of x, y positions set for PIV 1814 if ~isempty(errormsg) 1815 msgbox_uvmat('ERROR',errormsg) 1816 return 1817 end 1818 ind_good=find(Data.Civ1_FF==0); 1819 Civ1_U_Diff=Data.Civ1_U(ind_good)-Data.Civ1_U_smooth(ind_good); 1820 Civ1_V_Diff=Data.Civ1_V(ind_good)-Data.Civ1_V_smooth(ind_good); 1821 DiffVel(irho)=sqrt(mean(Civ1_U_Diff.*Civ1_U_Diff+Civ1_V_Diff.*Civ1_V_Diff)); 1822 NbExclude(irho)=(NbGood-numel(ind_good))/NbGood; 1823 end 1824 figure 1825 semilogx(SmoothingParam,DiffVel,'b',SmoothingParam,NbExclude,'r') 1826 grid on 1827 legend('rms velocity diff. Patch1-Civ1 (pixels)','proportion of excluded vectors (between 0 to 1)') 1828 XLabel('smoothing parameter') 1829 YLabel('smoothing effect') 1830 set(handles.TestPatch1,'BackgroundColor',[1 0 0]) 1831 else 1832 corrfig=findobj(allchild(0),'tag','corrfig');% look for a current figure for image correlation display 1833 if ~isempty(corrfig) 1834 delete(corrfig) 1835 end 1836 hview_field=findobj(allchild(0),'tag','view_field');% look for view_field 1837 if ~isempty(hview_field) 1838 delete(hview_field) 1839 end 1840 end 1841 1842 1843 % --- Executes on button press in TestCiv2. 1844 function TestCiv2_Callback(hObject, eventdata, handles) 1944 1845 1945 1846 … … 1981 1882 end 1982 1883 1983 % --- Executes on button press in TestPatch1.1984 function TestPatch1_Callback(hObject, eventdata, handles)1985 set(handles.TestPatch1,'BackgroundColor',[1 1 0])1986 drawnow1987 if get(handles.TestPatch1,'Value')1988 ref_i=str2double(get(handles.ref_i,'String'));1989 if strcmp(get(handles.ref_j,'Visible'),'on')1990 ref_j=str2double(get(handles.ref_j,'String'));1991 else1992 ref_j=1;%default1993 end1994 filecell=set_civ_filenames(handles,ref_i,ref_j,[0 0 1 0 0 0]);1995 Data.ListVarName={'ny','nx','A'};1996 Data.VarDimName= {'ny','nx',{'ny','nx'}};1997 param_patch1=read_GUI(handles.Patch1);1998 param_patch1.CivFile=filecell.nc.civ1{1};1999 Param.Patch1=param_patch1;2000 for irho=1:72001 [Data,errormsg]=civ_matlab(Param);% get the grid of x, y positions set for PIV2002 if ~isempty(errormsg)2003 msgbox_uvmat('ERROR',errormsg)2004 return2005 end2006 SmoothingParam(irho)=Param.Patch1.FieldSmooth;2007 Data.Civ1_U_Diff=Data.Civ1_U_Diff(Data.Civ1_FF==0);2008 Data.Civ1_V_Diff=Data.Civ1_V_Diff(Data.Civ1_FF==0);2009 DiffVel(irho)=sqrt(mean(Data.Civ1_U_Diff.*Data.Civ1_U_Diff+Data.Civ1_V_Diff.*Data.Civ1_V_Diff));2010 NbSites(irho,:)=Data.Civ1_NbSites*numel(Data.Civ1_NbSites)/numel(Data.Civ1_U_Diff);2011 Param.Patch1.SmoothingParam=2*Param.Patch1.FieldSmooth;2012 end2013 figure2014 plot(SmoothingParam,DiffVel,'b',SmoothingParam,NbSites,'r')2015 set(handles.TestPatch1,'BackgroundColor',[1 0 0])2016 else2017 corrfig=findobj(allchild(0),'tag','corrfig');% look for a current figure for image correlation display2018 if ~isempty(corrfig)2019 delete(corrfig)2020 end2021 hview_field=findobj(allchild(0),'tag','view_field');% look for view_field2022 if ~isempty(hview_field)2023 delete(hview_field)2024 end2025 end2026 2027 2028 % --- Executes on button press in TestCiv2.2029 function TestCiv2_Callback(hObject, eventdata, handles)2030 2031 2032 2033 function num_OriginIndex_Callback(hObject, eventdata, handles)2034 % hObject handle to num_OriginIndex (see GCBO)2035 % eventdata reserved - to be defined in a future version of MATLAB2036 % handles structure with handles and user data (see GUIDATA)2037 2038 % Hints: get(hObject,'String') returns contents of num_OriginIndex as text2039 % str2double(get(hObject,'String')) returns contents of num_OriginIndex as a double2040 2041 2042 % --- Executes during object creation, after setting all properties.2043 function num_OriginIndex_CreateFcn(hObject, eventdata, handles)2044 % hObject handle to num_OriginIndex (see GCBO)2045 % eventdata reserved - to be defined in a future version of MATLAB2046 % handles empty - handles not created until after all CreateFcns called2047 2048 % Hint: edit controls usually have a white background on Windows.2049 % See ISPC and COMPUTER.2050 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))2051 set(hObject,'BackgroundColor','white');2052 end2053 1884 2054 1885 %------------------------------------------------------------------------ … … 2057 1888 find_pair_indices(str_civ,i_series,j_series,MinIndex_i,MaxIndex_i,MinIndex_j,MaxIndex_j) 2058 1889 %------------------------------------------------------------------------ 2059 % i1_series=i_series;% set of first image indexes2060 % i2_series=i_series;2061 % j1_series=ones(size(i_series));% set of first image numbers2062 % j2_series=ones(size(i_series));2063 % check_bounds=false(size(i_series));2064 1890 ind1=''; 2065 1891 ind2=''; … … 2092 1918 end 2093 1919 end 2094 % if strcmp (mode,'Di') 2095 % i1_series=i_series-ind1;% set of first image numbers 2096 % i2_series=i_series+ind2; 2097 % check_bounds=i1_series<MinIndex_i | i2_series>MaxIndex_i; 2098 % if isempty(j_series) 2099 % NomTypeNc='_1-2'; 2100 % else 2101 % j1_series=j_series; 2102 % j2_series=j_series; 2103 % NomTypeNc='_1-2_1'; 2104 % end 2105 % elseif strcmp (mode,'Dj') 2106 % j1_series=j_series-ind1; 2107 % j2_series=j_series+ind2; 2108 % check_bounds=j1_series<MinIndex_j | j2_series>MaxIndex_j; 2109 % NomTypeNc='_1_1-2'; 2110 % else %bursts 2111 % j1_series=ind1*ones(size(i_series)); 2112 % j2_series=ind2*ones(size(i_series)); 2113 % end 1920 1921 %------------------------------------------------------------------------ 1922 % --- fill civ_input with the parameters retrieved from an input Civ file 1923 %------------------------------------------------------------------------ 1924 function fill_civ_input(Data,handles) 1925 1926 %% Civ param 1927 % lists of parameters to enter 1928 ListParamNum={'CorrBoxSize','SearchBoxSize','SearchBoxShift','Dx','Dy','Dz','MinIma','MaxIma'};% list of numerical values (to transform in strings) 1929 ListParamValue={'CorrSmooth','CheckGrid','CheckMask','CheckThreshold'}; 1930 ListParamString={'Grid','Mask'}; 1931 % CorrSmooth ?? 1932 option={'Civ1','Civ2'}; 1933 for ichoice=1:2 1934 if isfield(Data,[option{ichoice} '_CorrBoxSize']) 1935 fill_panel(Data,handles,option{ichoice},ListParamNum,ListParamValue,ListParamString) 1936 end 1937 end 1938 1939 %% Fix param 1940 option={'Fix1','Fix2'}; 1941 for ichoice=1:2 1942 if isfield(Data,[option{ichoice} '_CheckFmin2']) 1943 ListParamNum={'MinVel','MaxVel','MinCorr'};% list of numerical values (to transform in strings) 1944 ListParamValue={'CheckFmin2','CheckF3','CheckF4'}; 1945 ListParamString={'ref_fix_1'}; 1946 fill_panel(Data,handles,option{ichoice},ListParamNum,ListParamValue,ListParamString) 1947 end 1948 end 1949 1950 %% Patch param 1951 option={'Patch1','Patch2'}; 1952 for ichoice=1:2 1953 if isfield(Data,[option{ichoice} '_FieldSmooth']) 1954 ListParamNum={'FieldSmooth','MaxDiff','SubDomainSize'};% list of numerical values (to transform in strings) 1955 ListParamValue={}; 1956 ListParamString={}; 1957 fill_panel(Data,handles,option{ichoice},ListParamNum,ListParamValue,ListParamString) 1958 end 1959 end 1960 %------------------------------------------------------------------------ 1961 % --- fill a panel of civ_input with the parameters retrieved from an input Civ file 1962 %------------------------------------------------------------------------ 1963 function fill_panel(Data,handles,panel,ListParamNum,ListParamValue,ListParamString) 1964 children=get(handles.(panel),'children');%handles of the children of the input GUI with handle 'GUI_handle' 1965 handles_panel=[]; 1966 for ichild=1:numel(children) 1967 if ~isempty(get(children(ichild),'tag')) 1968 handles_panel.(get(children(ichild),'tag'))=children(ichild); 1969 end 1970 end 1971 for ilist=1:numel(ListParamNum) 1972 ParamName=ListParamNum{ilist}; 1973 CivParamName=[panel '_' ParamName]; 1974 if isfield(Data,CivParamName) 1975 for icoord=1:numel(Data.(CivParamName)) 1976 if numel(Data.(CivParamName))>1 1977 Tag=['num_' ParamName '_' num2str(icoord)]; 1978 else 1979 Tag=['num_' ParamName]; 1980 end 1981 if isfield(handles_panel,Tag) 1982 set(handles_panel.(Tag),'String',num2str(Data.(CivParamName)(icoord))) 1983 set(handles_panel.(Tag),'Visible','on') 1984 end 1985 end 1986 end 1987 end 1988 for ilist=1:numel(ListParamValue) 1989 ParamName=ListParamValue{ilist}; 1990 CivParamName=[panel '_' ParamName]; 1991 if strcmp(ParamName,'CorrSmooth') 1992 ParamName=['num_' ParamName]; 1993 end 1994 if isfield(Data,CivParamName) 1995 if isfield(handles_panel,ParamName) 1996 set(handles_panel.(ParamName),'Value',Data.(CivParamName)) 1997 end 1998 end 1999 end 2000 for ilist=1:numel(ListParamString) 2001 ParamName=ListParamString{ilist}; 2002 CivParamName=[panel '_' ParamName]; 2003 if isfield(Data,CivParamName) 2004 if isfield(handles_panel,ParamName) 2005 set(handles_panel.(ParamName),'String',Data.(CivParamName)) 2006 end 2007 end 2008 end 2009 2010 2011 % % --- Executes on key press with focus on civ_input and none of its controls. 2012 function keyboard_callback(hObject,eventdata,handles) 2013 set(handles.ConfigSource,'String','NEW')% indicate that param have been modified 2014 2015 %------------------------------------------------------------------------ 2016 function [Data,par_civ1]=get_param_civ1(handles) 2017 2018 ref_i=str2double(get(handles.ref_i,'String'));% read reference i index 2019 if strcmp(get(handles.ref_j,'Visible'),'on') 2020 ref_j=str2double(get(handles.ref_j,'String'));% read reference j index if relevant 2021 else 2022 ref_j=1;%default j index 2023 end 2024 Data.ListVarName={'ny','nx','A'}; 2025 Data.VarDimName= {'ny','nx',{'ny','nx'}}; 2026 hseries=findobj(allchild(0),'Tag','series'); 2027 hhseries=guidata(hseries); 2028 InputTable=get(hhseries.InputTable,'Data'); 2029 ind_A=1; 2030 if strcmp(InputTable{1,5},'.nc'); 2031 ind_A=2; 2032 end 2033 list_pair=get(handles.ListPairCiv1,'String');%get the menu of image pairs 2034 PairString=list_pair{get(handles.ListPairCiv1,'Value')}; 2035 [ind1,ind2,mode]=find_pair_indices(PairString,ref_i,ref_j);%,MinIndex_i,MaxIndex_i,MinIndex_j,MaxIndex_j) 2036 switch mode 2037 case 'Di' 2038 i1=ref_i-ind1; 2039 i2=ref_i+ind2; 2040 j1=ref_j; 2041 j2=ref_j; 2042 case 'Dj' 2043 i1=ref_i; 2044 i2=ref_i; 2045 j1=ref_j-ind1; 2046 j2=ref_j+ind2; 2047 case 'burst' 2048 i1=ref_i; 2049 i2=ref_i; 2050 j1=ind1; 2051 j2=ind2; 2052 end 2053 ImageName_A=fullfile_uvmat(InputTable{ind_A,1},InputTable{ind_A,2},InputTable{ind_A,3},InputTable{ind_A,5},InputTable{ind_A,4},... 2054 i1,[],j1); 2055 ImageName_B=fullfile_uvmat(InputTable{ind_A,1},InputTable{ind_A,2},InputTable{ind_A,3},InputTable{ind_A,5},InputTable{ind_A,4},... 2056 i2,[],j2); 2057 Data.A=imread(ImageName_A); % read the first image 2058 if ndims(Data.A)==3 %case of color image 2059 Data.VarDimName= {'ny','nx',{'ny','nx','rgb'}}; 2060 end 2061 Data.ny=[size(Data.A,1) 1]; 2062 Data.nx=[1 size(Data.A,2)]; 2063 Data.CoordUnit='pixel';% used to set equal scaling for x and y in image dispa=ly 2064 par_civ1=read_GUI(handles.Civ1); 2065 par_civ1.FileTypeA=get_file_type(ImageName_A); 2066 par_civ1.ImageWidth=size(Data.A,2); 2067 par_civ1.ImageHeight=size(Data.A,1); 2068 par_civ1.Mask='all';% will provide only the grid set for PIV, no image correlation 2069 par_civ1.FrameIndexA=num2str(i1); 2070 par_civ1.FrameIndexB=num2str(i2); 2071 par_civ1.ImageName_B=ImageName_B; 2072 2073 2074 % handles structure with handles and user data (see GUIDATA) -
trunk/src/series/civ_series.m
r768 r774 52 52 Data.AllowInputSort='off';% allow alphabetic sorting of the list of input file SubDir (options 'off'/'on', 'off' by default) 53 53 Data.WholeIndexRange='off';% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default) 54 if strcmp(Data.ActionInput.PairIndices.ListPairMode,'pair j1-j2')54 if isfield(Data,'ActionInput') && strcmp(Data.ActionInput.PairIndices.ListPairMode,'pair j1-j2') 55 55 Data.Desable_j_index='on';% hide the j index in series (set by the pair choice in civ_input) 56 56 end -
trunk/src/series/sub_background.m
r716 r774 102 102 NbSlice=Param.IndexRange.NbSlice; 103 103 end 104 %nbview=numel(i1_series);%number of input file series (lines in InputTable) 105 nbfield_j=size(i1_series{1},1); %nb of fields for the j index (bursts or volume slices)%A CORRIGER !!!!!!! 106 nbfield_i=size(i1_series{1},2); %nb of fields for the i index 104 incr_j=1;%default 105 if isfield(Param.IndexRange,'incr_j')&&~isempty(Param.IndexRange.incr_j) 106 incr_j=Param.IndexRange.incr_j; 107 end 108 if isempty(first_j)||isempty(last_j) 109 nbfield_j=1; 110 else 111 nbfield_j=numel(first_j:incr_j:last_j);%nb of fields for the j index (bursts or volume slices) 112 end 113 incr_i=1;%default 114 first_i=1;last_i=1;incr_i;%default 115 if isfield(Param.IndexRange,'first_i'); last_i=Param.IndexRange.first_i; end 116 if isfield(Param.IndexRange,'last_i'); last_i=Param.IndexRange.last_j; end 117 if isfield(Param.IndexRange,'incr_i')&&~isempty(Param.IndexRange.incr_i) 118 incr_i=Param.IndexRange.incr_i; 119 end 120 nbfield_i=numel(first_i:incr_i:last_i);%nb of fields for the i index (bursts or volume slices) 107 121 nbfield=nbfield_j*nbfield_i; %total number of fields 108 122 nbfield_i=floor(nbfield/NbSlice);%total number of indexes in a slice (adjusted to an integer number of slices) … … 175 189 NomType=Param.InputTable(:,4); 176 190 FileExt=Param.InputTable(:,5); 191 hdisp=disp_uvmat('WAITING...','checking the file series',checkrun); 177 192 [filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param); 193 if ~isempty(hdisp),delete(hdisp),end; 178 194 %%%%%%%%%%%% 179 195 % The cell array filecell is the list of input file names, while
Note: See TracChangeset
for help on using the changeset viewer.