Changeset 127
- Timestamp:
- Nov 19, 2010, 10:44:24 AM (14 years ago)
- Location:
- trunk/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r122 r127 453 453 filebase=get(handles.RootName,'String'); 454 454 ext=get(handles.ImaDoc,'String'); 455 browse=get(handles.browse_root,'UserData') ;%default455 browse=get(handles.browse_root,'UserData')%default 456 456 if isfield(browse,'nom_type_ima') 457 457 nom_type_ima=browse.nom_type_ima;% get an image nomenclature type already determined by an input image name … … 548 548 nbfield=size(time,1); 549 549 nbfield2=size(time,2); 550 %transform .Time to a column vector if it is a line vector the nomenclature uses a single index550 %transform .Time to a column vector if it is a line vector thenomenclature uses a single index: correct possible bug in xml 551 551 if isequal(nbfield,1) && ~isequal(nbfield2,1)% .Time is a line vector 552 if numel(nom_type_read)>=2 && (strcmp(nom_type_read,'_i')||strcmp(nom_type_read(1:2),'%0')||strcmp(nom_type_read(1:2),'_%'))552 if numel(nom_type_read)>=2 && isempty(regexp(nom_type_read(2:end),'\D')) 553 553 time=time'; 554 554 nbfield=nbfield2; … … 2059 2059 %check the list of operations: 2060 2060 operations={'CIV1','FIX1','PATCH1','CIV2','FIX2','PATCH2'}; 2061 run_flag=1;2061 % run_flag=1; 2062 2062 box_test(1)=get(handles.CIV1,'Value'); 2063 2063 box_test(2)=get(handles.FIX1,'Value'); … … 2121 2121 s=convert(t); 2122 2122 end 2123 2124 2123 test_interp=0; 2124 if batch 2125 2125 if isfield(s,'BatchParam') 2126 2126 sparam=s.BatchParam; … … 2167 2167 % end 2168 2168 if isfield(sparam,'FixBin') 2169 % fixBin=sparam.FixBin;2170 2169 if ~exist(sparam.FixBin,'file') 2171 2170 sparam.FixBin=fullfile(path_UVMAT,sparam.FixBin); … … 2218 2217 else 2219 2218 if isunix 2220 [ s,w]=unix('ps faux |grep civ|wc -l');2219 [xx,w]=unix('ps faux |grep civ|wc -l'); 2221 2220 w(end)=[]; 2222 if str2 num(w)+numel(num1_civ1)> MaxCivProcesses2221 if str2double(w)+numel(num1_civ1)> MaxCivProcesses 2223 2222 msgbox_uvmat('ERROR',{['There are already ' w ' civ processes running locally'];'Use BATCH or submit RUN later'}) 2224 2223 return … … 2241 2240 flagindex1(2)=get(handles.vec_F3, 'Value'); 2242 2241 flagindex1(3)=get(handles.vec_F2, 'Value'); 2243 thresh_vecC1=str2 num(get(handles.thresh_vecC,'String'));%threshold on image correlation vec_C2244 thresh_vel1=str2 num(get(handles.thresh_vel,'String'));%threshold on velocity modulus2242 thresh_vecC1=str2double(get(handles.thresh_vecC,'String'));%threshold on image correlation vec_C 2243 thresh_vel1=str2double(get(handles.thresh_vel,'String'));%threshold on velocity modulus 2245 2244 test_mask=get(handles.get_mask_fix1,'Value'); 2246 2245 nbslice_mask=get(handles.mask_fix1,'UserData'); % get the number of slices (= number of masks) … … 2262 2261 %get patch1 parameters 2263 2262 if box_test(3)==1 2264 rho_patch1=str2 num(get(handles.rho_patch1,'String'));2265 if is empty(rho_patch1)2263 rho_patch1=str2double(get(handles.rho_patch1,'String')); 2264 if isnan(rho_patch1) 2266 2265 rho_patch1='1000'; 2267 2266 set(handles.rho_patch1,'String','1') … … 2271 2270 nx_patch1=get(handles.nx_patch1,'String'); 2272 2271 ny_patch1=get(handles.ny_patch1,'String'); 2273 if is equal(str2num(nx_patch1),[])2272 if isnan(str2double(nx_patch1)) 2274 2273 nx_patch1='50' ;%default 2275 2274 set(handles.nx_patch1,'String','50'); 2276 2275 end 2277 if is equal(str2num(ny_patch1),[])2276 if isnan(str2double(ny_patch1)) 2278 2277 ny_patch1='50' ;%default 2279 2278 set(handles.ny_patch1,'String','50'); … … 2293 2292 flagindex2(2)=get(handles.vec_F3_2, 'Value'); 2294 2293 flagindex2(3)=get(handles.vec_F4, 'Value'); 2295 thresh_vec2C=str2 num(get(handles.thresh_vec2C,'String'));%threshold on image correlation vec_C2296 thresh_vel2=str2 num(get(handles.thresh_vel2,'String'));%threshold on velocity modulus2294 thresh_vec2C=str2double(get(handles.thresh_vec2C,'String'));%threshold on image correlation vec_C 2295 thresh_vel2=str2double(get(handles.thresh_vel2,'String'));%threshold on velocity modulus 2297 2296 test_mask=get(handles.get_mask_fix2,'Value'); 2298 2297 nbslice_mask=get(handles.mask_fix2,'UserData'); % get the number of slices (= number of masks) … … 2306 2305 %get patch2 parameters 2307 2306 if box_test(6)==1 2308 rho_patch2=str2 num(get(handles.rho_patch2,'String'));2309 if is empty(rho_patch2)2307 rho_patch2=str2double(get(handles.rho_patch2,'String')); 2308 if isnan(rho_patch2) 2310 2309 rho_patch2='1000'; 2311 2310 set(handles.rho_patch2,'String','1') … … 2315 2314 nx_patch2=get(handles.nx_patch2,'String'); 2316 2315 ny_patch2=get(handles.ny_patch2,'String'); 2317 if is equal(str2num(nx_patch2),[])2316 if isnan(str2double(nx_patch2)) 2318 2317 nx_patch2='50' ;%default 2319 2318 set(handles.nx_patch2,'String','50'); 2320 2319 end 2321 if is equal(str2num(ny_patch2),[])2320 if isnan(str2double(ny_patch2)) 2322 2321 ny_patch2='50' ;%default 2323 2322 set(handles.ny_patch2,'String','50'); … … 2330 2329 %MAIN LOOP 2331 2330 % for ifile=1:nbfield 2332 p1text=[];%initiate command text2331 % p1text=[];%initiate command text 2333 2332 time=get(handles.RootName,'UserData'); %get the set of times 2334 2333 civAll=get(handles.Experimental,'Value'); % Boolean for new civ excution method … … 2350 2349 end 2351 2350 filename_cmx=filecell.nc.civ1{ifile,j};%output netcdf file 2352 filename_cmx(end-1:end)='cm';%name of cmx file 2353 filename_cmx=[filename_cmx 'x']; 2351 filename_cmx(end-1:end+1)='cmx';%name of cmx file 2354 2352 2355 2353 %CIV1 … … 2513 2511 end 2514 2512 2515 if box_test(4)==1 | box_test(5)==1| box_test(6)==12513 if box_test(4)==1 || box_test(5)==1 || box_test(6)==1 2516 2514 filename_cmx=filecell.nc.civ2{ifile,j};%output netcdf file 2517 filename_cmx([end-1:end ])=[ 'cm'];%name of cmx file2518 filename_cmx=[filename_cmx 'x'];2515 filename_cmx([end-1:end+1])=[ 'cmx'];%name of cmx file 2516 % filename_cmx=[filename_cmx 'x']; 2519 2517 end 2520 2518 … … 2798 2796 filebase_B=filebase;% root name of the second field series for stereo 2799 2797 if strcmp(compare,'displacement') || strcmp(compare,'stereo PIV') 2800 test_disp=1;2798 % test_disp=1; 2801 2799 nom_type_ima1=browse.nom_type_ima_1; %nomenclature type of the second file series 2802 2800 [Path2,Name2]=fileparts(filebase_B); … … 2812 2810 filebase_AB=fullfile(Path2,[Name2 '-' Name1]); 2813 2811 else 2814 test_disp=0;2812 % test_disp=0; 2815 2813 filebase_A=filebase; 2816 2814 nom_type_ima1=nom_type_ima2; … … 2841 2839 last_j=str2num(get(handles.last_j,'String')); 2842 2840 incr_j=str2num(get(handles.incr_j,'String')); 2843 num_i_ref= [first_i:incr_i:last_i];2844 num_j_ref= [first_j:incr_j:last_j];2841 num_i_ref=first_i:incr_i:last_i; 2842 num_j_ref=first_j:incr_j:last_j; 2845 2843 if isequal(mode,'displacement') 2846 2844 num_i1=num_i_ref; … … 2889 2887 ref=get(handles.ref_fix2,'UserData'); 2890 2888 if ~isempty(ref) 2891 first_i=str2 num(get(handles.first_i,'String'));2892 last_i=str2 num(get(handles.last_i,'String'));2893 incr_i=str2 num(get(handles.incr_i,'String'));2894 first_j=str2 num(get(handles.first_j,'String'));2895 last_j=str2 num(get(handles.last_j,'String'));2896 incr_j=str2 num(get(handles.incr_j,'String'));2889 first_i=str2double(get(handles.first_i,'String')); 2890 last_i=str2double(get(handles.last_i,'String')); 2891 incr_i=str2double(get(handles.incr_i,'String')); 2892 first_j=str2double(get(handles.first_j,'String')); 2893 last_j=str2double(get(handles.last_j,'String')); 2894 incr_j=str2double(get(handles.incr_j,'String')); 2897 2895 num_i_ref=[first_i:incr_i:last_i]; 2898 2896 num_j_ref=[first_j:incr_j:last_j]; … … 2951 2949 dircur=pwd; %current working directory 2952 2950 m2=''; 2953 [ erread,message]=fileattrib(Path_ima);2951 [xx,message]=fileattrib(Path_ima); 2954 2952 if ~isempty(message) && ~isequal(message.UserWrite,1) 2955 2953 msgbox_uvmat('ERROR',['No writting access to ' Path_ima]) … … 2963 2961 if box_test(1)==1; 2964 2962 detect=1; 2963 vers=0; 2964 subdir_civ1_new=subdir_civ1; 2965 2965 while detect==1 %create a new subdir if the netcdf files already exist 2966 vers=0;2967 subdir_civ1_new=subdir_civ1;2968 2966 for ifile=1:nbfield 2969 2967 for j=1:nbslice … … 2971 2969 detect=exist(filename,'file')==2; 2972 2970 if detect% if a netcdf file already exists 2973 vers=vers+1; 2974 subdir_civ1_new=[subdir_civ1 '_' num2str(vers)]; 2971 indstr=regexp(subdir_civ1,'\D'); 2972 if indstr(end)<length(subdir_civ1) %subdir_civ1 ends by a number 2973 vers=str2double(subdir_civ1(indstr(end)+1:end))+1; 2974 subdir_civ1_new=[subdir_civ1(1:indstr(end)) num2str(vers)]; 2975 else 2976 vers=vers+1; 2977 subdir_civ1_new=[subdir_civ1(1:indstr(end)) '_' num2str(vers)]; 2978 end 2975 2979 subdir_civ2=subdir_civ1; 2976 2980 break … … 2982 2986 end 2983 2987 end 2984 subdir_civ1=subdir_civ1_new;2985 2988 %create the new subdir_civ1 2986 if ~exist(fullfile(Path_ima,subdir_civ1 ),'dir')2987 [ m1,m2,m3]=mkdir(subdir_civ1);2989 if ~exist(fullfile(Path_ima,subdir_civ1_new),'dir') 2990 [xx,m2]=mkdir(subdir_civ1_new); 2988 2991 if ~isequal(m2,'') 2989 2992 msgbox_uvmat('ERROR', m2)%error message for directory creation … … 2994 2997 end 2995 2998 if strcmp(compare,'stereo PIV')&&(strcmp(mode,'pair j1-j2')||strcmp(mode,'series(Dj)')||strcmp(mode,'series(Di)'))%check second nc series 2996 vers=0;2997 subdir_civ1_new=subdir_civ1;2999 % vers=0; 3000 % subdir_civ1_new=subdir_civ1; 2998 3001 for ifile=1:nbfield 2999 3002 for j=1:nbslice … … 3001 3004 detect=exist(filename,'file')==2; 3002 3005 if detect% if a netcdf file already exists 3003 vers=vers+1; 3004 subdir_civ1_new=[subdir_civ1 '_' num2str(vers)]; 3005 subdir_civ2=subdir_civ1; 3006 break 3006 indstr=regexp(subdir_civ1,'\D'); 3007 if indstr(end)<length(subdir_civ1) %subdir_civ1 ends by a number 3008 vers=str2double(subdir_civ1(indstr(end)+1:end))+1; 3009 subdir_civ1_new=[subdir_civ1(1:indstr(end)) num2str(vers)]; 3010 else 3011 vers=vers+1; 3012 subdir_civ1_new=[subdir_civ1 '_' num2str(vers)]; 3013 end 3014 subdir_civ2=subdir_civ1; 3015 break 3007 3016 end 3008 3017 filecell.ncA.civ1(ifile,j)={filename}; … … 3012 3021 end 3013 3022 end 3014 subdir_civ1=subdir_civ1_new;3023 % subdir_civ1=subdir_civ1_new; 3015 3024 %create the new subdir_civ1 3016 if ~exist(fullfile(Path_ima,subdir_civ1 ),'dir')3017 [ m1,m2,m3]=mkdir(subdir_civ1);3025 if ~exist(fullfile(Path_ima,subdir_civ1_new),'dir') 3026 [xx,m2]=mkdir(subdir_civ1_new); 3018 3027 if ~isequal(m2,'') 3019 3028 msgbox_uvmat('ERROR', m2) … … 3025 3034 end 3026 3035 end 3036 subdir_civ1=subdir_civ1_new; 3027 3037 % get image names 3028 3038 for ifile=1:nbfield … … 3114 3124 testdiff=0; 3115 3125 if (box_test(4)==1)&&... 3116 ((get(handles.list_pair_civ1,'Value')~=get(handles.list_pair_civ2,'Value'))||~ isequal(subdir_civ2,subdir_civ1))3126 ((get(handles.list_pair_civ1,'Value')~=get(handles.list_pair_civ2,'Value'))||~strcmp(subdir_civ2,subdir_civ1)) 3117 3127 testdiff=1; 3118 3128 detect=1; 3129 vers=0; 3130 subdir_civ2_new=subdir_civ2; 3119 3131 while detect==1 %create a new subdir if the netcdf files already exist 3120 3132 for ifile=1:nbfield 3121 3133 for j=1:nbslice 3122 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 );%3134 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_new);% 3123 3135 detect=exist(filename,'file')==2; 3124 3136 if detect% if a netcdf file already exists 3125 subdir_civ2=[subdir_civ2 '.0']; 3137 indstr=regexp(subdir_civ2,'\D'); 3138 if indstr(end)<length(subdir_civ2) %subdir_civ1 ends by a number 3139 vers=str2double(subdir_civ2(indstr(end)+1:end))+1; 3140 subdir_civ2_new=[subdir_civ2(1:indstr(end)) num2str(vers)]; 3141 else 3142 vers=vers+1; 3143 subdir_civ2_new=[subdir_civ1 '_' num2str(vers)]; 3144 end 3126 3145 break 3127 3146 end … … 3134 3153 %create the new subdir_civ2 3135 3154 if ~exist(fullfile(Path_ima,subdir_civ2),'dir') 3136 [ m1,m2,m3]=mkdir(subdir_civ2);3155 [xx,m2]=mkdir(subdir_civ2); 3137 3156 if ~isequal(m2,'') 3138 3157 msgbox_uvmat('ERROR', m2) … … 3143 3162 end 3144 3163 if strcmp(compare,'stereo PIV')%check second nc series 3145 vers=0;3146 subdir_civ2_new=subdir_civ2;3147 3164 for ifile=1:nbfield 3148 3165 for j=1:nbslice … … 3151 3168 detect=exist(filename,'file')==2; 3152 3169 if detect% if a netcdf file already exists 3153 vers=vers+1; 3154 subdir_civ2_new=[subdir_civ2 '_' num2str(vers)]; 3170 indstr=regexp(subdir_civ2,'\D'); 3171 if indstr(end)<length(subdir_civ2) %subdir_civ1 ends by a number 3172 vers=str2double(subdir_civ2(indstr(end)+1:end))+1; 3173 subdir_civ2_new=[subdir_civ2(1:indstr(end)) num2str(vers)]; 3174 else 3175 vers=vers+1; 3176 subdir_civ2_new=[subdir_civ1 '_' num2str(vers)]; 3177 end 3155 3178 break 3156 3179 end … … 3163 3186 subdir_civ2=subdir_civ2_new; 3164 3187 %create the new subdir_civ1 3165 if ~exist(fullfile(Path_ima,subdir_civ2 ),'dir')3166 [ m1,m2,m3]=mkdir(subdir_civ2);3188 if ~exist(fullfile(Path_ima,subdir_civ2_new),'dir') 3189 [xx,m2]=mkdir(subdir_civ2_new); 3167 3190 if ~isequal(m2,'') 3168 3191 msgbox_uvmat('ERROR', m2)%error message for directory creation … … 3174 3197 end 3175 3198 end 3199 subdir_civ2=subdir_civ2_new; 3176 3200 end 3177 3201 cd(currentdir);%come back to the current working directory … … 3303 3327 %%%%%%%%%%%%% if stereo fields are calculated by PATCH %%%%%%%%%%%%% 3304 3328 if strcmp(compare,'stereo PIV') 3305 if box_test(3)==1 & isequal(get(handles.test_stereo1,'Value'),1)3329 if box_test(3)==1 && isequal(get(handles.test_stereo1,'Value'),1) 3306 3330 for ifile=1:nbfield 3307 3331 for j=1:nbslice … … 3312 3336 end 3313 3337 end 3314 if box_test(6)==1 & isequal(get(handles.test_stereo2,'Value'),1)3338 if box_test(6)==1 && isequal(get(handles.test_stereo2,'Value'),1) 3315 3339 for ifile=1:nbfield 3316 3340 for j=1:nbslice … … 3434 3458 end 3435 3459 3436 %------------------------------------------------------------------------3437 %CIV1 CIV1 CIV1 CIV1 NOT USED: replaced by RUN_BATCH3438 function RUN_CIV1(handles,filecell,filecell_1,filecell_nc1,num1,num2,num_a,num_b,nom_type_nc)3439 %------------------------------------------------------------------------3440 %pixels per cm and matrix of the image times, read from the .civ file by uvmat3441 global civ1Bin sge%name of the executable for civ1 calculation3442 3443 %get civ parameters3444 ibx_val=str2num(get(handles.ibx,'String'));3445 if isempty(ibx_val)3446 ibx='21'; set(handles.ibx,'String','21')3447 else3448 ibx=num2str(ibx_val);3449 end3450 iby_val=str2num(get(handles.iby,'String'));3451 if isempty(iby_val)3452 iby='21'; set(handles.iby,'String','21')3453 else3454 iby=num2str(iby_val);3455 end3456 isx=get(handles.isx,'String');3457 if isempty(str2num(isx)), isx='41'; set(handles.isx,'String','41'), end; %default3458 if str2num(isx)<ibx_val+8,isx=num2str(ibx_val+8); set(handles.isx,'String',num2str(ibx_val+8)); end3459 isy=get(handles.isy,'String');3460 if isempty(str2num(isy)), isy='41'; set(handles.isy,'String','41'), end;%default3461 if str2num(isy)<iby_val+8,isy=num2str(iby_val+8); set(handles.isy,'String',num2str(iby_val+8)); end3462 shiftx=get(handles.shiftx,'String');3463 if isempty(str2num(shiftx)), shiftx='0'; set(handles.shiftx,'String','0'), end;%default3464 shifty=get(handles.shifty,'String');3465 if isempty(str2num(shifty)), shifty='0'; set(handles.shifty,'String','0'), end;%default3466 rho=get(handles.rho,'String');3467 dx=get(handles.dx_civ1,'String');3468 if isequal(str2num(dx),[]), dx='20'; set(handles.dx_civ1,'String','20'); end%default3469 dy=get(handles.dy_civ1,'String');3470 if isequal(str2num(dy),[]), dy='20'; set(handles.dy_civ1,'String','20');end %default3471 if isequal(str2num(dy),[]), dy='20'; end%default3472 pxcmx='1'; %velocity fields are expressed in pixel displacement3473 pxcmy='1';3474 image_first=cell2mat(filecell(1,1));3475 if ~exist(image_first,'file')3476 msgbox_uvmat('ERROR',['image ' image_first 'not found'])3477 set(handles.RUN, 'Enable','On')3478 set(handles.RUN,'BackgroundColor',[1 0 0])3479 return3480 end3481 A=imread(cell2mat(filecell(1,1)));%read the first image to get the size3482 sizim=size(A);3483 npx=num2str(sizim(2));3484 npy=num2str(sizim(1));3485 time=get(handles.RootName,'UserData'); %get the set of times3486 gridname='';%default ='noFile use default'3487 gridflag='n';%default3488 test_grid=get(handles.browse_gridciv1,'Value');3489 nbslice_grid=[];3490 if test_grid3491 gridname=get(handles.grid_civ1,'String');3492 if numel(gridname)>4 && isequal(gridname(end-3:end),'grid')3493 nbslice_grid=str2num(gridname(1:end-4)); %3494 if ~isempty(nbslice_grid)3495 gridflag='y';3496 end3497 elseif exist(gridname,'file')3498 gridflag='y';3499 else3500 msgbox_uvmat('ERROR',['input grid file ' gridname ' not found'])3501 return3502 end3503 end3504 if isequal(get(handles.ImaThreshold,'Value'),1)3505 threshflag='y';3506 min_ima=get(handles.MinIma,'String');3507 max_ima=get(handles.MaxIma,'String');3508 else3509 threshflag='n';3510 min_ima='0';3511 max_ima='4096';3512 end3513 %main loop3514 filebase=get(handles.RootName,'String');3515 sizcell=size(filecell);3516 nbfield=sizcell(1);3517 nbslice=sizcell(2);3518 icount=0;3519 for ifile=1:nbfield3520 for j=1:nbslice3521 icount=icount+1;3522 barlength=0.188*icount/(nbfield*nbslice);3523 set(handles.waitbar_1,'Position',[0.946 0.877-barlength 0.03 barlength])3524 drawnow3525 filename_ima=cell2mat(filecell(ifile,j));3526 filename_ima([end-3:end])=[];%remove .png extension3527 filename_ima_1=cell2mat(filecell_1(ifile,j));3528 filename_ima_1([end-3:end])=[];%remove .png extension3529 filename_cmx=cell2mat(filecell_nc1(ifile,j));%output netcdf file3530 filename_cmx([end-1:end])=[ 'cm'];%name of cmx file3531 filename_cmx=[filename_cmx 'x'];3532 namelog=[filename_cmx([1:end-3]) 'log'];3533 if size(time,1)>=num2(ifile) & size(time,2)>=num_b(j)3534 Dt=num2str(time(num2(ifile),num_b(j))-time(num1(ifile),num_a(j)));3535 if isequal(Dt,'0')3536 Dt='1' ;%case of 'displacement' mode3537 end3538 T0=num2str((time(num2(ifile),num_b(j))+time(num1(ifile),num_a(j)))/2);3539 else3540 Dt='1';3541 T0='0';3542 end3543 term_a=num2stra(num_a(j),nom_type_nc);%UTILITE?3544 term_b=num2stra(num_b(j),nom_type_nc);%3545 if test_grid && ~isempty(nbslice_grid)3546 num1_grid=mod(num1(ifile)-1,nbslice_grid)+1;3547 gridname=[filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')];3548 if ~exist(gridname,'file')3549 msgbox_uvmat('ERROR',['missing grid file ' gridname])3550 return3551 end3552 end3553 test_mask=get(handles.get_mask_civ1,'Value');3554 if test_mask==03555 maskname='noFile use default';3556 maskflag='n';3557 else3558 maskdispl=get(handles.mask_civ1,'String');%look for mask name in edit box3559 maskbase=[filebase '_' maskdispl];%3560 nbslice=str2num(maskdispl(1:end-4)); %3561 num1_mask=mod(num1(ifile)-1,nbslice)+1;3562 maskname=name_generator(maskbase,num1_mask,1,'.png','_i');3563 if exist(maskname,'file')3564 maskflag='y';3565 else3566 maskname='noFile use default';3567 maskflag='n';3568 end3569 end3570 textcmx={'############## CMX file';...3571 ['FirstImage ' filename_ima];...3572 ['LastImage ' filename_ima_1];...3573 'XX' ;...3574 ['Mask ' maskflag] ;...3575 ['MaskName ' maskname];...3576 ['ImageSize ' npx ' ' npy];... %VERIFIER CAS GENERAL ?3577 ['CorrelationBoxesSize ' ibx ' ' iby];...3578 ['SearchBoxeSize ' isx ' ' isy];...3579 ['RO ' rho];...3580 ['GridSpacing ' dx ' ' dy];...3581 'XX 1.0';...3582 ['Dt_TO ' Dt ' ' T0];...3583 ['PixCmXY ' pxcmx ' ' pxcmy];...3584 'XX 1';...3585 ['ShiftXY ' shiftx ' ' shifty];...3586 ['Grid ' gridflag];...3587 ['GridName ' gridname] ;...3588 'XX 85';...3589 'XX 1.0';...3590 'XX 1.0';...3591 'Hart 1';...3592 'DecimalShift 0';...3593 'Deformation 0';...3594 'CorrelationMin 0';...3595 'IntensityMin 0';...3596 ['SeuilImage ' threshflag];...3597 ['SeuilImageValues ' min_ima ' ' max_ima];...3598 ['ImageToUse ' term_a ' ' term_b];... % VERIFIER ?3599 'ImageUsedBefore null null'};3600 textout=char(textcmx);3601 % dlmwrite(filename_cmx,textout,'');3602 fid=fopen([filename_cmx],'w');3603 fprintf(fid, ['############## CMX file' '\n']);3604 fprintf(fid, ['FirstImage ' regexprep(filename_ima,'\\','\\\\') '\n' ]);3605 fprintf(fid, ['LastImage ' regexprep(filename_ima_1,'\\','\\\\') '\n' ]);3606 fprintf(fid, ['XX' '\n' ]);3607 fprintf(fid, ['Mask ' maskflag '\n' ]);3608 fprintf(fid, ['MaskName ' maskname '\n' ]);3609 fprintf(fid, ['ImageSize ' npx ' ' npy '\n' ]); %VERIFIER CAS GENERAL ?3610 fprintf(fid, ['CorrelationBoxesSize ' ibx ' ' iby '\n' ]);3611 fprintf(fid, ['SearchBoxeSize ' isx ' ' isy '\n' ]);3612 fprintf(fid, ['RO ' rho '\n' ]);3613 fprintf(fid, ['GridSpacing ' dx ' ' dy '\n' ]);3614 fprintf(fid, ['XX 1.0' '\n' ]);3615 fprintf(fid, ['Dt_TO ' Dt ' ' T0 '\n' ]);3616 fprintf(fid, ['PixCmXY ' pxcmx ' ' pxcmy '\n' ]);3617 fprintf(fid, ['XX 1' '\n' ]);3618 fprintf(fid, ['ShiftXY ' shiftx ' ' shifty '\n' ]);3619 fprintf(fid, ['Grid ' gridflag '\n' ]);3620 fprintf(fid, ['GridName ' gridname '\n' ]);3621 fprintf(fid, ['XX 85' '\n' ]);3622 fprintf(fid, ['XX 1.0' '\n' ]);3623 fprintf(fid, ['XX 1.0' '\n' ]);3624 fprintf(fid, ['Hart 1' '\n' ]);3625 fprintf(fid, [ 'DecimalShift 0' '\n' ]);3626 fprintf(fid, ['Deformation 0' '\n' ]);3627 fprintf(fid, ['CorrelationMin 0' '\n' ]);3628 fprintf(fid, ['IntensityMin 0' '\n' ]);3629 fprintf(fid, ['SeuilImage n' '\n' ]);3630 fprintf(fid, ['SeuilImageValues 0 4096' '\n' ]);3631 fprintf(fid, ['ImageToUse ' term_a ' ' term_b '\n' ]); % VERIFIER ?3632 fprintf(fid, ['ImageUsedBefore null null' '\n' ]);3633 fclose(fid);3634 3635 s=-1;3636 display(['!' civ1Bin ' -f ' filename_cmx ' > ' namelog ])3637 eval(['!' civ1Bin ' -f ' filename_cmx ' > ' namelog ]);3638 % if sge%dispatch computation on the cluster using interactive queue3639 % % [s,w] = unix(['qrsh -q fast.q ' civ1Bin ' -f ' filename_cmx ' > ' namelog ' 2>&1' ]);3640 % end3641 % if s~=03642 % % ['!' civ1Bin ' -f ' filename_cmx ' > ' namelog]3643 % % eval(['!' civ1Bin ' -f ' filename_cmx ' > ' namelog]);3644 % end3645 end3646 end3647 3648 % %------------------------------------------------------------------------3649 % % RUN CIV2 CIV2 CIV2 CIV23650 % function RUN_CIV2(handles,filecell_2,filecell_3,filecell_nc1,filecell_nc2,num1,num2,num_a,num_b,nom_type_nc)3651 % %------------------------------------------------------------------------3652 % %filecell_2: names of first image3653 % %filecell_3: names of second images3654 % global civ2Bin sge3655 %3656 % %names of the civ2 fields3657 % field.vel_type='civ2';3658 % field.nb='nb_vectors2';3659 % field.X='vec2_X';3660 % field.Y='vec2_Y';3661 % field.U='vec2_U';3662 % field.V='vec2_V';3663 %3664 % %get civ parameters3665 % ibx=get(handles.ibx_civ2,'String');3666 % iby=get(handles.iby_civ2,'String');3667 % rho=get(handles.rho_civ2,'String');3668 % decimal=int2str(get(handles.decimal,'Value'));3669 % deformation=int2str(get(handles.deformation,'Value'));3670 % dx=get(handles.dx_civ2,'String');3671 % dy=get(handles.dy_civ2,'String');3672 % if isequal(str2num(dx),[])3673 % dx='20';%default3674 % end3675 % if isequal(str2num(dy),[])3676 % dy='20';%default3677 % end3678 % pxcmx='1';%velocity fields are expressed in pixel displacement3679 % pxcmy='1';3680 % A=imread(cell2mat(filecell_2(1,1)));%read the first image to get the size3681 % sizim=size(A);3682 % npx=num2str(sizim(2));3683 % npy=num2str(sizim(1));3684 % time=get(handles.RootName,'UserData'); %get the set of times3685 % filebase=get(handles.RootName,'String');3686 % %grid3687 % gridname='';%default ='noFile use default'3688 % gridflag='n';%default3689 % test_grid=get(handles.browse_gridciv2,'Value');3690 % nbslice_grid=[];3691 % if test_grid3692 % gridname=get(handles.grid_civ2,'String');3693 % if numel(gridname)>4 && isequal(gridname(end-3:end),'grid')3694 % nbslice_grid=str2num(gridname(1:end-4)); %3695 % if ~isempty(nbslice_grid)3696 % gridflag='y';3697 % end3698 % elseif exist(gridname,'file')3699 % gridflag='y';3700 % else3701 % msgbox_uvmat('ERROR',['input grid file ' gridname ' not found'])3702 % return3703 % end3704 % end3705 % sizcell=size(filecell_2);3706 % nbfield=sizcell(1);3707 % nbslice=sizcell(2);3708 %3709 % %main loop3710 % icount=0;3711 % for ifile=1:nbfield3712 % for j=1:nbslice3713 % icount=icount+1;3714 % barlength=0.188*icount/(nbfield*nbslice);3715 % set(handles.waitbar_civ2,'Position',[0.946 0.407-barlength 0.03 barlength])3716 % drawnow3717 % filename_ima_2=cell2mat(filecell_2(ifile,j));3718 % filename_ima_2([end-3:end])=[];%remove .png extension3719 % filename_ima_3=cell2mat(filecell_3(ifile,j));3720 % filename_ima_3([end-3:end])=[];%remove .png extension3721 % filename_cmx=cell2mat(filecell_nc2(ifile,j));%output netcdf file3722 % filename_cmx([end-1:end])=[ 'cm'];%name of cmx file3723 % filename_cmx=[filename_cmx 'x'];3724 % namelog=[filename_cmx([1:end-3]) 'log'];3725 % if size(time,1)>=num2(ifile) & size(time,2)>=num_b(j)3726 % Dt=num2str(time(num2(ifile),num_b(j))-time(num1(ifile),num_a(j)));3727 % if isequal(Dt,'0')3728 % Dt='1' ;%case of 'displacement' mode3729 % end3730 % T0=num2str((time(num2(ifile),num_b(j))+time(num1(ifile),num_a(j)))/2);3731 % else3732 % Dt='1';3733 % T0='0';3734 % end3735 % term_a=num2stra(num_a(j),nom_type_nc);3736 % term_b=num2stra(num_b(j),nom_type_nc);3737 % filename_nc1=cell2mat(filecell_nc1(ifile,j));3738 % filename_nc1([end-2:end])=[]; % remove '.nc'3739 % if test_grid && ~isempty(nbslice_grid)3740 % num1_grid=mod(num1(ifile)-1,nbslice_grid)+1;3741 % gridname=[filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')];3742 % if ~exist(gridname,'file')3743 % msgbox_uvmat('ERROR',['missing grid file ' gridname])3744 % return3745 % end3746 % end3747 % test_mask=get(handles.get_mask_civ2,'Value');3748 % if test_mask==03749 % maskname='noFile use default';3750 % maskflag='n';3751 % else3752 % maskdispl=get(handles.mask_civ2,'String');3753 % maskbase=[filebase '_' maskdispl]; %3754 % nbslice_mask=str2num(maskdispl(1:end-4)); %3755 % num1_mask=mod(num1(ifile)-1,nbslice_mask)+1;3756 % maskname =name_generator(maskbase,num1_mask,1,'.png','_i');3757 % if ~exist(maskname,'file')3758 % maskflag='y';3759 % else3760 % maskname='noFile use default';3761 % maskflag='n';3762 % end3763 % end3764 %3765 % textcmx={'############## CMX file';...3766 % ['FirstImage ' filename_ima_2];...3767 % ['LastImage ' filename_ima_3];...3768 % 'XX' ;...3769 % ['Mask ' maskflag];...3770 % ['MaskName ' maskname];...3771 % ['ImageSize ' npx ' ' npy];...3772 % ['CorrelationBoxesSize ' ibx ' ' iby];...3773 % ['SearchBoxeSize ' ibx ' ' iby];...3774 % ['RO ' rho];...3775 % ['GridSpacing ' dx ' ' dy];...3776 % 'XX 1.0';...3777 % ['Dt_TO ' Dt ' ' T0];...3778 % ['PixCmXY ' pxcmx ' ' pxcmy];...3779 % 'XX 1';...3780 % ['ShiftXY 0 0'];...3781 % ['Grid ' gridflag];...3782 % ['GridName ' gridname];...3783 % 'XX 85';...3784 % 'XX 1.0';...3785 % 'XX 1.0';...3786 % 'Hart 1';...3787 % ['DecimalShift ' decimal];...3788 % ['Deformation ' deformation];...3789 % 'CorrelationMin 0';...3790 % 'IntensityMin 0';...3791 % 'SeuilImage n';...3792 % 'SeuilImageValues 0 4096';...3793 % ['ImageToUse ' term_a ' ' term_b];... % VERIFIER ?3794 % ['ImageUsedBefore ' filename_nc1]};3795 % textout=char(textcmx);3796 % dlmwrite(filename_cmx,textout,'');3797 % s=-1;3798 % display(['!' civ2Bin ' -f ' filename_cmx ' > ' namelog ])3799 % eval(['!' civ2Bin ' -f ' filename_cmx ' > ' namelog ]);3800 %3801 % % if sge%dispatch computation on the cluster using interactive queue3802 % % [s,w] = unix(['qrsh -q fast.q ' civ2Bin ' -f ' filename_cmx ' > ' namelog ' 2>&1']);3803 % % end3804 % % if s~=03805 % % eval(['!' civ2Bin ' -f ' filename_cmx ' > ' namelog]);3806 % % ['!' civ2Bin ' -f ' filename_cmx ' > ' namelog]3807 % % end3808 % end3809 % end3810 % % close(h)3811 3460 3812 3461 %------------------------------------------------------------------------ … … 4721 4370 function par=read_param_civ1(handles,file_ima) 4722 4371 %------------------------------------------------------------------------ 4723 ibx_val=str2 num(get(handles.ibx,'String'));4372 ibx_val=str2double(get(handles.ibx,'String')); 4724 4373 par.ibx=num2str(ibx_val); 4725 iby_val=str2 num(get(handles.iby,'String'));4374 iby_val=str2double(get(handles.iby,'String')); 4726 4375 par.iby=num2str(iby_val); 4727 4376 isx=get(handles.isx,'String'); 4728 if is empty(str2num(isx)), isx='41'; set(handles.isx,'String','41'), end; %default4729 if str2 num(isx)<ibx_val+8,isx=num2str(ibx_val+8); set(handles.isx,'String',num2str(ibx_val+8)); end4377 if isnan(str2double(isx)), isx='41'; set(handles.isx,'String','41'), end; %default 4378 if str2double(isx)<ibx_val+8,isx=num2str(ibx_val+8); set(handles.isx,'String',num2str(ibx_val+8)); end 4730 4379 isy=get(handles.isy,'String'); 4731 if is empty(str2num(isy)), isy='41'; set(handles.isy,'String','41'), end;%default4732 if str2 num(isy)<iby_val+8,isy=num2str(iby_val+8); set(handles.isy,'String',num2str(iby_val+8)); end4380 if isnan(str2double(isy)), isy='41'; set(handles.isy,'String','41'), end;%default 4381 if str2double(isy)<iby_val+8,isy=num2str(iby_val+8); set(handles.isy,'String',num2str(iby_val+8)); end 4733 4382 par.isx=get(handles.isx,'String'); 4734 4383 par.isy=get(handles.isy,'String'); 4735 4384 par.shiftx=get(handles.shiftx,'String'); 4736 4385 par.shifty=get(handles.shifty,'String'); 4737 if is empty(str2num(par.isx))4386 if isnan(str2double(par.isx)) 4738 4387 par.isx='41';%default 4739 4388 set(handles.isx,'String','41'); 4740 4389 end 4741 if is empty(str2num(par.isy))4390 if isnan(str2double(par.isy)) 4742 4391 par.isy='41'; %default 4743 4392 set(handles.isy,'String','41'); 4744 4393 end 4745 if is empty(str2num(par.shiftx))4394 if isnan(str2double(par.shiftx)) 4746 4395 par.shiftx='0';%default 4747 4396 set(handles.shiftx,'String','0'); 4748 4397 end 4749 if is empty(str2num(par.shifty))4398 if isnan(str2double(par.shifty)) 4750 4399 par.shifty='0'; %default 4751 4400 set(handles.shifty,'String','0'); … … 4754 4403 par.dx=get(handles.dx_civ1,'String'); 4755 4404 par.dy=get(handles.dy_civ1,'String'); 4756 if is equal(str2num(par.dx),[])4405 if isnan(str2double(par.dx)) 4757 4406 if isempty(get(handles.grid_civ1,'String')); 4758 4407 par.dx='0'; %just read by civ program, not used … … 4762 4411 end 4763 4412 end 4764 if is equal(str2num(par.dy),[])4413 if isnan(str2double(par.dy)) 4765 4414 if isempty(get(handles.grid_civ1,'String')); 4766 4415 par.dy='0';%just read by civ program, not used … … 4777 4426 par.npx=num2str(sizim(2)); 4778 4427 par.npy=num2str(sizim(1)); 4779 time=get(handles.RootName,'UserData'); %get the set of times4428 %time=get(handles.RootName,'UserData'); %get the set of times 4780 4429 par.gridname=get(handles.grid_civ1,'String'); 4781 4430 par.gridflag='y'; 4782 if isequal(par.gridname,'')| isempty(par.gridname)4431 if strcmp(par.gridname,'')|| isempty(par.gridname) 4783 4432 par.gridname='nogrid'; 4784 4433 par.gridflag='n'; … … 4795 4444 par.dx=get(handles.dx_civ2,'String'); 4796 4445 par.dy=get(handles.dy_civ2,'String'); 4797 if is equal(str2num(par.dx),[])4446 if isnan(str2double(par.dx)) 4798 4447 if isempty(get(handles.grid_civ2,'String')); 4799 4448 par.dx='0'; %just read by civ program, not used … … 4803 4452 end 4804 4453 end 4805 if is equal(str2num(par.dy),[])4454 if isnan(str2double(par.dy)) 4806 4455 if isempty(get(handles.grid_civ2,'String')); 4807 4456 par.dy='0';%just read by civ program, not used … … 4817 4466 par.npx=num2str(sizim(2)); 4818 4467 par.npy=num2str(sizim(1)); 4819 time=get(handles.RootName,'UserData'); %get the set of times4468 %time=get(handles.RootName,'UserData'); %get the set of times 4820 4469 par.gridname=get(handles.grid_civ2,'String'); 4821 4470 par.gridflag='y'; 4822 if isequal(par.gridname,'')| isempty(par.gridname)4471 if strcmp(par.gridname,'')|| isempty(par.gridname) 4823 4472 par.gridname='nogrid'; 4824 4473 par.gridflag='n'; -
trunk/src/dataview.m
r89 r127 113 113 % Get default command line output from handles structure 114 114 varargout{1} = handles.output; 115 delete(handles.figure)115 %delete(handles.figure) 116 116 117 117 %------------------------------------------------------------------------ -
trunk/src/name_generator.m
r122 r127 51 51 end 52 52 if ~ischar(ext),ext='';end 53 idetect=0;53 % idetect=0; 54 54 if ~exist('num_i1','var') || isempty(num_i1) || isnan(num_i1) 55 55 num_i1=1; %default … … 82 82 end 83 83 if ~test_pairs%case of a single index i, and possibly j 84 numlength=numel(nom_type); 84 % numlength=numel(nom_type); 85 nom_type_mod=nom_type; 85 86 num_j_str=''; 86 87 if strcmp(nom_type(1),'_') 87 88 filename=[filename '_']; 88 nom_type (1)=[];89 end 90 if strcmp(nom_type (end),'a')91 nom_type (end)=[];89 nom_type_mod(1)=[]; 90 end 91 if strcmp(nom_type_mod(end),'a') 92 nom_type_mod(end)=[]; 92 93 num_j_str=char(num_j1+96);% lower letter corresponding to the index 93 elseif strcmp(nom_type (end),'A')94 elseif strcmp(nom_type_mod(end),'A') 94 95 nom_type(end)=[]; 95 96 num_j_str=char(num_j1+64);% lower letter corresponding to the index 96 elseif isequal(numel(regexp(nom_type (2:end),'_')),1)%if aseparator '_' exists in nom_type97 elseif isequal(numel(regexp(nom_type_mod,'_')),1)%if a second separator '_' exists in nom_type 97 98 num_j_str=['_' num2str(num_j1)]; 98 nom_type (regexp(nom_type(2:end),'_'):end)=[];99 nom_type_mod(regexp(nom_type_mod,'_'):end)=[]; 99 100 else 100 101 num_j1_out=[];%no index j 101 102 end 102 if ~is empty(str2num(nom_type))103 numtype=['%0' num2str(length(nom_type )) 'd'];%indicate the number of digits (0 before the number)103 if ~isnan(str2double(nom_type_mod)) 104 numtype=['%0' num2str(length(nom_type_mod)) 'd'];%indicate the number of digits (0 before the number) 104 105 filename=[filename num2str(num_i1,numtype) num_j_str ext]; 105 106 num_i2_out=num_i1_out; … … 109 110 filename=[filename ext]; 110 111 end 111 % if strcmp(nom_type,'_i'); 112 % filename=[filebase '_' num2str(num_i1) ext]; 113 % num_i2_out=num_i1; 114 % num_j1_out=[]; 115 % num_j2_out=[]; 116 % elseif length(nom_type)==5 && strcmp(nom_type(1:3),'_%0')&& strcmp(nom_type(5),'d'); 117 % filename=[filebase '_' num2str(num_i1,nom_type(2:5)) ext]; 118 % num_i2_out=num_i1; 119 % num_j2_out=num_j1; 120 % elseif strcmp(nom_type,'_i_j') 121 % filename=[filebase '_' num2str(num_i1) '_' num2str(num_j1) ext]; 122 % num_i2_out=num_i1; 123 % num_j2_out=num_j1; 124 % elseif strcmp(nom_type,'#a')| strcmp(nom_type,'#A') 125 % filename=[filebase num2str(num_i1,'%03d') num2stra(num_j1,nom_type) ext]; 126 % num_i2_out=num_i1; 127 % num_j2_out=num_j1; 128 % elseif length(nom_type)>=5 & strcmp(nom_type(2:3),'%0') & strcmp(nom_type(5),'d') %strcmp(nom_type,'_%04dA') %camera PCO Toulouse 129 % filename=[filebase nom_type(1) num2str(num_i1,nom_type(2:4)) num2stra(num_j1,nom_type) ext]; 130 % num_i2_out=num_i1; 131 % num_j2_out=num_j1; 132 % elseif strcmp(nom_type,'#') 133 % filename=[filebase num2str(num_i1) ext]; 134 % num_i2_out=num_i1; 135 % num_j1_out=[]; 136 % num_j2_out=[]; 137 % elseif length(nom_type)>=4 & strcmp(nom_type(1:2),'%0') & strcmp(nom_type(end),'d') 138 % filename=[filebase num2str(num_i1,nom_type) ext]; %test number with a 0 before 139 % num_i2_out=num_i1; 140 % num_j1_out=[]; 141 % num_j2_out=[]; 142 % elseif length(nom_type)>=4 & strcmp(nom_type(1:2),'%0') & strcmp(nom_type(end-1:end),'dA') 143 % filename=[filebase num2str(num_i1,nom_type(1:end-1)) num2stra(num_j1,'#A') ext]; %test number with a 0 before 144 % num_i2_out=num_i1; 145 % num_j1_out=[]; 146 % num_j2_out=[]; 147 % end 112 148 113 %case of derived file indexing (e.g. netcdf files) 149 114 else 150 %inexistant pair if num_i2=0 or num_j2=0151 % if strcmp(num_i2,0)152 % filename=[filebasesub '*-*_' num2str(num_i1) ext];153 % return154 % end155 % if strcmp(num_j2,0)156 % filename=[filebasesub '_' num2str(num_i1) '_*-*' ext];157 % return158 % end159 115 % case of an imposed image pair (comp_input=1) 160 116 if (exist('comp_input','var') && isequal(comp_input,1)) … … 205 161 elseif isequal(nom_type,'i1-i2_j1-j2') 206 162 if isequal(num2str(num_i1),num2str(num_i2))% case of displacements at the same time 207 app1= [num2str(num_i1)];163 app1= num2str(num_i1); 208 164 else 209 165 app1= [num2str(num_i1) '-' num2str(num_i2)]; 210 166 end 211 167 if isequal(num2str(num_j1),num2str(num_j2))% case of displacements at the same time 212 app2= [num2str(num_j1)];168 app2= num2str(num_j1); 213 169 else 214 170 app2= [num2str(num_j1) '-' num2str(num_j2)]; … … 228 184 direct=dir(pathfile);%directory containing filebase 229 185 datedir=[];%default 230 idir=0;186 % idir=0; 231 187 indir=find(cell2mat({direct.isdir}));% find indices of subdirectories 232 direct=direct(indir( [3:end]));% keep only the subdirectories,eliminating the two first terms '.' and '..'188 direct=direct(indir(3:end));% keep only the subdirectories,eliminating the two first terms '.' and '..' 233 189 lengthdir=length(direct); 234 190 if lengthdir==0 … … 240 196 char_code=double(date_str);% code of the date characters 241 197 special_char=(char_code>127); %non standard Ascii character (e.g. date in french) 242 if isempty(find(special_char ))% standard Ascii character198 if isempty(find(special_char,1))% standard Ascii character 243 199 datedir(idir)=datenum(date_str); 244 200 end … … 250 206 filebasesub=fullfile(pathfile,subdir,name); 251 207 %if the image pair is imposed 252 if (exist('comp_input','var') & isequal(comp_input,1))253 if isequal(nom_type,' netc_old')|isequal(nom_type,'#_ab')208 if (exist('comp_input','var') && isequal(comp_input,1)) 209 if isequal(nom_type,'#_ab') 254 210 filename=[filebasesub num2str(num_i1,'%03d') '_' num2stra(num_j1,nom_type) num2stra(num_j2,nom_type) ext]; 255 elseif isequal(nom_type,' netc_2D')|isequal(nom_type,'_i1_j1-j2')211 elseif isequal(nom_type,'_i1_j1-j2') 256 212 filename=[filebasesub '_' num2str(num_i1) '_' num2str(num_j1) '-' num2str(num_i2) ext]; 257 elseif isequal(nom_type,' netc_3D')|isequal(nom_type,'_i1-i2_j')213 elseif isequal(nom_type,'_i1-i2_j') 258 214 filename=[filebasesub '_' num2str(num_i1) '-' num2str(num_i2) '_' num2str(num_j1) ext]; 259 elseif isequal(nom_type,' netc_series')|isequal(nom_type,'_i1-i2')215 elseif isequal(nom_type,'_i1-i2') 260 216 filename=[filebasesub '_' num2str(num_i1) '-' num2str(num_i2) ext]; 261 217 end 262 idetect=(exist(filename,'file')==2);218 % idetect=(exist(filename,'file')==2); 263 219 else 264 [filename,num_i1_out,num_j1_out,num_i2_out,num_j2_out ,idetect]=search_pair(filebasesub,num_i1,num_j1,num_i2,nom_type);220 [filename,num_i1_out,num_j1_out,num_i2_out,num_j2_out]=search_pair(filebasesub,num_i1,num_j1,num_i2,nom_type); 265 221 end 266 222 end 267 223 end 268 if ~isequal(subdir,'?'), subdir_out=subdir; else, subdir_out='';end; 224 if ~strcmp(subdir,'?') 225 subdir_out=subdir; 226 else 227 subdir_out=''; 228 end 269 229 270 230 %------------------------------------------------------------------------ … … 278 238 279 239 filename=[];num_j2=[];idetect=0;%default values 280 if isequal(nom_type,' netc_old')|isequal(nom_type,'#_ab')240 if isequal(nom_type,'#_ab') 281 241 dirpair=dir([filebasesub num2str(num_i1,'%03d') '_*.nc']); 282 elseif isequal(nom_type,' netc_2D')|isequal(nom_type,'_i_j1-j2')242 elseif isequal(nom_type,'_i_j1-j2') 283 243 dirpair=dir([filebasesub '_' num2str(num_i1) '_*-*.nc']); 284 elseif isequal(nom_type,' netc_3D')|isequal(nom_type,'_i1-i2_j')244 elseif isequal(nom_type,'_i1-i2_j') 285 245 dirpair=dir([filebasesub '_' num2str(num_i1) '-*_' num2str(num_j1) '.nc']); 286 elseif isequal(nom_type,' netc_series')|isequal(nom_type,'_i1-i2')246 elseif isequal(nom_type,'_i1-i2') 287 247 dirpair=dir([filebasesub '_' num2str(num_i1) '-*.nc']); 288 248 if isempty(dirpair) … … 293 253 if nbpair >= 1 %choose the most recent file if several are found 294 254 idetect=1; %detected pair 255 datepair=zeros(1,nbpair);%default 295 256 for ipair=1:nbpair 296 257 date_str=dirpair(ipair).date;%string of the date of last modification 297 datepair(ipair)=0;%default298 258 char_code=double(date_str);% code of the date characters 299 259 special_char=(char_code>127); %non standard Ascii character (e.g. date in french) … … 301 261 datepair(ipair)=datenum(date_str); 302 262 end 303 % datepair(ipair)=datenum(dirpair(ipair).date);304 263 end 305 264 [choice,indpair]=max(datepair); 306 % [filebase,field_count,str2,str_a,str_b,ext,nom_type]=name2display(dirpair(indpair).name); 307 [pathname,file,field_count,str2,str_a,str_b,ext,nom_type]=name2display(dirpair(indpair).name); 308 num_i1=str2num(field_count); 309 num_i2=str2num(str2); 310 num_j1=stra2num(str_a); 311 num_j2=stra2num(str_b); 265 [pathname,file,field_count,str2,str_a,str_b]=name2display(dirpair(indpair).name); 266 num_i1=str2double(field_count); 267 num_i2=str2double(str2); 268 num_j1=stra2double(str_a); 269 num_j2=stra2double(str_b); 312 270 pathname=fileparts(filebasesub);% CORRIGE LE 6 JUIN (ETAIT DESACTIVE) 313 271 filename=fullfile(pathname,dirpair(indpair).name); -
trunk/src/nc2struct.m
r100 r127 98 98 if ischar(valuestr) && length(valuestr)<200 99 99 iatt_g=iatt_g+1; 100 indstr1=regexp(keystr,'\\' );%detect '\\'101 indstr2=regexp(keystr,'\.' );%detect '\.'100 indstr1=regexp(keystr,'\\','once');%detect '\\' 101 indstr2=regexp(keystr,'\.','once');%detect '\.' 102 102 if isempty(indstr1) && isempty(indstr2) 103 103 eval(['Data.' keystr '=''' valuestr ''';']) … … 228 228 %select the used dimensions 229 229 if ~isempty(var_read) 230 % if isfield(Data,'ListDimName') %&& isfield(Data,'DimValue')231 % Data=rmfield(Data,'ListDimName');232 % %Data=rmfield(Data,'DimValue');233 % end234 % else235 % list_dim=1:ndims;236 230 dim_index=find(flag_used); 237 % list_dim=list_dim(dim_index);238 231 old2new=cumsum(flag_used); 239 232 ListDimName=ListDimName(dim_index); … … 241 234 end 242 235 for ivar=1:length(var_read) 243 %Data.VarDimIndex{ivar}=old2new(VarDimIndex{ivar});% ENLEVER Data.VarDimIndex ulterieurement244 %Data.VarDimName{ivar}=Data.ListDimName(Data.VarDimIndex{ivar});245 236 Data.VarDimName{ivar}=ListDimName(old2new(VarDimIndex{ivar})); 246 237 end … … 257 248 end 258 249 eval(['Data.' VarName '=double(netcdf.getVar(nc,var_index(ivar)-1));'])%read the variable data 259 %eval(['siz=size(Data.' VarName ');'])260 % if numel(siz)<=2261 %eval(['Data.' VarName '=Data.' VarName ''';'])%read the variable data262 %end263 250 end 264 251 end -
trunk/src/read_civxdata.m
r93 r127 97 97 test_civ2=isequal(VelTypeOut,'civ2')||isequal(VelTypeOut,'interp2')||isequal(VelTypeOut,'filter2'); 98 98 if test_civ1 99 Field.Time=Field.absolut_time_T0; 99 Field.Time=double(Field.absolut_time_T0); 100 Field.dt=double(Field.dt); 100 101 elseif test_civ2 101 Field.Time= Field.absolut_time_T0_2;102 Field.dt= Field.dt2;102 Field.Time=double(Field.absolut_time_T0_2); 103 Field.dt=double(Field.dt2); 103 104 else 104 105 Field.Txt='the input file is not civx'; … … 136 137 % rescale to pixel coordiantes 137 138 if isfield(Field,'pixcmx') 139 Field.pixcmx=double(Field.pixcmx); 140 Field.pixcmy=double(Field.pixcmy); 138 141 Field.U=Field.U*Field.pixcmx; 139 142 Field.V=Field.V*Field.pixcmy; -
trunk/src/series/merge_proj.m
r116 r127 295 295 296 296 if ~isempty(NbSlice_calib) 297 Field{iview}.ZIndex=mod(num_i1{iview}(ifile)-1,NbSlice_calib{1})+1 297 Field{iview}.ZIndex=mod(num_i1{iview}(ifile)-1,NbSlice_calib{1})+1; 298 298 end 299 299 % Field{iview}.ZIndex=1; 300 300 if ~isempty(transform_fct) 301 XmlData{iview}.GeometryCalib 302 Field{iview}=transform_fct(Field{iview},XmlData{iview}); 303 %transform to phys if requested 301 Field{iview}=transform_fct(Field{iview},XmlData{iview}); %transform to phys if requested 304 302 end 305 303 if testcivx -
trunk/src/sub_field.m
r109 r127 181 181 else 182 182 AName=Field.ListVarName{ivar_C}; 183 size(Field.vort)183 % size(Field.vort) 184 184 eval(['SubData.' AName '=Field.' AName '-vec_A_1;']) 185 185 end -
trunk/src/uvmat.m
r122 r127 1755 1755 1756 1756 comp_input=get(handles.fix_pair,'Value'); 1757 % if isequal(NomType,'_i1-i2')||isequal(NomType,'_i1-i2_j')1758 % comp_input=1; %impose a fixed pair1759 % set(handles.fix_pair,'Value',1)1760 % end1761 1757 1762 1758 %case of scanning along the first direction (rootfile numbers) … … 1764 1760 num1=num1+increment; 1765 1761 num2=num2+increment; 1766 [filename,num1,num_a,num2,num_b]=name_generator(filebase,num1,num_a,FileExt,NomType,comp_input,num2,num_b,subdir) ;1762 [filename,num1,num_a,num2,num_b]=name_generator(filebase,num1,num_a,FileExt,NomType,comp_input,num2,num_b,subdir) 1767 1763 if sub_value% set the second field name and indices 1768 1764 num1_1=num1_1+increment; … … 1773 1769 num_a=num_a+increment; 1774 1770 num_b=num_b+increment; 1771 [filename,num1,num_a,num2,num_b]=name_generator(filebase,num1,num_a,FileExt,NomType,comp_input,num2,num_b,subdir); 1775 1772 if sub_value 1776 1773 num_a_1=num_a_1+increment; 1777 1774 num_b_1=num_b_1+increment; 1778 1775 filename_1=name_generator(filebase_1,num1_1,num_a_1,FileExt_1,NomType_1,1,num2_1,num_b_1,SubDir_1); 1779 % else % redefine the j index if it exceeds its upper bound (only in the absence of a second field) 1780 % lastfield_cell=get(handles.last_j,'String'); % get the last field number 1781 % lastfield=str2double(lastfield_cell{1}); 1782 % if num_a>lastfield && ~isnan(lastfield) 1783 % num_a=mod(num_a,lastfield); 1784 % num_b=mod(num_b,lastfield) 1785 % end 1786 end 1787 [filename,num1,num_a,num2,num_b]=name_generator(filebase,num1,num_a,FileExt,NomType,comp_input,num2,num_b,subdir); 1776 end 1788 1777 end 1789 1778
Note: See TracChangeset
for help on using the changeset viewer.