Changeset 128 for trunk/src/civ.m


Ignore:
Timestamp:
Nov 21, 2010, 10:06:11 PM (13 years ago)
Author:
sommeria
Message:

series: give writting access to the group for all subdirectories produced
uvmat.fig: change of vect and scalar frames (to be consistent with view_field)
uvmat: various cleaning
plot_field: various cleaning to improve axes definition and avoid blinking
geometry_calib: improved dispay of point coordiantes, improved link with dataview for REPLICATE.
struct2nc: repair bug , file was not closed.
cell2tab: cleaning
dataview: improve the browser
civ: solve pb of image naming

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r127 r128  
    9292if ~isempty(ext) && (~isempty(imformats(ext(2:end)))||strcmpi(ext,'.avi'));%if an image file has been opened by uvmat
    9393    set(handles.ImaExt,'String',ext)
     94    browse.ext_ima=ext;
    9495    if exist('nom_type_read','var')
    9596        browse.nom_type_ima=nom_type_read; % the image nomenclature is stored
     
    452453pxcmy_search=[];%default
    453454filebase=get(handles.RootName,'String');
    454 ext=get(handles.ImaDoc,'String');
     455ext_imadoc=get(handles.ImaDoc,'String');
    455456browse=get(handles.browse_root,'UserData')%default
    456457if isfield(browse,'nom_type_ima')
     
    498499
    499500%look for an image documentation file
    500 if ~isequal(ext,'.xml') && ~isequal(ext,'.civ')&& ~isequal(ext,'.avi')&& ~isequal(ext,'.AVI')
     501if ~strcmp(ext_imadoc,'.xml') && ~strcmp(ext_imadoc,'.civ')&& ~strcmpi(ext_imadoc,'.avi')
    501502    if exist([filebase '.xml'],'file')
    502         ext='.xml';
     503        ext_imadoc='.xml';
    503504    elseif exist([filebase '.civxml'],'file')
    504         ext='.civxml';
     505        ext_imadoc='.civxml';
    505506    elseif exist([filebase '.civ'],'file')
    506         ext='.civ';
     507        ext_imadoc='.civ';
    507508    elseif exist([filebase '.avi'],'file')
    508         ext='.avi';
     509        ext_imadoc='.avi';
    509510    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)
    513514end
    514515
     
    517518set(handles.ImaDoc,'BackgroundColor',[1 1 0])
    518519drawnow
    519 if isequal(ext,'.civxml') || isequal(ext,'.xml')|| isequal(ext,'.civ')
     520if isequal(ext_imadoc,'.civxml') || isequal(ext_imadoc,'.xml')|| isequal(ext_imadoc,'.civ')
    520521    set(handles.ref_i,'Visible','On')%use a reference index
    521522    set(handles.ref_j,'Visible','On')
    522 elseif isequal(ext,'.avi') || isequal(ext,'.AVI')
     523elseif isequal(ext_imadoc,'.avi') || isequal(ext_imadoc,'.AVI')
    523524    set(handles.ref_j,'Visible','Off')
    524525else
     
    527528end
    528529testima_xml=0;
    529 if isequal(ext,'.civxml')%TO ABANDON
     530if isequal(ext_imadoc,'.civxml')%TO ABANDON
    530531    [nbfield,nbfield2,time]=read_civxml([filebase '.civxml']);
    531532    mode='pair j1-j2';
     
    533534        nom_type_ima='_i_j';
    534535    end
    535 elseif isequal(ext,'.xml')
     536elseif isequal(ext_imadoc,'.xml')
    536537    [XmlData,warntext]=imadoc2struct([filebase '.xml']);
    537538    ext_ima_read=[];
     
    577578        end
    578579    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 previously
    582 %         else   %keep the image extension
    583 %             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 %             end
    586 %         end
    587         nom_type_ima=nom_type_read;
    588     end
    589 elseif strcmp(ext,'.civ')% case of .civ image documentation file
     580%     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
     590elseif strcmp(ext_imadoc,'.civ')% case of .civ image documentation file
    590591    [error,time,TimeUnit,mode,npx,npy]=read_imatext([filebase '.civ']);
    591592    if error==2, msgbox_uvmat('WARNING',['no file ' filebase '.civ']);
    592593    elseif error==1, msgbox_uvmat('WARNING','inconsistent number of fields in the .civ file');
    593594    end
    594     %         ImaExt='.png';
    595     nom_type_ima='png_old';
    596 elseif strcmpi(ext,'.avi')
     595    nom_type_ima='001a';
     596elseif strcmpi(ext_imadoc,'.avi')
    597597    nom_type_ima='*';
    598     ext_ima=ext;
     598    ext_ima=ext_imadoc;
    599599    set(handles.mode,'String',{'series(Di)'})
    600600    dt=0.04;%default
    601     if exist([filebase ext],'file')==2
    602         info=aviinfo([filebase ext]);%read infos on the avi movie
     601    if exist([filebase ext_imadoc],'file')==2
     602        info=aviinfo([filebase ext_imadoc]);%read infos on the avi movie
    603603        dt=1/info.FramesPerSecond;%time interval between successive frames
    604604        nbfield=info.NumFrames;%number of frames
     
    627627                appendix=char(96+first_j);
    628628                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
    640631    end
    641632end
     
    651642% no image documentation file found: look for a series of existing files,images by priority or .nc files
    652643if isempty(nom_type_ima)
    653     ext_search=ext;
     644    ext_search=ext_imadoc;
    654645    nom_type_search=nom_type_nc;
    655646else
     
    29882979        %create the new subdir_civ1
    29892980        if ~exist(fullfile(Path_ima,subdir_civ1_new),'dir')
    2990             [xx,m2]=mkdir(subdir_civ1_new);
    2991             if ~isequal(m2,'')
    2992                 msgbox_uvmat('ERROR', m2)%error message for directory creation
     2981            [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
    29932984                cd(currentdir)
    29942985                filecell={};
    29952986                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
    29962995            end
    29972996        end
     
    30243023            %create the new subdir_civ1
    30253024            if ~exist(fullfile(Path_ima,subdir_civ1_new),'dir')
    3026                 [xx,m2]=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])
    30293028                    cd(currentdir)
    30303029                    filecell={};
    30313030                    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
    30323039                end
    30333040            end
     
    31513158            end
    31523159        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)
    31563164            if ~isequal(m2,'')
    3157                 msgbox_uvmat('ERROR', m2)
     3165                msgbox_uvmat('ERROR',['cannot create ' subdir_civ2_new ': ' m2])
    31583166                filecell={};
    31593167                cd(currentdir)
     
    31883196            if ~exist(fullfile(Path_ima,subdir_civ2_new),'dir')
    31893197                [xx,m2]=mkdir(subdir_civ2_new);
     3198                 [xx,msg2] = fileattrib(subdir_civ2_new,'+w','g'); %yield writing access (+w) to user group (g)
    31903199                if ~isequal(m2,'')
    3191                     msgbox_uvmat('ERROR', m2)%error message for directory creation
     3200                    msgbox_uvmat('ERROR', ['cannot create ' subdir_civ2_new ': ' m2])%error message for directory creation
    31923201                    cd(currentdir)
    31933202                    filecell={};
Note: See TracChangeset for help on using the changeset viewer.