Changeset 128 for trunk/src/civ.m
- Timestamp:
- Nov 21, 2010, 10:06:11 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r127 r128 92 92 if ~isempty(ext) && (~isempty(imformats(ext(2:end)))||strcmpi(ext,'.avi'));%if an image file has been opened by uvmat 93 93 set(handles.ImaExt,'String',ext) 94 browse.ext_ima=ext; 94 95 if exist('nom_type_read','var') 95 96 browse.nom_type_ima=nom_type_read; % the image nomenclature is stored … … 452 453 pxcmy_search=[];%default 453 454 filebase=get(handles.RootName,'String'); 454 ext =get(handles.ImaDoc,'String');455 ext_imadoc=get(handles.ImaDoc,'String'); 455 456 browse=get(handles.browse_root,'UserData')%default 456 457 if isfield(browse,'nom_type_ima') … … 498 499 499 500 %look for an image documentation file 500 if ~ isequal(ext,'.xml') && ~isequal(ext,'.civ')&& ~isequal(ext,'.avi')&& ~isequal(ext,'.AVI')501 if ~strcmp(ext_imadoc,'.xml') && ~strcmp(ext_imadoc,'.civ')&& ~strcmpi(ext_imadoc,'.avi') 501 502 if exist([filebase '.xml'],'file') 502 ext ='.xml';503 ext_imadoc='.xml'; 503 504 elseif exist([filebase '.civxml'],'file') 504 ext ='.civxml';505 ext_imadoc='.civxml'; 505 506 elseif exist([filebase '.civ'],'file') 506 ext ='.civ';507 ext_imadoc='.civ'; 507 508 elseif exist([filebase '.avi'],'file') 508 ext ='.avi';509 ext_imadoc='.avi'; 509 510 elseif exist([filebase '.AVI'],'file') 510 ext ='.AVI';511 end 512 set(handles.ImaDoc,'String',ext )511 ext_imadoc='.AVI'; 512 end 513 set(handles.ImaDoc,'String',ext_imadoc) 513 514 end 514 515 … … 517 518 set(handles.ImaDoc,'BackgroundColor',[1 1 0]) 518 519 drawnow 519 if isequal(ext ,'.civxml') || isequal(ext,'.xml')|| isequal(ext,'.civ')520 if isequal(ext_imadoc,'.civxml') || isequal(ext_imadoc,'.xml')|| isequal(ext_imadoc,'.civ') 520 521 set(handles.ref_i,'Visible','On')%use a reference index 521 522 set(handles.ref_j,'Visible','On') 522 elseif isequal(ext ,'.avi') || isequal(ext,'.AVI')523 elseif isequal(ext_imadoc,'.avi') || isequal(ext_imadoc,'.AVI') 523 524 set(handles.ref_j,'Visible','Off') 524 525 else … … 527 528 end 528 529 testima_xml=0; 529 if isequal(ext ,'.civxml')%TO ABANDON530 if isequal(ext_imadoc,'.civxml')%TO ABANDON 530 531 [nbfield,nbfield2,time]=read_civxml([filebase '.civxml']); 531 532 mode='pair j1-j2'; … … 533 534 nom_type_ima='_i_j'; 534 535 end 535 elseif isequal(ext ,'.xml')536 elseif isequal(ext_imadoc,'.xml') 536 537 [XmlData,warntext]=imadoc2struct([filebase '.xml']); 537 538 ext_ima_read=[]; … … 577 578 end 578 579 end 579 if ~isempty(ext_ima_read) && ~isempty(nom_type_read)580 % if isempty(ext_ima)581 % ext_ima=ext_ima_read;% define image extension from the xml file if an image has not been opened previously582 % else %keep the image extension583 % if ~strcmp(ext_ima_read,ext_ima)584 % msgbox_uvmat('WARNING',['FirtsImage extension ' ext_ima_read ' announced in the xml file inconsistent with the selected image'])585 % end586 % end587 nom_type_ima=nom_type_read;588 end589 elseif strcmp(ext ,'.civ')% case of .civ image documentation file580 % if ~isempty(ext_ima_read) && ~isempty(nom_type_read) 581 % % if isempty(ext_ima) 582 % % ext_ima=ext_ima_read;% define image extension from the xml file if an image has not been opened previously 583 % % else %keep the image extension 584 % % if ~strcmp(ext_ima_read,ext_ima) 585 % % msgbox_uvmat('WARNING',['FirtsImage extension ' ext_ima_read ' announced in the xml file inconsistent with the selected image']) 586 % % end 587 % % end 588 % nom_type_ima=nom_type_read; 589 % end 590 elseif strcmp(ext_imadoc,'.civ')% case of .civ image documentation file 590 591 [error,time,TimeUnit,mode,npx,npy]=read_imatext([filebase '.civ']); 591 592 if error==2, msgbox_uvmat('WARNING',['no file ' filebase '.civ']); 592 593 elseif error==1, msgbox_uvmat('WARNING','inconsistent number of fields in the .civ file'); 593 594 end 594 % ImaExt='.png'; 595 nom_type_ima='png_old'; 596 elseif strcmpi(ext,'.avi') 595 nom_type_ima='001a'; 596 elseif strcmpi(ext_imadoc,'.avi') 597 597 nom_type_ima='*'; 598 ext_ima=ext ;598 ext_ima=ext_imadoc; 599 599 set(handles.mode,'String',{'series(Di)'}) 600 600 dt=0.04;%default 601 if exist([filebase ext ],'file')==2602 info=aviinfo([filebase ext ]);%read infos on the avi movie601 if exist([filebase ext_imadoc],'file')==2 602 info=aviinfo([filebase ext_imadoc]);%read infos on the avi movie 603 603 dt=1/info.FramesPerSecond;%time interval between successive frames 604 604 nbfield=info.NumFrames;%number of frames … … 627 627 appendix=char(96+first_j); 628 628 dirima=dir([filebase '*' num2str(first_i) appendix '.*']); 629 % if ~isempty(dirima) 630 % [pp,ff,fc,str2,str_a,str_b,ext_ima,nom_type_ima]=name2display(dirima(1).name); 631 % end 632 % else 633 % [pp,ff,fc,str2,str_a,str_b,ext_ima,nom_type_ima]=name2display(dirima(1).name); 634 end 635 % else 636 % [pp,ff,fc,str2,str_a,str_b,ext_ima,nom_type_ima]=name2display(dirima(1).name); 637 end 638 % else 639 % [pp,ff,fc,str2,str_a,str_b,ext_ima,nom_type_ima]=name2display(dirima(1).name); 629 end 630 end 640 631 end 641 632 end … … 651 642 % no image documentation file found: look for a series of existing files,images by priority or .nc files 652 643 if isempty(nom_type_ima) 653 ext_search=ext ;644 ext_search=ext_imadoc; 654 645 nom_type_search=nom_type_nc; 655 646 else … … 2988 2979 %create the new subdir_civ1 2989 2980 if ~exist(fullfile(Path_ima,subdir_civ1_new),'dir') 2990 [xx,m 2]=mkdir(subdir_civ1_new);2991 if ~ isequal(m2,'')2992 msgbox_uvmat('ERROR', m2)%error message for directory creation2981 [xx,msg1]=mkdir(subdir_civ1_new); 2982 if ~strcmp(msg1,'') 2983 msgbox_uvmat('ERROR',['cannot create ' subdir_civ1_new ': ' msg1])%error message for directory creation 2993 2984 cd(currentdir) 2994 2985 filecell={}; 2995 2986 return 2987 else 2988 [xx,msg2] = fileattrib(subdir_civ1_new,'+w','g'); %yield writing access (+w) to user group (g) 2989 if ~strcmp(msg2,'') 2990 msgbox_uvmat('ERROR',['cannot create ' subdir_civ1_new ': ' msg2])%error message for directory creation 2991 cd(currentdir) 2992 filecell={}; 2993 return 2994 end 2996 2995 end 2997 2996 end … … 3024 3023 %create the new subdir_civ1 3025 3024 if ~exist(fullfile(Path_ima,subdir_civ1_new),'dir') 3026 [xx,m 2]=mkdir(subdir_civ1_new);3027 if ~ isequal(m2,'')3028 msgbox_uvmat('ERROR', m2)3025 [xx,msg1]=mkdir(subdir_civ1_new); 3026 if ~strcmpl(msg1,'') 3027 msgbox_uvmat('ERROR',['cannot create ' subdir_civ1_new ': ' msg1]) 3029 3028 cd(currentdir) 3030 3029 filecell={}; 3031 3030 return 3031 else 3032 [xx,msg2] = fileattrib(subdir_civ1_new,'+w','g'); %yield writing access (+w) to user group (g) 3033 if ~strcmp(msg2,'') 3034 msgbox_uvmat('ERROR',['pb of permission for ' subdir_civ1_new ': ' msg2])%error message for directory creation 3035 cd(currentdir) 3036 filecell={}; 3037 return 3038 end 3032 3039 end 3033 3040 end … … 3151 3158 end 3152 3159 end 3153 %create the new subdir_civ2 3154 if ~exist(fullfile(Path_ima,subdir_civ2),'dir') 3155 [xx,m2]=mkdir(subdir_civ2); 3160 %create the new subdir_civ2_new 3161 if ~exist(fullfile(Path_ima,subdir_civ2_new),'dir') 3162 [xx,m2]=mkdir(subdir_civ2_new); 3163 [xx,msg2] = fileattrib(subdir_civ2_new,'+w','g'); %yield writing access (+w) to user group (g) 3156 3164 if ~isequal(m2,'') 3157 msgbox_uvmat('ERROR', m2)3165 msgbox_uvmat('ERROR',['cannot create ' subdir_civ2_new ': ' m2]) 3158 3166 filecell={}; 3159 3167 cd(currentdir) … … 3188 3196 if ~exist(fullfile(Path_ima,subdir_civ2_new),'dir') 3189 3197 [xx,m2]=mkdir(subdir_civ2_new); 3198 [xx,msg2] = fileattrib(subdir_civ2_new,'+w','g'); %yield writing access (+w) to user group (g) 3190 3199 if ~isequal(m2,'') 3191 msgbox_uvmat('ERROR', m2)%error message for directory creation3200 msgbox_uvmat('ERROR', ['cannot create ' subdir_civ2_new ': ' m2])%error message for directory creation 3192 3201 cd(currentdir) 3193 3202 filecell={};
Note: See TracChangeset
for help on using the changeset viewer.