Changeset 353 for trunk/src/civ.m
- Timestamp:
- Dec 29, 2011, 12:00:59 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r344 r353 180 180 end 181 181 %[RootPath,RootFile,str1,str2,str_a,str_b,FileExt,NomType,subdir]=name2display(fileinput); 182 [ ~,~,~,i1,i2,j1,j2,FileExt,NomType]=fileparts_uvmat(fileinput);182 [tild,tild,tild,i1,i2,j1,j2,FileExt,NomType]=fileparts_uvmat(fileinput); 183 183 % filebase=fullfile(RootPath,RootFile); 184 184 … … 351 351 352 352 % form=imformats(ext_input(2:end)); 353 check_letter=0; 354 check_separator=0; 353 355 if ~isempty(ext_input)&&(~isempty(imformats(ext_input(2:end)))||strcmpi(ext_input,'.avi'))% if the extension corresponds to an image or movie format recognized by Matlab 354 356 ext_ima=ext_input; 355 357 nom_type_ima=nom_type_input; 356 358 imagename=fileinput; 359 check_letter=~isempty(regexp(nom_type_ima,'[a|A]$'));%detect pair label by letter 357 360 else %case of netcdf input file, look for corresponding images 358 361 nom_type_nc=nom_type_input; 359 imagename=name_generator(fullfile(RootPath,RootFile),1,1,ext_ima,nom_type_ima); 362 imagename=fullfile_uvmat(RootPath,[],RootFile,ext_ima,nom_type_ima,1,[],1); 363 %imagename=name_generator(fullfile(RootPath,RootFile),1,1,ext_ima,nom_type_ima); 360 364 i1_str=''; 361 365 j1_str=''; … … 367 371 %TODO: read the image name in the netcdf file (if documented) 368 372 %look for double image series '_i_j' 369 check_letter= regexp(nom_type_nc,'[ab|AB]$');%detect pair label by letter370 if ~isempty(check_letter)373 check_letter=~isempty(regexp(nom_type_nc,'[ab|AB]$'));%detect pair label by letter 374 if check_letter 371 375 j1_str=nom_type_nc(end-1); 372 376 r=regexp(nom_type_nc,'_(?<num1>\d+)','names'); … … 378 382 r_end=regexp(NomTypeIma,'.\D(?<num2>\d+$','names'); 379 383 if ~isempty(r_end) 380 j1_str=r.num2 384 j1_str=r.num2; 381 385 end 382 386 end … … 401 405 for ilist=1:numel(dirima) 402 406 %[pp,ff,i1_str,i2_str,j1_str,j2_str,ext_list,nom_type_list]=name2display(dirima(ilist).name); 403 [ ~,~,~,i1,i2,j1,j2,ext_list,nom_type_list]=fileparts_uvmat(dirima(ilist).name);407 [tild,tild,tild,i1,i2,j1,j2,ext_list,nom_type_list]=fileparts_uvmat(dirima(ilist).name); 404 408 form=imformats(ext_list(2:end)); 405 409 if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab … … 432 436 end 433 437 end 434 [RootPath,RootFile,i1_series, ~,j1_series,~,NomType,FileType,Object]=find_file_series(imagename);438 [RootPath,RootFile,i1_series,tild,j1_series,tild,NomType,FileType,Object]=find_file_series(imagename); 435 439 MaxIndex_i=max(i1_series(i1_series>0)); 436 440 MaxIndex_j=max(j1_series(j1_series>0)); … … 464 468 switch ext_imadoc 465 469 case '.civxml'%OBSOLETE 466 [ ~,~,time]=read_civxml([RootName '.civxml']);470 [tild,tild,time]=read_civxml([RootName '.civxml']); 467 471 mode='pair j1-j2'; 468 472 if isempty(nom_type_ima)% dtermine types by default if not already selected by browser or uvmat … … 475 479 if isfield(XmlData,'Heading')&&isfield(XmlData.Heading','ImageName')&&ischar(XmlData.Heading.ImageName)% get image nom type and extension from the xml file 476 480 %[PP,FF,fc,str2,str_a,str_b,ext_ima_read,nom_type_read]=name2display(XmlData.Heading.ImageName); 477 [ ~,~,~,~,~,~,~,~,nom_type_read]=fileparts_uvmat(XmlData.Heading.ImageName);481 [tild,tild,tild,tild,tild,tild,tild,tild,nom_type_read]=fileparts_uvmat(XmlData.Heading.ImageName); 478 482 fullname=fullfile(fileparts(RootName),XmlData.Heading.ImageName); %full name (including path) of the first image defined by the xmle file, 479 483 if ~exist(fullname,'file') … … 590 594 % test_ima_i=numel(nom_type_ima)>1 && isempty(regexp(nom_type_ima(2:end),'\D','once'))%=1 for images with single indexing 591 595 % TODO: determine MaxIndex_i and MaxIndex_j using find_file_series (in the absence of xml file) 592 try593 if (~check_letter&&~check_separator)|| isequal(nom_type_nc,'_1-2')|| (MaxIndex_j==1)596 % try 597 if ~check_letter|| isequal(nom_type_nc,'_1-2')|| (MaxIndex_j==1) 594 598 set(handles.ListPairMode,'Value',1) 595 599 set(handles.ListPairMode,'String',{'series(Di)'}) 596 elseif MaxIndex_i==1 && MaxIndex_j % simple series in j600 elseif MaxIndex_i==1 && MaxIndex_j>1% simple series in j 597 601 set(handles.ListPairMode,'String',{'pair j1-j2';'series(Dj)'}) 598 602 if MaxIndex_j <= 10 … … 605 609 end 606 610 end 607 end611 % end 608 612 609 613 %% update the subdirectory display … … 1805 1809 filebase_nc=filebase_B; 1806 1810 end 1807 1811 [RootPath_ima1,RootFile_ima1]=fileparts(filebase_ima1); 1812 [RootPath_ima2,RootFile_ima2]=fileparts(filebase_ima2); 1813 [RootPath_nc,RootFile_ima1]=fileparts(filebase_nc); 1814 1808 1815 %determine reference files for fix: 1809 1816 file_ref_fix1={};%default … … 1824 1831 if isequal(mode,'displacement') 1825 1832 num_i1=num_i_ref; 1826 num_i2=num_i_ref;1833 name_genna num_i2=num_i_ref; 1827 1834 num_j1=num_j_ref; 1828 1835 num_j2=num_j_ref; … … 1852 1859 for ifile=1:nbfield 1853 1860 for j=1:nbslice 1854 file_ref=name_generator(ref.filebase,num_i1(ifile),num_j1(j),'.nc',ref.nom_type,1,num_i2(ifile),num_j2(j),ref.subdir);% 1861 [RootPath,RootFile]=fileparts(ref.filebase); 1862 file_ref=fullfile_uvmat(RootPath,ref.subdir,RootFile,'.nc',ref.nom_type,num_i1(ifile),num_i2(ifile),num_j1(j),num_j2(j)); 1863 % file_ref=name_generator(ref.filebase,num_i1(ifile),num_j1(j),'.nc',ref.nom_type,1,num_i2(ifile),num_j2(j),ref.subdir);% 1855 1864 file_ref_fix1(ifile,j)={file_ref}; 1856 1865 if ~exist(file_ref,'file') … … 1903 1912 for ifile=1:nbfield 1904 1913 for j=1:nbslice 1905 file_ref=name_generator(ref.filebase,num_i1(ifile),num_j1(j),'.nc',ref.nom_type,1,num_i2(ifile),num_j2(j),ref.subdir);% 1914 [RootPath,RootFile]=fileparts(ref.filebase); 1915 file_ref=fullfile_uvmat(RootPath,ref.subdir,RootFile,'.nc',ref.nom_type,num_i1(ifile),num_i2(ifile),num_j1(j),num_j2(j)); 1916 %file_ref=name_generator(ref.filebase,num_i1(ifile),num_j1(j),'.nc',ref.nom_type,1,num_i2(ifile),num_j2(j),ref.subdir);% 1906 1917 file_ref_fix2(ifile,j)={file_ref}; 1907 1918 if ~exist(file_ref,'file') … … 1944 1955 for ifile=1:nbfield 1945 1956 for j=1:nbslice 1957 [RootPath,RootFile]=fileparts(ref.filebase_nc); 1946 1958 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_new); 1947 1959 detect=exist(filename,'file')==2; … … 2204 2216 for ifile=1:nbfield 2205 2217 for j=1:nbslice 2206 filename=name_generator(filebase_nc,num1_civ1(ifile),num_a_civ1(j),'.nc',... 2207 nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1);% 2218 filename=fullfile_uvmat(RootPath_nc,subdir_civ1,RootFile_nc,'.nc',nom_type_nc,num1_civ1(ifile),num2_civ1(ifile),num_a_civ1(j),num_b_civ1(j)); 2219 %filename=name_generator(filebase_nc,num1_civ1(ifile),num_a_civ1(j),'.nc',... 2220 % nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1);% 2208 2221 filecell.nc.civ1(ifile,j)={filename};% name of the civ1 file 2209 2222 if ~exist(filename,'file') … … 2244 2257 for ifile=1:nbfield 2245 2258 for j=1:nbslice 2246 filename=name_generator(filebase_A,num1_civ2(ifile),num_a_civ2(j),'.nc',... 2247 nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2);% 2259 filename=fullfile_uvmat(RootPath_A,subdir_civ2,RootFile_A,'.nc',nom_type_nc,num1_civ2(ifile),num2_civ2(ifile),num_a_civ2(j),num_b_civ2(j)); 2260 % filename=name_generator(filebase_A,num1_civ2(ifile),num_a_civ2(j),'.nc',... 2261 % nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2);% 2248 2262 filecell.ncA.civ2(ifile,j)={filename}; 2249 2263 if ~exist(filename,'file') … … 2262 2276 for ifile=1:nbfield 2263 2277 for j=1:nbslice 2264 filename=name_generator(filebase_nc,num1_civ2(ifile),num_a_civ2(j),'.nc',... 2265 nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2); 2278 filename=fullfile_uvmat(RootPath_nc,subdir_civ2,RootFile_nc,'.nc',nom_type_nc,num1_civ2(ifile),num2_civ2(ifile),num_a_civ2(j),num_b_civ2(j)); 2279 % filename=name_generator(filebase_nc,num1_civ2(ifile),num_a_civ2(j),'.nc',... 2280 % nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2); 2266 2281 detect=exist(filename,'file')==2; 2267 2282 filecell.nc.civ2(ifile,j)={filename}; … … 2274 2289 for ifile=1:nbfield 2275 2290 for j=1:nbslice 2276 filename=name_generator(filebase_ima1, num1_civ2(ifile),num_a_civ2(j),ext_ima,nom_type_ima1); 2291 filename=fullfile_uvmat(RootPath_ima1,[],RootFile_ima1,ext_ima,nom_type_ima1,num1_civ2(ifile),num2_civ2(ifile),num_a_civ2(j),num_b_civ2(j)); 2292 %filename=name_generator(filebase_ima1, num1_civ2(ifile),num_a_civ2(j),ext_ima,nom_type_ima1); 2277 2293 idetect_2(j)=exist(filename,'file')==2; 2278 2294 filecell.ima1.civ2(ifile,j)={filename};%first image … … 2293 2309 for ifile=1:nbfield 2294 2310 for j=1:nbslice 2295 filename=name_generator(filebase_ima2, num2_civ2(ifile),num_b_civ2(j),ext_ima,nom_type_ima2); 2311 filename=fullfile_uvmat(RootPath_ima2,[],RootFile_ima2,ext_ima,nom_type_ima2,num1_civ2(ifile),num2_civ2(ifile),num_a_civ2(j),num_b_civ2(j)); 2312 % filename=name_generator(filebase_ima2, num2_civ2(ifile),num_b_civ2(j),ext_ima,nom_type_ima2); 2296 2313 idetect_3(j)=exist(filename,'file')==2; 2297 2314 filecell.ima2.civ2(ifile,j)={filename};%first image … … 2312 2329 for ifile=1:nbfield 2313 2330 for j=1:nbslice 2314 filename=name_generator(filebase_nc,num1_civ2(ifile),num_a_civ2(j),'.nc',... 2315 nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2);% 2331 filename=fullfile_uvmat(RootPath_nc,subdir_civ2,RootFile_nc,'.nc',nom_type_nc,num1_civ2(ifile),num2_civ2(ifile),num_a_civ2(j),num_b_civ2(j)); 2332 % filename=name_generator(filebase_nc,num1_civ2(ifile),num_a_civ2(j),'.nc',... 2333 % nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2);% 2316 2334 filecell.nc.civ2(ifile,j)={filename}; 2317 2335 if ~exist(filename,'file') … … 2341 2359 for ifile=1:nbfield 2342 2360 for j=1:nbslice 2343 filename=name_generator(filebase_AB,num1_civ1(ifile),num_a_civ1(j),'.nc',... 2344 nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1);% 2361 filename=fullfile_uvmat(RootPath_AB,subdir_civ1,RootFile_AB,'.nc',nom_type_nc,num1_civ1(ifile),num2_civ1(ifile),num_a_civ1(j),num_b_civ1(j)); 2362 % filename=name_generator(filebase_AB,num1_civ1(ifile),num_a_civ1(j),'.nc',... 2363 % nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1);% 2345 2364 filecell.st(ifile,j)={filename}; 2346 2365 end … … 2350 2369 for ifile=1:nbfield 2351 2370 for j=1:nbslice 2352 filename=name_generator(filebase_AB,num1_civ2(ifile),num_a_civ2(j),'.nc',... 2353 nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2);% 2371 filename=fullfile_uvmat(RootPath_AB,subdir_civ2,RootFile_AB,'.nc',nom_type_nc,num1_civ2(ifile),num2_civ2(ifile),num_a_civ2(j),num_b_civ2(j)); 2372 % filename=name_generator(filebase_AB,num1_civ2(ifile),num_a_civ2(j),'.nc',... 2373 % nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2);% 2354 2374 filecell.st(ifile,j)={filename}; 2355 2375 end … … 2430 2450 waitbar(ifile/nbfield); 2431 2451 for j=1:nbslice 2432 filename=name_generator(filebase_ima1,num1_civ1(ifile),num_a_civ1(j),'.png',nom_type_imanew1); 2452 filename=fullfile_uvmat(RootPath_ima1,[],RootFile_ima1,'.png',nom_type_imanew1,num1_civ1(ifile),num2_civ1(ifile),num_a_civ1(j),num_b_civ1(j)); 2453 % filename=name_generator(filebase_ima1,num1_civ1(ifile),num_a_civ1(j),'.png',nom_type_imanew1); 2433 2454 if ~exist(filename,'file') 2434 2455 A=read_image(filecell.ima1.civ1{ifile,j},type_ima1,num1_civ1(ifile),movieobject1); … … 2436 2457 end 2437 2458 filecell.ima1.civ1(ifile,j)={filename}; 2438 filename=name_generator(filebase_ima2, num2_civ1(ifile),num_b_civ1(j),'.png',nom_type_imanew2); 2459 filename=fullfile_uvmat(RootPath_ima2,[],RootFile_ima2,'.png',nom_type_imanew2,num2_civ1(ifile),num2_civ1(ifile),num_b_civ1(j),num_b_civ1(j)); 2460 %filename=name_generator(filebase_ima2, num2_civ1(ifile),num_b_civ1(j),'.png',nom_type_imanew2); 2439 2461 if ~exist(filename,'file') 2440 2462 A=read_image(filecell.ima2.civ1{ifile,j},type_ima2,num2_civ1(ifile),movieobject2); … … 2451 2473 waitbar(ifile/nbfield); 2452 2474 for j=1:nbslice 2453 filename=name_generator(filebase_ima1,num1_civ2(ifile),num_a_civ2(j),'.png',nom_type_imanew1); 2475 filename=fullfile_uvmat(RootPath_ima1,[],RootFile_ima1,'.png',nom_type_imanew1,num1_civ2(ifile),[],num_a_civ1(j)); 2476 %filename=name_generator(filebase_ima1,num1_civ2(ifile),num_a_civ2(j),'.png',nom_type_imanew1); 2454 2477 if ~exist(filename,'file') 2455 2478 A=read_image(cell2mat(filecell.ima1.civ2(ifile,j)),type_ima2,num1_civ2(ifile)); … … 2619 2642 % set(handles.RootName_1,'String',name); 2620 2643 %[RootPath,RootFile,field_count,str2,str_a,str_b,xx,nom_type,SubDir]=name2display(name); 2621 [ ~,~,RootFile,~,~,~,~,~,nom_type]=fileparts_uvmat(name);2644 [tild,tild,RootFile,tild,tild,tild,tild,tild,nom_type]=fileparts_uvmat(name); 2622 2645 set(handles.RootName_1,'String',RootFile); 2623 2646 browse=get(handles.RootName,'UserData'); … … 2840 2863 find_netcpair_civ1( handles) 2841 2864 find_netcpair_civ2(handles) 2842 'TESTin' 2843 browse=get(handles.RootName,'UserData') 2865 browse=get(handles.RootName,'UserData'); 2844 2866 2845 2867 %------------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.