Changeset 300


Ignore:
Timestamp:
Nov 24, 2011, 10:34:50 PM (12 years ago)
Author:
sommeria
Message:

improve again the input to the civ GUI: a few bufg corrections

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r298 r300  
    404404end
    405405
    406 % %% default first_i and j and increments
    407 % first_i=str2double(get(handles.first_i,'String'));%value possibly set by uvmat_Opening
    408 % if isnan(first_i)|| first_i < 1
    409 %     first_i=1; %default first_i
    410 % end
    411 % last_i=str2double(get(handles.last_i,'String'));
    412 % if isnan(last_i)|| last_i < first_i
    413 %     last_i=first_i;  %default last_i
    414 % end
    415 % first_j=str2double(get(handles.first_j,'String'));
    416 % if isnan(first_j)|| first_j < 1
    417 %     first_j=1; %default first_j
    418 % end
    419 % last_j=str2double(get(handles.last_j,'String'));
    420 % if isnan(last_j)|| last_j < first_j
    421 %     last_j=first_j; %default last_j
    422 % end
    423 % incr_i=str2double(get(handles.incr_i,'String'));
    424 % if isnan(incr_i) || incr_i < 1;
    425 %     set(handles.incr_i,'String','1') %default incr_i
    426 % end
    427 % incr_j=str2double(get(handles.incr_j,'String'));
    428 % if isnan(incr_j) || incr_j < 1;
    429 %     set(handles.incr_j,'String','1') %default incr_j
    430 % end
    431 
    432406%% determine nomenclature types and extension of the input files
    433407ext_ima='';%default
     
    437411RootName=fullfile(RootPath,FileName);
    438412set(handles.RootName,'String',RootName)
    439 num_ref_i=str2double(i1_str);
    440 num_ref_j=str2double(j1_str);
    441 browse=[];%default
     413num_i1=str2double(i1_str);
     414num_i2=str2double(i2_str);
     415num_j1=str2double(j1_str);
     416num_j2=str2double(i2_str);
     417ref_i=num_i1;%efaulmt ref index
     418ref_j=num_j1;
     419browse.incr_pair=[0 0];%default
    442420if ~isempty(imformats(ext_input(2:end)))||strcmp(lower(ext_input),'.avi')% if the extension corresponds to an image or movie format recognized by Matlab
    443421    ext_ima=ext_input;
     
    445423else %case of netcdf input file, look for corresponding images
    446424    nom_type_nc=nom_type_input;
     425    if ~isempty(num_i2)
     426        ref_i=floor((ref_i+num_i2)/2);% reference image number corresponding to the file
     427        browse.incr_pair(1)=num_i2-num_i1;
     428        browse.incr_pair(2)=0;
     429    end
    447430    %TODO: read the image name in the netcdf file (if documented)
    448431    dirima='';%default
     
    495478    end
    496479end
    497 set(handles.RootName,'UserData',browse);
     480
    498481% ext_imadoc=get(handles.ImaDoc,'String');
    499482% browse=get(handles.RootName,'UserData');%default
     
    642625set(handles.first_j,'String',num2str(num_ref_j));
    643626set(handles.last_j,'String',num2str(num_ref_j));%
    644 browse.nom_type_ima=nom_type_ima;
    645 set(handles.RootName,'UserData',browse)% store the nomenclature type
    646627
    647628%% set the civ options depending on the input file content
     
    660641    set(handles.(ListOptions{index}),'value',0)
    661642end
    662 for index = ind_opening+1:length(ListOptions)
     643for index = ind_opening+1
    663644    set(handles.(ListOptions{index}),'value',1)
    664645end
     
    682663
    683664%% update the subdirectory display
    684 listot=dir(RootPath);
     665listot=dir(RootPath);%directory of RootPath
    685666idir=0;
    686667listdir={''};%default
     668% get the list of existing civ subdirectories in the path of theinput root  file
    687669for ilist=1:length(listot)
    688670    if listot(ilist).isdir
     
    695677end
    696678Value=find(strcmp(subdir,listdir));%search the index of subdir in the cell listdir
    697 if isempty(Value)
    698     ValueCiv1=get(handles.ListSubdirCiv1,'Value');
     679if isempty(Value)% if the input subdir is not found
     680    ValueCiv1=get(handles.ListSubdirCiv1,'Value');%read the currrently selected dir name
    699681    if ValueCiv1>numel(listdir)
    700682        ValueCiv1=1;
    701683    end
    702684    set(handles.ListSubdirCiv1,'Value',ValueCiv1)
     685    set(handles.txt_SubdirCiv1,'String',listdir{ValueCiv1})
    703686    ValueCiv2=get(handles.ListSubdirCiv2,'Value');
    704687    if ValueCiv2>numel(listdir)
     
    706689    end
    707690    set(handles.ListSubdirCiv2,'Value',ValueCiv2)
    708 else
    709     set(handles.ListSubdirCiv1,'Value',Value)
    710     set(handles.ListSubdirCiv2,'Value',Value)
    711 end
    712 set(handles.ListSubdirCiv1,'Value',1)
    713 set(handles.ListSubdirCiv2,'Value',1)
     691    set(handles.txt_SubdirCiv2,'String',listdir{ValueCiv2})
     692else
     693     set(handles.txt_SubdirCiv1,'String',listdir{Value})
     694     set(handles.txt_SubdirCiv2,'String',listdir{Value})
     695end
     696set(handles.ListSubdirCiv1,'Value',Value)
     697set(handles.ListSubdirCiv2,'Value',Value)
    714698set(handles.ListSubdirCiv1,'String',[listdir;'new...'])
    715699set(handles.ListSubdirCiv2,'String',[listdir;'new...'])
    716700if isempty(listdir)
    717     dirname='CIV';
    718 else
    719     dirname=listdir{1}; %default civ directory name
    720 end
    721 set(handles.txt_SubdirCiv1,'String',dirname)
    722 set(handles.txt_SubdirCiv2,'String',dirname)
    723 
     701    set(handles.txt_SubdirCiv1,'String','CIV')
     702    set(handles.txt_SubdirCiv2,'String','CIV')
     703end
     704
     705%% store info
     706browse.nom_type_ima=nom_type_ima;
     707set(handles.RootName,'UserData',browse)% store the nomenclature type
    724708
    725709%% list the possible index pairs, depending on the option set in ListPairMode
     
    972956% be performed, while the result is needed for next steps.
    973957displ_pair={''};
    974 select=ones(size(1:nbpair));%flag for displayed pairs =1 for display
     958select=ones(size(1:nbpair))%flag for displayed pairs =1 for display
    975959testpair=0;
    976960% case with no checkciv1 operation, netcdf files need to exist for reading
     
    10541038end
    10551039set(handles.ListPairCiv1,'String',displ_pair');
    1056 ichoice=find(select,1);
     1040
     1041%% determine the default selection in the pair menu
     1042ichoice=find(select,1)% index of selected pair
    10571043if (isempty(ichoice) || ichoice < 1); ichoice=1; end;
    1058 initial=get(handles.ListPairCiv1,'Value');%initial choice of pair
    1059 if initial>nbpair
     1044initial=get(handles.ListPairCiv1,'Value')%initial choice of pair
     1045if initial>nbpair || (numel(select)>=initial && ~isequal(select(initial),1))
    10601046    set(handles.ListPairCiv1,'Value',ichoice);% first valid pair proposed by default in the menu
    10611047end
    1062 if numel(select)>=initial && ~isequal(select(initial),1)
    1063     set(handles.ListPairCiv1,'Value',ichoice);% first valid pair proposed by default in the menu
    1064 end
     1048% if numel(select)>=initial && ~isequal(select(initial),1)
     1049%     set(handles.ListPairCiv1,'Value',ichoice);% first valid pair proposed by default in the menu
     1050% end
    10651051
    10661052%set(handles.ListPairCiv2,'String',displ_pair');
     
    11291115subdir_civ1=get(handles.txt_SubdirCiv1,'String');%subdirectory subdir_civ1 for the netcdf data
    11301116subdir_civ2=get(handles.txt_SubdirCiv2,'String');%subdirectory subdir_civ2 for the netcdf data
    1131 % first_i=str2num(get(handles.first_i,'String'));
    1132 % last_i=str2num(get(handles.last_i,'String'));
    1133 % incr=str2num(get(handles.incr_i,'String'));
    1134 % num1=first_i:incr:last_i;
    1135 % if isempty(num1)
    1136 %     set(handles.ListPairCiv2,'Value',1);
    1137 %     set(handles.ListPairCiv2,'String',{''});
    1138 %     return
    1139 % end
    11401117ref_i=str2double(get(handles.ref_i,'String'));
    11411118if isequal(mode,'pair j1-j2')%|isequal(mode,'st_pair j1-j2')
     
    11481125    time=[0 1];%default
    11491126end
    1150 %dt_unit=str2num(get(handles.dt,'String'));% used when there is no image documentation file
    1151 %dt_unit=1000;
    11521127displ_num=get(handles.ListPairCiv1,'UserData');
    1153 
    11541128
    11551129%eliminate the first pairs inconsistent with the position
     
    30773051checkbox(4)=get(handles.CheckCiv2,'Value');
    30783052checkbox(5)=get(handles.CheckFix2,'Value');
    3079 checkbox(6)=get(handles.CheckPatch2,'Value')
    3080 ind_selected=find(checkbox);
     3053checkbox(6)=get(handles.CheckPatch2,'Value');
     3054ind_selected=find(checkbox,1);
    30813055if ~isempty(ind_selected)
    30823056  RootName=get(handles.RootName,'String');
     
    30903064set(handles.ListSubdirCiv1,'Visible','on')
    30913065find_netcpair_civ1(handles) % select the available netcdf files
    3092 % check_civ2pair=ind_selected(4;6);
    30933066if max(checkbox(4:6))% case of civ2 pair choice needed
    30943067    set(handles.TitlePairCiv2,'Visible','on')
     
    31043077    set(handles.ListPairCiv2,'Visible','off')
    31053078end
    3106 %index_last=find(checkbox,1,'last');%last selected button
    31073079options={'Civ1','Fix1','Patch1','Civ2','Fix2','Patch2'};
    31083080for ilist=1:length(options)
Note: See TracChangeset for help on using the changeset viewer.