- Timestamp:
- Oct 14, 2010, 5:48:05 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r111 r112 1 %'civ': function associated with the interface 'civ.fig' for PIV, spline interpolation and stereo PIV (patch) 1 %'civ': function associated with the interface 'civ.fig' for PIV, spline interpolation and stereo PIV (patch) 2 2 %------------------------------------------------------------------------ 3 3 % provides an interface for the software CIVx … … 8 8 % Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.org. 9 9 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 10 % This file is part of the toolbox UVMAT. 11 % 10 % This file is part of the toolbox UVMAT. 11 % 12 12 % UVMAT is free software; you can redistribute it and/or modify 13 13 % it under the terms of the GNU General Public License as published by 14 14 % the Free Software Foundation; either version 2 of the License, or 15 15 % (at your option) any later version. 16 % 16 % 17 17 % UVMAT is distributed in the hope that it will be useful, 18 18 % but WITHOUT ANY WARRANTY; without even the implied warranty of … … 26 26 gui_Singleton = 1; 27 27 gui_State = struct('gui_Name', mfilename, ... 28 29 30 31 32 28 'gui_Singleton', gui_Singleton, ... 29 'gui_OpeningFcn', @civ_OpeningFcn, ... 30 'gui_OutputFcn', @civ_OutputFcn, ... 31 'gui_LayoutFcn', [] , ... 32 'gui_Callback', []); 33 33 if nargin && ischar(varargin{1}) 34 34 gui_State.gui_Callback = str2func(varargin{1}); … … 52 52 % varargin command line arguments to civ (see VARARGIN) 53 53 global patch_newBin %=1 if new patch processing available 54 %filebase: root name 54 %filebase: root name 55 55 %nom_type: nomencalture used ('png_old','_i_j'...) 56 56 %list of field numbers to process 57 %subdir: subdirectory of the opened netcdf file 57 %subdir: subdirectory of the opened netcdf file 58 58 %ind_opening: operation number advised for beginning (1=civ1,2=fix1,3=patch1,4=civ2,5=fix2,6=patch2), 59 59 %ind_a_opening ind_b_opening chosen pair from the opened netcdf file … … 66 66 filebase=''; % root file name ('filebase'.civ) 67 67 ext=[]; 68 testall=0; 68 testall=0; 69 69 browse=[]; 70 70 %default input parameters: … … 74 74 num_b=1; % second set of field j numbers (fields b) 75 75 subdir='A'; % subdir for the netcdf result files 76 ind_opening=1; % proposed operation number (1=civ1,2=fix1,3=patch1,4=civ2,5=fix2,6=patch2) 77 %load the initial parameters if the interface is started from uvmat 76 ind_opening=1; % proposed operation number (1=civ1,2=fix1,3=patch1,4=civ2,5=fix2,6=patch2) 77 %load the initial parameters if the interface is started from uvmat 78 78 if exist('param','var')&&isstruct(param)% the interface is opened from uvmat 79 79 filebase=param.RootName; … … 88 88 end 89 89 if ~isempty(ext) && (~isempty(imformats(ext(2:end)))||... 90 91 92 93 94 90 strcmp(lower(ext),'.avi'));%if an image file has been opened by uvmat 91 set(handles.ImaExt,'String',ext) 92 if exist('nom_type_read','var') 93 browse.nom_type_ima=nom_type_read; % the image nomenclature is stored 94 end 95 95 elseif isequal(ext,'.nc') 96 96 if exist('nom_type_read','var') … … 109 109 % xmlfile=fullfile(path_UVMAT,'PARAM.xml'); 110 110 % if ~exist(xmlfile,'file') 111 111 xmlfile='PARAM.xml'; 112 112 % end 113 113 if exist(xmlfile,'file') 114 114 try 115 t=xmltree(xmlfile);116 sparam=convert(t);115 t=xmltree(xmlfile); 116 sparam=convert(t); 117 117 catch 118 errormsg={' Unable to read the file PARAM.xml defining the civx binaries:'; lasterr};118 errormsg={' Unable to read the file PARAM.xml defining the civx binaries:'; lasterr}; 119 119 end 120 120 else … … 124 124 125 125 if ~isempty(errormsg) 126 126 msgbox_uvmat('ERROR',errormsg); 127 127 end 128 128 % patch_newBin=''; … … 137 137 if isfield(sparam.RunParam,'CivBin') 138 138 if ~exist(sparam.RunParam.CivBin,'file') 139 139 sparam.RunParam.CivBin=fullfile(path_UVMAT,sparam.RunParam.CivBin); 140 140 end 141 141 else … … 151 151 end 152 152 % set default operation options 153 154 155 156 157 158 159 160 161 162 163 164 165 166 153 enable_civ1(handles,'off') 154 enable_civ2(handles,'off') 155 enable_pair1(handles,'on') 156 enable_fix1(handles,'off') 157 desable_patch1(handles) 158 desable_fix2(handles) 159 desable_patch2(handles) 160 set(handles.CIV1,'Value',0) 161 set(handles.FIX1,'Value',0) 162 set(handles.PATCH1,'Value',0) 163 set(handles.CIV2,'Value',0) 164 set(handles.FIX2,'Value',0) 165 set(handles.PATCH2,'Value',0) 166 set(handles.frame_subdirciv2,'BackgroundColor',[0.831 0.816 0.784]) 167 167 if isequal(ind_opening,1) 168 168 set(handles.CIV1,'Value',1) … … 180 180 set(handles.FIX2,'Value',1) 181 181 enable_fix2(handles) 182 183 184 185 182 set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0]) 183 set(handles.list_pair_civ2,'Enable','On') 184 set(handles.list_pair_civ2,'Enable','On') 185 enable_pair1(handles,'off') 186 186 elseif isequal(ind_opening,6) 187 187 set(handles.PATCH2,'Value',1) … … 208 208 else 209 209 num_ref_j=floor((num_a+num_b)/2); 210 browse.incr_pair(2)=num_b-num_a; 210 browse.incr_pair(2)=num_b-num_a; 211 211 end 212 212 set(handles.first_i,'String',num2str(num_ref_i)); … … 220 220 set(handles.browse_root,'UserData',browse); 221 221 if exist('param','var')%varargin the interface is opened from uvmat 222 RootName_Callback(hObject, eventdata, handles); 222 RootName_Callback(hObject, eventdata, handles); 223 223 end 224 224 … … 247 247 oldfile=''; %default 248 248 if isempty(filebase)|| isequal(filebase,'')%loads the previously stored file name and set it as default in the file_input box 249 dir_perso=prefdir; 250 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 251 display(profil_perso) 252 if exist(profil_perso,'file') 253 h=load (profil_perso); 254 if isfield(h,'filebase')&& ischar(h.filebase) 255 oldfile=h.filebase; 256 end 257 if isfield(h,'RootPath') && ischar(h.RootPath) 258 oldfile=h.RootPath; 259 end 260 end 261 else 262 oldfile=filebase; 263 end 249 dir_perso=prefdir; 250 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 251 if exist(profil_perso,'file') 252 h=load (profil_perso); 253 if isfield(h,'filebase')&& ischar(h.filebase) 254 oldfile=h.filebase; 255 end 256 if isfield(h,'RootPath') && ischar(h.RootPath) 257 oldfile=h.RootPath; 258 end 259 end 260 else 261 oldfile=filebase; 262 end 264 263 testall=get(handles.ImaDoc,'UserData'); 265 264 ind_opening=1;%default 266 265 browse.incr_pair=[0 0]; %default 267 if testall 266 if testall 268 267 menu={'*.*', 'All Files (*.*)'; '*.xml; *.avi;*.AVI;*.nc','(*.xml,*.avi,*.nc)'; ... 269 268 '*.xml', '.xml files';'*.avi;*.AVI', '.avi files';'*.nc','.nc files'}; 270 269 else % menu selecting only .civ or .avi files 271 menu={'*.xml;*.avi;*.AVI;*.nc','(*.xml,*.avi,*.nc)'; ...270 menu={'*.xml;*.avi;*.AVI;*.nc','(*.xml,*.avi,*.nc)'; ... 272 271 '*.xml', '.xml files';'*.avi;*.AVI', '.avi files';'*.nc', '.nc files';... 273 272 '*.*', 'All Files (*.*)'}; 274 273 end 275 274 [FileName, PathName, filtindex] = uigetfile( menu, 'Pick a file',oldfile); 276 fileinput=[PathName FileName];%complete file name 275 fileinput=[PathName FileName];%complete file name 277 276 sizf=size(fileinput); 278 277 if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end %stop if fileinput not a character string … … 288 287 end 289 288 if testeditxml==1 || isequal(ext,'.xls') 290 heditxml=editxml({fileinput});291 set(heditxml,'Tag','browser')292 waitfor(heditxml,'Tag','idle')293 if ~ishandle(heditxml)294 return295 end296 attr=findobj(get(heditxml,'children'),'Tag','CurrentAttributes');297 set(handles.browse,'UserData',fileinput)% store for future opening with browser298 fileinput=get(attr,'UserData');299 if ~exist(fileinput,'file')300 return301 end289 heditxml=editxml({fileinput}); 290 set(heditxml,'Tag','browser') 291 waitfor(heditxml,'Tag','idle') 292 if ~ishandle(heditxml) 293 return 294 end 295 attr=findobj(get(heditxml,'children'),'Tag','CurrentAttributes'); 296 set(handles.browse,'UserData',fileinput)% store for future opening with browser 297 fileinput=get(attr,'UserData'); 298 if ~exist(fileinput,'file') 299 return 300 end 302 301 end 303 302 [RootPath,RootFile,str1,str2,str_a,str_b,ext,nom_type,subdir]=name2display(fileinput); … … 310 309 if isnan(num_j1),num_j1=1;end 311 310 num_j2=stra2num(str_b); 312 if isnan(num_j2),num_j2=num_j1;end 311 if isnan(num_j2),num_j2=num_j1;end 313 312 if isequal(get(handles.compare,'Value'),1) 314 313 browse=[];%initialisation … … 317 316 end 318 317 if length(ext)>1 && (~isempty(imformats(ext(2:end)))||... 319 318 isequal(ext,'.avi')||isequal(ext,'.AVI'));%if an image file has been opened by uvmat 320 319 set(handles.ImaExt,'String',ext) 321 320 browse.nom_type_ima=nom_type; … … 327 326 if isequal(ext,'.nc') 328 327 browse.nom_type_nc=nom_type; 329 ind_opening=2;% propose 'fix' as the default option 328 ind_opening=2;% propose 'fix' as the default option 330 329 Data=nc2struct(fileinput,[]); 331 if isfield(Data,'absolut_time_T0')%test for civx files 330 if isfield(Data,'absolut_time_T0')%test for civx files 332 331 if isfield(Data,'fix') && isequal(Data.fix,1) 333 332 ind_opening=3; … … 344 343 testciv=1; %TO SUPPRESS WITH NEW VERSION OF CIVX 345 344 else 346 ind_opening=3; %GUI used only for patch 345 ind_opening=3; %GUI used only for patch 347 346 testciv=0; 348 347 end … … 373 372 if ~isempty(num_j2) 374 373 ref_j=floor((num_j1+num_j2)/2); 375 browse.incr_pair(2)=num_j2-num_j1; 374 browse.incr_pair(2)=num_j2-num_j1; 376 375 end 377 376 set(handles.first_j,'String',num2str(ref_j)); 378 377 set(handles.last_j,'String',num2str(ref_j)); 379 set(handles.ref_j,'String',num2str(ref_j)); 378 set(handles.ref_j,'String',num2str(ref_j)); 380 379 set(handles.ref_j_civ2,'String',num2str(ref_j)); 381 380 end … … 412 411 set(handles.FIX2,'Value',1) 413 412 enable_fix2(handles) 414 415 416 413 set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0]) 414 set(handles.list_pair_civ2,'Enable','On') 415 set(handles.list_pair_civ2,'Enable','On') 417 416 elseif isequal(ind_opening,6) 418 417 enable_pair1(handles,'off') … … 438 437 %------------------------------------------------------------------------ 439 438 set(handles.compare,'Visible','on') 440 ext_ima=get(handles.ImaExt,'String'); 439 ext_ima=get(handles.ImaExt,'String'); 441 440 nom_type_ima=[];%default 442 441 field_count=1;%default … … 451 450 ext=get(handles.ImaDoc,'String'); 452 451 browse=get(handles.browse_root,'UserData');%default 453 if ~isempty(browse) 452 if ~isempty(browse) 454 453 if isfield(browse,'nom_type_ima') 455 454 nom_type_ima=browse.nom_type_ima;% get an image nomenclature type already determined by an input image name … … 490 489 nburst=[];%default 491 490 pxcmx=1; 492 pxcmy=1; 493 494 491 pxcmy=1; 492 493 %look for an image documentation file 495 494 if ~isequal(ext,'.xml') && ~isequal(ext,'.civ')&& ~isequal(ext,'.avi')&& ~isequal(ext,'.AVI') 496 495 if exist([filebase '.xml'],'file') 497 496 ext='.xml'; 498 497 elseif exist([filebase '.civxml'],'file') 499 498 ext='.civxml'; 500 499 elseif exist([filebase '.civ'],'file') 501 502 elseif exist([filebase '.avi'],'file') 503 500 ext='.civ'; 501 elseif exist([filebase '.avi'],'file') 502 ext='.avi'; 504 503 elseif exist([filebase '.AVI'],'file') 505 504 ext='.AVI'; 506 505 end 507 506 set(handles.ImaDoc,'String',ext) … … 526 525 mode='pair j1-j2'; 527 526 if isempty(nom_type_ima)% dtermine types by default if not already selected by browser or uvmat 528 527 nom_type_ima='_i_j'; 529 528 end 530 529 elseif isequal(ext,'.xml') … … 534 533 if isfield(XmlData,'Heading')&&isfield(XmlData.Heading','ImageName')&&ischar(XmlData.Heading.ImageName)% get image nom type and extension from the xml file 535 534 [PP,FF,fc,str2,str_a,str_b,ext_ima_read,nom_type_read]=name2display(XmlData.Heading.ImageName); 536 fullname=fullfile(fileparts(filebase),XmlData.Heading.ImageName); %full name (including path) of the first image defined by the xmle file, 535 fullname=fullfile(fileparts(filebase),XmlData.Heading.ImageName); %full name (including path) of the first image defined by the xmle file, 537 536 if ~exist(fullname,'file') 538 537 msgbox_uvmat('WARNING',['FirstImage ' fullname ' defined in the xml file does not exist']) … … 563 562 if isfield(XmlData,'GeometryCalib') 564 563 tsai=XmlData.GeometryCalib; 565 if isfield(tsai,'f') && isfield(tsai,'Tz') && isfield(tsai,'dpx') && isfield(tsai,'dpy')&& isfield(tsai,'R') 566 567 568 pxcmy_search=tsai.f * sqrt(det(rot2D))/(tsai.Tz*tsai.dpy);569 end 570 if isfield(tsai,'CoordUnit') 571 572 end 573 end 564 if isfield(tsai,'f') && isfield(tsai,'Tz') && isfield(tsai,'dpx') && isfield(tsai,'dpy')&& isfield(tsai,'R') 565 rot2D=tsai.R(1:2,[1,2]); 566 pxcmx_search=tsai.f * sqrt(det(rot2D))/(tsai.Tz*tsai.dpx); 567 pxcmy_search=tsai.f * sqrt(det(rot2D))/(tsai.Tz*tsai.dpy); 568 end 569 if isfield(tsai,'CoordUnit') 570 CoordUnit=tsai.CoordUnit; 571 end 572 end 574 573 if ~isempty(ext_ima_read) && ~isempty(nom_type_read) 575 574 if isempty(ext_ima) 576 577 else %keep the image extension 575 ext_ima=ext_ima_read;% define image extension from the xml file if an image has not been opened previously 576 else %keep the image extension 578 577 if ~strcmp(ext_ima_read,ext_ima) 579 msgbox_uvmat('WARNING',['FirtsImage extension ' ext_ima_read ' announced in the xml file inconsistent with the selected image'])578 msgbox_uvmat('WARNING',['FirtsImage extension ' ext_ima_read ' announced in the xml file inconsistent with the selected image']) 580 579 end 581 580 end … … 583 582 end 584 583 elseif isequal(ext,'.civ')% case of .civ image documentation file 585 586 587 588 589 % ImaExt='.png';590 nom_type_ima='png_old';591 elseif isequal(lower(ext),'.avi') 592 593 594 595 596 597 598 599 600 601 time=(dt*(0:nbfield-1))';%list of image times602 584 [error,time,TimeUnit,mode,npx,npy]=read_imatext([filebase '.civ']); 585 if error==2, msgbox_uvmat('WARNING',['no file ' filebase '.civ']); 586 elseif error==1, msgbox_uvmat('WARNING','inconsistent number of fields in the .civ file'); 587 end 588 % ImaExt='.png'; 589 nom_type_ima='png_old'; 590 elseif isequal(lower(ext),'.avi') 591 nom_type_ima='*'; 592 ext_ima=ext; 593 set(handles.mode,'String',{'series(Di)'}) 594 dt=0.04;%default 595 if exist([filebase ext],'file')==2 596 info=aviinfo([filebase ext]);%read infos on the avi movie 597 dt=1/info.FramesPerSecond;%time interval between successive frames 598 nbfield=info.NumFrames;%number of frames 599 end 600 time=(dt*(0:nbfield-1))';%list of image times 601 %set(handles.dt,'String',num2str(dt*1000));%store the time interval between successive images 603 602 end 604 603 if isempty(time) … … 612 611 dirima=dir([filebase '_' num2str(first_i) '_' num2str(first_j) '.*']); 613 612 if isempty(dirima) 614 % look for images series with sub marker '_'615 dirima=dir([filebase '_*' num2str(first_i) '.*']);616 if isempty(dirima)617 % look for other images series618 dirima=dir([filebase '*' num2str(first_i) '.*']);619 if ~isempty(dirima)620 [pp,ff,fc,str2,str_a,str_b,ext_ima,nom_type_ima]=name2display(dirima(1).name);621 end622 else623 [pp,ff,fc,str2,str_a,str_b,ext_ima,nom_type_ima]=name2display(dirima(1).name);624 end613 % look for images series with sub marker '_' 614 dirima=dir([filebase '_*' num2str(first_i) '.*']); 615 if isempty(dirima) 616 % look for other images series 617 dirima=dir([filebase '*' num2str(first_i) '.*']); 618 if ~isempty(dirima) 619 [pp,ff,fc,str2,str_a,str_b,ext_ima,nom_type_ima]=name2display(dirima(1).name); 620 end 621 else 622 [pp,ff,fc,str2,str_a,str_b,ext_ima,nom_type_ima]=name2display(dirima(1).name); 623 end 625 624 else 626 [pp,ff,fc,str2,str_a,str_b,ext_ima,nom_type_ima]=name2display(dirima(1).name);627 end 628 end 629 % no image documentation file found: look for a series of existing images or .nc files 625 [pp,ff,fc,str2,str_a,str_b,ext_ima,nom_type_ima]=name2display(dirima(1).name); 626 end 627 end 628 % no image documentation file found: look for a series of existing images or .nc files 630 629 if isempty(time) && ~isequal(ext,'.nc') && ~strcmp(nom_type_ima,'none') && ~strcmp(nom_type_ima,'') && ~strcmp(nom_type_ima,'*') 631 630 subdir=get(handles.subdir_civ1,'String'); 632 631 incr_pair=[0 0];%default 633 632 if isfield(browse,'incr_pair') 634 635 end 636 % nbdetect=0;%test of detected images633 incr_pair=browse.incr_pair; 634 end 635 % nbdetect=0;%test of detected images 637 636 field_i=field_count; 638 637 idetect=1; 639 while idetect==1 %look for the maximum file number in the series 638 while idetect==1 %look for the maximum file number in the series 640 639 imagename=name_generator(filebase,field_i+1,1,ext_ima,nom_type_ima); 641 640 idetect=(exist(imagename,'file')==2); … … 643 642 field_i=field_i+1; 644 643 end 645 646 % nbdetect=nbdetect+(exist(imagename,'file')==2);644 %SEE CASE OF NETCDF FILES 645 % nbdetect=nbdetect+(exist(imagename,'file')==2); 647 646 end 648 647 nb_field=field_i;% last detected field number 649 648 field_i=field_count;%look for the minimum file number in the series 650 649 idetect=1; 651 while idetect==1 650 while idetect==1 652 651 imagename=name_generator(filebase,field_i-1,1,ext_ima,nom_type_ima); 653 652 idetect=(exist(imagename,'file')==2); 654 653 if idetect 655 field_i=field_i-1;654 field_i=field_i-1; 656 655 end 657 656 end 658 657 first_i=max(field_i,1); 659 658 660 659 if strcmp(nom_type_ima,'_i_j') 661 660 field_i=field_count; … … 673 672 nb_field_j=field_j-1;% last detected field number 674 673 end 675 674 676 675 677 676 %determine the set of times and possible intervals for CIV 678 % dt=(1/1000)*str2num(get(handles.dt,'String'));677 % dt=(1/1000)*str2num(get(handles.dt,'String')); 679 678 time=(0:nb_field-1)';% time=file index -1 by default 680 if strcmp(nom_type_ima,'_i_j') 681 % time=[0:nb_field-1]'*ones(1,nb_field_j);% time=file index -1 by default682 time=[0:nb_field-1]'*[0:nb_field_j-1];% time=file index -1 by default683 end 684 685 679 if strcmp(nom_type_ima,'_i_j') 680 % time=[0:nb_field-1]'*ones(1,nb_field_j);% time=file index -1 by default 681 time=[0:nb_field-1]'*[0:nb_field_j-1];% time=file index -1 by default 682 end 683 684 686 685 set(handles.mode,'String',{'series(Di)'}) 687 686 end 688 687 % if isequal(nom_type_ima,'none')% no file numbering used 689 % first_i=1; 688 % first_i=1; 690 689 % last_i=1; 691 690 % first_j=1; … … 715 714 set(handles.browse_root,'UserData',browse)% store the nomenclature type 716 715 717 716 %%%%%%%%%%% set the menus of image pairs and default selection for civ %%%%%%%%%%%%%%%%%%% 718 717 if isequal(nom_type_ima,'_i')|| isequal(nom_type_nc,'_i1-i2')||~(exist('nbfield2','var')&&(nbfield2~=1)) 719 718 set(handles.mode,'String',{'series(Di)'}) … … 728 727 set(handles.mode,'String',{'pair j1-j2';'series(Dj)';'series(Di)'})%multiple choice 729 728 if nbfield2 <= 5 730 731 end 732 % else733 % if isequal(mode,'volume')734 % set(handles.mode,'Value',3)735 % elseif nbfield2 <= 5736 % set(handles.mode,'Value',1)% advice 'pair j1-j2' for small bursts737 % else738 % set(handles.mode,'Value',2)% advice series Dj for long bursts, not volume739 % end740 end 741 742 %update the subdir 729 set(handles.mode,'Value',1)% advice 'pair j1-j2' for small burst 730 end 731 % else 732 % if isequal(mode,'volume') 733 % set(handles.mode,'Value',3) 734 % elseif nbfield2 <= 5 735 % set(handles.mode,'Value',1)% advice 'pair j1-j2' for small bursts 736 % else 737 % set(handles.mode,'Value',2)% advice series Dj for long bursts, not volume 738 % end 739 end 740 741 %update the subdir 743 742 pathdir=fileparts(filebase);%path to the current xml file 744 743 listot=dir(pathdir); … … 754 753 end 755 754 end 756 set(handles.list_subdir_civ1,'Value',1) 755 set(handles.list_subdir_civ1,'Value',1) 757 756 set(handles.list_subdir_civ2,'Value',1) 758 757 set(handles.list_subdir_civ1,'String',[{'browse...'};listdir]) … … 762 761 subdir_civ2=get(handles.subdir_civ2,'String'); 763 762 764 mode_Callback(hObject, eventdata, handles) 763 mode_Callback(hObject, eventdata, handles) 765 764 766 765 %%%%%% initialize waitbars and RUN button … … 774 773 set(handles.BATCH,'BackgroundColor',[1 0 0]) 775 774 end 776 775 777 776 %%%%% store the root input filename for future opening 778 777 dir_perso=prefdir; … … 786 785 relnumb=str2num(Release(3:4)); 787 786 if relnumb >= 14 788 save (profil_perso,'RootPath','-V6'); %store the root name for future opening of uvmat 787 save (profil_perso,'RootPath','-V6'); %store the root name for future opening of uvmat 789 788 else 790 789 save (profil_perso,'RootPath'); %store the root name for future opening of uvmat … … 828 827 for numod_a=1:nbfield2-1 %nbfield2 always >=2 for 'pair j1-j2' mode 829 828 for numod_b=(numod_a+1):nbfield2 830 831 832 833 829 index=index+1; 830 numlist_a(index)=numod_a; 831 numlist_b(index)=numod_b; 832 if ~isempty(time) 834 833 dt(numod_a,numod_b)=time(ref_i,numod_b)-time(ref_i,numod_a);%first time interval dt 835 834 displ_dt(index)=dt(numod_a,numod_b); 836 837 838 839 840 841 842 843 displ_num(1,:)=numlist_a(indsort);844 displ_num(2,:)=numlist_b(indsort);845 846 847 848 835 else 836 displ_dt(index)=1; 837 end 838 end 839 end 840 [dtsort,indsort]=sort(displ_dt); 841 if ~isempty(numlist_a) 842 displ_num(1,:)=numlist_a(indsort); 843 displ_num(2,:)=numlist_b(indsort); 844 end 845 displ_num(3,:)=0; 846 displ_num(4,:)=0; 847 set(handles.jtext,'Visible','Off') 849 848 set(handles.first_j,'Visible','Off') 850 849 set(handles.last_j,'Visible','Off') … … 853 852 set(handles.ref_j,'Visible','Off') 854 853 elseif isequal(mode,'series(Dj)') %| isequal(mode,'st_series(Dj)') 855 856 857 858 859 860 end861 862 863 864 865 866 867 854 for index=1:min(nbfield2-1,200) 855 displ_num(1,index)=-floor(index/2); 856 displ_num(2,index)=ceil(index/2); 857 displ_num(3,index)=0; 858 displ_num(4,index)=0; 859 end 860 set(handles.jtext,'Visible','On') 861 set(handles.first_j,'Visible','On') 862 set(handles.last_j,'Visible','On') 863 set(handles.incr_j,'Visible','On') 864 set(handles.nb_field2,'Visible','On') 865 set(handles.ref_j,'Visible','On') 866 if nbfield > 1 868 867 set(handles.itext,'Visible','On') 869 868 set(handles.first_i,'Visible','On') … … 880 879 set(handles.ref_i,'Visible','Off') 881 880 end 882 elseif isequal(mode,'series(Di)') %| isequal(mode,'st_series(Di)') 883 884 885 886 887 888 889 890 891 892 893 894 895 881 elseif isequal(mode,'series(Di)') %| isequal(mode,'st_series(Di)') 882 for index=1:200%min(nbfield-1,200) 883 displ_num(1,index)=0; 884 displ_num(2,index)=0; 885 displ_num(3,index)=-floor(index/2); 886 displ_num(4,index)=ceil(index/2); 887 end 888 set(handles.itext,'Visible','On') 889 set(handles.first_i,'Visible','On') 890 set(handles.last_i,'Visible','On') 891 set(handles.incr_i,'Visible','On') 892 set(handles.nb_field,'Visible','On') 893 set(handles.ref_i,'Visible','On') 894 if nbfield2 > 1 896 895 set(handles.jtext,'Visible','On') 897 896 set(handles.first_j,'Visible','On') … … 900 899 set(handles.nb_field2,'Visible','On') 901 900 set(handles.ref_j,'Visible','On') 902 901 else 903 902 set(handles.jtext,'Visible','Off') 904 903 set(handles.first_j,'Visible','Off') … … 909 908 end 910 909 elseif isequal(mode,'displacement')%the pairs have the same indices 911 displ_num(1,1)=0;912 913 914 915 910 displ_num(1,1)=0; 911 displ_num(2,1)=0; 912 displ_num(3,1)=0; 913 displ_num(4,1)=0; 914 if nbfield > 1 916 915 set(handles.itext,'Visible','On') 917 916 set(handles.first_i,'Visible','On') … … 929 928 end 930 929 if nbfield2 > 1 931 set(handles.jtext,'Visible','On')932 set(handles.first_j,'Visible','On')933 set(handles.last_j,'Visible','On')934 set(handles.incr_j,'Visible','On')935 set(handles.nb_field2,'Visible','On')936 set(handles.ref_j,'Visible','On')930 set(handles.jtext,'Visible','On') 931 set(handles.first_j,'Visible','On') 932 set(handles.last_j,'Visible','On') 933 set(handles.incr_j,'Visible','On') 934 set(handles.nb_field2,'Visible','On') 935 set(handles.ref_j,'Visible','On') 937 936 else 938 937 set(handles.jtext,'Visible','Off') … … 943 942 set(handles.ref_j,'Visible','Off') 944 943 end 945 end 944 end 946 945 set(handles.list_pair_civ1,'UserData',displ_num); 947 946 find_netcpair_civ1(hObject, eventdata, handles) … … 975 974 end 976 975 977 %determine nom_type_nc: 976 %determine nom_type_nc: 978 977 nom_type_nc=[];%default 979 978 if isfield(browse,'nom_type_nc') … … 981 980 end 982 981 if isempty(nom_type_nc) 983 982 [nom_type_nc]=nomtype2pair(nom_type_ima,isequal(mode,'series(Di)'),isequal(mode,'series(Dj)')); 984 983 end 985 984 browse.nom_type_nc=nom_type_nc; … … 1005 1004 if isempty(time) 1006 1005 time=[0 1]; 1007 end 1006 end 1008 1007 %dt_unit=str2double(get(handles.dt,'String'));% used when there is no image documentation file 1009 1008 dt_unit=1000;%default 1010 1009 displ_num=get(handles.list_pair_civ1,'UserData'); 1011 1010 1012 %eliminate the first pairs inconsistent with the position 1013 1014 1015 1011 %eliminate the first pairs inconsistent with the position 1012 if isempty(displ_num) 1013 nbpair=0; 1014 else 1016 1015 nbpair=length(displ_num(1,:));%nbre of displayed pairs 1017 1016 if isequal(mode,'series(Di)') %| isequal(mode,'st_series(Di)') … … 1020 1019 nbpair=min(2*ref_j-1,nbpair);%limit the number of pairs with positive first index 1021 1020 end 1022 1021 end 1023 1022 nbpair=min(200,nbpair);%limit the number of displayed pairs to 200 1024 1023 1025 %look for existing processed pairs involving the field at the middle of the series if civ1 will not 1024 %look for existing processed pairs involving the field at the middle of the series if civ1 will not 1026 1025 % be performed, while the result is needed for next steps. 1027 1026 displ_pair={''}; … … 1029 1028 testpair=0; 1030 1029 if get(handles.CIV1,'Value')==0 % 1031 if ~exist(fullfile(filepath,subdir_civ1,ext_dir),'dir') 1032 1033 1034 1035 end 1036 for ipair=1:nbpair 1030 if ~exist(fullfile(filepath,subdir_civ1,ext_dir),'dir') 1031 msgbox_uvmat('ERROR',['no civ1 file available: subdirectory ' subdir_civ1 ' does not exist']); 1032 set(handles.list_pair_civ1,'String',{}); 1033 return 1034 end 1035 for ipair=1:nbpair 1037 1036 filename=name_generator(filebase,ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair),'.nc',nom_type_nc,1,... 1038 ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair),subdir_civ1);1037 ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair),subdir_civ1); 1039 1038 select(ipair)=exist(filename,'file')==2; 1040 1039 end 1041 1040 if ~exist('select','var') || isequal(select,zeros(size(1:nbpair))) 1042 if isfield(browse,'incr_pair') 1041 if isfield(browse,'incr_pair') 1043 1042 num_i1=ref_i-floor(browse.incr_pair(1)/2); 1044 1043 num_i2=ref_i+ceil(browse.incr_pair(1)/2); … … 1049 1048 testpair=1; 1050 1049 else 1051 if isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)') 1050 if isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)') 1052 1051 msgbox_uvmat('ERROR',['no civ1 file available for the selected reference index j=' num2str(ref_j) ' and subdirectory ' subdir_civ1]); 1053 1052 else 1054 1053 msgbox_uvmat('ERROR',['no civ1 file available for the selected reference index i=' num2str(ref_i) ' and subdirectory ' subdir_civ1]); 1055 1054 end 1056 1057 1055 set(handles.list_pair_civ1,'String',{''}); 1056 %COMPLETER CAS STEREO 1058 1057 return 1059 1058 end … … 1088 1087 elseif isequal(mode,'series(Dj)')%|isequal(mode,'st_series(Dj)')% series on the j index 1089 1088 if testpair 1090 displ_pair{1}=['Dj= ' num2str(-floor(browse.incr_pair(1)/2)) '|' num2str(ceil(browse.incr_pair(1)/2))];1089 displ_pair{1}=['Dj= ' num2str(-floor(browse.incr_pair(1)/2)) '|' num2str(ceil(browse.incr_pair(1)/2))]; 1091 1090 else 1092 for ipair=1:nbpair1093 if select(ipair)1094 if size(time,1)>=ref_i+displ_num(4,ipair) && size(time,2)>=ref_j+displ_num(2,ipair)1095 dt=time(ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair))-time(ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair));%time interval dt1096 displ_pair{ipair}=['Dj= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)];1097 end1098 elseif testpair1099 displ_pair{1}=['Dj= ' num2str(-floor(browse.incr_pair(2)/2)) '|' num2str(ceil(browse.incr_pair(2)/2))];1100 else1101 displ_pair{ipair}='...'; %pair not displayed in the menu1102 end1103 end1104 end1091 for ipair=1:nbpair 1092 if select(ipair) 1093 if size(time,1)>=ref_i+displ_num(4,ipair) && size(time,2)>=ref_j+displ_num(2,ipair) 1094 dt=time(ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair))-time(ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair));%time interval dt 1095 displ_pair{ipair}=['Dj= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)]; 1096 end 1097 elseif testpair 1098 displ_pair{1}=['Dj= ' num2str(-floor(browse.incr_pair(2)/2)) '|' num2str(ceil(browse.incr_pair(2)/2))]; 1099 else 1100 displ_pair{ipair}='...'; %pair not displayed in the menu 1101 end 1102 end 1103 end 1105 1104 elseif isequal(mode,'pair j1-j2')%|isequal(mode,'st_pair j1-j2')%case of pairs 1106 1105 for ipair=1:nbpair 1107 1106 if select(ipair) 1108 dt=time(ref_i+displ_num(4,ipair),displ_num(2,ipair))-time(ref_i+displ_num(3,ipair),displ_num(1,ipair));%time interval dt1109 displ_pair{ipair}=['j= ' num2stra(displ_num(1,ipair),nom_type_ima) '-' num2stra(displ_num(2,ipair),nom_type_ima) ...1110 1111 else1112 displ_pair{ipair}='...'; %pair not displayed in the menu1113 end 1114 end1107 dt=time(ref_i+displ_num(4,ipair),displ_num(2,ipair))-time(ref_i+displ_num(3,ipair),displ_num(1,ipair));%time interval dt 1108 displ_pair{ipair}=['j= ' num2stra(displ_num(1,ipair),nom_type_ima) '-' num2stra(displ_num(2,ipair),nom_type_ima) ... 1109 ' :dt= ' num2str(dt*1000)]; 1110 else 1111 displ_pair{ipair}='...'; %pair not displayed in the menu 1112 end 1113 end 1115 1114 elseif isequal(mode,'displacement') 1116 displ_pair={'Di=Dj=0'}; 1117 end 1115 displ_pair={'Di=Dj=0'}; 1116 end 1118 1117 set(handles.list_pair_civ1,'String',displ_pair'); 1119 1118 ichoice=min(find(select)); 1120 1119 if (isempty(ichoice) || ichoice < 1); ichoice=1; end; 1121 1120 initial=get(handles.list_pair_civ1,'Value');%initial choice of pair 1122 if initial>nbpair 1123 1121 if initial>nbpair 1122 set(handles.list_pair_civ1,'Value',ichoice);% first valid pair proposed by default in the menu 1124 1123 end 1125 1124 if numel(select)>=initial && ~isequal(select(initial),1) … … 1140 1139 1141 1140 %------------------------------------------------------------------------ 1142 % determine the menu for civ2 pairs depending on the existing netcdf file at the 1143 %middle of the series set by first_i, incr, last_i 1141 % determine the menu for civ2 pairs depending on the existing netcdf file at the 1142 %middle of the series set by first_i, incr, last_i 1144 1143 function find_netcpair_civ2(hObject, eventdata, handles) 1145 1144 %------------------------------------------------------------------------ … … 1174 1173 nom_type_nc='none'; 1175 1174 elseif isequal(nom_type_ima,'avi')||isequal(nom_type_ima,'_i')||isequal(nom_type_ima,'ima_num')||isequal(nom_type_nc,'_i1-i2') 1176 1175 nom_type_nc='_i1-i2'; 1177 1176 else 1178 1177 if isequal(mode,'series(Di)')%|isequal(mode,'st_series(Di)') … … 1180 1179 else 1181 1180 nom_type_nc='_i_j1-j2'; 1182 end 1181 end 1183 1182 end 1184 1183 browse.nom_type_nc=nom_type_nc; … … 1212 1211 1213 1212 1214 %eliminate the first pairs inconsistent with the position 1213 %eliminate the first pairs inconsistent with the position 1215 1214 if isempty(displ_num) 1216 1215 nbpair=0; 1217 1216 else 1218 1217 nbpair=length(displ_num(1,:));%nbre of displayed pairs 1219 if isequal(mode,'series(Di)')% | isequal(mode,'st_series(Di)') 1218 if isequal(mode,'series(Di)')% | isequal(mode,'st_series(Di)') 1220 1219 nbpair=min(2*ref_i-1,nbpair);%limit the number of pairs with positive first index 1221 elseif isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)') 1220 elseif isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)') 1222 1221 nbpair=min(2*ref_j-1,nbpair);%limit the number of pairs with positive first index 1223 1222 end … … 1225 1224 nbpair=min(200,nbpair);%limit the number of displayed pairs to 200 1226 1225 1227 %look for existing processed pairs involving the field at the middle of the series if civ1 will not 1226 %look for existing processed pairs involving the field at the middle of the series if civ1 will not 1228 1227 % be performed, while the result is needed for next steps. 1229 1228 displ_pair={''}; %default 1230 1229 select=ones(size(1:nbpair));%default =1 for numbers of displayed pairs 1231 1230 if get(handles.CIV2,'Value')==0 & get(handles.CIV1,'Value')==0 & get(handles.FIX1,'Value')==0 & get(handles.PATCH1,'Value')==0%&... 1232 if ~exist(fullfile(filepath,subdir_civ2,ext_dir),'dir') 1233 1234 1235 1236 1237 end 1238 for ipair=1:nbpair 1231 if ~exist(fullfile(filepath,subdir_civ2,ext_dir),'dir') 1232 errordlg(['no civ2 file available: subdirectory ' subdir_civ2 ' does not exist']) 1233 set(handles.list_pair_civ2,'Value',1); 1234 set(handles.list_pair_civ2,'String',{''}); 1235 return 1236 end 1237 for ipair=1:nbpair 1239 1238 filename=name_generator(filebase,ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair),'.nc',nom_type_nc,1,... 1240 ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair),subdir_civ1);1239 ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair),subdir_civ1); 1241 1240 select(ipair)=exist(filename,'file')==2; 1242 1241 end 1243 1242 if isequal(select,zeros(size(1:nbpair))) 1244 if isfield(browse,'incr_pair') 1243 if isfield(browse,'incr_pair') 1245 1244 num_i1=ref_i-floor(browse.incr_pair(1)/2); 1246 1245 num_i2=ref_i+floor((browse.incr_pair(1)+1)/2); … … 1250 1249 select(1)=exist(filename,'file')==2; 1251 1250 else 1252 if isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)') 1251 if isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)') 1253 1252 errordlg(['no civ2 file available for the selected reference index j=' num2str(ref_j) ' and subdirectory ' subdir_civ2]) 1254 1253 else 1255 1254 errordlg(['no civ2 file available for the selected reference index i=' num2str(ref_i) ' and subdirectory ' subdir_civ2]) 1256 1255 end 1257 1258 1256 set(handles.list_pair_civ2,'Value',1); 1257 set(handles.list_pair_civ2,'String',{''}); 1259 1258 return 1260 1259 end 1261 1260 end 1262 1261 end 1263 if isequal(mode,'series(Di)') % | isequal(mode,'st_series(Di)') 1264 1265 1266 1262 if isequal(mode,'series(Di)') % | isequal(mode,'st_series(Di)') 1263 for ipair=1:nbpair 1264 if select(ipair) 1265 if size(time,1)>=ref_i+displ_num(4,ipair) && size(time,2)>=ref_j+displ_num(2,ipair) 1267 1266 dt=time(ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair))-time(ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair));%time interval dt 1268 1267 displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)]; 1269 1270 else1271 1272 1273 1268 end 1269 else 1270 displ_pair{ipair}='...'; %pair not displayed in the menu 1271 end 1272 end 1274 1273 elseif isequal(mode,'series(Dj)') %| isequal(mode,'st_series(Dj)') % series on the j index 1275 1276 1277 1278 dt=time(ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair))-time(ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair));%time interval dt1279 displ_pair{ipair}=['Dj= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)];1280 1281 else1282 1283 1284 1274 for ipair=1:nbpair 1275 if select(ipair) 1276 if size(time,1)>=ref_i+displ_num(4,ipair) && size(time,2)>=ref_j+displ_num(2,ipair) 1277 dt=time(ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair))-time(ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair));%time interval dt 1278 displ_pair{ipair}=['Dj= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)]; 1279 end 1280 else 1281 displ_pair{ipair}='...'; %pair not displayed in the menu 1282 end 1283 end 1285 1284 elseif isequal(mode,'pair j1-j2')% | isequal(mode,'st_pair j1-j2') %case of pairs 1286 1285 for ipair=1:nbpair 1287 1286 if select(ipair) 1288 dt=time(ref_i+displ_num(4,ipair),displ_num(2,ipair))-time(ref_i+displ_num(3,ipair),displ_num(1,ipair));%time interval dt1289 displ_pair{ipair}=['j= ' num2stra(displ_num(1,ipair),nom_type_ima) '-' num2stra(displ_num(2,ipair),nom_type_ima) ...1290 1291 else1292 displ_pair{ipair}='...'; %pair not displayed in the menu1293 end1294 end1287 dt=time(ref_i+displ_num(4,ipair),displ_num(2,ipair))-time(ref_i+displ_num(3,ipair),displ_num(1,ipair));%time interval dt 1288 displ_pair{ipair}=['j= ' num2stra(displ_num(1,ipair),nom_type_ima) '-' num2stra(displ_num(2,ipair),nom_type_ima) ... 1289 ' :dt= ' num2str(dt*1000)]; 1290 else 1291 displ_pair{ipair}='...'; %pair not displayed in the menu 1292 end 1293 end 1295 1294 elseif isequal(mode,'displacement') 1296 displ_pair={'Di=Dj=0'}; 1297 end 1295 displ_pair={'Di=Dj=0'}; 1296 end 1298 1297 val=get(handles.list_pair_civ2,'Value'); 1299 1298 ichoice=min(find(select)); … … 1311 1310 1312 1311 %------------------------------------------------------------------------ 1313 % determine the list of index pairs of processing file 1312 % determine the list of index pairs of processing file 1314 1313 function [num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2]=... 1315 1314 find_pair_indices(handles,mode) 1316 1315 %------------------------------------------------------------------------ 1317 first_i=str2double(get(handles.first_i,'String'));%first index i 1318 last_i=str2double(get(handles.last_i,'String'));%last index i 1316 first_i=str2double(get(handles.first_i,'String'));%first index i 1317 last_i=str2double(get(handles.last_i,'String'));%last index i 1319 1318 incr=str2double(get(handles.incr_i,'String'));% increment 1320 1319 num_i=[first_i:incr:last_i];% list of i indices (reference values for each pair) 1321 1320 if isequal(get(handles.first_j,'Visible'),'on') 1322 1321 first_j=str2double(get(handles.first_j,'String'));%first index j 1323 last_j=str2double(get(handles.last_j,'String'));%last index j 1322 last_j=str2double(get(handles.last_j,'String'));%last index j 1324 1323 incr_j=str2double(get(handles.incr_j,'String'));% increment 1325 1324 else … … 1344 1343 str_civ2=list_civ2{index_civ2};%string defining the image pairs for civ2 1345 1344 if isempty(first_i)||isempty(first_j), msgbox_uvmat('ERROR','first field number not defined'),... 1346 return,end;1345 return,end; 1347 1346 if isequal(last_i,[])|| isequal(last_j,[]),msgbox_uvmat('ERROR','last field number not defined'),... 1348 return,end;1347 return,end; 1349 1348 if isequal(incr,[])|| isequal(incr_j,[]),msgbox_uvmat('ERROR','increment in field number not defined'),... 1350 return,end;1349 return,end; 1351 1350 if last_i < first_i || last_j < first_j , msgbox_uvmat('ERROR','last field number must be larger than the first one'),... 1352 return,end;1353 if isequal (mode,'series(Di)') 1354 1355 1351 return,end; 1352 if isequal (mode,'series(Di)') 1353 %recognize the pair civ1 from the display 1354 indsel=find((double(str_civ1)<48)|(double(str_civ1)>57));% character indices of non numerical characters 1356 1355 str_raw=str_civ1(indsel); 1357 1356 indsepar=find(str_raw=='|'); %character index of the separator … … 1361 1360 else 1362 1361 d2=str2double(str_civ1([indsel(indsepar)+1:indsel(indsepar+1)-1])); 1363 end 1362 end 1364 1363 num1_civ1=num_i-d1;% set of first image numbers 1365 1364 num2_civ1=num_i+d2; … … 1376 1375 else 1377 1376 d2=str2num(str_civ2([indsel(indsepar)+1:indsel(indsepar+1)-1])); 1378 end 1377 end 1379 1378 if isempty(d1) 1380 1379 num1_civ2=num_i; … … 1472 1471 end 1473 1472 1474 %update first_i and last_i according to the chosen image pairs 1473 %update first_i and last_i according to the chosen image pairs 1475 1474 mode_list=get(handles.mode,'String'); 1476 1475 mode_value=get(handles.mode,'Value'); … … 1484 1483 if ~isequal(lastfield,[]) 1485 1484 ind=find((num1-floor(index_pair/2)*ones(size(num1))>0)& ... 1486 1485 (num1+ceil(index_pair/2)*ones(size(num1))<=lastfield)); 1487 1486 num1=num1(ind); 1488 1487 end … … 1497 1496 if ~isequal(lastfield2,[]) 1498 1497 ind=find((num_j-floor(index_pair/2)*ones(size(num_j))>0)& ... 1499 1498 (num_j+ceil(index_pair/2)*ones(size(num_j))<=lastfield2)); 1500 1499 num1=num_j(ind); 1501 1500 end 1502 1501 set(handles.first_j,'String',num2str(num1(1))); 1503 1502 set(handles.last_j,'String',num2str(num1(end))); 1504 end 1503 end 1505 1504 1506 1505 %------------------------------------------------------------------------ … … 1508 1507 function list_pair_civ2_Callback(hObject, eventdata, handles) 1509 1508 %------------------------------------------------------------------------ 1510 index_pair=get(handles.list_pair_civ2,'Value');%get the selected position index in the menu 1511 1512 %update first_i and last_i according to the chosen image pairs 1509 index_pair=get(handles.list_pair_civ2,'Value');%get the selected position index in the menu 1510 1511 %update first_i and last_i according to the chosen image pairs 1513 1512 mode_list=get(handles.mode,'String'); 1514 1513 mode_value=get(handles.mode,'Value'); … … 1522 1521 if ~isequal(lastfield,[]) 1523 1522 ind=find((num1-floor(index_pair/2)*ones(size(num1))>0)& ... 1524 1523 (num1+ceil(index_pair/2)*ones(size(num1))<=lastfield)); 1525 1524 num1=num1(ind); 1526 1525 end … … 1535 1534 if ~isequal(lastfield2,[]) 1536 1535 ind=find((num_j-floor(index_pair/2)*ones(size(num_j))>0)& ... 1537 1536 (num_j+ceil(index_pair/2)*ones(size(num_j))<=lastfield2)); 1538 1537 num1=num_j(ind); 1539 1538 end 1540 1539 set(handles.first_j,'String',num2str(num1(1))); 1541 1540 set(handles.last_j,'String',num2str(num1(end))); 1542 end 1541 end 1543 1542 1544 1543 %------------------------------------------------------------------------ … … 1570 1569 % return 1571 1570 % end 1572 % 1571 % 1573 1572 % %root name 1574 1573 % filebase=get(handles.RootName,'String'); … … 1602 1601 % end 1603 1602 % end 1604 % 1605 % %read names of the .exe file 1606 % if box_test(1)==1 || box_test(3)==1 || box_test(4)==1 || box_test(6)==1 1603 % 1604 % %read names of the .exe file 1605 % if box_test(1)==1 || box_test(3)==1 || box_test(4)==1 || box_test(6)==1 1607 1606 % path_uvmat=which('uvmat');% check the path detected for source file uvmat 1608 1607 % path_UVMAT=fileparts(path_uvmat); %path to UVMAT … … 1636 1635 % if isfield(sparam,'SGE') 1637 1636 % sge=str2double(sparam.SGE); 1638 % end 1637 % end 1639 1638 % if ~isunix % for windows system, check whether the Matlab working dir is a UBC name 1640 1639 % dircur=pwd; … … 1645 1644 % end 1646 1645 % end 1647 % 1646 % 1648 1647 % %initialize the waitbars 1649 1648 % set(handles.waitbar_1,'Position',[0.946 0.877 0.03 0.001]) … … 1654 1653 % set(handles.RUN, 'Enable','Off') 1655 1654 % drawnow 1656 % 1655 % 1657 1656 % % get the list of file names and check the files 1658 1657 % display('checking the files...') … … 1661 1660 % nbfield=numel(num1_civ1); 1662 1661 % nbslice=size(num_a_civ1); 1663 % 1662 % 1664 1663 % if isempty(filecell) 1665 1664 % set(handles.RUN, 'Enable','On') … … 1669 1668 % return 1670 1669 % end 1671 % display('files OK, processing...') 1670 % display('files OK, processing...') 1672 1671 % nbfield=size(num1_civ1,2); 1673 1672 % nbslice=size(num1_civ1,1); 1674 % 1673 % 1675 1674 % %RUN CIV1 1676 1675 % if box_test(1)==1 … … 1680 1679 % end 1681 1680 % end 1682 % 1681 % 1683 1682 % %RUN FIX1 1684 % if box_test(2)==1 1683 % if box_test(2)==1 1685 1684 % filebase=get(handles.RootName,'String'); 1686 1685 % %names of the civ1 fields … … 1704 1703 % else 1705 1704 % fieldchoice=menu{index}; 1706 % end 1707 % h = waitbar(0,'removing velocity vectors, fix1');% display a wait bar 1708 % test_mask=get(handles.get_mask_fix1,'Value'); 1705 % end 1706 % h = waitbar(0,'removing velocity vectors, fix1');% display a wait bar 1707 % test_mask=get(handles.get_mask_fix1,'Value'); 1709 1708 % if test_mask 1710 1709 % maskdispl=get(handles.mask_fix1,'String'); … … 1723 1722 % maskflag=0; 1724 1723 % elseif test_mask==1 1725 % nbslice_mask=str2double(maskdispl(1:end-4)); % 1724 % nbslice_mask=str2double(maskdispl(1:end-4)); % 1726 1725 % num1_mask=mod(num1_civ1(ifile)-1,nbslice_mask)+1; 1727 1726 % maskname=name_generator(maskbase,num1_mask,1,'.png','_i');% mask corresponding to the first image of the pair 1728 1727 % maskflag= exist(maskname,'file')==2; 1729 % if ~maskflag; 1728 % if ~maskflag; 1730 1729 % maskname='noFile use default'; 1731 % end 1730 % end 1732 1731 % end 1733 1732 % if ~isempty(file_ref_fix1) … … 1738 1737 % error=RUN_FIX(filecell.nc.civ1{ifile,j},field1,flagindex,1,thresh_vecC,maskflag,maskname,... 1739 1738 % thresh_vel,inf_sup,file_ref,fieldchoice); 1740 % 1739 % 1741 1740 % if compare==3 &&(isequal(mode,'pair j1-j2') || isequal(mode,'series(Dj)') || isequal(mode,'series(Di)')) 1742 % if test_mask==0 1741 % if test_mask==0 1743 1742 % maskname='noFile use default'; 1744 1743 % maskflag=0; 1745 1744 % else 1746 1745 % maskbase=[get(handles.RootName2,'String') '_' maskdispl]; % mask root name 1747 % nbslice_mask=str2num(maskdispl(1:end-4)); % 1748 % num1_mask=mod(num1_civ1(ifile)-1,nbslice_mask)+1; 1746 % nbslice_mask=str2num(maskdispl(1:end-4)); % 1747 % num1_mask=mod(num1_civ1(ifile)-1,nbslice_mask)+1; 1749 1748 % maskname=name_generator(maskbase,num1_mask,1,'.png','_i'); 1750 1749 % maskflag= exist(maskname,'file')==2; 1751 % if ~maskflag; 1750 % if ~maskflag; 1752 1751 % maskname='noFile use default'; 1753 1752 % end … … 1758 1757 % msgbox_uvmat('ERROR',error) 1759 1758 % return 1760 % end 1759 % end 1761 1760 % end 1762 1761 % end … … 1764 1763 % close(h) 1765 1764 % end 1766 % 1765 % 1767 1766 % % RUN PATCH1 1768 1767 % if box_test(3)==1 … … 1786 1785 % subdomain_patch1=get(handles.subdomain_patch1,'String'); 1787 1786 % thresh_patch1=get(handles.thresh_patch1,'String'); 1788 % test_interp=get(handles.test_interp,'Value'); 1787 % test_interp=get(handles.test_interp,'Value'); 1789 1788 % icount=0; 1790 1789 % for ifile=1:nbfield … … 1802 1801 % if s~=0 1803 1802 % display(['!' cmd]) 1804 % eval(['!' cmd]); 1803 % eval(['!' cmd]); 1805 1804 % end 1806 % 1805 % 1807 1806 % %stereo case: 1808 1807 % elseif isequal(get(handles.test_stereo1,'Value'),1) … … 1811 1810 % nx_patch1,ny_patch1,rho_patch1,subdomain_patch1,thresh_patch1,[filebase_A '.xml'],[filebase_B '.xml']); 1812 1811 % display(['!' cmd]) 1813 % eval(['!' cmd]); 1812 % eval(['!' cmd]); 1814 1813 % else 1815 1814 % RUN_STLIN(filecell.ncA.civ1{ifile,j},filecell.nc.civ1{ifile,j},'civ1',filecell.st{ifile,j},... … … 1831 1830 % end 1832 1831 % end 1833 % 1832 % 1834 1833 % % CIV2 1835 % if box_test(4)==1 1834 % if box_test(4)==1 1836 1835 % RUN_CIV2(handles,filecell.ima1.civ2,filecell.ima2.civ2,filecell.nc.civ1,filecell.nc.civ2,num1_civ2,num2_civ2,... 1837 1836 % num_a_civ2,num_b_civ2,nom_type_nc) 1838 1837 % end 1839 % 1838 % 1840 1839 % % FIX2 1841 % if box_test(5)==1 1840 % if box_test(5)==1 1842 1841 % %names of the civ2 fields 1843 1842 % field2.vel_type='civ2'; … … 1860 1859 % else 1861 1860 % fieldchoice=menu{index}; 1862 % end 1861 % end 1863 1862 % h = waitbar(0,['removing velocity vectors, fix2']);% display a wait bar 1864 1863 % test_mask=get(handles.get_mask_fix2,'Value'); … … 1874 1873 % for ifile=1:nbfield 1875 1874 % waitbar(ifile/nbfield); %update the waitbar 1876 % for j=1:nbslice 1877 % if test_mask==0 1875 % for j=1:nbslice 1876 % if test_mask==0 1878 1877 % maskname='noFile use default'; 1879 1878 % maskflag=0; 1880 1879 % elseif test_mask==1 1881 % nbslice_mask=str2num(maskdispl(1:end-4)); % 1880 % nbslice_mask=str2num(maskdispl(1:end-4)); % 1882 1881 % num1_mask=mod(num1_civ2(ifile)-1,nbslice_mask)+1; 1883 1882 % maskname=name_generator(maskbase,num1_mask,1,'.png','_i'); 1884 1883 % maskflag= exist(maskname,'file')==2; 1885 % if ~maskflag; 1884 % if ~maskflag; 1886 1885 % maskname='noFile use default'; 1887 1886 % end … … 1893 1892 % end 1894 1893 % error=RUN_FIX(filecell.nc.civ2{ifile,j},field2,flagindex,2,thresh_vec2C,maskflag,maskname,... 1895 % thresh_vel2,inf_sup,file_ref,fieldchoice); 1894 % thresh_vel2,inf_sup,file_ref,fieldchoice); 1896 1895 % if ~isempty(error) 1897 1896 % msgbox_uvmat('ERROR',error) 1898 1897 % return 1899 % end 1898 % end 1900 1899 % if compare==3 1901 % if test_mask==0 1900 % if test_mask==0 1902 1901 % maskname='noFile use default'; 1903 1902 % maskflag=0; 1904 1903 % else 1905 1904 % maskbase=[get(handles.RootName2,'String') '_' maskdispl]; % mask root name 1906 % nbslice_mask=str2num(maskdispl(1:end-4)); % 1905 % nbslice_mask=str2num(maskdispl(1:end-4)); % 1907 1906 % num1_mask=mod(num1_civ2(ifile)-1,nbslice_mask)+1; 1908 1907 % maskname=name_generator(maskbase,num1_mask,1,'.png','_i'); 1909 1908 % maskflag= exist(maskname,'file')==2; 1910 % if ~maskflag; 1909 % if ~maskflag; 1911 1910 % maskname='noFile use default'; 1912 1911 % end … … 1917 1916 % msgbox_uvmat('ERROR',error) 1918 1917 % return 1919 % end 1918 % end 1920 1919 % end 1921 1920 % end … … 1923 1922 % close(h) 1924 1923 % end 1925 % 1924 % 1926 1925 % %PATCH 2 1927 1926 % if box_test(6)==1 … … 1963 1962 % end 1964 1963 % elseif compare==3 && isequal(get(handles.test_stereo2,'Value'),1) 1965 % if exist('stinterp_exe','var')%Prog Gauthier 1964 % if exist('stinterp_exe','var')%Prog Gauthier 1966 1965 % cmd=RUN_STINTERP(stinterp_exe,filecell.ncA.civ2{ifile,j},filecell.nc.civ2{ifile,j},filecell.st{ifile,j},... 1967 1966 % nx_patch2,ny_patch2,rho_patch2,subdomain_patch2,thresh_patch2,[filebase_A '.xml'],[filebase_B '.xml']); … … 1972 1971 % str2num(nx_patch2),str2num(ny_patch2),str2num(thresh_patch2),[filebase_A '.xml'],[filebase_B '.xml']) 1973 1972 % end 1974 % end 1973 % end 1975 1974 % if compare==3 && isequal(get(handles.test_stereo2,'Value'),0) 1976 1975 % cmd=RUN_PATCH(filecell.ncA.civ2{ifile,j},nx_patch2,ny_patch2,rho_patch2,subdomain_patch2,1,0); … … 1987 1986 % end 1988 1987 % end 1989 % 1988 % 1990 1989 % set(handles.RUN, 'Enable','On') 1991 1990 % set(handles.RUN,'BackgroundColor',[1 0 0]) 1992 % 1991 % 1993 1992 % %save the current interface setting as figure namefig, append .0 to the name if it already exists 1994 1993 % if isfield(filecell,'st') … … 2003 2002 % [RootPath,RootFile,field_count,str2,str_a,str_b,ext,nom_type,subdir]=name2display(fileresu); 2004 2003 % namedoc=fullfile(RootPath,subdir,RootFile); 2005 % detect=1; 2004 % detect=1; 2006 2005 % while detect==1 2007 2006 % namefigfull=[namedoc '.fig']; … … 2073 2072 return 2074 2073 end 2075 2074 2076 2075 %check mask if selecetd 2077 2076 if isequal(get(handles.get_mask_civ1,'Value'),1) … … 2090 2089 maskname=get(handles.mask_civ2,'String'); 2091 2090 if ~exist(maskname,'file') 2092 get_mask_civ2_Callback(hObject, eventdata, handles);2091 get_mask_civ2_Callback(hObject, eventdata, handles); 2093 2092 end 2094 2093 end … … 2096 2095 maskname=get(handles.mask_fix2,'String'); 2097 2096 if ~exist(maskname,'file') 2098 get_mask_fix2_Callback(hObject, eventdata, handles);2097 get_mask_fix2_Callback(hObject, eventdata, handles); 2099 2098 end 2100 2099 end … … 2103 2102 path_uvmat=which('uvmat');% check the path detected for source file uvmat 2104 2103 path_UVMAT=fileparts(path_uvmat); %path to UVMAT 2105 xmlfile= fullfile(path_UVMAT,'PARAM.xml');2104 xmlfile='PARAM.xml'; 2106 2105 if exist(xmlfile,'file') 2107 2106 t=xmltree(xmlfile); … … 2125 2124 return 2126 2125 end 2127 end 2128 if isfield(sparam,'CivBin') 2129 if ~exist(sparam.CivBin,'file') 2130 sparam.CivBin=fullfile(path_UVMAT,sparam.CivBin); 2131 end 2132 end 2133 if isfield(sparam,'Civ1Bin') 2134 if ~exist(sparam.Civ1Bin,'file') 2135 sparam.Civ1Bin=fullfile(path_UVMAT,sparam.Civ1Bin); 2136 end 2137 end 2138 if isfield(sparam,'Civ2Bin') 2139 if ~exist(sparam.Civ2Bin,'file') 2140 sparam.Civ2Bin=fullfile(path_UVMAT,sparam.Civ2Bin); 2141 end 2142 end 2143 %test_interp=get(handles.test_interp,'Value'); 2144 test_interp=0; 2145 if isfield(sparam,'PatchBin') 2146 if ~exist(sparam.PatchBin,'file') 2147 sparam.PatchBin=fullfile(path_UVMAT,sparam.PatchBin); 2148 end 2149 end 2150 % if test_interp && isfield(sparam,'PatchNewBin') 2151 % if ~exist(sparam.PatchNewBin,'file') 2152 % sparam.PatchNewBin=fullfile(path_UVMAT,sparam.PatchNewBin); 2153 % end 2154 % end 2155 if isfield(sparam,'FixBin') 2156 % fixBin=sparam.FixBin; 2157 if ~exist(sparam.FixBin,'file') 2158 sparam.FixBin=fullfile(path_UVMAT,sparam.FixBin); 2159 end 2160 end 2126 if isfield(sparam,'CivBin') 2127 if ~exist(sparam.CivBin,'file') 2128 sparam.CivBin=fullfile(path_UVMAT,sparam.CivBin); 2129 end 2130 end 2131 if isfield(sparam,'Civ1Bin') 2132 if ~exist(sparam.Civ1Bin,'file') 2133 sparam.Civ1Bin=fullfile(path_UVMAT,sparam.Civ1Bin); 2134 end 2135 end 2136 if isfield(sparam,'Civ2Bin') 2137 if ~exist(sparam.Civ2Bin,'file') 2138 sparam.Civ2Bin=fullfile(path_UVMAT,sparam.Civ2Bin); 2139 end 2140 end 2141 %test_interp=get(handles.test_interp,'Value'); 2142 test_interp=0; 2143 if isfield(sparam,'PatchBin') 2144 if ~exist(sparam.PatchBin,'file') 2145 sparam.PatchBin=fullfile(path_UVMAT,sparam.PatchBin); 2146 end 2147 end 2148 % if test_interp && isfield(sparam,'PatchNewBin') 2149 % if ~exist(sparam.PatchNewBin,'file') 2150 % sparam.PatchNewBin=fullfile(path_UVMAT,sparam.PatchNewBin); 2151 % end 2152 % end 2153 if isfield(sparam,'FixBin') 2154 % fixBin=sparam.FixBin; 2155 if ~exist(sparam.FixBin,'file') 2156 sparam.FixBin=fullfile(path_UVMAT,sparam.FixBin); 2157 end 2158 end 2159 end 2160 2161 2162 2161 2163 if batch 2162 2164 if isfield(sparam,'BatchMode') … … 2165 2167 else 2166 2168 MaxCivProcesses=50; 2167 if isfield(sparam,'MaxCivProcesses')2169 if isfield(sparam,'MaxCivProcesses') 2168 2170 MaxCivProcesses=str2double(sparam.MaxCivProcesses); 2169 end2171 end 2170 2172 end 2171 2173 … … 2183 2185 % cur_dir=pwd; 2184 2186 % if ~isequal(cur_dir(2:3),':\') 2185 % cd(matlabroot); %move to the Matlab root directory if the current Matlab dir does not allow the dos command or is M: 2187 % cd(matlabroot); %move to the Matlab root directory if the current Matlab dir does not allow the dos command or is M: 2186 2188 % end 2187 2189 % [ss,ww]=dos(['net use ' filebase(1:2)]); … … 2205 2207 display('checking the files...') 2206 2208 [filecell,num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2,nom_type_nc,file_ref_fix1,file_ref_fix2]=... 2207 2209 set_civ_filenames(handles,compare,box_test); 2208 2210 if isempty(filecell) 2209 2211 return … … 2218 2220 str={'urgent';'normal';'low'}; 2219 2221 [ind_answer,v] = listdlg('PromptString',str_displ,... 2220 2221 2222 if isequal(v,0) % to handle Cancel button and figure close, 2223 return % a better way should be create2222 'SelectionMode','single',... 2223 'ListString',str,'ListSize',[200 200],'Name','job priority','InitialValue',3); 2224 if isequal(v,0) % to handle Cancel button and figure close, 2225 return % a better way should be create 2224 2226 end 2225 2227 else … … 2237 2239 end 2238 2240 end 2239 2240 display('files OK, processing...') 2241 2242 display('files OK, processing...') 2241 2243 nbfield=numel(num1_civ1); 2242 2244 nbslice=numel(num_a_civ1); 2243 2245 2244 2246 %GET PARAMETERS: 2245 2247 %get civ parameters 2246 2248 if box_test(1)==1 2247 2249 par_civ1=read_param_civ1(handles,filecell.ima1.civ1{1,1}); 2248 end 2250 end 2249 2251 2250 2252 %get fix1 parameters 2251 if box_test(2)==1 2253 if box_test(2)==1 2252 2254 flagindex1(1)=get(handles.vec_Fmin2, 'Value'); 2253 2255 flagindex1(2)=get(handles.vec_F3, 'Value'); … … 2258 2260 nbslice_mask=get(handles.mask_fix1,'UserData'); % get the number of slices (= number of masks) 2259 2261 %%%%%%%%%%%%%COMPLETER LE PROGRAMME FIX 2260 % inf_sup=get(handles.inf_sup1,'Value');802261 % fileref=get(handles.ref_fix1,'String');2262 % refpath=get(handles.ref_fix1,'UserData');2263 % fileref=fullfile(refpath,fileref);2262 % inf_sup=get(handles.inf_sup1,'Value');80 2263 % fileref=get(handles.ref_fix1,'String'); 2264 % refpath=get(handles.ref_fix1,'UserData'); 2265 % fileref=fullfile(refpath,fileref); 2264 2266 menu=get(handles.field_ref1,'String'); 2265 2267 index=get(handles.field_ref1,'Value'); … … 2268 2270 else 2269 2271 fieldchoice=menu{index}; 2270 2271 end 2272 end 2273 2274 2272 msgbox_uvmat('WARNING','reference field is not used presently with batch, use RUN option') 2273 end 2274 end 2275 2276 %get patch1 parameters 2275 2277 if box_test(3)==1 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2278 rho_patch1=str2num(get(handles.rho_patch1,'String')); 2279 if isempty(rho_patch1) 2280 rho_patch1='1000'; 2281 set(handles.rho_patch1,'String','1') 2282 else 2283 rho_patch1=num2str(1000*rho_patch1); 2284 end 2285 nx_patch1=get(handles.nx_patch1,'String'); 2286 ny_patch1=get(handles.ny_patch1,'String'); 2287 if isequal(str2num(nx_patch1),[]) 2288 nx_patch1='50' ;%default 2289 set(handles.nx_patch1,'String','50'); 2290 end 2291 if isequal(str2num(ny_patch1),[]) 2292 ny_patch1='50' ;%default 2293 set(handles.ny_patch1,'String','50'); 2294 end 2295 subdomain_patch1=get(handles.subdomain_patch1,'String'); 2296 thresh_patch1=get(handles.thresh_patch1,'String'); 2297 end 2298 2299 %get civ2 parameters 2298 2300 if box_test(4)==1 2299 2301 par_civ2=read_param_civ2(handles,cell2mat(filecell.ima1.civ2(1,1))); … … 2301 2303 2302 2304 %get fix2 parameters 2303 if box_test(5)==1 2305 if box_test(5)==1 2304 2306 flagindex2(1)=get(handles.vec_Fmin2_2, 'Value'); 2305 2307 flagindex2(2)=get(handles.vec_F3_2, 'Value'); … … 2309 2311 test_mask=get(handles.get_mask_fix2,'Value'); 2310 2312 nbslice_mask=get(handles.mask_fix2,'UserData'); % get the number of slices (= number of masks) 2311 2312 % inf_sup=get(handles.inf_sup2,'Value');2313 % ref=get(handles.ref_fix2,'UserData');2314 2313 %%%%%%%%%%%%%COMPLETER LE PROGRAMME FIX AVEC REF FILE ET OPTION inf_sup=2 2314 % inf_sup=get(handles.inf_sup2,'Value'); 2315 % ref=get(handles.ref_fix2,'UserData'); 2316 2315 2317 %%%%%%%%%%%%%%%%%%% 2316 2318 end … … 2339 2341 subdomain_patch2=get(handles.subdomain_patch2,'String'); 2340 2342 thresh_patch2=get(handles.thresh_patch2,'String'); 2341 % test_interp=get(handles.test_interp,'Value');2343 % test_interp=get(handles.test_interp,'Value'); 2342 2344 end 2343 2345 … … 2346 2348 p1text=[];%initiate command text 2347 2349 time=get(handles.RootName,'UserData'); %get the set of times 2348 civAll=get(handles.Experimental,'Value'); % Boolean for new civ excution method 2350 civAll=get(handles.Experimental,'Value'); % Boolean for new civ excution method 2349 2351 for ifile=1:nbfield 2350 2352 for j=1:nbslice 2351 i_cmd=0; 2353 i_cmd=0; 2352 2354 cmd=''; 2353 2355 if isunix % check: necessaire aussi en RUN? 2354 %fid=fopen([filename '.cmx'],'w')2355 cmd='#!/bin/bash \n';2356 cmd=[cmd '#$ -cwd \n'];2357 cmd=[cmd 'hostname && date \n'];2356 %fid=fopen([filename '.cmx'],'w') 2357 cmd='#!/bin/bash \n'; 2358 cmd=[cmd '#$ -cwd \n']; 2359 cmd=[cmd 'hostname && date \n']; 2358 2360 end 2359 2361 if civAll … … 2366 2368 filename_cmx=[filename_cmx 'x']; 2367 2369 2368 %CIV12370 %CIV1 2369 2371 if box_test(1)==1 2370 2372 par_civ1.filename_ima_a=filecell.ima1.civ1{ifile,j}; 2371 par_civ1.filename_ima_b=filecell.ima2.civ1{ifile,j}; 2373 par_civ1.filename_ima_b=filecell.ima2.civ1{ifile,j}; 2372 2374 namelog=[filename_cmx([1:end-3]) 'log']; 2373 2375 par_civ1.Dt=num2str(time(num2_civ1(ifile),num_b_civ1(j))-time(num1_civ1(ifile),num_a_civ1(j))); 2374 par_civ1.T0=num2str((time(num2_civ1(ifile),num_b_civ1(j))+time(num1_civ1(ifile),num_a_civ1(j)))/2); 2376 par_civ1.T0=num2str((time(num2_civ1(ifile),num_b_civ1(j))+time(num1_civ1(ifile),num_a_civ1(j)))/2); 2375 2377 par_civ1.term_a=num2stra(num_a_civ1(j),nom_type_nc);%UTILITE? 2376 par_civ1.term_b=num2stra(num_b_civ1(j),nom_type_nc);% 2378 par_civ1.term_b=num2stra(num_b_civ1(j),nom_type_nc);% 2377 2379 test_mask=get(handles.get_mask_civ1,'Value'); 2378 if test_mask==0 2380 if test_mask==0 2379 2381 par_civ1.maskname='noFile use default'; 2380 2382 par_civ1.maskflag='n'; … … 2383 2385 if exist(maskdispl,'file') 2384 2386 par_civ1.maskname=maskdispl; 2385 par_civ1.maskflag='y'; 2387 par_civ1.maskflag='y'; 2386 2388 else 2387 maskbase=[filebase '_' maskdispl]; % 2388 nbslice_mask=str2num(maskdispl(1:end-4)); % 2389 maskbase=[filebase '_' maskdispl]; % 2390 nbslice_mask=str2num(maskdispl(1:end-4)); % 2389 2391 num1_mask=mod(num1_civ1(ifile)-1,nbslice_mask)+1; 2390 2392 par_civ1.maskname=name_generator(maskbase,num1_mask,1,'.png','_i'); … … 2393 2395 else 2394 2396 par_civ1.maskname='noFile use default'; 2395 par_civ1.maskflag='n'; 2397 par_civ1.maskflag='n'; 2396 2398 end 2397 2399 end … … 2408 2410 par_civ1.gridname=[filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')]; 2409 2411 if ~exist(par_civ1.gridname,'file') 2410 msgbox_uvmat('ERROR','grid file absent for civ1')2412 msgbox_uvmat('ERROR','grid file absent for civ1') 2411 2413 end 2412 2414 elseif exist(gridname,'file') 2413 par_civ1.gridname=gridname; 2415 par_civ1.gridname=gridname; 2414 2416 else 2415 2417 msgbox_uvmat('ERROR','grid file absent for civ1') … … 2417 2419 end 2418 2420 else 2419 2420 2421 end 2422 % 2421 par_civ1.gridname='noFile use default'; 2422 par_civ1.gridflag='n'; 2423 end 2424 % 2423 2425 i_cmd=i_cmd+1; 2424 2426 if isequal(civAll,0) 2425 2427 cmd=[cmd CIV1_CMD(filename_cmx(1:end-4),namelog,par_civ1,handles,sparam) '\n']; 2426 2428 else 2427 2428 2429 2429 civAllCmd=[civAllCmd ' civ1 ']; 2430 str=CIV1_CMD_Unified(filename_cmx([1:end-4]),namelog,par_civ1); 2431 fieldnames=fields(str); 2430 2432 [civAllxml,uid_civ1]=add(civAllxml,1,'element','civ1'); 2431 2433 for ilist=1:length(fieldnames) 2432 val=eval(['str.' fieldnames{ilist}]);2433 if ischar(val)2434 [civAllxml,uid_t]=add(civAllxml,uid_civ1,'element',fieldnames{ilist});2435 [civAllxml,uid_t2]=add(civAllxml,uid_t,'chardata',val);2436 end2437 end 2434 val=eval(['str.' fieldnames{ilist}]); 2435 if ischar(val) 2436 [civAllxml,uid_t]=add(civAllxml,uid_civ1,'element',fieldnames{ilist}); 2437 [civAllxml,uid_t2]=add(civAllxml,uid_t,'chardata',val); 2438 end 2439 end 2438 2440 end 2439 2441 end 2440 2442 2441 % FIX12442 if box_test(2)==12443 test_mask=get(handles.get_mask_fix1,'Value');2444 if test_mask==02443 % FIX1 2444 if box_test(2)==1 2445 test_mask=get(handles.get_mask_fix1,'Value'); 2446 if test_mask==0 2445 2447 maskname=''; 2446 else2448 else 2447 2449 maskdispl=get(handles.mask_fix1,'String'); 2448 nbslice_mask=str2num(maskdispl(1:end-4)); % 2450 nbslice_mask=str2num(maskdispl(1:end-4)); % 2449 2451 num1_mask=mod(num1_civ1(ifile)-1,nbslice_mask)+1; 2450 2452 maskbase=[filebase '_' maskdispl]; 2451 2453 maskname=name_generator(maskbase,num1_mask,1,'.png','_i'); 2452 end2453 if isequal(civAll,0)2454 end 2455 if isequal(civAll,0) 2454 2456 cmd_FIX=[sparam.FixBin ' -f ' filecell.nc.civ1{ifile,j} ' -fi1 ' num2str(flagindex1(1)) ... 2455 ' -fi2 ' num2str(flagindex1(2)) ' -fi3 ' num2str(flagindex1(3)) ...2456 ' -threshC ' num2str(thresh_vecC1) ' -threshV ' num2str(thresh_vel1) ' -maskName ' maskname];2457 ' -fi2 ' num2str(flagindex1(2)) ' -fi3 ' num2str(flagindex1(3)) ... 2458 ' -threshC ' num2str(thresh_vecC1) ' -threshV ' num2str(thresh_vel1) ' -maskName ' maskname]; 2457 2459 cmd_FIX=regexprep(cmd_FIX,'\\','\\\\'); 2458 2460 cmd=[cmd cmd_FIX '\n']; 2459 else2461 else 2460 2462 fix1.inputFileName=filecell.nc.civ1{ifile,j} ; 2461 2463 fix1.fi1=num2str(flagindex1(1)); … … 2463 2465 fix1.fi3=num2str(flagindex1(3)); 2464 2466 fix1.threshC=num2str(thresh_vecC1); 2465 fix1.threshV=num2str(thresh_vel1); 2467 fix1.threshV=num2str(thresh_vel1); 2466 2468 fieldnames=fields(fix1); 2467 2469 [civAllxml,uid_fix1]=add(civAllxml,1,'element','fix1'); 2468 2470 for ilist=1:length(fieldnames) 2469 val=eval(['fix1.' fieldnames{ilist}]); 2470 if ischar(val) 2471 [civAllxml,uid_t]=add(civAllxml,uid_fix1,'element',fieldnames{ilist}); 2472 [civAllxml,uid_t2]=add(civAllxml,uid_t,'chardata',val); 2473 end 2474 end 2475 civAllCmd=[civAllCmd ' fix1 ']; 2476 end 2477 end 2478 2479 %PATCH1 2480 if box_test(3)==1 2481 if isequal(civAll,0) 2482 cmd_PATCH=PATCH_CMD(filecell.nc.civ1{ifile,j},nx_patch1,ny_patch1,rho_patch1,subdomain_patch1,thresh_patch1,test_interp,sparam.PatchBin); 2483 cmd_PATCH=regexprep(cmd_PATCH,'\\','\\\\'); 2484 cmd=[cmd cmd_PATCH '\n']; 2485 else 2486 patch1.inputFileName=filecell.nc.civ1{ifile,j} ; 2487 patch1.nopt=subdomain_patch1; 2488 patch1.maxdiff=thresh_patch1; 2489 patch1.ro=rho_patch1; 2490 test_grid=get(handles.get_gridpatch1,'Value'); 2491 if test_grid 2492 patch1.gridflag='y'; 2493 gridname=get(handles.grid_patch1,'String'); 2494 if isequal(gridname(end-3:end),'grid') 2495 nbslice_grid=str2num(gridname(1:end-4)); % 2496 if ~isempty(nbslice_grid) 2497 num1_grid=mod(num1_civ1(ifile)-1,nbslice_grid)+1; 2498 patch1.gridPatch=[filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')]; 2499 if ~exist(patch1.gridPatch,'file') 2500 msgbox_uvmat('ERROR','grid file absent for patch1') 2501 end 2502 elseif exist(gridname,'file') 2503 patch1.gridPatch=gridname; 2504 else 2505 msgbox_uvmat('ERROR','grid file absent for patch1') 2471 val=eval(['fix1.' fieldnames{ilist}]); 2472 if ischar(val) 2473 [civAllxml,uid_t]=add(civAllxml,uid_fix1,'element',fieldnames{ilist}); 2474 [civAllxml,uid_t2]=add(civAllxml,uid_t,'chardata',val); 2506 2475 end 2507 2476 end 2477 civAllCmd=[civAllCmd ' fix1 ']; 2478 end 2479 end 2480 2481 %PATCH1 2482 if box_test(3)==1 2483 if isequal(civAll,0) 2484 cmd_PATCH=PATCH_CMD(filecell.nc.civ1{ifile,j},nx_patch1,ny_patch1,rho_patch1,subdomain_patch1,thresh_patch1,test_interp,sparam.PatchBin); 2485 cmd_PATCH=regexprep(cmd_PATCH,'\\','\\\\'); 2486 cmd=[cmd cmd_PATCH '\n']; 2508 2487 else 2509 patch1.gridPatch='none'; 2510 patch1.gridflag='n'; 2511 patch1.m=nx_patch1; 2512 patch1.n=ny_patch1; 2513 end 2514 patch1.convectFlow='n'; 2515 fieldnames=fields(patch1); 2488 patch1.inputFileName=filecell.nc.civ1{ifile,j} ; 2489 patch1.nopt=subdomain_patch1; 2490 patch1.maxdiff=thresh_patch1; 2491 patch1.ro=rho_patch1; 2492 test_grid=get(handles.get_gridpatch1,'Value'); 2493 if test_grid 2494 patch1.gridflag='y'; 2495 gridname=get(handles.grid_patch1,'String'); 2496 if isequal(gridname(end-3:end),'grid') 2497 nbslice_grid=str2num(gridname(1:end-4)); % 2498 if ~isempty(nbslice_grid) 2499 num1_grid=mod(num1_civ1(ifile)-1,nbslice_grid)+1; 2500 patch1.gridPatch=[filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')]; 2501 if ~exist(patch1.gridPatch,'file') 2502 msgbox_uvmat('ERROR','grid file absent for patch1') 2503 end 2504 elseif exist(gridname,'file') 2505 patch1.gridPatch=gridname; 2506 else 2507 msgbox_uvmat('ERROR','grid file absent for patch1') 2508 end 2509 end 2510 else 2511 patch1.gridPatch='none'; 2512 patch1.gridflag='n'; 2513 patch1.m=nx_patch1; 2514 patch1.n=ny_patch1; 2515 end 2516 patch1.convectFlow='n'; 2517 fieldnames=fields(patch1); 2516 2518 [civAllxml,uid_patch1]=add(civAllxml,1,'element','patch1'); 2517 2519 for ilist=1:length(fieldnames) 2518 val=eval(['patch1.' fieldnames{ilist}]);2519 if ischar(val)2520 [civAllxml,uid_t]=add(civAllxml,uid_patch1,'element',fieldnames{ilist});2521 [civAllxml,uid_t2]=add(civAllxml,uid_t,'chardata',val);2522 end2523 end 2524 civAllCmd=[civAllCmd ' patch1 '];2525 end2526 end2527 2528 if box_test(4)==1 | box_test(5)==1 | box_test(6)==12529 filename_cmx=filecell.nc.civ2{ifile,j};%output netcdf file2530 filename_cmx([end-1:end])=[ 'cm'];%name of cmx file2531 filename_cmx=[filename_cmx 'x'];2532 end2533 2534 if box_test(4)==12520 val=eval(['patch1.' fieldnames{ilist}]); 2521 if ischar(val) 2522 [civAllxml,uid_t]=add(civAllxml,uid_patch1,'element',fieldnames{ilist}); 2523 [civAllxml,uid_t2]=add(civAllxml,uid_t,'chardata',val); 2524 end 2525 end 2526 civAllCmd=[civAllCmd ' patch1 ']; 2527 end 2528 end 2529 2530 if box_test(4)==1 | box_test(5)==1 | box_test(6)==1 2531 filename_cmx=filecell.nc.civ2{ifile,j};%output netcdf file 2532 filename_cmx([end-1:end])=[ 'cm'];%name of cmx file 2533 filename_cmx=[filename_cmx 'x']; 2534 end 2535 2536 if box_test(4)==1 2535 2537 par_civ2.filename_ima_a=filecell.ima1.civ2{ifile,j}; 2536 2538 %par_civ2.filename_ima_a([end-3:end])=[];%remove .png extension … … 2539 2541 namelog=[filename_cmx([1:end-3]) 'log']; 2540 2542 par_civ2.Dt=num2str(time(num2_civ2(ifile),num_b_civ2(j))-time(num1_civ2(ifile),num_a_civ2(j))); 2541 par_civ2.T0=num2str((time(num2_civ1(ifile),num_b_civ2(j))+time(num1_civ2(ifile),num_a_civ2(j)))/2); 2543 par_civ2.T0=num2str((time(num2_civ1(ifile),num_b_civ2(j))+time(num1_civ2(ifile),num_a_civ2(j)))/2); 2542 2544 par_civ2.term_a=num2stra(num_a_civ2(j),nom_type_nc); 2543 par_civ2.term_b=num2stra(num_b_civ2(j),nom_type_nc); 2545 par_civ2.term_b=num2stra(num_b_civ2(j),nom_type_nc); 2544 2546 par_civ2.filename_nc1=filecell.nc.civ1{ifile,j}; 2545 2547 par_civ2.filename_nc1([end-2:end])=[]; % remove '.nc' 2546 2548 test_mask=get(handles.get_mask_civ2,'Value'); 2547 if test_mask==0 2549 if test_mask==0 2548 2550 par_civ2.maskname='noFile use default'; 2549 2551 par_civ2.maskflag='n'; … … 2554 2556 par_civ2.maskflag='y'; 2555 2557 else 2556 maskbase=[filebase '_' maskdispl]; % 2557 nbslice_mask=str2num(maskdispl(1:end-4)); % 2558 maskbase=[filebase '_' maskdispl]; % 2559 nbslice_mask=str2num(maskdispl(1:end-4)); % 2558 2560 num1_mask=mod(num1_civ2(ifile)-1,nbslice_mask)+1; 2559 2561 par_civ2.maskname=name_generator(maskbase,num1_mask,1,'.png','_i'); 2560 2562 if exist(par_civ2.maskname,'file') 2561 par_civ2.maskflag='y'; 2563 par_civ2.maskflag='y'; 2562 2564 else 2563 2565 par_civ2.maskname='noFile use default'; 2564 par_civ2.maskflag='n'; 2566 par_civ2.maskflag='n'; 2565 2567 end 2566 2568 end … … 2577 2579 par_civ2.gridname=[filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')]; 2578 2580 if exist(par_civ2.gridname,'file') 2579 par_civ2.gridflag='y'; 2581 par_civ2.gridflag='y'; 2580 2582 else 2581 2583 par_civ2.gridname='noFile use default'; 2582 par_civ2.gridflag='n'; 2584 par_civ2.gridflag='n'; 2583 2585 end 2584 2586 elseif exist(gridname,'file') 2585 par_civ2.gridflag='y'; 2587 par_civ2.gridflag='y'; 2586 2588 else 2587 2589 par_civ2.gridname='noFile use default'; 2588 par_civ2.gridflag='n'; 2590 par_civ2.gridflag='n'; 2589 2591 end 2590 2592 end … … 2600 2602 end 2601 2603 else 2602 2603 2604 2604 civAllCmd=[civAllCmd ' civ2 ']; 2605 str=CIV2_CMD_Unified(filename_cmx([1:end-4]),namelog,par_civ2); 2606 fieldnames=fields(str); 2605 2607 [civAllxml,uid_civ2]=add(civAllxml,1,'element','civ2'); 2606 2608 for ilist=1:length(fieldnames) 2607 2609 val=eval(['str.' fieldnames{ilist}]); 2608 2610 if ischar(val) 2609 [civAllxml,uid_t]=add(civAllxml,uid_civ2,'element',fieldnames{ilist});2610 [civAllxml,uid_t2]=add(civAllxml,uid_t,'chardata',val);2611 [civAllxml,uid_t]=add(civAllxml,uid_civ2,'element',fieldnames{ilist}); 2612 [civAllxml,uid_t2]=add(civAllxml,uid_t,'chardata',val); 2611 2613 end 2612 end 2613 end 2614 end2615 2616 % FIX22617 if box_test(5)==12618 test_mask=get(handles.get_mask_fix2,'Value');2619 if test_mask==0 2620 maskname=''; %no mask used 2614 end 2615 end 2616 end 2617 2618 % FIX2 2619 if box_test(5)==1 2620 test_mask=get(handles.get_mask_fix2,'Value'); 2621 if test_mask==0 2622 maskname=''; %no mask used 2621 2623 else 2622 2624 maskdispl=get(handles.mask_fix2,'String'); 2623 maskbase=[filebase '_' maskdispl]; % 2624 nbslice_mask=str2num(maskdispl(1:end-4)); % 2625 maskbase=[filebase '_' maskdispl]; % 2626 nbslice_mask=str2num(maskdispl(1:end-4)); % 2625 2627 num1_mask=mod(num1_civ2(ifile)-1,nbslice_mask)+1; 2626 2628 maskname =name_generator(maskbase,num1_mask,1,'.png','_i'); 2627 end 2628 if isequal(civAll,0)2629 end 2630 if isequal(civAll,0) 2629 2631 cmd_FIX=[sparam.FixBin ' -f ' filecell.nc.civ2{ifile,j} ' -fi1 ' num2str(flagindex2(1)) ... 2630 ' -fi2 ' num2str(flagindex2(2)) ' -fi3 ' num2str(flagindex2(3)) ...2631 ' -threshC ' num2str(thresh_vec2C) ' -threshV ' num2str(thresh_vel2) ' -maskName ' maskname];2632 cmd_FIX=regexprep(cmd_FIX,'\\','\\\\');2633 cmd=[cmd cmd_FIX '\n'];2634 else2632 ' -fi2 ' num2str(flagindex2(2)) ' -fi3 ' num2str(flagindex2(3)) ... 2633 ' -threshC ' num2str(thresh_vec2C) ' -threshV ' num2str(thresh_vel2) ' -maskName ' maskname]; 2634 cmd_FIX=regexprep(cmd_FIX,'\\','\\\\'); 2635 cmd=[cmd cmd_FIX '\n']; 2636 else 2635 2637 fix2.inputFileName=filecell.nc.civ2{ifile,j} ; 2636 2638 fix2.fi1=num2str(flagindex2(1)); … … 2638 2640 fix2.fi3=num2str(flagindex2(3)); 2639 2641 fix2.threshC=num2str(thresh_vec2C); 2640 fix2.threshV=num2str(thresh_vel2); 2642 fix2.threshV=num2str(thresh_vel2); 2641 2643 fieldnames=fields(fix2); 2642 2644 [civAllxml,uid_fix2]=add(civAllxml,1,'element','fix2'); 2643 2645 for ilist=1:length(fieldnames) 2644 val=eval(['fix2.' fieldnames{ilist}]);2645 if ischar(val)2646 [civAllxml,uid_t]=add(civAllxml,uid_fix2,'element',fieldnames{ilist});2647 [civAllxml,uid_t2]=add(civAllxml,uid_t,'chardata',val);2648 end2649 end 2650 civAllCmd=[civAllCmd ' fix2 ']; 2651 end2652 end2653 2654 %PATCH22655 if box_test(6)==12646 val=eval(['fix2.' fieldnames{ilist}]); 2647 if ischar(val) 2648 [civAllxml,uid_t]=add(civAllxml,uid_fix2,'element',fieldnames{ilist}); 2649 [civAllxml,uid_t2]=add(civAllxml,uid_t,'chardata',val); 2650 end 2651 end 2652 civAllCmd=[civAllCmd ' fix2 ']; 2653 end 2654 end 2655 2656 %PATCH2 2657 if box_test(6)==1 2656 2658 if isequal(civAll,0) 2657 2659 cmd_PATCH=PATCH_CMD(filecell.nc.civ2{ifile,j},nx_patch2,ny_patch2,rho_patch2,subdomain_patch2,thresh_patch2,test_interp,sparam.PatchBin); … … 2673 2675 patch2.gridPatch=[filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')]; 2674 2676 if ~exist(patch2.gridPatch,'file') 2675 msgbox_uvmat('ERROR','grid file absent for patch2')2677 msgbox_uvmat('ERROR','grid file absent for patch2') 2676 2678 end 2677 2679 elseif exist(gridname,'file') 2678 patch2.gridPatch=gridname; 2680 patch2.gridPatch=gridname; 2679 2681 else 2680 2682 msgbox_uvmat('ERROR','grid file absent for patch2') … … 2682 2684 end 2683 2685 else 2684 2685 2686 2687 2686 patch2.gridPatch='none'; 2687 patch2.gridflag='n'; 2688 patch2.m=nx_patch2; 2689 patch2.n=ny_patch2; 2688 2690 end 2689 2691 patch2.convectFlow='n'; … … 2691 2693 [civAllxml,uid_patch2]=add(civAllxml,1,'element','patch2'); 2692 2694 for ilist=1:length(fieldnames) 2693 val=eval(['patch2.' fieldnames{ilist}]);2694 if ischar(val)2695 [civAllxml,uid_t]=add(civAllxml,uid_patch2,'element',fieldnames{ilist});2696 [civAllxml,uid_t2]=add(civAllxml,uid_t,'chardata',val);2697 end2698 end 2695 val=eval(['patch2.' fieldnames{ilist}]); 2696 if ischar(val) 2697 [civAllxml,uid_t]=add(civAllxml,uid_patch2,'element',fieldnames{ilist}); 2698 [civAllxml,uid_t2]=add(civAllxml,uid_t,'chardata',val); 2699 end 2700 end 2699 2701 civAllCmd=[civAllCmd ' patch2 ']; 2700 end 2702 end 2701 2703 end 2702 2704 if isequal(civAll,1) … … 2705 2707 cmd=[cmd CivBin ' -f ' filename_cmx(1:end-4) '.xml ' civAllCmd '\n']; 2706 2708 end 2707 % create the .bat file:2709 % create the .bat file: 2708 2710 if batch 2709 2710 2711 [Rootbat,Filebat,extbat]=fileparts(filename_cmx); 2712 filename_bat=fullfile(Rootbat,['job_' Filebat extbat]); 2711 2713 else 2712 2714 filename_bat=filename_cmx; … … 2726 2728 end 2727 2729 else 2728 %% to lauch the jobs locally :2730 %% to lauch the jobs locally : 2729 2731 if(isunix) 2730 eval(['!. ' filename_bat ' &']);2731 display(['!. ' filename_bat ' &'])2732 eval(['!. ' filename_bat ' &']); 2733 display(['!. ' filename_bat ' &']) 2732 2734 else 2733 eval(['!' filename_bat ' &']);2734 display(['!' filename_bat ' &'])2735 end 2736 end 2737 2735 eval(['!' filename_bat ' &']); 2736 display(['!' filename_bat ' &']) 2737 end 2738 end 2739 end 2738 2740 end 2739 2741 % set(handles.BATCH, 'Enable','On') … … 2750 2752 [RootPath,RootFile,field_count,str2,str_a,str_b,ext,nom_type,subdir]=name2display(fileresu); 2751 2753 namedoc=fullfile(RootPath,subdir,RootFile); 2752 detect=1; 2754 detect=1; 2753 2755 while detect==1 2754 2756 namefigfull=[namedoc '.fig']; … … 2777 2779 % num1_civ2(i),num2_civ2(i): lists of first and last i indices for civ2 2778 2780 % num_a_civ2(j),num_b_civ2(j): lists of first and last j indices for civ2 2779 % nom_type_nc: nomenclature type for velocity files 2781 % nom_type_nc: nomenclature type for velocity files 2780 2782 % file_ref_fix1,file_ref_fix2: reference files possibly used by Fix1 and 2 2781 2783 function [filecell,num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2,nom_type_nc,file_ref_fix1,file_ref_fix2]=... … … 2807 2809 filebase_B=filebase;% root name of the second field series for stereo 2808 2810 if strcmp(compare,'displacement') || strcmp(compare,'stereo PIV') 2809 test_disp=1; 2811 test_disp=1; 2810 2812 nom_type_ima1=browse.nom_type_ima_1; %nomenclature type of the second file series 2811 2813 [Path2,Name2]=fileparts(filebase_B); … … 2827 2829 end 2828 2830 if strcmp(compare,'displacement') 2829 2830 2831 filebase_nc=filebase_AB; %root name for the result of civ22832 else 2833 2834 2835 2836 end 2831 filebase_ima1=filebase_A; 2832 filebase_ima2=filebase_B; 2833 filebase_nc=filebase_AB; %root name for the result of civ2 2834 else 2835 filebase_ima1=filebase_B; 2836 filebase_ima2=filebase_B; 2837 filebase_nc=filebase_B; 2838 end 2837 2839 2838 2840 %determine reference files for fix: … … 2962 2964 [erread,message]=fileattrib(Path_ima); 2963 2965 if ~isempty(message) & ~isequal(message.UserWrite,1) 2964 2965 2966 2967 2966 msgbox_uvmat('ERROR',['No writting access to ' Path_ima]) 2967 filecell=[]; 2968 cd(currentdir); 2969 return 2968 2970 end 2969 2971 … … 2971 2973 % %%%%%%%%%%%% case CIV1 activated %%%%%%%%%%%%% 2972 2974 if box_test(1)==1; 2973 detect=1; 2974 while detect==1 %create a new subdir if the netcdf files already exist 2975 for ifile=1:nbfield; 2976 for j=1:nbslice 2977 filename=name_generator(filebase_nc,num1_civ1(ifile),num_a_civ1(j),'.nc',nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1); 2978 detect=exist(filename,'file')==2; 2979 if detect% if a netcdf file already exists 2980 subdir_civ1=[subdir_civ1 '.0']; 2981 subdir_civ2=subdir_civ1; 2982 break 2983 end 2984 filecell.nc.civ1(ifile,j)={filename}; 2985 end 2986 if detect% if a netcdf file already exists 2987 break 2988 end 2989 end 2990 %create the new subdir_civ1 2991 if ~exist(fullfile(Path_ima,subdir_civ1),'dir') 2992 [m1,m2,m3]=mkdir(subdir_civ1); 2975 detect=1; 2976 while detect==1 %create a new subdir if the netcdf files already exist 2977 for ifile=1:nbfield; 2978 for j=1:nbslice 2979 filename=name_generator(filebase_nc,num1_civ1(ifile),num_a_civ1(j),'.nc',nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1); 2980 detect=exist(filename,'file')==2; 2981 if detect% if a netcdf file already exists 2982 subdir_civ1=[subdir_civ1 '.0']; 2983 subdir_civ2=subdir_civ1; 2984 break 2985 end 2986 filecell.nc.civ1(ifile,j)={filename}; 2987 end 2988 if detect% if a netcdf file already exists 2989 break 2990 end 2991 end 2992 %create the new subdir_civ1 2993 if ~exist(fullfile(Path_ima,subdir_civ1),'dir') 2994 [m1,m2,m3]=mkdir(subdir_civ1); 2995 if ~isequal(m2,'') 2996 msgbox_uvmat('ERROR', m2) 2997 %msgbox(m2);%error message for directory creation 2998 end 2999 end 3000 if strcmp(compare,'stereo PIV')&&(strcmp(mode,'pair j1-j2')||strcmp(mode,'series(Dj)')||strcmp(mode,'series(Di)'))%check second nc series 3001 for ifile=1:nbfield 3002 for j=1:nbslice 3003 filename=name_generator(filebase_A,num1_civ1(ifile),num_a_civ1(j),'.nc',nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1);% 3004 detect=exist(filename,'file')==2; 3005 if detect% if a netcdf file already exists 3006 subdir_civ1=[subdir_civ1 '.0']; 3007 subdir_civ2=subdir_civ1; 3008 break 3009 end 3010 filecell.ncA.civ1(ifile,j)={filename}; 3011 end 3012 if detect% if a netcdf file already exists 3013 break 3014 end 3015 end 3016 %create the new subdir_civ1 3017 if ~exist(fullfile(Path_ima,subdir_civ1),'dir') 3018 [m1,m2,m3]=mkdir(subdir_civ1); 2993 3019 if ~isequal(m2,'') 2994 msgbox_uvmat('ERROR', m2) 2995 %msgbox(m2);%error message for directory creation 2996 end 2997 end 2998 if strcmp(compare,'stereo PIV')&&(strcmp(mode,'pair j1-j2')||strcmp(mode,'series(Dj)')||strcmp(mode,'series(Di)'))%check second nc series 2999 for ifile=1:nbfield 3000 for j=1:nbslice 3001 filename=name_generator(filebase_A,num1_civ1(ifile),num_a_civ1(j),'.nc',nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1);% 3002 detect=exist(filename,'file')==2; 3003 if detect% if a netcdf file already exists 3004 subdir_civ1=[subdir_civ1 '.0']; 3005 subdir_civ2=subdir_civ1; 3006 break 3007 end 3008 filecell.ncA.civ1(ifile,j)={filename}; 3009 end 3010 if detect% if a netcdf file already exists 3011 break 3012 end 3013 end 3014 %create the new subdir_civ1 3015 if ~exist(fullfile(Path_ima,subdir_civ1),'dir') 3016 [m1,m2,m3]=mkdir(subdir_civ1); 3017 if ~isequal(m2,'') 3018 msgbox_uvmat('ERROR', m2) 3019 end 3020 end 3021 end 3022 end 3020 msgbox_uvmat('ERROR', m2) 3021 end 3022 end 3023 end 3024 end 3023 3025 % get image names 3024 3026 for ifile=1:nbfield 3025 3027 for j=1:nbslice 3026 3028 filename=name_generator(filebase_ima1, num1_civ1(ifile),num_a_civ1(j),ext_ima,nom_type_ima1); 3027 3029 idetect(j)=exist(filename,'file')==2; … … 3030 3032 idetect_1(j)=exist(filename,'file')==2; 3031 3033 filecell.ima2.civ1(ifile,j)={filename};%second image 3032 end 3034 end 3035 [idetectmin,indexj]=min(idetect); 3036 if idetectmin==0, 3037 msgbox_uvmat('ERROR',[filecell.ima1.civ1{ifile,indexj} ' not found']) 3038 filecell=[]; 3039 return 3040 end 3041 [idetectmin,indexj]=min(idetect_1); 3042 if idetectmin==0, 3043 msgbox_uvmat('ERROR',[filecell.ima2.civ1{ifile,indexj} ' not found']) 3044 filecell=[]; 3045 cd(currentdir) 3046 return 3047 end 3048 end 3049 if strcmp(compare,'stereo PIV') && (strcmp(mode,'pair j1-j2') || strcmp(mode,'series(Dj)') || strcmp(mode,'series(Di)')) 3050 for ifile=1:nbfield 3051 for j=1:nbslice 3052 filename=name_generator(filebase_A, num1_civ1(ifile),num_a_civ1(j),ext_ima,nom_type_ima1); 3053 idetect(j)=exist(filename,'file')==2; 3054 filecell.imaA1.civ1(ifile,j)={filename} ;%first image 3055 filename=name_generator(filebase_A, num2_civ1(ifile),num_b_civ1(j),ext_ima,nom_type_ima2); 3056 idetect_1(j)=exist(filename,'file')==2; 3057 filecell.imaA2.civ1(ifile,j)={filename};%second image 3058 end 3033 3059 [idetectmin,indexj]=min(idetect); 3034 if idetectmin==0, 3035 msgbox_uvmat('ERROR',[filecell.ima1.civ1{ifile,indexj} ' not found']) 3036 filecell=[]; 3037 return 3038 end 3039 [idetectmin,indexj]=min(idetect_1); 3040 if idetectmin==0, 3041 msgbox_uvmat('ERROR',[filecell.ima2.civ1{ifile,indexj} ' not found']) 3060 if idetectmin==0, 3061 msgbox_uvmat('ERROR',[filecell.imaA1.civ1{ifile,indexj} ' not found']) 3042 3062 filecell=[]; 3043 3063 cd(currentdir) 3044 3064 return 3045 end 3046 end 3047 if strcmp(compare,'stereo PIV') && (strcmp(mode,'pair j1-j2') || strcmp(mode,'series(Dj)') || strcmp(mode,'series(Di)')) 3048 for ifile=1:nbfield 3049 for j=1:nbslice 3050 filename=name_generator(filebase_A, num1_civ1(ifile),num_a_civ1(j),ext_ima,nom_type_ima1); 3051 idetect(j)=exist(filename,'file')==2; 3052 filecell.imaA1.civ1(ifile,j)={filename} ;%first image 3053 filename=name_generator(filebase_A, num2_civ1(ifile),num_b_civ1(j),ext_ima,nom_type_ima2); 3054 idetect_1(j)=exist(filename,'file')==2; 3055 filecell.imaA2.civ1(ifile,j)={filename};%second image 3056 end 3057 [idetectmin,indexj]=min(idetect); 3058 if idetectmin==0, 3059 msgbox_uvmat('ERROR',[filecell.imaA1.civ1{ifile,indexj} ' not found']) 3065 end 3066 [idetectmin,indexj]=min(idetect_1); 3067 if idetectmin==0, 3068 msgbox_uvmat('ERROR',[filecell.imaA2.civ1{ifile,indexj} ' not found']) 3069 filecell=[]; 3070 cd(currentdir) 3071 return 3072 end 3073 end 3074 end 3075 3076 %%%%%%%%%%%%% fix1 or patch1 activated but no civ1 %%%%%%%%%%%%% 3077 elseif (box_test(2)==1 || box_test(3)==1); 3078 for ifile=1:nbfield 3079 for j=1:nbslice 3080 filename=name_generator(filebase_nc,num1_civ1(ifile),num_a_civ1(j),'.nc',... 3081 nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1);% 3082 detect=exist(filename,'file')==2; 3083 filecell.nc.civ1(ifile,j)={filename}; 3084 end 3085 end 3086 if strcmp(compare,'stereo PIV') 3087 for ifile=1:nbfield 3088 for j=1:nbslice 3089 filename=name_generator(filebase_A,num1_civ1(ifile),num_a_civ1(j),'.nc',nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1);% 3090 filecell.ncA.civ1(ifile,j)={filename}; 3091 if ~exist(filename,'file') 3092 msgbox_uvmat('ERROR',['input file ' filename ' not found']) 3093 set(handles.RUN, 'Enable','On') 3094 set(handles.RUN,'BackgroundColor',[1 0 0]) 3095 % set(handles.BATCH, 'Enable','On') 3096 % set(handles.BATCH,'BackgroundColor',[1 0 0]) 3060 3097 filecell=[]; 3061 3098 cd(currentdir) 3062 3099 return 3063 end3064 [idetectmin,indexj]=min(idetect_1);3065 if idetectmin==0,3066 msgbox_uvmat('ERROR',[filecell.imaA2.civ1{ifile,indexj} ' not found'])3067 filecell=[];3068 cd(currentdir)3069 return3070 end3071 end3072 end3073 3074 %%%%%%%%%%%%% fix1 or patch1 activated but no civ1 %%%%%%%%%%%%%3075 elseif (box_test(2)==1 || box_test(3)==1);3076 for ifile=1:nbfield3077 for j=1:nbslice3078 filename=name_generator(filebase_nc,num1_civ1(ifile),num_a_civ1(j),'.nc',...3079 nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1);%3080 detect=exist(filename,'file')==2;3081 filecell.nc.civ1(ifile,j)={filename};3082 end3083 end3084 if strcmp(compare,'stereo PIV')3085 for ifile=1:nbfield3086 for j=1:nbslice3087 filename=name_generator(filebase_A,num1_civ1(ifile),num_a_civ1(j),'.nc',nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1);%3088 filecell.ncA.civ1(ifile,j)={filename};3089 if ~exist(filename,'file')3090 msgbox_uvmat('ERROR',['input file ' filename ' not found'])3091 set(handles.RUN, 'Enable','On')3092 set(handles.RUN,'BackgroundColor',[1 0 0])3093 % set(handles.BATCH, 'Enable','On')3094 % set(handles.BATCH,'BackgroundColor',[1 0 0])3095 filecell=[];3096 cd(currentdir)3097 return3098 end3099 3100 end 3100 3101 end 3102 end 3101 3103 end 3102 3104 end … … 3105 3107 testdiff=0; 3106 3108 if (box_test(4)==1)&&... 3107 ((get(handles.list_pair_civ1,'Value')~=get(handles.list_pair_civ2,'Value'))||~isequal(subdir_civ2,subdir_civ1)) 3109 ((get(handles.list_pair_civ1,'Value')~=get(handles.list_pair_civ2,'Value'))||~isequal(subdir_civ2,subdir_civ1)) 3108 3110 testdiff=1; 3109 detect=1; 3111 detect=1; 3110 3112 while detect==1 %create a new subdir if the netcdf files already exist 3111 for ifile=1:nbfield 3112 for j=1:nbslice 3113 filename=name_generator(filebase_nc,num1_civ2(ifile),num_a_civ2(j),'.nc',nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2);% 3114 detect=exist(filename,'file')==2; 3115 if detect% if a netcdf file already exists 3116 subdir_civ2=[subdir_civ2 '.0']; 3117 break 3118 end 3119 filecell.nc.civ2(ifile,j)={filename}; 3120 end 3121 if detect% if a netcdf file already exists 3122 break 3123 end 3124 end 3125 %create the new subdir_civ2 3126 if ~exist(fullfile(Path_ima,subdir_civ2),'dir') 3127 [m1,m2,m3]=mkdir(subdir_civ2); 3128 if ~isequal(m2,'') 3129 msgbox_uvmat('ERROR', m2) 3130 end 3131 end 3132 if strcmp(compare,'stereo PIV')%check second nc series 3133 for ifile=1:nbfield 3134 for j=1:nbslice 3135 filename=name_generator(filebase_A,num1_civ2(ifile),num_a_civ2(j),'.nc',... 3136 nom_type_nc,1,num2_civ2(ifile),num_b_civ1(j),subdir_civ2);% 3137 detect=exist(filename,'file')==2; 3138 if detect% if a netcdf file already exists 3139 subdir_civ2=[subdir_civ2 '.0']; 3140 break 3141 end 3142 filecell.ncA.civ2(ifile,j)={filename}; 3143 end 3113 for ifile=1:nbfield 3114 for j=1:nbslice 3115 filename=name_generator(filebase_nc,num1_civ2(ifile),num_a_civ2(j),'.nc',nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2);% 3116 detect=exist(filename,'file')==2; 3117 if detect% if a netcdf file already exists 3118 subdir_civ2=[subdir_civ2 '.0']; 3119 break 3120 end 3121 filecell.nc.civ2(ifile,j)={filename}; 3122 end 3123 if detect% if a netcdf file already exists 3124 break 3125 end 3126 end 3127 %create the new subdir_civ2 3128 if ~exist(fullfile(Path_ima,subdir_civ2),'dir') 3129 [m1,m2,m3]=mkdir(subdir_civ2); 3130 if ~isequal(m2,'') 3131 msgbox_uvmat('ERROR', m2) 3132 end 3133 end 3134 if strcmp(compare,'stereo PIV')%check second nc series 3135 for ifile=1:nbfield 3136 for j=1:nbslice 3137 filename=name_generator(filebase_A,num1_civ2(ifile),num_a_civ2(j),'.nc',... 3138 nom_type_nc,1,num2_civ2(ifile),num_b_civ1(j),subdir_civ2);% 3139 detect=exist(filename,'file')==2; 3144 3140 if detect% if a netcdf file already exists 3145 break 3141 subdir_civ2=[subdir_civ2 '.0']; 3142 break 3146 3143 end 3147 end 3148 %create the new subdir_civ1 3149 if ~exist(fullfile(Path_ima,subdir_civ2),'dir') 3150 [m1,m2,m3]=mkdir(subdir_civ2); 3151 if ~isequal(m2,'') 3152 msgbox_uvmat('ERROR', m2) 3153 %msgbox(m2);%error message for directory creation 3154 end 3155 end 3156 end 3157 end 3144 filecell.ncA.civ2(ifile,j)={filename}; 3145 end 3146 if detect% if a netcdf file already exists 3147 break 3148 end 3149 end 3150 %create the new subdir_civ1 3151 if ~exist(fullfile(Path_ima,subdir_civ2),'dir') 3152 [m1,m2,m3]=mkdir(subdir_civ2); 3153 if ~isequal(m2,'') 3154 msgbox_uvmat('ERROR', m2) 3155 %msgbox(m2);%error message for directory creation 3156 end 3157 end 3158 end 3159 end 3158 3160 end 3159 3161 cd(currentdir);%come back to the current working directory 3160 3162 3161 3163 3162 3164 %%%%%%%%%%%%% if civ2 results are obtained or used %%%%%%%%%%%%% … … 3171 3173 if ~exist(filename,'file') 3172 3174 msgbox_uvmat('ERROR',['input file ' filename ' not found']) 3173 filecell=[];3175 filecell=[]; 3174 3176 return 3175 3177 end … … 3181 3183 filecell=[]; 3182 3184 return 3183 end 3185 end 3184 3186 elseif box_test(3)==0; %check the existence of patch if it is not calculated 3185 3187 Data=nc2struct(filename,'ListGlobalAttribute','patch'); … … 3189 3191 return 3190 3192 end 3191 end 3193 end 3192 3194 end 3193 3195 end … … 3203 3205 set(handles.RUN, 'Enable','On') 3204 3206 set(handles.RUN,'BackgroundColor',[1 0 0]) 3205 % set(handles.BATCH, 'Enable','On')3206 % set(handles.BATCH,'BackgroundColor',[1 0 0])3207 % set(handles.BATCH, 'Enable','On') 3208 % set(handles.BATCH,'BackgroundColor',[1 0 0]) 3207 3209 cd(currentdir) 3208 3210 return … … 3212 3214 end 3213 3215 end 3214 3215 detect=1; 3216 % while detect==1%creates a new subdir if the netcdf files already contain civ2 data3217 3218 3219 3216 3217 detect=1; 3218 % while detect==1%creates a new subdir if the netcdf files already contain civ2 data 3219 for ifile=1:nbfield 3220 for j=1:nbslice 3221 filename=name_generator(filebase_nc,num1_civ2(ifile),num_a_civ2(j),'.nc',... 3220 3222 nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2); 3221 3222 3223 3224 3223 detect=exist(filename,'file')==2; 3224 filecell.nc.civ2(ifile,j)={filename}; 3225 end 3226 end 3225 3227 %get first image names for civ2 3226 3228 if box_test(1)==1 & isequal(num1_civ1,num1_civ2) & isequal(num_a_civ1,num_a_civ2) … … 3233 3235 filecell.ima1.civ2(ifile,j)={filename};%first image 3234 3236 end 3235 3237 [idetectmin,indexj]=min(idetect_2); 3236 3238 if idetectmin==0, 3237 3238 3239 3239 msgbox_uvmat('ERROR',['input image ' filecell.ima1.civ2{ifile,indexj} ' not found']) 3240 filecell=[]; 3241 return 3240 3242 end 3241 3243 end … … 3252 3254 filecell.ima2.civ2(ifile,j)={filename};%first image 3253 3255 end 3254 3256 [idetectmin,indexj]=min(idetect_3); 3255 3257 if idetectmin==0, 3256 3257 3258 3258 msgbox_uvmat('ERROR',['input image ' filecell.ima2.civ2{ifile,indexj} ' not found']) 3259 filecell=[]; 3260 return 3259 3261 end 3260 3262 end … … 3264 3266 if ~testdiff 3265 3267 filecell.nc.civ2=filecell.nc.civ1;% file already checked 3266 else % check the civ2 files 3268 else % check the civ2 files 3267 3269 for ifile=1:nbfield 3268 3270 for j=1:nbslice 3269 3271 filename=name_generator(filebase_nc,num1_civ2(ifile),num_a_civ2(j),'.nc',... 3270 3272 nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2);% 3271 3273 filecell.nc.civ2(ifile,j)={filename}; 3272 3274 if ~exist(filename,'file') … … 3276 3278 else 3277 3279 Data=nc2struct(filename,'ListGlobalAttribute','civ2'); 3278 if isempty(Data.civ2)||isequal(Data.civ2,0) 3280 if isempty(Data.civ2)||isequal(Data.civ2,0) 3279 3281 msgbox_uvmat('ERROR',['no civ2 data in ' filename]) 3280 3282 filecell=[]; … … 3289 3291 %%%%%%%%%%%%% if stereo fields are calculated by PATCH %%%%%%%%%%%%% 3290 3292 if strcmp(compare,'stereo PIV') 3291 if box_test(3)==1 & isequal(get(handles.test_stereo1,'Value'),1) 3293 if box_test(3)==1 & isequal(get(handles.test_stereo1,'Value'),1) 3292 3294 for ifile=1:nbfield 3293 3295 for j=1:nbslice … … 3298 3300 end 3299 3301 end 3300 if box_test(6)==1 & isequal(get(handles.test_stereo2,'Value'),1)3302 if box_test(6)==1 & isequal(get(handles.test_stereo2,'Value'),1) 3301 3303 for ifile=1:nbfield 3302 3304 for j=1:nbslice … … 3306 3308 end 3307 3309 end 3308 3310 end 3309 3311 end 3310 3312 set(handles.subdir_civ1,'String',subdir_civ1);%update the edit box … … 3337 3339 type_ima1='avi'; 3338 3340 end 3339 else 3340 form=imformats(ext_ima(2:end));3341 if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab3342 if isequal(nom_type_ima1,'*');3343 type_ima1='multimage';%image series in a single image file3344 else3345 type_ima1='image';3346 end3347 end3341 else 3342 form=imformats(ext_ima(2:end)); 3343 if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab 3344 if isequal(nom_type_ima1,'*'); 3345 type_ima1='multimage';%image series in a single image file 3346 else 3347 type_ima1='image'; 3348 end 3349 end 3348 3350 end 3349 3351 type_ima2='none';%default … … 3357 3359 type_ima2='avi'; 3358 3360 end 3359 else 3360 form=imformats(ext_ima(2:end));3361 if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab3362 if isequal(nom_type_ima1,'*');3363 type_ima2='multimage';%image series in a single image file3364 else3365 type_ima2='image';3366 end3367 end3361 else 3362 form=imformats(ext_ima(2:end)); 3363 if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab 3364 if isequal(nom_type_ima1,'*'); 3365 type_ima2='multimage';%image series in a single image file 3366 else 3367 type_ima2='image'; 3368 end 3369 end 3368 3370 end 3369 3371 %npxy=get(handles.ImaExt,'UserData'); 3370 % % if numel(npxy)<23371 % 3372 % filename=name_generator(filebase_ima1,num1_civ1(1),num_a_civ1(1),ImaExt,nom_type_ima1);3373 % A=imread(filename);3374 % npxy=size(A);3375 % % end3376 % npy=npxy(1);3377 % npx=npxy(2);3372 % % if numel(npxy)<2 3373 % 3374 % filename=name_generator(filebase_ima1,num1_civ1(1),num_a_civ1(1),ImaExt,nom_type_ima1); 3375 % A=imread(filename); 3376 % npxy=size(A); 3377 % % end 3378 % npy=npxy(1); 3379 % npx=npxy(2); 3378 3380 if box_test(1)==1 %if civ1 is performed 3379 h = waitbar(0,['copy images to the .png format for civ1']);% display a wait bar 3380 for ifile=1:nbfield 3381 waitbar(ifile/nbfield); 3382 for j=1:nbslice 3383 filename=name_generator(filebase_ima1,num1_civ1(ifile),num_a_civ1(j),'.png',nom_type_imanew1); 3384 if ~exist(filename,'file') 3385 A=read_image(filecell.ima1.civ1{ifile,j},type_ima1,num1_civ1(ifile),movieobject1); 3386 imwrite(A,filename,'BitDepth',16); 3387 end 3388 filecell.ima1.civ1(ifile,j)={filename}; 3389 filename=name_generator(filebase_ima2, num2_civ1(ifile),num_b_civ1(j),'.png',nom_type_imanew2); 3390 if ~exist(filename,'file') 3391 A=read_image(filecell.ima2.civ1{ifile,j},type_ima2,num2_civ1(ifile),movieobject2); 3392 imwrite(A,filename,'BitDepth',16); 3393 end 3394 filecell.ima2.civ1(ifile,j)={filename}; 3395 end 3396 end 3397 close(h) 3398 end 3399 if box_test(4)==1 %if civ2 is performed 3400 h = waitbar(0,['copy images to the .png format for civ2']);% display a wait bar 3381 h = waitbar(0,['copy images to the .png format for civ1']);% display a wait bar 3401 3382 for ifile=1:nbfield 3402 3383 waitbar(ifile/nbfield); 3403 3384 for j=1:nbslice 3404 filename=name_generator(filebase_ima1,num1_civ2(ifile),num_a_civ2(j),'.png',nom_type_imanew1); 3405 if ~exist(filename,'file') 3406 A=read_image(cell2mat(filecell.ima1.civ2(ifile,j)),type_ima2,num1_civ2(ifile)); 3407 imwrite(A,filename,'BitDepth',16); 3408 end 3409 filecell.ima1.civ2(ifile,j)={filename}; 3410 filename=name_generator(filebase_ima2, num2_civ2(ifile),num_b_civ2(j),'.png',nom_type_imanew2); 3411 if ~exist(filename,'file') 3412 A=read_image(cell2mat(filecell.ima2.civ2(ifile,j)),type_ima2,num2_civ2(ifile)); 3413 imwrite(A,filename,'BitDepth',16); 3414 end 3415 filecell.ima2.civ2(ifile,j)={filename}; 3385 filename=name_generator(filebase_ima1,num1_civ1(ifile),num_a_civ1(j),'.png',nom_type_imanew1); 3386 if ~exist(filename,'file') 3387 A=read_image(filecell.ima1.civ1{ifile,j},type_ima1,num1_civ1(ifile),movieobject1); 3388 imwrite(A,filename,'BitDepth',16); 3389 end 3390 filecell.ima1.civ1(ifile,j)={filename}; 3391 filename=name_generator(filebase_ima2, num2_civ1(ifile),num_b_civ1(j),'.png',nom_type_imanew2); 3392 if ~exist(filename,'file') 3393 A=read_image(filecell.ima2.civ1{ifile,j},type_ima2,num2_civ1(ifile),movieobject2); 3394 imwrite(A,filename,'BitDepth',16); 3395 end 3396 filecell.ima2.civ1(ifile,j)={filename}; 3397 end 3398 end 3399 close(h) 3400 end 3401 if box_test(4)==1 %if civ2 is performed 3402 h = waitbar(0,['copy images to the .png format for civ2']);% display a wait bar 3403 for ifile=1:nbfield 3404 waitbar(ifile/nbfield); 3405 for j=1:nbslice 3406 filename=name_generator(filebase_ima1,num1_civ2(ifile),num_a_civ2(j),'.png',nom_type_imanew1); 3407 if ~exist(filename,'file') 3408 A=read_image(cell2mat(filecell.ima1.civ2(ifile,j)),type_ima2,num1_civ2(ifile)); 3409 imwrite(A,filename,'BitDepth',16); 3410 end 3411 filecell.ima1.civ2(ifile,j)={filename}; 3412 filename=name_generator(filebase_ima2, num2_civ2(ifile),num_b_civ2(j),'.png',nom_type_imanew2); 3413 if ~exist(filename,'file') 3414 A=read_image(cell2mat(filecell.ima2.civ2(ifile,j)),type_ima2,num2_civ2(ifile)); 3415 imwrite(A,filename,'BitDepth',16); 3416 end 3417 filecell.ima2.civ2(ifile,j)={filename}; 3416 3418 end 3417 3419 end … … 3431 3433 if isempty(ibx_val) 3432 3434 ibx='21'; set(handles.ibx,'String','21') 3433 else 3435 else 3434 3436 ibx=num2str(ibx_val); 3435 3437 end … … 3437 3439 if isempty(iby_val) 3438 3440 iby='21'; set(handles.iby,'String','21') 3439 else 3441 else 3440 3442 iby=num2str(iby_val); 3441 3443 end … … 3478 3480 if numel(gridname)>4 && isequal(gridname(end-3:end),'grid') 3479 3481 nbslice_grid=str2num(gridname(1:end-4)); % 3480 if ~isempty(nbslice_grid) 3481 gridflag='y'; 3482 if ~isempty(nbslice_grid) 3483 gridflag='y'; 3482 3484 end 3483 3485 elseif exist(gridname,'file') … … 3496 3498 min_ima='0'; 3497 3499 max_ima='4096'; 3498 end 3499 3500 end 3501 %main loop 3500 3502 filebase=get(handles.RootName,'String'); 3501 3503 sizcell=size(filecell); … … 3516 3518 filename_cmx([end-1:end])=[ 'cm'];%name of cmx file 3517 3519 filename_cmx=[filename_cmx 'x']; 3518 namelog=[filename_cmx([1:end-3]) 'log']; 3520 namelog=[filename_cmx([1:end-3]) 'log']; 3519 3521 if size(time,1)>=num2(ifile) & size(time,2)>=num_b(j) 3520 3522 Dt=num2str(time(num2(ifile),num_b(j))-time(num1(ifile),num_a(j))); … … 3526 3528 Dt='1'; 3527 3529 T0='0'; 3528 end 3530 end 3529 3531 term_a=num2stra(num_a(j),nom_type_nc);%UTILITE? 3530 3532 term_b=num2stra(num_b(j),nom_type_nc);% 3531 if test_grid && ~isempty(nbslice_grid) 3532 3533 if test_grid && ~isempty(nbslice_grid) 3534 num1_grid=mod(num1(ifile)-1,nbslice_grid)+1; 3533 3535 gridname=[filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')]; 3534 3536 if ~exist(gridname,'file') … … 3543 3545 else 3544 3546 maskdispl=get(handles.mask_civ1,'String');%look for mask name in edit box 3545 maskbase=[filebase '_' maskdispl];% 3546 nbslice=str2num(maskdispl(1:end-4)); % 3547 maskbase=[filebase '_' maskdispl];% 3548 nbslice=str2num(maskdispl(1:end-4)); % 3547 3549 num1_mask=mod(num1(ifile)-1,nbslice)+1; 3548 3550 maskname=name_generator(maskbase,num1_mask,1,'.png','_i'); 3549 3551 if exist(maskname,'file') 3550 maskflag='y'; 3552 maskflag='y'; 3551 3553 else 3552 3554 maskname='noFile use default'; 3553 maskflag='n'; 3554 end 3555 end 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 % dlmwrite(filename_cmx,textout,'');3588 fid=fopen([filename_cmx],'w');3589 fprintf(fid, ['############## CMX file' '\n']);3590 fprintf(fid, ['FirstImage ' regexprep(filename_ima,'\\','\\\\') '\n' ]);3591 fprintf(fid, ['LastImage ' regexprep(filename_ima_1,'\\','\\\\') '\n' ]);3592 fprintf(fid, ['XX' '\n' ]);3593 fprintf(fid, ['Mask ' maskflag '\n' ]);3594 fprintf(fid, ['MaskName ' maskname '\n' ]);3595 fprintf(fid, ['ImageSize ' npx ' ' npy '\n' ]); %VERIFIER CAS GENERAL ?3596 fprintf(fid, ['CorrelationBoxesSize ' ibx ' ' iby '\n' ]);3597 fprintf(fid, ['SearchBoxeSize ' isx ' ' isy '\n' ]);3598 fprintf(fid, ['RO ' rho '\n' ]);3599 fprintf(fid, ['GridSpacing ' dx ' ' dy '\n' ]);3600 fprintf(fid, ['XX 1.0' '\n' ]);3601 fprintf(fid, ['Dt_TO ' Dt ' ' T0 '\n' ]);3602 fprintf(fid, ['PixCmXY ' pxcmx ' ' pxcmy '\n' ]);3603 fprintf(fid, ['XX 1' '\n' ]);3604 fprintf(fid, ['ShiftXY ' shiftx ' ' shifty '\n' ]);3605 fprintf(fid, ['Grid ' gridflag '\n' ]);3606 fprintf(fid, ['GridName ' gridname '\n' ]);3607 fprintf(fid, ['XX 85' '\n' ]);3608 fprintf(fid, ['XX 1.0' '\n' ]);3609 fprintf(fid, ['XX 1.0' '\n' ]);3610 fprintf(fid, ['Hart 1' '\n' ]);3611 fprintf(fid, [ 'DecimalShift 0' '\n' ]);3612 fprintf(fid, ['Deformation 0' '\n' ]);3613 fprintf(fid, ['CorrelationMin 0' '\n' ]);3614 fprintf(fid, ['IntensityMin 0' '\n' ]);3615 fprintf(fid, ['SeuilImage n' '\n' ]);3616 fprintf(fid, ['SeuilImageValues 0 4096' '\n' ]);3617 fprintf(fid, ['ImageToUse ' term_a ' ' term_b '\n' ]); % VERIFIER ?3618 fprintf(fid, ['ImageUsedBefore null null' '\n' ]);3619 fclose(fid);3620 3621 s=-1; 3555 maskflag='n'; 3556 end 3557 end 3558 textcmx={'############## CMX file';... 3559 ['FirstImage ' filename_ima];... 3560 ['LastImage ' filename_ima_1];... 3561 'XX' ;... 3562 ['Mask ' maskflag] ;... 3563 ['MaskName ' maskname];... 3564 ['ImageSize ' npx ' ' npy];... %VERIFIER CAS GENERAL ? 3565 ['CorrelationBoxesSize ' ibx ' ' iby];... 3566 ['SearchBoxeSize ' isx ' ' isy];... 3567 ['RO ' rho];... 3568 ['GridSpacing ' dx ' ' dy];... 3569 'XX 1.0';... 3570 ['Dt_TO ' Dt ' ' T0];... 3571 ['PixCmXY ' pxcmx ' ' pxcmy];... 3572 'XX 1';... 3573 ['ShiftXY ' shiftx ' ' shifty];... 3574 ['Grid ' gridflag];... 3575 ['GridName ' gridname] ;... 3576 'XX 85';... 3577 'XX 1.0';... 3578 'XX 1.0';... 3579 'Hart 1';... 3580 'DecimalShift 0';... 3581 'Deformation 0';... 3582 'CorrelationMin 0';... 3583 'IntensityMin 0';... 3584 ['SeuilImage ' threshflag];... 3585 ['SeuilImageValues ' min_ima ' ' max_ima];... 3586 ['ImageToUse ' term_a ' ' term_b];... % VERIFIER ? 3587 'ImageUsedBefore null null'}; 3588 textout=char(textcmx); 3589 % dlmwrite(filename_cmx,textout,''); 3590 fid=fopen([filename_cmx],'w'); 3591 fprintf(fid, ['############## CMX file' '\n']); 3592 fprintf(fid, ['FirstImage ' regexprep(filename_ima,'\\','\\\\') '\n' ]); 3593 fprintf(fid, ['LastImage ' regexprep(filename_ima_1,'\\','\\\\') '\n' ]); 3594 fprintf(fid, ['XX' '\n' ]); 3595 fprintf(fid, ['Mask ' maskflag '\n' ]); 3596 fprintf(fid, ['MaskName ' maskname '\n' ]); 3597 fprintf(fid, ['ImageSize ' npx ' ' npy '\n' ]); %VERIFIER CAS GENERAL ? 3598 fprintf(fid, ['CorrelationBoxesSize ' ibx ' ' iby '\n' ]); 3599 fprintf(fid, ['SearchBoxeSize ' isx ' ' isy '\n' ]); 3600 fprintf(fid, ['RO ' rho '\n' ]); 3601 fprintf(fid, ['GridSpacing ' dx ' ' dy '\n' ]); 3602 fprintf(fid, ['XX 1.0' '\n' ]); 3603 fprintf(fid, ['Dt_TO ' Dt ' ' T0 '\n' ]); 3604 fprintf(fid, ['PixCmXY ' pxcmx ' ' pxcmy '\n' ]); 3605 fprintf(fid, ['XX 1' '\n' ]); 3606 fprintf(fid, ['ShiftXY ' shiftx ' ' shifty '\n' ]); 3607 fprintf(fid, ['Grid ' gridflag '\n' ]); 3608 fprintf(fid, ['GridName ' gridname '\n' ]); 3609 fprintf(fid, ['XX 85' '\n' ]); 3610 fprintf(fid, ['XX 1.0' '\n' ]); 3611 fprintf(fid, ['XX 1.0' '\n' ]); 3612 fprintf(fid, ['Hart 1' '\n' ]); 3613 fprintf(fid, [ 'DecimalShift 0' '\n' ]); 3614 fprintf(fid, ['Deformation 0' '\n' ]); 3615 fprintf(fid, ['CorrelationMin 0' '\n' ]); 3616 fprintf(fid, ['IntensityMin 0' '\n' ]); 3617 fprintf(fid, ['SeuilImage n' '\n' ]); 3618 fprintf(fid, ['SeuilImageValues 0 4096' '\n' ]); 3619 fprintf(fid, ['ImageToUse ' term_a ' ' term_b '\n' ]); % VERIFIER ? 3620 fprintf(fid, ['ImageUsedBefore null null' '\n' ]); 3621 fclose(fid); 3622 3623 s=-1; 3622 3624 display(['!' civ1Bin ' -f ' filename_cmx ' > ' namelog ]) 3623 3625 eval(['!' civ1Bin ' -f ' filename_cmx ' > ' namelog ]); 3624 % if sge%dispatch computation on the cluster using interactive queue3625 % % [s,w] = unix(['qrsh -q fast.q ' civ1Bin ' -f ' filename_cmx ' > ' namelog ' 2>&1' ]);3626 % end 3627 % if s~=03628 % % ['!' civ1Bin ' -f ' filename_cmx ' > ' namelog]3629 % % eval(['!' civ1Bin ' -f ' filename_cmx ' > ' namelog]); 3630 % end3626 % if sge%dispatch computation on the cluster using interactive queue 3627 % % [s,w] = unix(['qrsh -q fast.q ' civ1Bin ' -f ' filename_cmx ' > ' namelog ' 2>&1' ]); 3628 % end 3629 % if s~=0 3630 % % ['!' civ1Bin ' -f ' filename_cmx ' > ' namelog] 3631 % % eval(['!' civ1Bin ' -f ' filename_cmx ' > ' namelog]); 3632 % end 3631 3633 end 3632 3634 end … … 3639 3641 % %filecell_3: names of second images 3640 3642 % global civ2Bin sge 3641 % 3643 % 3642 3644 % %names of the civ2 fields 3643 3645 % field.vel_type='civ2'; … … 3647 3649 % field.U='vec2_U'; 3648 3650 % field.V='vec2_V'; 3649 % 3651 % 3650 3652 % %get civ parameters 3651 3653 % ibx=get(handles.ibx_civ2,'String'); … … 3679 3681 % if numel(gridname)>4 && isequal(gridname(end-3:end),'grid') 3680 3682 % nbslice_grid=str2num(gridname(1:end-4)); % 3681 % if ~isempty(nbslice_grid) 3682 % gridflag='y'; 3683 % if ~isempty(nbslice_grid) 3684 % gridflag='y'; 3683 3685 % end 3684 3686 % elseif exist(gridname,'file') … … 3692 3694 % nbfield=sizcell(1); 3693 3695 % nbslice=sizcell(2); 3694 % 3696 % 3695 3697 % %main loop 3696 3698 % icount=0; … … 3708 3710 % filename_cmx([end-1:end])=[ 'cm'];%name of cmx file 3709 3711 % filename_cmx=[filename_cmx 'x']; 3710 % namelog=[filename_cmx([1:end-3]) 'log']; 3712 % namelog=[filename_cmx([1:end-3]) 'log']; 3711 3713 % if size(time,1)>=num2(ifile) & size(time,2)>=num_b(j) 3712 3714 % Dt=num2str(time(num2(ifile),num_b(j))-time(num1(ifile),num_a(j))); … … 3718 3720 % Dt='1'; 3719 3721 % T0='0'; 3720 % end 3722 % end 3721 3723 % term_a=num2stra(num_a(j),nom_type_nc); 3722 3724 % term_b=num2stra(num_b(j),nom_type_nc); 3723 3725 % filename_nc1=cell2mat(filecell_nc1(ifile,j)); 3724 % filename_nc1([end-2:end])=[]; % remove '.nc' 3725 % if test_grid && ~isempty(nbslice_grid) 3726 % filename_nc1([end-2:end])=[]; % remove '.nc' 3727 % if test_grid && ~isempty(nbslice_grid) 3726 3728 % num1_grid=mod(num1(ifile)-1,nbslice_grid)+1; 3727 3729 % gridname=[filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')]; … … 3730 3732 % return 3731 3733 % end 3732 % end 3734 % end 3733 3735 % test_mask=get(handles.get_mask_civ2,'Value'); 3734 % if test_mask==0 3736 % if test_mask==0 3735 3737 % maskname='noFile use default'; 3736 3738 % maskflag='n'; 3737 3739 % else 3738 3740 % maskdispl=get(handles.mask_civ2,'String'); 3739 % maskbase=[filebase '_' maskdispl]; % 3740 % nbslice_mask=str2num(maskdispl(1:end-4)); % 3741 % maskbase=[filebase '_' maskdispl]; % 3742 % nbslice_mask=str2num(maskdispl(1:end-4)); % 3741 3743 % num1_mask=mod(num1(ifile)-1,nbslice_mask)+1; 3742 3744 % maskname =name_generator(maskbase,num1_mask,1,'.png','_i'); 3743 3745 % if ~exist(maskname,'file') 3744 % maskflag='y'; 3746 % maskflag='y'; 3745 3747 % else 3746 3748 % maskname='noFile use default'; 3747 % maskflag='n'; 3749 % maskflag='n'; 3748 3750 % end 3749 3751 % end 3750 % 3752 % 3751 3753 % textcmx={'############## CMX file';... 3752 3754 % ['FirstImage ' filename_ima_2];... … … 3755 3757 % ['Mask ' maskflag];... 3756 3758 % ['MaskName ' maskname];... 3757 % ['ImageSize ' npx ' ' npy];... 3759 % ['ImageSize ' npx ' ' npy];... 3758 3760 % ['CorrelationBoxesSize ' ibx ' ' iby];... 3759 3761 % ['SearchBoxeSize ' ibx ' ' iby];... … … 3780 3782 % ['ImageUsedBefore ' filename_nc1]}; 3781 3783 % textout=char(textcmx); 3782 % dlmwrite(filename_cmx,textout,''); 3783 % s=-1; 3784 % dlmwrite(filename_cmx,textout,''); 3785 % s=-1; 3784 3786 % display(['!' civ2Bin ' -f ' filename_cmx ' > ' namelog ]) 3785 % eval(['!' civ2Bin ' -f ' filename_cmx ' > ' namelog ]); 3786 % 3787 % eval(['!' civ2Bin ' -f ' filename_cmx ' > ' namelog ]); 3788 % 3787 3789 % % if sge%dispatch computation on the cluster using interactive queue 3788 3790 % % [s,w] = unix(['qrsh -q fast.q ' civ2Bin ' -f ' filename_cmx ' > ' namelog ' 2>&1']); 3789 % % end 3791 % % end 3790 3792 % % if s~=0 3791 3793 % % eval(['!' civ2Bin ' -f ' filename_cmx ' > ' namelog]); 3792 3794 % % ['!' civ2Bin ' -f ' filename_cmx ' > ' namelog] 3793 % % end 3795 % % end 3794 3796 % end 3795 3797 % end 3796 % % close(h) 3798 % % close(h) 3797 3799 3798 3800 %------------------------------------------------------------------------ … … 3800 3802 function cmd_PATCH=PATCH_CMD(filename_nc,nx_patch,ny_patch,rho_patch,subdomain_patch,thresh_value,test_interp,PatchBin) 3801 3803 %------------------------------------------------------------------------ 3802 3803 3804 3805 3806 3807 3808 3809 3804 namelog=[filename_nc([1:end-3]) '_patch.log']; 3805 if test_interp==0 3806 cmd_PATCH=[PatchBin ' -f ' filename_nc ' -m ' nx_patch ' -n ' ny_patch ' -ro ' rho_patch ' -nopt ' subdomain_patch ... 3807 ' > ' namelog ' 2>&1']; % redirect standard output to the log file 3808 else %nouveau programme patch 3809 cmd_PATCH=[PatchBin ' -f ' filename_nc ' -m ' nx_patch ' -n ' ny_patch ' -ro ' rho_patch ... 3810 ' -max ' thresh_value ' -nopt ' subdomain_patch ' > ' namelog ' 2>&1']; % redirect standard output to the log file 3811 end 3810 3812 3811 3813 %------------------------------------------------------------------------ … … 3922 3924 num_a=1; 3923 3925 num_b=1; 3924 elseif isequal (mode, 'series(Dj)') 3926 elseif isequal (mode, 'series(Dj)') 3925 3927 num1=1; 3926 3928 num2=1; … … 3959 3961 subdir=get(handles.subdir_civ1,'String'); 3960 3962 set(handles.subdir_civ2,'String',subdir); 3961 if get(handles.CIV1,'Value')==0 3963 if get(handles.CIV1,'Value')==0 3962 3964 find_netcpair_civ1(hObject, eventdata, handles); %update the list of available pairs from netcdf files in the new directory 3963 3965 end … … 3984 3986 [ nbslice_mask, flag_mask]=get_mask(filebase,handles); 3985 3987 if isequal(flag_mask,1) 3986 3988 mask_displ=[num2str(nbslice_mask) 'mask']; 3987 3989 elseif get(handles.compare,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series 3988 3989 3990 3991 3992 3993 3990 common_path=fileparts(filebase); 3991 filebase_a=fullfile(common_path,get(handles.RootName_1,'String')); 3992 [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); 3993 if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice_mask) 3994 mask_displ='no mask'; 3995 end 3994 3996 end 3995 3997 if isequal(mask_displ,'no mask') 3996 3998 [FileName, PathName, filterindex] = uigetfile( ... 3997 3998 3999 4000 4001 mask_displ=fullfile(PathName,FileName); 3999 {'*.png', ' (*.png)'; 4000 '*.png', '.png files '; ... 4001 '*.*', 'All Files (*.*)'}, ... 4002 'Pick a mask file *.png',filebase); 4003 mask_displ=fullfile(PathName,FileName); 4002 4004 if ~exist(mask_displ,'file') 4003 4005 mask_displ='no mask'; … … 4028 4030 set(handles.mask_fix1,'String','') 4029 4031 else 4030 mask_displ='no mask'; %default4031 filebase=get(handles.RootName,'String');4032 [nbslice, flag_mask]=get_mask(filebase,handles);4033 if isequal(flag_mask,1)4034 mask_displ=[num2str(nbslice) 'mask'];4035 elseif get(handles.compare,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series4032 mask_displ='no mask'; %default 4033 filebase=get(handles.RootName,'String'); 4034 [nbslice, flag_mask]=get_mask(filebase,handles); 4035 if isequal(flag_mask,1) 4036 mask_displ=[num2str(nbslice) 'mask']; 4037 elseif get(handles.compare,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series 4036 4038 filebase_a=get(handles.RootName_1,'String'); 4037 4039 [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); … … 4039 4041 mask_displ='no mask'; 4040 4042 end 4041 end4042 if isequal(mask_displ,'no mask')4043 [FileName, PathName, filterindex] = uigetfile( ...4044 {'*.png', ' (*.png)';4043 end 4044 if isequal(mask_displ,'no mask') 4045 [FileName, PathName, filterindex] = uigetfile( ... 4046 {'*.png', ' (*.png)'; 4045 4047 '*.png', '.png files '; ... 4046 4048 '*.*', 'All Files (*.*)'}, ... 4047 4049 'Pick a mask file *.png',filebase); 4048 mask_displ=fullfile(PathName,FileName);4049 if ~exist(mask_displ,'file')4050 mask_displ='no mask';4051 end4052 end4053 if isequal(mask_displ,'no mask')4054 set(handles.get_mask_fix1,'Value',0)4055 set(handles.get_mask_civ2,'Value',0)4056 set(handles.get_mask_fix2,'Value',0)4057 else4058 %set(handles.get_mask_civ2,'Value',1)4059 set(handles.get_mask_fix2,'Value',1)4060 end 4061 set(handles.mask_fix1,'String',mask_displ)4062 set(handles.mask_civ2,'String',mask_displ)4063 set(handles.mask_fix2,'String',mask_displ)4050 mask_displ=fullfile(PathName,FileName); 4051 if ~exist(mask_displ,'file') 4052 mask_displ='no mask'; 4053 end 4054 end 4055 if isequal(mask_displ,'no mask') 4056 set(handles.get_mask_fix1,'Value',0) 4057 set(handles.get_mask_civ2,'Value',0) 4058 set(handles.get_mask_fix2,'Value',0) 4059 else 4060 %set(handles.get_mask_civ2,'Value',1) 4061 set(handles.get_mask_fix2,'Value',1) 4062 end 4063 set(handles.mask_fix1,'String',mask_displ) 4064 set(handles.mask_civ2,'String',mask_displ) 4065 set(handles.mask_fix2,'String',mask_displ) 4064 4066 end 4065 4067 … … 4072 4074 set(handles.mask_civ2,'String','') 4073 4075 else 4074 mask_displ='no mask'; %default4075 filebase=get(handles.RootName,'String');4076 [nbslice, flag_mask]=get_mask(filebase,handles);4077 if isequal(flag_mask,1)4078 mask_displ=[num2str(nbslice) 'mask'];4079 elseif get(handles.compare,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series4076 mask_displ='no mask'; %default 4077 filebase=get(handles.RootName,'String'); 4078 [nbslice, flag_mask]=get_mask(filebase,handles); 4079 if isequal(flag_mask,1) 4080 mask_displ=[num2str(nbslice) 'mask']; 4081 elseif get(handles.compare,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series 4080 4082 filebase_a=get(handles.RootName_1,'String'); 4081 4083 [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); … … 4083 4085 mask_displ='no mask'; 4084 4086 end 4085 end4086 if isequal(mask_displ,'no mask')4087 [FileName, PathName, filterindex] = uigetfile( ...4088 {'*.png', ' (*.png)';4087 end 4088 if isequal(mask_displ,'no mask') 4089 [FileName, PathName, filterindex] = uigetfile( ... 4090 {'*.png', ' (*.png)'; 4089 4091 '*.png', '.png files '; ... 4090 4092 '*.*', 'All Files (*.*)'}, ... 4091 4093 'Pick a mask file *.png',filebase); 4092 mask_displ=fullfile(PathName,FileName);4093 if ~exist(mask_displ,'file')4094 mask_displ='no mask';4095 end4096 end4097 if isequal(mask_displ,'no mask')4098 set(handles.get_mask_civ2,'Value',0)4099 set(handles.get_mask_fix2,'Value',0)4100 else4101 set(handles.get_mask_fix2,'Value',1)4102 end 4103 set(handles.mask_civ2,'String',mask_displ)4104 set(handles.mask_fix2,'String',mask_displ)4094 mask_displ=fullfile(PathName,FileName); 4095 if ~exist(mask_displ,'file') 4096 mask_displ='no mask'; 4097 end 4098 end 4099 if isequal(mask_displ,'no mask') 4100 set(handles.get_mask_civ2,'Value',0) 4101 set(handles.get_mask_fix2,'Value',0) 4102 else 4103 set(handles.get_mask_fix2,'Value',1) 4104 end 4105 set(handles.mask_civ2,'String',mask_displ) 4106 set(handles.mask_fix2,'String',mask_displ) 4105 4107 end 4106 4108 … … 4117 4119 [nbslice, flag_mask]=get_mask(filebase,handles); 4118 4120 if isequal(flag_mask,1) 4119 4121 mask_displ=[num2str(nbslice) 'mask']; 4120 4122 elseif get(handles.compare,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series 4121 4122 4123 4124 4125 4123 filebase_a=get(handles.RootName_1,'String'); 4124 [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); 4125 if isequal(flag_mask_a,0) | ~isequal(nbslice_a,nbslice) 4126 mask_displ='no mask'; 4127 end 4126 4128 end 4127 4129 if isequal(mask_displ,'no mask') 4128 4130 [FileName, PathName, filterindex] = uigetfile( ... 4129 4130 4131 4132 4133 mask_displ=fullfile(PathName,FileName); 4131 {'*.png', ' (*.png)'; 4132 '*.png', '.png files '; ... 4133 '*.*', 'All Files (*.*)'}, ... 4134 'Pick a mask file *.png',filebase); 4135 mask_displ=fullfile(PathName,FileName); 4134 4136 if ~exist(mask_displ,'file') 4135 4137 mask_displ='no mask'; … … 4138 4140 if isequal(mask_displ,'no mask') 4139 4141 set(handles.get_mask_fix2,'Value',0) 4140 end 4142 end 4141 4143 set(handles.mask_fix2,'String',mask_displ) 4142 4144 end … … 4146 4148 function [nbslice, flag_mask]=get_mask(filebase,handles) 4147 4149 %------------------------------------------------------------------------ 4148 %detect mask files, images with appropriate file base 4150 %detect mask files, images with appropriate file base 4149 4151 %[filebase '_' xx 'mask'], xx=nbslice 4150 4152 %flag_mask=1 indicates detection … … 4164 4166 cd(currentdir);%come back to the current working directory 4165 4167 if ~isempty(maskfiles) 4166 % msgbox_uvmat('ERROR','no mask available, to create it use Tools/Make mask in the upper menu bar of uvmat')4167 % else4168 % msgbox_uvmat('ERROR','no mask available, to create it use Tools/Make mask in the upper menu bar of uvmat') 4169 % else 4168 4170 flag_mask=1; 4169 4171 maskname=maskfiles(1).name;% take the first mask file in the list … … 4174 4176 i=ind_mask-1; 4175 4177 while val(i)==0 & i>0 4176 i=i-1;4178 i=i-1; 4177 4179 end 4178 4180 nbslice=str2num(Name(i+1:ind_mask-1)); 4179 4181 if ~isequal(nbslice,[]) & Name(i)=='_' 4180 4182 flag_mask=1; 4181 4183 else 4182 4183 4184 4185 end 4186 end 4184 msgbox_uvmat('ERROR',['bad mask file ' Name ext ' found in ' Path2]) 4185 return 4186 nbslice=1; 4187 end 4188 end 4187 4189 4188 4190 %------------------------------------------------------------------------ … … 4206 4208 i=ind_mask-1; 4207 4209 while val(i)==0 & i>0 4208 i=i-1;4210 i=i-1; 4209 4211 end 4210 4212 nbslice=str2num(Name(i+1:ind_mask-1)); 4211 4213 if ~isequal(nbslice,[]) & Name(i)=='_' 4212 4214 flag_mask=1; 4213 4215 else 4214 4215 4216 4216 msgbox_uvmat('ERROR',['bad grid file ' Name ext ' found in ' Path2]) 4217 return 4218 nbslice=1; 4217 4219 end 4218 4220 end … … 4286 4288 testgrid=0; 4287 4289 if value 4288 4290 filebase=get(handles.RootName,'String'); 4289 4291 [nbslice, flag_grid]=get_grid(filebase,handles); 4290 4292 if isequal(flag_grid,1) 4291 filegrid=[num2str(nbslice) 'grid'];4292 testgrid=1;4293 else 4293 filegrid=[num2str(nbslice) 'grid']; 4294 testgrid=1; 4295 else 4294 4296 [FileName, PathName, filterindex] = uigetfile( ... 4295 4296 4297 4298 4297 {'*.grid', ' (*.grid)'; 4298 '*.grid', '.grid files '; ... 4299 '*.*', 'All Files (*.*)'}, ... 4300 'Pick a file',filebase); 4299 4301 filegrid=fullfile(PathName,FileName); 4300 4302 if ~(isempty(FileName)||isempty(PathName)||isequal(FileName,0)||~exist(filegrid,'file')) 4301 4303 testgrid=1; 4302 4304 end 4303 end 4305 end 4304 4306 end 4305 4307 if testgrid 4306 4307 4308 4309 4310 4311 4312 4313 set(handles.grid_civ1,'String',filegrid)4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 set(handles.grid_civ1,'String','')4327 4328 4329 4308 set(handles.browse_gridciv2,'Value',1) 4309 set(handles.get_gridpatch1,'Value',1) 4310 set(handles.get_gridpatch2,'Value',1) 4311 set(handles.dx_civ1,'Visible','off'); 4312 set(handles.dy_civ1,'Visible','off'); 4313 set(handles.dx_civ2,'Visible','off'); 4314 set(handles.dy_civ2,'Visible','off'); 4315 set(handles.grid_civ1,'String',filegrid) 4316 set(handles.grid_patch1,'String',filegrid) 4317 set(handles.grid_civ2,'String',filegrid) 4318 set(handles.grid_patch2,'String',filegrid) 4319 else 4320 set(handles.browse_gridciv1,'Value',0); 4321 set(handles.browse_gridciv2,'Value',0); 4322 set(handles.get_gridpatch1,'Value',0) 4323 set(handles.get_gridpatch2,'Value',0) 4324 set(handles.dx_civ1,'Visible','on'); 4325 set(handles.dy_civ1,'Visible','on'); 4326 set(handles.dx_civ2,'Visible','on'); 4327 set(handles.dy_civ2,'Visible','on'); 4328 set(handles.grid_civ1,'String','') 4329 set(handles.grid_patch1,'String','') 4330 set(handles.grid_civ2,'String','') 4331 set(handles.grid_patch2,'String','') 4330 4332 end 4331 4333 … … 4336 4338 value=get(handles.browse_gridciv2,'Value'); 4337 4339 if value 4338 4340 filebase=get(handles.RootName,'String'); 4339 4341 [nbslice, flag_grid]=get_grid(filebase,handles); 4340 4342 if isequal(flag_grid,1) … … 4343 4345 set(handles.dx_civ2,'Visible','off'); 4344 4346 set(handles.dy_civ2,'Visible','off'); 4345 else 4347 else 4346 4348 [FileName, PathName, filterindex] = uigetfile( ... 4347 4348 4349 4350 4349 {'*.grid', ' (*.grid)'; 4350 '*.grid', '.grid files '; ... 4351 '*.*', 'All Files (*.*)'}, ... 4352 'Pick a file',filebase); 4351 4353 filegrid=fullfile(PathName,FileName); 4352 4354 if isempty(FileName)|isempty(PathName)|isequal(FileName,0)|~exist(filegrid,'file') … … 4365 4367 else 4366 4368 set(handles.grid_civ2,'string',''); 4367 4368 4369 4369 set(handles.dx_civ2,'Visible','on'); 4370 set(handles.dy_civ2,'Visible','on'); 4371 set(handles.grid_civ2,'string',''); 4370 4372 end 4371 4373 4372 4374 % % --- Executes on button press in browse_gridciv2. 4373 4375 % function browse_gridciv2_Callback(hObject, eventdata, handles) 4374 % 4376 % 4375 4377 % filebase=get(handles.RootName,'String'); 4376 4378 % [FileName, PathName, filterindex] = uigetfile( ... … … 4393 4395 filebase=get(handles.RootName,'String'); 4394 4396 [FileName, PathName, filterindex] = uigetfile( ... 4395 4396 4397 4398 4397 {'*.grid', ' (*.grid)'; 4398 '*.grid', '.grid files '; ... 4399 '*.*', 'All Files (*.*)'}, ... 4400 'Pick a file',filebase); 4399 4401 filegrid=fullfile(PathName,FileName); 4400 4402 set(handles.grid_patch1,'string',filegrid); … … 4508 4510 set(handles.nx_patch1_title,'Visible','on') 4509 4511 set(handles.ny_patch1_title,'Visible','on') 4510 % if ~isempty(patch_newBin) 4512 % if ~isempty(patch_newBin) 4511 4513 % set(handles.test_interp,'Visible','on'); 4512 4514 % end … … 4578 4580 set(handles.MaxIma2,'Visible','off') 4579 4581 set(handles.ImaThreshold2,'Value',0) 4580 if isequal(get(handles.FIX2,'Value'),0) & isequal(get(handles.PATCH2,'Value'),0) 4582 if isequal(get(handles.FIX2,'Value'),0) & isequal(get(handles.PATCH2,'Value'),0) 4581 4583 set(handles.list_pair_civ2,'Visible','off') 4582 4584 set(handles.subdir_civ2,'Visible','off') … … 4640 4642 set(handles.inf_sup2,'Visible','off') 4641 4643 set(handles.field_ref2,'Visible','off') 4642 if isequal(get(handles.CIV2,'Value'),0) & isequal(get(handles.PATCH2,'Value'),0) 4644 if isequal(get(handles.CIV2,'Value'),0) & isequal(get(handles.PATCH2,'Value'),0) 4643 4645 set(handles.list_pair_civ2,'Visible','off') 4644 4646 set(handles.subdir_civ2,'Visible','off') … … 4682 4684 set(handles.get_gridpatch2,'Visible','off') 4683 4685 set(handles.grid_patch2,'Visible','off') 4684 if isequal(get(handles.CIV2,'Value'),0) & isequal(get(handles.FIX2,'Value'),0) 4686 if isequal(get(handles.CIV2,'Value'),0) & isequal(get(handles.FIX2,'Value'),0) 4685 4687 set(handles.list_pair_civ2,'Visible','off') 4686 4688 set(handles.subdir_civ2,'Visible','off') … … 4719 4721 par.shifty=get(handles.shifty,'String'); 4720 4722 if isempty(str2num(par.isx)) 4721 4722 4723 par.isx='41';%default 4724 set(handles.isx,'String','41'); 4723 4725 end 4724 4726 if isempty(str2num(par.isy)) 4725 4726 4727 par.isy='41'; %default 4728 set(handles.isy,'String','41'); 4727 4729 end 4728 4730 if isempty(str2num(par.shiftx)) 4729 4730 4731 end 4731 par.shiftx='0';%default 4732 set(handles.shiftx,'String','0'); 4733 end 4732 4734 if isempty(str2num(par.shifty)) 4733 4734 4735 end 4736 4737 4738 4739 if isequal(str2num(par.dx),[]) 4740 4741 4742 4735 par.shifty='0'; %default 4736 set(handles.shifty,'String','0'); 4737 end 4738 par.rho=get(handles.rho,'String'); 4739 par.dx=get(handles.dx_civ1,'String'); 4740 par.dy=get(handles.dy_civ1,'String'); 4741 if isequal(str2num(par.dx),[]) 4742 if isempty(get(handles.grid_civ1,'String')); 4743 par.dx='0'; %just read by civ program, not used 4744 else 4743 4745 par.dx='20';%default 4744 4746 set(handles.dx_civ1,'String','20'); 4745 4746 4747 4748 4749 4750 4747 end 4748 end 4749 if isequal(str2num(par.dy),[]) 4750 if isempty(get(handles.grid_civ1,'String')); 4751 par.dy='0';%just read by civ program, not used 4752 else 4751 4753 par.dy='20';%default 4752 4754 set(handles.dy_civ1_title,'String','20'); 4753 4754 4755 4756 4755 end 4756 end 4757 par.pxcmx='1'; %velocities are expressed in pixel dispalcement 4758 par.pxcmy='1'; 4757 4759 % end 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4760 A=imread(file_ima);%read the first image to get the size 4761 sizim=size(A); 4762 par.npx=num2str(sizim(2)); 4763 par.npy=num2str(sizim(1)); 4764 time=get(handles.RootName,'UserData'); %get the set of times 4765 par.gridname=get(handles.grid_civ1,'String'); 4766 par.gridflag='y'; 4767 if isequal(par.gridname,'')| isempty(par.gridname) 4768 par.gridname='nogrid'; 4769 par.gridflag='n'; 4770 end 4769 4771 4770 4772 %------------------------------------------------------------------------ … … 4778 4780 par.dx=get(handles.dx_civ2,'String'); 4779 4781 par.dy=get(handles.dy_civ2,'String'); 4780 if isequal(str2num(par.dx),[]) 4781 4782 4783 4782 if isequal(str2num(par.dx),[]) 4783 if isempty(get(handles.grid_civ2,'String')); 4784 par.dx='0'; %just read by civ program, not used 4785 else 4784 4786 par.dx='20';%default 4785 4787 set(handles.dx_civ2,'String','20'); 4786 4787 4788 4789 4790 4791 4788 end 4789 end 4790 if isequal(str2num(par.dy),[]) 4791 if isempty(get(handles.grid_civ2,'String')); 4792 par.dy='0';%just read by civ program, not used 4793 else 4792 4794 par.dy='20';%default 4793 4795 set(handles.dy_civ2,'String','20'); 4794 4795 4796 4797 4796 end 4797 end 4798 par.pxcmx='1'; 4799 par.pxcmy='1'; 4798 4800 A=imread(file_ima);%read the first image to get the size 4799 4801 sizim=size(A); … … 4816 4818 %changes : filename_cmx -> filename ( no extension ) 4817 4819 4818 4819 4820 end 4821 % 4820 if isequal(par.Dt,'0') 4821 par.Dt='1' ;%case of 'displacement' mode 4822 end 4823 % 4822 4824 % textcmx={'############## CMX file';... 4823 4825 % ['FirstImage ' par.filename_ima_a];... … … 4850 4852 % ['ImageToUse ' par.term_a ' ' par.term_b];... % VERIFIER ? 4851 4853 % 'ImageUsedBefore null null'}; 4852 % 4854 % 4853 4855 % textout=char(textcmx); 4854 4856 par.filename_ima_a=regexprep(par.filename_ima_a,'.png',''); … … 4856 4858 fid=fopen([filename '.cmx'],'w'); 4857 4859 fprintf(fid,['############## CMX file' '\n' ]); 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4860 fprintf(fid, ['FirstImage ' regexprep(par.filename_ima_a,'\\','\\\\') '\n' ]);% for windows compatibility 4861 fprintf(fid, ['LastImage ' regexprep(par.filename_ima_b,'\\','\\\\') '\n' ]);% for windows compatibility 4862 fprintf(fid, ['XX' '\n' ]); 4863 fprintf(fid, ['Mask ' par.maskflag '\n' ]); 4864 fprintf(fid, ['MaskName ' regexprep(par.maskname,'\\','\\\\') '\n' ]); 4865 fprintf(fid, ['ImageSize ' par.npx ' ' par.npy '\n' ]); %VERIFIER CAS GENERAL ? 4866 fprintf(fid, ['CorrelationBoxesSize ' par.ibx ' ' par.iby '\n' ]); 4867 fprintf(fid, ['SearchBoxeSize ' par.isx ' ' par.isy '\n' ]); 4868 fprintf(fid, ['RO ' par.rho '\n' ]); 4869 fprintf(fid, ['GridSpacing ' par.dx ' ' par.dy '\n' ]); 4870 fprintf(fid, ['XX 1.0' '\n' ]); 4871 fprintf(fid, ['Dt_TO ' par.Dt ' ' par.T0 '\n' ]); 4872 fprintf(fid, ['PixCmXY ' par.pxcmx ' ' par.pxcmy '\n' ]); 4873 fprintf(fid, ['XX 1' '\n' ]); 4874 fprintf(fid, ['ShiftXY ' par.shiftx ' ' par.shifty '\n' ]); 4875 fprintf(fid, ['Grid ' par.gridflag '\n' ]); 4876 fprintf(fid, ['GridName ' regexprep(par.gridname,'\\','\\\\') '\n' ]); 4877 fprintf(fid, ['XX 85' '\n' ]); 4878 fprintf(fid, ['XX 1.0' '\n' ]); 4879 fprintf(fid, ['XX 1.0' '\n' ]); 4880 fprintf(fid, ['Hart 1' '\n' ]); 4881 fprintf(fid, [ 'DecimalShift 0' '\n' ]); 4882 fprintf(fid, ['Deformation 0' '\n' ]); 4883 fprintf(fid, ['CorrelationMin 0' '\n' ]); 4884 fprintf(fid, ['IntensityMin 0' '\n' ]); 4885 fprintf(fid, ['SeuilImage n' '\n' ]); 4886 fprintf(fid, ['SeuilImageValues 0 4096' '\n' ]); 4887 fprintf(fid, ['ImageToUse ' par.term_a ' ' par.term_b '\n' ]); % VERIFIER ? 4888 fprintf(fid, ['ImageUsedBefore null null' '\n' ]); 4887 4889 fclose(fid); 4888 4890 4889 4891 cmd_CIV1=[sparam.Civ1Bin ' -f ' filename '.cmx' ]; % redirect standard output to the log file 4890 4892 cmd_CIV1=regexprep(cmd_CIV1,'\\','\\\\'); … … 4906 4908 %global CivBin%name of the executable for civ1 calculation 4907 4909 4908 4909 4910 civ1.imageSize_X=par.npx; 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4910 civ1.image1=par.filename_ima_a; 4911 civ1.image2=par.filename_ima_b; 4912 civ1.imageSize_X=par.npx; 4913 civ1.imageSize_Y=par.npy; 4914 civ1.outputFileName=[filename '.nc']; 4915 civ1.correlationBoxesSize_X=par.ibx; 4916 civ1.correlationBoxesSize_Y=par.iby; 4917 civ1.searchBoxesSize_X=par.isx; 4918 civ1.searchBoxesSize_Y=par.isy; 4919 civ1.globalShift_X=par.shiftx; 4920 civ1.globalShift_Y=par.shifty; 4921 civ1.ro=par.rho; 4922 civ1.hart='y'; 4923 if isequal(par.gridflag,'y') 4924 civ1.grid=par.gridname; 4925 else 4926 civ1.grid='n'; 4927 civ1.gridSpacing_X=par.dx; 4928 civ1.gridSpacing_Y=par.dy; 4929 end 4930 if isequal(par.maskflag,'y') 4931 civ1.mask=par.maskname; 4932 end 4933 civ1.dt=par.Dt; 4934 civ1.unit='pixel'; 4935 civ1.absolut_time_T0=par.T0; 4936 civ1.pixcmx=par.pxcmx; 4937 civ1.pixcmy=par.pxcmy; 4938 civ1.convectFlow='n'; 4939 4940 xml_civ1_parameters=civ1; 4939 4941 4940 4942 %------------------------------------------------------------------------ … … 4947 4949 civ2.image1=par.filename_ima_a; 4948 4950 civ2.image2=par.filename_ima_b; 4949 civ2.imageSize_X=par.npx; 4951 civ2.imageSize_X=par.npx; 4950 4952 civ2.imageSize_Y=par.npy; 4951 4953 civ2.inputFileName=[par.filename_nc1 '.nc']; … … 4996 4998 %pixels per cm and matrix of the image times, read from the .civ file by uvmat 4997 4999 % global civ2Bin sge%name of the executable for civ1 calculation 4998 4999 5000 end 5000 if isequal(par.Dt,'0') 5001 par.Dt='1' ;%case of 'displacement' mode 5002 end 5001 5003 % textcmx=['############## CMX file' '\n'... 5002 5004 % ['FirstImage ' par.filename_ima_a] '\n'... … … 5005 5007 % ['Mask ' par.maskflag] '\n'... 5006 5008 % ['MaskName ' par.maskname] '\n'... 5007 % ['ImageSize ' par.npx ' ' par.npy] '\n'... 5009 % ['ImageSize ' par.npx ' ' par.npy] '\n'... 5008 5010 % ['CorrelationBoxesSize ' par.ibx ' ' par.iby] '\n'... 5009 5011 % ['SearchBoxeSize ' par.ibx ' ' par.iby] '\n'... … … 5031 5033 % textout=char(textcmx); 5032 5034 % fid=fopen([filename_cmx '2'],'w'); 5033 % fprintf(fid,textout); 5035 % fprintf(fid,textout); 5034 5036 % fclose(fid) 5035 5037 5036 5038 par.filename_ima_a=regexprep(par.filename_ima_a,'.png',''); 5037 5039 par.filename_ima_b=regexprep(par.filename_ima_b,'.png','');% bug : .png appears two times ? 5038 fid=fopen([filename_cmx '2'],'w'); 5040 fid=fopen([filename_cmx '2'],'w'); 5039 5041 fprintf(fid,['############## CMX file' '\n' ]); 5040 5042 fprintf(fid, ['FirstImage ' regexprep(par.filename_ima_a,'\\','\\\\') '\n' ]);% for windows compatibility … … 5082 5084 else 5083 5085 addpath (fullfile(pathelp,'uvmat_doc')) 5084 web([helpfile '#civ']) 5086 web([helpfile '#civ']) 5085 5087 end 5086 5088 … … 5094 5096 A=read(movieobject,num); 5095 5097 case 'avi' 5096 mov=aviread(filename,num);5097 A=frame2im(mov(1));5098 mov=aviread(filename,num); 5099 A=frame2im(mov(1)); 5098 5100 case 'multimage' 5099 5101 A=imread(filename,num); 5100 case 'image' 5102 case 'image' 5101 5103 A=imread(filename); 5102 5104 end … … 5115 5117 find_netcpair_civ1(hObject, eventdata, handles);% update the menu of pairs depending on the available netcdf files 5116 5118 if isequal(mode,'series(Di)') || ...% we do patch2 only 5117 (get(handles.CIV2,'Value')==0 && get(handles.CIV1,'Value')==0 && get(handles.FIX1,'Value')==0 && get(handles.PATCH1,'Value')==0)5119 (get(handles.CIV2,'Value')==0 && get(handles.CIV1,'Value')==0 && get(handles.FIX1,'Value')==0 && get(handles.PATCH1,'Value')==0) 5118 5120 find_netcpair_civ2(hObject, eventdata, handles); 5119 5121 end … … 5125 5127 mode_value=get(handles.mode,'Value'); 5126 5128 mode=mode_list{mode_value}; 5127 if isequal(get(handles.CIV1,'Value'),0)|| isequal(mode,'series(Dj)') 5129 if isequal(get(handles.CIV1,'Value'),0)|| isequal(mode,'series(Dj)') 5128 5130 find_netcpair_civ1(hObject, eventdata, handles);% update the menu of pairs depending on the available netcdf files 5129 5131 end 5130 5132 if isequal(mode,'series(Dj)') || ... 5131 (get(handles.CIV2,'Value')==0 && get(handles.CIV1,'Value')==0 && get(handles.FIX1,'Value')==0 && get(handles.PATCH1,'Value')==0)5133 (get(handles.CIV2,'Value')==0 && get(handles.CIV1,'Value')==0 && get(handles.FIX1,'Value')==0 && get(handles.PATCH1,'Value')==0) 5132 5134 find_netcpair_civ2(hObject, eventdata, handles); 5133 5135 end … … 5147 5149 mode_value=get(handles.mode,'Value'); 5148 5150 mode=mode_list{mode_value}; 5149 if isequal(mode,'series(Dj)') 5151 if isequal(mode,'series(Dj)') 5150 5152 find_netcpair_civ2(hObject, eventdata, handles);% update the menu of pairs depending on the available netcdf files 5151 5153 end … … 5156 5158 %------------------------------------------------------------------------ 5157 5159 test=get(handles.compare,'Value'); 5158 if test==2 || test==3 5160 if test==2 || test==3 5159 5161 filebase=get(handles.RootName,'String'); 5160 5162 browse=get(handles.browse_root,'Userdata'); … … 5162 5164 set(handles.browse_root,'UserData',browse); 5163 5165 set(handles.sub_txt,'Visible','on') 5164 set(handles.RootName_1,'Visible','On');%mkes the second file input window visible 5166 set(handles.RootName_1,'Visible','On');%mkes the second file input window visible 5165 5167 mode_store=get(handles.mode,'String');%get the present 'mode' 5166 set(handles.compare,'UserData',mode_store);%store the mode display 5168 set(handles.compare,'UserData',mode_store);%store the mode display 5167 5169 set(handles.mode,'Visible','off') 5168 5170 if test==2 5169 set(handles.mode,'Visible','off') 5171 set(handles.mode,'Visible','off') 5170 5172 else 5171 5173 set(handles.mode,'Visible','on') … … 5177 5179 oldfile=get(handles.RootName,'String'); 5178 5180 menu={'*.xml;*.avi;*.AVI;*.nc','(*.xml,*.avi,*.nc)'; ... 5179 5180 5181 '*.xml', '.xml files';'*.avi;*.AVI', '.avi files';'*.nc', '.nc files';... 5182 '*.*', 'All Files (*.*)'}; 5181 5183 [FileName, PathName, filtindex] = uigetfile( menu, 'Pick a file',oldfile); 5182 fileinput=[PathName FileName];%complete file name 5184 fileinput=[PathName FileName];%complete file name 5183 5185 sizf=size(fileinput); 5184 5186 if (~ischar(fileinput)|~isequal(sizf(1),1)),return;end %stop if fileinput not a character string … … 5186 5188 [path1]=fileparts(filebase); 5187 5189 if ~strcmp(path1,path) 5188 5190 msgbox_uvmat('ERROR','The two input image series must be in the same directory') 5189 5191 return 5190 5192 end … … 5193 5195 browse=get(handles.browse_root,'UserData'); 5194 5196 browse.nom_type_ima_1=nom_type; 5195 set(handles.browse_root,'UserData',browse) 5197 set(handles.browse_root,'UserData',browse) 5196 5198 5197 5199 %check image extension … … 5226 5228 filebase=get(handles.RootName,'String'); 5227 5229 [FileName, PathName, filterindex] = uigetfile( ... 5228 5229 5230 5231 5232 5230 {'*.nc', ' (*.nc)'; 5231 '*.nc', 'netcdf files '; ... 5232 '*.*', 'All Files (*.*)'}, ... 5233 'Pick a file',filebase); 5234 5233 5235 fileinput=[PathName FileName]; 5234 5236 sizf=size(fileinput); … … 5271 5273 filebase=get(handles.RootName,'String'); 5272 5274 [FileName, PathName, filterindex] = uigetfile( ... 5273 5274 5275 5276 5275 {'*.nc', ' (*.nc)'; 5276 '*.nc', 'netcdf files '; ... 5277 '*.*', 'All Files (*.*)'}, ... 5278 'Pick a file',filebase); 5277 5279 fileinput=[PathName FileName]; 5278 5280 sizf=size(fileinput); … … 5290 5292 end 5291 5293 set(handles.ref_fix2,'String',[fullfile(ref.subdir,File) '....nc']); 5292 set(handles.ref_fix2,'UserData',ref) 5294 set(handles.ref_fix2,'UserData',ref) 5293 5295 menu_field{1}='civ1'; 5294 5296 Data=nc2struct(fileinput,[]); … … 5323 5325 set(handles.ref_fix1,'String',''); 5324 5326 set(handles.thresh_vel1,'String','0'); 5325 5327 5326 5328 %------------------------------------------------------------------------ 5327 5329 function ref_fix2_Callback(hObject, eventdata, handles)
Note: See TracChangeset
for help on using the changeset viewer.