Changeset 323


Ignore:
Timestamp:
Dec 7, 2011, 9:24:23 AM (9 years ago)
Author:
sommeria
Message:

GUI uvmat modified by introduction of a pannel InputFile?, NomType? now explicitley written in a edit box NomType? on this panel.

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/read_GUI.m

    r309 r323  
    2121                        separator=regexp(tag,'_');
    2222                        if isempty(separator)
    23                             input=get(hchild(ichild),'Value');
     23                            input=get(hchild(ichild),'String');
    2424                        else
    2525                            switch(tag(1:separator))
     
    4444                        listinput=get(hchild(ichild),'String');
    4545                        value=get(hchild(ichild),'Value');
     46                        if ~isempty(listinput)
    4647                        input=listinput(value);
     48                        end
    4749                        separator=regexp(tag,'_');
    4850                        if strcmp(tag(1:separator),'num_')
  • trunk/src/uvmat.m

    r319 r323  
    522522        indices(end-length(ext)+1:end)=[]; %remove extension
    523523        set(handles.FileIndex,'String',indices);       
    524         set(handles.FileIndex,'UserData',NomType);
     524%         set(handles.FileIndex,'UserData',NomType);
     525set(handles.NomType,'String',NomType);
    525526        set(handles.FileExt,'String',ext);
    526527        % fill file index counters
     
    533534        if get(handles.SubField,'Value')==1% if the subfield button is activated, update the field numbers
    534535            [ff,rr,FileBase_1,ii,FileExt_1,SubDir_1]=read_file_boxes_1(handles);
    535             NomType_1=get(handles.FileIndex_1,'UserData');     
     536            NomType_1=get(handles.NomType_1,'String');
     537%             NomType_1=get(handles.FileIndex_1,'UserData');     
    536538            FileName_1=name_generator(FileBase_1,str2double(i1),str2double(i2),FileExt_1,NomType_1,1,stra2num(str_a),stra2num(str_b),SubDir_1);
    537539            if exist(FileName_1,'file')
     
    752754    %transform .Time to a column vector if it is a line vector the nomenclature uses a single index
    753755    if isequal(nbfield,1) && ~isequal(nburst,1)% .Time is a line vector
    754         NomType=get(handles.FileIndex,'UserData');
     756        NomType=get(handles.NomType,'String');
     757%         NomType=get(handles.FileIndex,'UserData');
    755758        if numel(NomType)>=2 &&(strcmp(NomType,'_i')||strcmp(NomType(1:2),'%0')||strcmp(NomType(1:2),'_%'))
    756759            XmlData.Time=(XmlData.Time)';
     
    886889
    887890%  set the corresponding index navigation options
    888 NomType=get(handles.FileIndex,'UserData');       
    889 NomType_1=get(handles.FileIndex_1,'UserData');
     891 NomType=get(handles.NomType,'String');       
     892 NomType_1=get(handles.NomType_1,'String');
     893% NomType=get(handles.FileIndex,'UserData');       
     894% NomType_1=get(handles.FileIndex_1,'UserData');
    890895last_i_str=get(handles.last_i,'String');
    891896nbfield=str2num(last_i_str{1});
     
    10741079       heditxml=editxml(fileinput);
    10751080       return
    1076     case {'.image','.nc','.cdf'}
     1081    case {'.image','.nc','.cdf'}       
    10771082%         set(handles.FileIndex,'UserData',NomType_1);
    10781083    otherwise
     
    11111116    end
    11121117end
    1113 set(handles.FileIndex_1,'UserData',NomType_1);
     1118set(handles.NomType_1,'String',NomType_1);
     1119% set(handles.FileIndex_1,'UserData',NomType_1);
    11141120
    11151121% make visible and fill the second raw of edit boxes
     
    11371143indices(end-length(FileExt_1)+1:end)=[]; %remove extension
    11381144set(handles.FileIndex_1,'String',indices)
    1139 set(handles.FileIndex_1,'UserData',NomType_1)
     1145set(handles.NomType_1,'String',NomType_1)
     1146% set(handles.FileIndex_1,'UserData',NomType_1)
    11401147set(handles.FileExt_1,'String',FileExt_1);
    11411148
     
    13501357    set(handles.scan_i,'Value',0)
    13511358    set(handles.scan_i,'BackgroundColor',[0.831 0.816 0.784])
    1352     NomType=get(handles.FileIndex,'UserData');
     1359    NomType=get(handles.NomType,'String');
     1360%     NomType=get(handles.FileIndex,'UserData');
    13531361    switch NomType
    13541362    case {'_i_j1-j2','#_ab','%3dab'},% pair with j index
     
    13681376%------------------------------------------------------------------------
    13691377set(handles.i1,'BackgroundColor',[0.7 0.7 0.7])
    1370 NomType=get(handles.FileIndex,'UserData');
     1378NomType=get(handles.NomType,'String');
     1379% NomType=get(handles.FileIndex,'UserData');
    13711380num1=stra2num(get(handles.i1,'String'));
    13721381num2=stra2num(get(handles.i2,'String'));
     
    17581767
    17591768%------------------------------------------------------------------------
     1769% --- function activated by runplus and run minus
    17601770function errormsg=runpm(hObject,eventdata,handles,increment)
    17611771%------------------------------------------------------------------------
    1762 %check for movie pair status
     1772%% check for movie pair status
    17631773movie_status=get(handles.movie_pair,'Value');
    17641774if isequal(movie_status,1)
    17651775    STOP_Callback(hObject, eventdata, handles)%interrupt movie pair if active
    17661776end
    1767 %read the data on the current input rootfile(s)
    1768 [FileName,RootPath,filebase,FileIndices,FileExt,subdir]=read_file_boxes(handles);
    1769 NomType=get(handles.FileIndex,'UserData');
    1770 
    1771 i1=stra2num(get(handles.i1,'String'));
     1777
     1778%% read the current input file name(s) and field indices
     1779InputFile=read_GUI(handles.InputFile);
     1780filebase=InputFile.RootPath; %default
     1781if ~isempty(InputFile.SubDir)
     1782    InputFile.SubDir=regexprep(InputFile.SubDir,'/|\','');
     1783%    FileName=fullfile(InputFile.RootPath,InputFile.SubDir);
     1784end
     1785if ~isempty(InputFile.RootFile)
     1786    InputFile.RootFile=regexprep(InputFile.RootFile,'/|\','');
     1787    filebase=fullfile(filebase,InputFile.RootFile);
     1788end
     1789FileExt=InputFile.FileExt;
     1790subdir=InputFile.SubDir;
     1791% [FileName,RootPath,filebase,FileIndices,FileExt,subdir]=read_file_boxes(handles);
     1792NomType=get(handles.NomType,'String');
     1793% NomType=get(handles.FileIndex,'UserData');
     1794i1=stra2num(get(handles.i1,'String'));%read the field indices (for movie, it is not given by the file name)
    17721795i2=stra2num(get(handles.i2,'String'));
    17731796j1=stra2num(get(handles.j1,'String'));
    17741797j2=stra2num(get(handles.j2,'String'));
    1775 
    17761798sub_value= get(handles.SubField,'Value');
    17771799if sub_value % a second input file has been entered
     
    17821804    j1_1=stra2num(j1_1_str);
    17831805    j2_1=stra2num(j2_1_str);
    1784     NomType_1=get(handles.FileIndex_1,'UserData');
     1806    NomType_1=get(handles.NomType_1,'String');
     1807%     NomType_1=get(handles.FileIndex_1,'UserData');
    17851808else
    17861809    filename_1=[];
     
    17881811comp_input=get(handles.fix_pair,'Value');
    17891812
    1790 %case of scanning along the first direction (rootfile numbers)
     1813%% increment (or decrement) the field indices and update the input filename(s)
    17911814if get(handles.scan_i,'Value')==1% case of scanning along index i   
    17921815     i1=i1+increment;
     
    18091832end
    18101833
    1811 % refresh plots
     1834%% refresh plots
    18121835errormsg=refresh_field(handles,filename,filename_1,i1,i2,j1,j2);
    1813 if isempty(errormsg)  %update the index counters
    1814     if strcmp(NomType,'*')%case of movies
    1815         set(handles.i1,'String',num2str(i1))%update the index display
     1836
     1837%% update the index counters if the index move is successfull
     1838if isempty(errormsg)
     1839    set(handles.i1,'String',num2stra(i1,NomType,1));
     1840    if isequal(i2,i1)
     1841        set(handles.i2,'String','');
    18161842    else
    1817         [~,~,i1_str,i2_str,j1_str,j2_str]=name2display(filename);
    1818         set(handles.i1,'String',i1_str)
    1819         set(handles.j1,'String',j1_str)
    1820         if ~isequal(movie_status,1)
    1821             set(handles.i2,'String',i2_str)
    1822             set(handles.j2,'String',j2_str)
    1823         end
    1824         [indices]=name_generator('',i1,j1,'',NomType,1,i2,j2,'');
    1825         set(handles.FileIndex,'String',indices);
    1826         if ~isempty(filename_1)
    1827             indices_1=name_generator('',i1_1,j1_1,'',NomType_1,1,i2_1,j2_1,'');
    1828             set(handles.FileIndex_1,'String',indices_1);
    1829         end
    1830     end
    1831     %     set(handles.i1,'String',num2stra(i1,NomType,1));
    1832     %     if isequal(i2,i1)
    1833     %          set(handles.i2,'String','');
    1834     %     else
    1835     %         set(handles.i2,'String',num2stra(num2,NomType,1));
    1836     %     end
    1837     %     set(handles.j1,'String',num2stra(j1,NomType,2));
    1838     %     if isequal(j2,j1)
    1839     %          set(handles.j2,'String','');
    1840     %     else
    1841     %         set(handles.j2,'String',num2stra(j2,NomType,2));
    1842     %     end
    1843    
     1843        set(handles.i2,'String',num2stra(i2,NomType,1));
     1844    end
     1845    set(handles.j1,'String',num2stra(j1,NomType,2));
     1846    if isequal(j2,j1)
     1847        set(handles.j2,'String','');
     1848    else
     1849        set(handles.j2,'String',num2stra(j2,NomType,2));
     1850    end
     1851    [indices]=name_generator('',i1,j1,'',NomType,1,i2,j2,'');
     1852    set(handles.FileIndex,'String',indices);
     1853    if ~isempty(filename_1)
     1854        indices_1=name_generator('',i1_1,j1_1,'',NomType_1,1,i2_1,j2_1,'');
     1855        set(handles.FileIndex_1,'String',indices_1);
     1856    end
    18441857    if isequal(movie_status,1)
    18451858        set(handles.movie_pair,'Value',1)
     
    18711884    test_1=0;
    18721885    [ff,rr,filebase,xx,Ext,SubDir]=read_file_boxes(handles);
    1873     NomType=get(handles.FileIndex,'UserData');
     1886    NomType=get(handles.NomType,'String');
     1887%     NomType=get(handles.FileIndex,'UserData');
    18741888else
    18751889    list_fields=get(handles.Fields_1,'String');% list menu fields
     
    18791893        test_1=1;
    18801894        [ff,rr,filebase,xx,Ext,SubDir]=read_file_boxes_1(handles);
    1881         NomType=get(handles.FileIndex_1,'UserData');
     1895        NomType=get(handles.NomType_1,'String');
     1896%         NomType=get(handles.FileIndex_1,'UserData');
    18821897    else
    18831898        msgbox_uvmat('ERROR','an image or movie must be first introduced as input')
     
    20542069    return
    20552070end
    2056 NomType=get(handles.FileIndex,'UserData');
     2071NomType=get(handles.NomType,'String');
     2072% NomType=get(handles.FileIndex,'UserData');
    20572073%update the z position index
    20582074nbslice_str=get(handles.nb_slice,'String');
     
    21582174            Ext_1=get(handles.FileExt,'String');%read the file extension for the first series (case of veltype comparison within a single file)
    21592175        end
    2160         NomType_1=get(handles.FileIndex_1,'UserData');
     2176        NomType_1=get(handles.NomType_1,'String');
     2177%         NomType_1=get(handles.FileIndex_1,'UserData');
    21612178        if isequal(Ext_1,'.nc')||isequal(Ext_1,'.cdf')
    21622179            FileType_1='netcdf';
     
    30313048
    30323049%------------------------------------------------------------------------
    3033 % --- read the data displayed for the input rootfile windows (new)
     3050% --- read the data displayed for the input rootfile windows (new): TODO use read_GUI
     3051
    30343052function [FileName,RootPath,FileBase,FileIndices,FileExt,SubDir]=read_file_boxes(handles)
    30353053%------------------------------------------------------------------------
    3036 RootPath=get(handles.RootPath,'String');
    3037 FileName=RootPath; %default
    3038 SubDir=get(handles.SubDir,'String');
    3039 if ~isempty(SubDir) && ~isequal(SubDir,'')
    3040     if (isequal(SubDir(1),'/')|| isequal(SubDir(1),'\'))
    3041         SubDir(1)=[]; %suppress possible / or \ separator
    3042     end
    3043     FileName=fullfile(RootPath,SubDir);
    3044 end
    3045 RootFile=get(handles.RootFile,'String');
    3046 if ~isempty(RootFile) && ~isequal(RootFile,'')
    3047     if (isequal(RootFile(1),'/')|| isequal(RootFile(1),'\'))
    3048         RootFile(1)=[]; %suppress possible / or \ separator
    3049     end
    3050     FileName=fullfile(FileName,RootFile);
    3051 end
    3052 FileBase=fullfile(RootPath,RootFile);
    3053 FileIndices=get(handles.FileIndex,'String');
    3054 FileExt=get(handles.FileExt,'String');
    3055 FileName=[FileName FileIndices FileExt];
     3054InputFile=read_GUI(handles.InputFile);
     3055RootPath=InputFile.RootPath;
     3056FileName=InputFile.RootPath; %default
     3057if ~isempty(InputFile.SubDir)
     3058    InputFile.SubDir=regexprep(InputFile.SubDir,'/|\','');
     3059    FileName=fullfile(InputFile.RootPath,InputFile.SubDir);
     3060end
     3061if ~isempty(InputFile.RootFile)
     3062    InputFile.RootFile=regexprep(InputFile.RootFile,'/|\','');
     3063    FileName=fullfile(FileName,InputFile.RootFile);
     3064end
     3065SubDir=InputFile.SubDir;
     3066% if ~isempty(SubDir) && ~isequal(SubDir,'')
     3067%     if (isequal(SubDir(1),'/')|| isequal(SubDir(1),'\'))
     3068%         SubDir(1)=[]; %suppress possible / or \ separator
     3069%     end
     3070%     FileName=fullfile(RootPath,SubDir);
     3071% end
     3072% RootFile=get(handles.RootFile,'String');
     3073% if ~isempty(RootFile) && ~isequal(RootFile,'')
     3074%     if (isequal(RootFile(1),'/')|| isequal(RootFile(1),'\'))
     3075%         RootFile(1)=[]; %suppress possible / or \ separator
     3076%     end
     3077%     FileName=fullfile(FileName,RootFile);
     3078% end
     3079FileBase=fullfile(InputFile.RootPath,InputFile.RootFile);
     3080FileIndices=InputFile.FileIndex;
     3081FileExt=InputFile.FileExt;
     3082FileName=[FileName InputFile.FileIndex InputFile.FileExt];
    30563083
    30573084%------------------------------------------------------------------------
     
    31703197indices=name_generator('',str2double(str1),str2double(str_a),'',NomTypeNew,1,str2double(str2),str2double(str_b),'');
    31713198set(handles.FileIndex,'String',indices)
    3172 set(handles.FileIndex,'UserData',NomTypeNew)
     3199set(handles.NomType,'String',NomTypeNew)
     3200% set(handles.FileIndex,'UserData',NomTypeNew)
    31733201%common to Fields_1_Callback
    31743202if isequal(field,'image')||isequal(field_1,'image')
     
    32083236[FileName,RootPath,FileBase,FileIndices,FileExt_1]=read_file_boxes_1(handles);
    32093237[P,F,str1,str2,str_a,str_b,E,NomType_1]=name2display(['xxx' get(handles.FileIndex,'String') FileExt_1]);
    3210 % if isempty(FileExt_prev)|| strcmp(FileExt_prev,'')
    3211 %     FileExt_1=get(handles.FileExt,'String');
    3212 % else
    3213 %     FileExt_1=FileExt_prev;
    3214 % end
    3215 % NomType_1=get(handles.FileIndex_1,'UserData');
    32163238if isempty(NomType_1)|| strcmp(NomType_1,'')
    32173239    [FileName,RootPath,FileBase,FileIndices,FileExt_1]=read_file_boxes(handles);
    32183240    [P,F,str1,str2,str_a,str_b,E,NomType_1]=name2display(['xxx' get(handles.FileIndex,'String') FileExt_1]);
    3219 %     NomType_1=get(handles.FileIndex,'UserData');
    32203241end
    32213242NomTypeNew=NomType_1;%default
     
    33563377indices=name_generator('',str2num(str1),stra2num(str_a),'',NomTypeNew,1,str2num(str2),stra2num(str_b),'');
    33573378set(handles.FileIndex_1,'String',indices)
    3358 set(handles.FileIndex_1,'UserData',NomTypeNew)
     3379set(handles.NomType_1,'String',NomTypeNew)
     3380% set(handles.FileIndex_1,'UserData',NomTypeNew)
    33593381
    33603382%common to Fields_Callback
     
    34143436% end
    34153437
    3416 %-------------------------------------------------------------------
     3438%------------------------------------------------------------------------
    34173439% --- Executes on button press in VelType.
    34183440function VelType_Callback(hObject, eventdata, handles)
    3419 %-------------------------------------------------------------------
    3420 % if get(handles.VelType,'Value')==1
    3421 %     reset_vel_type([handles.interp1 handles.civ2 handles.filter1 handles.interp1 handles.interp2 handles.filter2],handles.VelType)
    3422 % else
    3423 %     reset_vel_type([handles.VelType handles.filter1 handles.interp1 handles.civ2 handles.interp2 handles.filter2])
    3424 % end
     3441%------------------------------------------------------------------------
    34253442set(handles.FixVelType,'Value',1)
    34263443run0_Callback(hObject, eventdata, handles)
    34273444
    3428 %---------------------------------------------
     3445%------------------------------------------------------------------------
     3446% --- Executes on button press in VelType.
    34293447function VelType_1_Callback(hObject, eventdata, handles)
    3430 %---------------------------------------------
     3448%------------------------------------------------------------------------
    34313449 
    34323450set(handles.FixVelType,'Value',1)% the velocity type is now imposed by the GUI (not automatic)
    34333451%refresh field with a second filename=first fiel name
    34343452set(handles.run0,'BackgroundColor',[1 1 0])%paint the command button in yellow
    3435 drawnow   
     3453drawnow   
     3454InputFile=read_GUI(handles.InputFile);
    34363455filename=read_file_boxes(handles);
    34373456
     
    46294648    end
    46304649end
    4631 param.NomType=get(handles.FileIndex,'UserData');
    4632 param.NomType_1=get(handles.FileIndex_1,'UserData');
     4650param.NomType=get(handles.NomType,'String');
     4651% param.NomType=get(handles.FileIndex,'UserData');
     4652param.NomType_1=get(handles.NomType_1,'String');
     4653% param.NomType_1=get(handles.FileIndex_1,'UserData');
    46334654param.comp_input=get(handles.fix_pair,'Value');
    46344655huvmat=get(handles.MenuSeries,'parent');
     
    49724993end
    49734994hset_object=set_object(ObjectData,[],ZBounds);
     4995
     4996
     4997
     4998function NomType_Callback(hObject, eventdata, handles)
     4999
     5000
     5001function NomType_1_Callback(hObject, eventdata, handles)
     5002
Note: See TracChangeset for help on using the changeset viewer.