Changeset 438 for trunk


Ignore:
Timestamp:
Jun 5, 2012, 8:17:55 AM (13 years ago)
Author:
sommeria
Message:

improvement of the civ GUI (order of elements)
improvement of netcdf file input

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r437 r438  
    306306NomTypeNc='';%default
    307307
    308 %% case of netcdf file as input, look for a coresponding image
     308%% case of xml file as input, read the civ parameters
    309309ind_opening=0;%default
    310310if strcmp(ExtInput,'.xml')
     
    313313    return
    314314end
     315
     316%% case of netcdf file as input, get the civ processing stage and look for a coresponding image
    315317if strcmp(ExtInput,'.nc')
    316318    NomTypeNc=NomTypeInput;
    317     if isempty(regexp(NomTypeInput,'[ab|AB|-]')) 
     319    if isempty(regexp(NomTypeInput,'[ab|AB|-]'))
    318320        set(handles.ListCompareMode,'Value',2) %mode displacement advised if the nomencalture does not involve index pairs
    319         [RootPath,SubDir]=fileparts(RootPath);
    320     set(handles.RootFile_1,'Visible','On');
     321      %  [RootPath,SubDir]=fileparts(RootPath);
     322        set(handles.RootFile_1,'Visible','On');
    321323    else
    322          set(handles.ListCompareMode,'Value',1)
    323          set(handles.RootFile_1,'Visible','Off');
     324        set(handles.ListCompareMode,'Value',1)
     325        set(handles.RootFile_1,'Visible','Off');
    324326    end
    325327    Data=nc2struct(fileinput,'ListGlobalAttribute','Conventions','absolut_time_T0','CivStage','Civ2_ImageA','Civ1_ImageA','Civ2_ImageB','Civ1_ImageB','fix','patch','civ2','fix2');
     
    328330        return
    329331    end
     332    % settings for  new civ data,
    330333    if strcmp(Data.Conventions,'uvmat/civdata')% case of new civ data,
    331334        set(handles.ListProgram,'Value',2) %select civ/Matlab by default
     
    343346            set(handles.RootFile_1,'String',[ImaName ImaExt])
    344347        end
    345        
     348        % settings for civx data,
    346349    elseif ~isempty(Data.absolut_time_T0')% case of  civx data,
    347350        set(handles.ListProgram,'Value',1) %select Cix by default
     
    356359            ind_opening=2;
    357360        end
    358         % look for the corresponding input images
    359         check_letter=~isempty(regexp(NomTypeInput,'[ab|AB]$'));%detect pair label by letter
    360         NomTypeIma=NomTypeInput;
    361         if check_letter
    362             NomTypeIma=NomTypeInput(1:end-1);
    363         else
    364             r=regexp(NomTypeIma,'.-(?<num2>\d+)$','names');
    365             if ~isempty(r)
    366                 NomTypeIma=regexprep(NomTypeIma,['-' r.num2],'');
    367             end
    368             r=regexp(NomTypeIma,'.-(?<num2>\d+)','names');
    369             if ~isempty(r)
    370                 NomTypeIma=regexprep(NomTypeIma,['-' r.num2],'');
    371             end
    372         end
    373         imageinput=fullfile_uvmat(RootPath,'',RootFile,'.png',NomTypeIma,i1,[],j1);
    374361    else
    375362        errormsg='the input netcdf file is not civ data';
    376363        return
    377364    end
     365    % look for the corresponding input images
     366    check_letter=~isempty(regexp(NomTypeInput,'[ab|AB]$','once'));%detect pair label by letter
     367    NomTypeIma=NomTypeInput;
     368    if check_letter
     369        NomTypeIma=NomTypeInput(1:end-1);
     370    else
     371        r=regexp(NomTypeIma,'.-(?<num2>\d+)$','names');
     372        if ~isempty(r)
     373            NomTypeIma=regexprep(NomTypeIma,['-' r.num2],'');
     374        end
     375        r=regexp(NomTypeIma,'.-(?<num2>\d+)','names');
     376        if ~isempty(r)
     377            NomTypeIma=regexprep(NomTypeIma,['-' r.num2],'');
     378        end
     379    end
     380    imageinput=fullfile_uvmat(RootPath,regexprep(SubDir,'.civ(_?)(\d*)$',''),RootFile,'.png',NomTypeIma,i1,[],j1);
    378381end
    379382
     
    400403% detect the file type, get the movie object if relevant, and look for the corresponding file series:
    401404% the root name and indices may be corrected by including the first index i1 if a corresponding xml file exists
    402 [RootPath,SubDir,RootFile,i1_series,tild,j1_series,tild,NomTypeIma,FileType,Object,i1,i2,j1,j2]=find_file_series(FilePath,[FileName ImaExt]);
     405[RootPath,SubdirImages,RootFile,i1_series,tild,j1_series,tild,NomTypeIma,FileType,Object,i1,i2,j1,j2]=find_file_series(FilePath,[FileName ImaExt]);
    403406
    404407switch FileType
     
    409412end
    410413set(handles.RootPath,'String',RootPath)
    411 set(handles.SubdirImages,'String',SubDir)
     414set(handles.SubdirImages,'String',SubdirImages)
    412415set(handles.RootFile,'String',RootFile)
    413 set(handles.SubdirCiv1,'String',[SubDir '.civ'])
     416if strcmp(ExtInput,'.nc')
     417    SubDirCiv=SubDir;
     418else
     419    SubDirCiv=[SubDir '.civ'];
     420end
     421set(handles.SubdirCiv1,'String',SubDirCiv)
     422set(handles.SubdirCiv2,'String',SubDirCiv)
    414423browse=get(handles.RootPath,'UserData');
    415424browse.incr_pair=[0 0];%default
     
    573582end
    574583if ind_opening~=0 || isempty(first_i) || isempty(last_i)|| first_i<MinIndex_i || last_i>MaxIndex_i
    575 set(handles.first_i,'String',num2str(num_ref_i));
    576 set(handles.last_i,'String',num2str(num_ref_i));%
     584    set(handles.first_i,'String',num2str(num_ref_i));
     585    set(handles.last_i,'String',num2str(num_ref_i));%
    577586end
    578587
     
    599608end
    600609set(handles.(ListOptions{min(ind_opening+1,6)}),'value',1)
    601 update_CivOptions(handles,1)
     610update_CivOptions(handles,ind_opening)
    602611
    603612%%  set the menus of image pairs and default selection for civ   %%%%%%%%%%%%%%%%%%%
     
    634643    end
    635644end
    636 
    637 %% update the selection for civ1 and civ2
    638 % if ~isempty(SubDir)% subdir for civ1 and civ2 initiated by the input
    639 %     SubdirCiv1=SubDir;
    640 %     SubdirCiv2=SubDir;
    641 %     set(handles.SubdirCiv1,'String',SubDir)
    642 %     set(handles.SubdirCiv2,'String',SubDir)
    643 % else% currently selected subdir preserved
    644 %     SubdirCiv1=get(handles.SubdirCiv1,'String');
    645 %     SubdirCiv2=get(handles.SubdirCiv2,'String');
    646 %     if isempty(SubdirCiv1)% default subdir name='CIV'
    647 %         set(handles.SubdirCiv1,'String','CIV');
    648 %         SubdirCiv1='CIV';
    649 %     end
    650 %     if isempty(SubdirCiv2)% default subdir name='CIV'
    651 %         set(handles.SubdirCiv2,'String','CIV');
    652 %         SubdirCiv2='CIV';
    653 %     end
    654 % end
    655 
    656 %% update the subdirectory menus
    657 % ValueCiv1=find(strcmp(SubdirCiv1,listdir));%search the index of subdir in the cell listdir
    658 % if isempty(ValueCiv1)% if the input subdir is not found
    659 %     ValueCiv1=numel(listdir)+1;%new subdirectory requested for civ1
    660 % end
    661 % ValueCiv2=find(strcmp(SubdirCiv2,listdir));%search the index of subdir in the cell listdir
    662 % if isempty(ValueCiv2)% if the input subdir is not found
    663 %     ValueCiv2=numel(listdir)+1;%new subdirectory requested for civ2
    664 % end
    665 % set(handles.ListSubdirCiv1,'String',[listdir;'new...'])
    666 % set(handles.ListSubdirCiv2,'String',[listdir;'new...'])
    667 % set(handles.ListSubdirCiv1,'Value',ValueCiv1)
    668 % set(handles.ListSubdirCiv2,'Value',ValueCiv2)
    669 % if isempty(listdir)
    670 %     set(handles.SubdirCiv1,'String','CIV')
    671 %     set(handles.SubdirCiv2,'String','CIV')
    672 % end
    673645
    674646%% store info
     
    795767set(handles.PairIndices,'Visible','on')
    796768set(handles.SubdirCiv1,'Visible','on')
    797 %set(handles.ListSubdirCiv1,'Visible','on')
    798769set(handles.TitleSubdirCiv1,'Visible','on')
    799770if ~opening
     
    818789    set(handles.TitleSubdirCiv2,'Visible','off')
    819790    set(handles.SubdirCiv2,'Visible','off')
    820    % set(handles.ListSubdirCiv2,'Visible','off')
    821791    set(handles.ListPairCiv2,'Visible','off')
    822792end
     
    31233093else %case civ2 alone
    31243094    if ~get(handles.CheckCiv2,'Value') && ~get(handles.CheckCiv1,'Value') && ~get(handles.CheckFix1,'Value') && ~get(handles.CheckPatch1,'Value')
    3125         if ~exist(fullfile(RootPath,subdir_civ2,ext_dir),'dir')
    3126             errordlg(['no civ2 file available: subdirectory ' subdir_civ2 ' does not exist'])
     3095        if ~exist(fullfile(RootPath,subdir_civ2),'dir')
     3096            msgbox_uvmat('ERROR',['no civ2 file available: subdirectory ' subdir_civ2 ' does not exist'])
    31273097            set(handles.ListPairCiv2,'Value',1);
    31283098            set(handles.ListPairCiv2,'String',{''});
Note: See TracChangeset for help on using the changeset viewer.