Changeset 441 for trunk/src/civ.m
- Timestamp:
- Jun 6, 2012, 2:45:37 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r440 r441 415 415 set(handles.RootFile,'String',RootFile) 416 416 if strcmp(ExtInput,'.nc') 417 SubDirCiv= SubDir;418 else 419 SubDirCiv= [SubDir '.civ'];417 SubDirCiv=regexprep(SubDir,[SuddirImages '^'],'');%suppress the root SuddirImages; 418 else 419 SubDirCiv= '.civ'; 420 420 end 421 421 set(handles.SubdirCiv1,'String',SubDirCiv) … … 442 442 %% look for an image documentation file 443 443 ext_imadoc='';%default 444 SubDirBase=regexprep(SubDir,'\..*','');%take the root part of SubDir, before the first dot '.' 445 filexml=fullfile(RootPath,[SubDirBase '.xml']);% new convention: xml above the image dir 446 if ~exist(filexml,'file') 447 filexml=fullfile(RootPath,SubDir,[RootFile '.xml']);%old convention: xml within the image directroy 448 end 444 449 RootName=fullfile(RootPath,RootFile); 445 if exist( [RootName '.xml'],'file')450 if exist(filexml,'file') 446 451 ext_imadoc='.xml'; 447 elseif exist([RootName '.civxml'],'file') 448 ext_imadoc='.civxml'; 449 elseif exist([RootName '.civ'],'file') 452 elseif exist(fullfile(RootPath,SubDir,[RootFile '.civ']),'file') 450 453 ext_imadoc='.civ'; 454 fileciv=fullfile(RootPath,SubDir,[RootFile '.civ']); 451 455 elseif exist([RootName '.avi'],'file') 452 456 ext_imadoc='.avi'; … … 465 469 drawnow 466 470 switch ext_imadoc 467 case '.civxml'%OBSOLETE468 [tild,tild,time]=read_civxml([RootName '.civxml']);469 mode='pair j1-j2';470 if isempty(nom_type_ima)% dtermine types by default if not already selected by browser or uvmat471 nom_type_ima='_i_j';472 end473 471 case '.xml' 474 [XmlData,warntext]=imadoc2struct( [RootName '.xml']);472 [XmlData,warntext]=imadoc2struct(filexml); 475 473 ext_ima_read=[]; 476 474 nom_type_read=[]; … … 508 506 end 509 507 case '.civ'% OBSOLETE: case of .civ image documentation file 510 [error,time,TimeUnit,mode,npx,npy]=read_imatext( [RootName '.civ']);511 if error==2, msgbox_uvmat('WARNING',['no file ' RootName '.civ']);508 [error,time,TimeUnit,mode,npx,npy]=read_imatext(fileciv); 509 if error==2, msgbox_uvmat('WARNING',['no file ' fileciv]); 512 510 elseif error==1, msgbox_uvmat('WARNING','inconsistent number of fields in the .civ file'); 513 511 end … … 522 520 hhh=which('videoreader'); 523 521 if isempty(hhh)%use old video function of matlab 524 imainfo=aviinfo([RootName ext_imadoc]);%read infos on the avi movie 522 imainfo=aviinfo([RootName ext_imadoc]);%read infos on the avi movie TO REPLACE mmreader 525 523 dt=1/imainfo.FramesPerSecond;%time interval between successive frames 526 524 MaxIndex_i=imainfo.NumFrames;%number of frames … … 681 679 if get(handles.CheckCiv1,'Value')% if Civ1 is performed 682 680 set(handles.SubdirCiv2,'String',SubDir);% set by default civ2 directory the same as civ1 683 set(handles.ListSubdirCiv2,'Value',ilist)681 % set(handles.ListSubdirCiv2,'Value',ilist) 684 682 else % if Civ1 data already exist 685 683 errormsg=find_netcpair_civ(handles,1); %update the list of available pairs from netcdf files in the new directory … … 1903 1901 end 1904 1902 %check result directory 1905 subdir_civ1=get(handles.SubdirCiv1,'String');%subdirectory subdir_civ1 for the netcdf output data 1906 subdir_civ2=get(handles.SubdirCiv2,'String'); 1907 if isequal(subdir_civ1,''),subdir_civ1='CIV'; end% put default subdir 1903 subdir_civ1=regexprep(get(handles.SubdirCiv1,'String'),'^.','');%subdirectory subdir_civ1 for the netcdf output data 1904 subdir_civ2=regexprep(get(handles.SubdirCiv2,'String'),'^.',''); 1905 if isequal(subdir_civ1,''),subdir_civ1='civ'; end% put default subdir 1906 % subdir_civ1=[ '.' subdir_civ1]; 1907 % subdir_civ2=[ '.' subdir_civ2]; 1908 1908 if isequal(subdir_civ2,''),subdir_civ2=subdir_civ1; end% put default subdir 1909 subdir_civ1=[SubdirImages '.' subdir_civ1]; 1910 subdir_civ2=[SubdirImages '.' subdir_civ2]; 1909 1911 1910 1912 %% choose root names depending on ListCompareMode =displacement, shift, PIV or stereo PIV … … 2098 2100 detect=exist(filename,'file')==2; 2099 2101 if detect% if a netcdf file already exists 2100 indstr=regexp(subdir_civ1_new,'\D'); 2101 if indstr(end)<length(subdir_civ1_new) %subdir_civ1 ends by a number 2102 vers=str2double(subdir_civ1_new(indstr(end)+1:end))+1; 2103 subdir_civ1_new=[subdir_civ1_new(1:indstr(end)) num2str(vers)]; 2104 else 2105 vers=vers+1; 2106 subdir_civ1_new=[subdir_civ1_new(1:indstr(end)) '_' num2str(vers)]; 2102 r=regexp(subdir_civ1_new,'(?<root>.*\D)(?<num1>\d+)$','names');%detect whether name ends by a number 2103 if isempty(r) 2104 r(1).root=[subdir_civ1_new '_']; 2105 r(1).num1='0'; 2107 2106 end 2107 subdir_civ1_new=[r(1).root num2str(str2num(r(1).num1)+1)];%increment the index by 1 or put 1 2108 % indstr=regexp(subdir_civ1_new,'\D'); 2109 % if indstr(end)<length(subdir_civ1_new) %subdir_civ1 ends by a number 2110 % vers=str2double(subdir_civ1_new(indstr(end)+1:end))+1; 2111 % subdir_civ1_new=[subdir_civ1_new(1:indstr(end)) num2str(vers)]; 2112 % else 2113 % vers=vers+1; 2114 % subdir_civ1_new=[subdir_civ1_new(1:indstr(end)) '_' num2str(vers)]; 2115 % end 2108 2116 subdir_civ2=subdir_civ1_new; 2109 2117 break … … 2467 2475 end 2468 2476 end 2469 set(handles.SubdirCiv1,'String', subdir_civ1);%update the edit box2470 set(handles.SubdirCiv2,'String', subdir_civ2);%update the edit box2477 set(handles.SubdirCiv1,'String',regexprep(subdir_civ1,['^' SubdirImages],''));%suppress the root SuddirImages;);%update the edit box 2478 set(handles.SubdirCiv2,'String',regexprep(subdir_civ2,['^' SubdirImages],''));%update the edit box 2471 2479 2472 2480 % For CivX COPY IMAGES TO THE FORMAT .png IF NEEDED … … 3563 3571 end 3564 3572 3565 % ------------------------------------------------------------------------3566 % --- Executes on button press in ListSubdirCiv1.3567 function ListSubdirCiv1_Callback(hObject, eventdata, handles)3568 % ------------------------------------------------------------------------3569 list_subdir_civ1=get(handles.ListSubdirCiv1,'String');3570 val=get(handles.ListSubdirCiv1,'Value');3571 SubDir=list_subdir_civ1{val};3572 if strcmp(SubDir,'new...')3573 if get(handles.CheckCiv1,'Value')3574 SubDir='CIV'; %default subdirectory3575 else3576 msgbox_uvmat('ERROR','select CheckCiv1 to perform a new Civ operation')3577 return3578 end3579 end3580 set(handles.SubdirCiv1,'String',SubDir);3581 errormsg=find_netcpair_civ(handles,1);3582 if ~isempty(errormsg)3583 msgbox_uvmat('ERROR',errormsg)3584 end3585 3586 %------------------------------------------------------------------------ 3587 % --- Executes on button press in ListSubdirCiv2.3588 function ListSubdirCiv2_Callback(hObject, eventdata, handles)3589 % ------------------------------------------------------------------------3590 list_subdir_civ2=get(handles.ListSubdirCiv2,'String');3591 val=get(handles.ListSubdirCiv2,'Value');3592 SubDir=list_subdir_civ2{val};3593 if strcmp(SubDir,'new...')3594 if get(handles.CheckCiv2,'Value')3595 SubDir='CIV'; %default subdirectory3596 else3597 msgbox_uvmat('ERROR','select CheckCiv2 to perform a new Civ operation')3598 return3599 end3600 end3601 set(handles.SubdirCiv2,'String',SubDir);3573 % %------------------------------------------------------------------------ 3574 % % --- Executes on button press in ListSubdirCiv1. 3575 % function ListSubdirCiv1_Callback(hObject, eventdata, handles) 3576 % %------------------------------------------------------------------------ 3577 % list_subdir_civ1=get(handles.ListSubdirCiv1,'String'); 3578 % val=get(handles.ListSubdirCiv1,'Value'); 3579 % SubDir=list_subdir_civ1{val}; 3580 % if strcmp(SubDir,'new...') 3581 % if get(handles.CheckCiv1,'Value') 3582 % SubDir='CIV'; %default subdirectory 3583 % else 3584 % msgbox_uvmat('ERROR','select CheckCiv1 to perform a new Civ operation') 3585 % return 3586 % end 3587 % end 3588 % set(handles.SubdirCiv1,'String',SubDir); 3589 % errormsg=find_netcpair_civ(handles,1); 3590 % if ~isempty(errormsg) 3591 % msgbox_uvmat('ERROR',errormsg) 3592 % end 3593 % 3594 %------------------------------------------------------------------------ 3595 % % --- Executes on button press in ListSubdirCiv2. 3596 % function ListSubdirCiv2_Callback(hObject, eventdata, handles) 3597 % %------------------------------------------------------------------------ 3598 % list_subdir_civ2=get(handles.ListSubdirCiv2,'String'); 3599 % val=get(handles.ListSubdirCiv2,'Value'); 3600 % SubDir=list_subdir_civ2{val}; 3601 % if strcmp(SubDir,'new...') 3602 % if get(handles.CheckCiv2,'Value') 3603 % SubDir='CIV'; %default subdirectory 3604 % else 3605 % msgbox_uvmat('ERROR','select CheckCiv2 to perform a new Civ operation') 3606 % return 3607 % end 3608 % end 3609 % set(handles.SubdirCiv2,'String',SubDir); 3602 3610 3603 3611 %------------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.