Changeset 89 for trunk/src/uvmat.m


Ignore:
Timestamp:
May 20, 2010, 1:48:25 AM (14 years ago)
Author:
sommeria
Message:

many bug corrections and cleaning. Activation of the BW option in uvmat. Improvement of the interaction of get_field with uvmat.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r88 r89  
    165165% Object{iobj}.plotaxes and nbobj representation graphs  Object{iobj}.plothandles(:) (where nbobj is the
    166166% nbre of current objects opened in uvmat. Note that Object{iobj}.plothandles(iobj)=[] : an object is not represented in its own projection field;
    167 %-------------------------------------------------------------------
    168 %-------------------------------------------------------------------
     167
     168%------------------------------------------------------------------------
     169%------------------------------------------------------------------------
    169170%  I - MAIN FUNCTION UVMAT (DO NOT MODIFY)
    170 %-------------------------------------------------------------------
    171 %-------------------------------------------------------------------
     171%------------------------------------------------------------------------
     172%------------------------------------------------------------------------
    172173function varargout = uvmat(varargin)
    173174
     
    191192% End initialization code - DO NOT EDIT
    192193
    193 %-------------------------------------------------------------------
     194%------------------------------------------------------------------------
    194195% --- Executes just before uvmat is made visible.
    195196function uvmat_OpeningFcn(hObject, eventdata, handles, input )
    196 %-------------------------------------------------------------------
     197%------------------------------------------------------------------------
    197198global nb_builtin
    198199
     
    221222set(hObject,'DeleteFcn',{@closefcn})%
    222223
    223 %TRANSFORM menu: loads the information stored in prefdir to initiate the browser and the list of functions
     224%refresh projection plane
     225UvData.Object{1}.Style='plane';%main plotting plane
     226UvData.Object{1}.ProjMode='projection';%main plotting plane
     227if ~isfield(UvData.Object{1},'plotaxes')
     228    UvData.Object{1}.plotaxes=handles.axes3;%default plotting axis
     229    set(handles.list_object_1,'Value',1);
     230    set(handles.list_object_1,'String',{'1-PLANE'});
     231end
     232
     233%TRANSFORM menu: builtin fcts
    224234menu_str={'';'phys';'px';'phys_polar'};
    225235nb_builtin=numel(menu_str); %number of functions
     
    238248end
    239249rmpath(fullfile(path_uvmat,'transform_field'))
    240 
    241 %refresh projection plane
    242 UvData.Object{1}.Style='plane';%main plotting plane
    243 UvData.Object{1}.ProjMode='projection';%main plotting plane
    244 if ~isfield(UvData.Object{1},'plotaxes')
    245     UvData.Object{1}.plotaxes=handles.axes3;%default plotting axis
    246     set(handles.list_object_1,'Value',1);
    247     set(handles.list_object_1,'String',{'1-PLANE'});
    248 end
    249250
    250251%load the list of previously browsed files in menus Open and Open_1
     
    279280             if exist(file,'file')
    280281                h_func=str2func(file);
    281                 testexist=[testexist 1]; %#ok<AGROW>
     282                testexist=[testexist 1];
    282283             else
    283284                h_func=[];
    284                 testexist=[testexist 0];  %#ok<AGROW>
     285                testexist=[testexist 0];
    285286             end
    286              fct_handle=[fct_handle; {h_func}];%#ok<AGROW> %concatene the list of paths
     287             fct_handle=[fct_handle; {h_func}]; %concatene the list of paths
    287288             rmpath(path)
    288              menu_str=[menu_str; {file}]; %#ok<AGROW>
     289             menu_str=[menu_str; {file}];
    289290         end
    290291      end
     
    344345        set(handles.Fields,'Value',1)
    345346        set(handles.Fields,'String',{'get_field...'})   
    346        % set(handles.Fields,'UserData',Field)
    347347        testinputfield=1;
    348348       
     
    577577            [ff,rr,FileBase_1,ii,FileExt_1,SubDir_1]=read_file_boxes_1(handles);
    578578            NomType_1=get(handles.FileIndex_1,'UserData');     
    579             FileName_1=name_generator(FileBase_1,stra2num(i1),stra2num(i2),FileExt_1,NomType_1,1,stra2num(str_a),stra2num(str_b),SubDir_1);
     579            FileName_1=name_generator(FileBase_1,str2double(i1),str2double(i2),FileExt_1,NomType_1,1,stra2num(str_a),stra2num(str_b),SubDir_1);
    580580            if exist(FileName_1,'file')
    581                 FileIndex_1=name_generator('',stra2num(i1),stra2num(i2),'',NomType_1,1,stra2num(str_a),stra2num(str_b),'');
     581                FileIndex_1=name_generator('',str2double(i1),str2double(i2),'',NomType_1,1,stra2num(str_a),stra2num(str_b),'');
    582582                set(handles.FileIndex_1,'String',FileIndex_1)
    583583            else
     
    608608end
    609609
    610 %-------------------------------------------------------------------
     610%------------------------------------------------------------------------
    611611function RootPath_Callback(hObject,eventdata,handles)
     612%------------------------------------------------------------------------
    612613update_rootinfo(hObject,eventdata,handles);
    613614
    614 %-------------------------------------------------------------------
     615%------------------------------------------------------------------------
    615616%-- called by action in RootFile edit box
    616 %-------------------------------------------------------------------
    617617function SubDir_Callback(hObject, eventdata, handles)
     618%------------------------------------------------------------------------
    618619%refresh the menu of input fields
    619620Fields_Callback(hObject, eventdata, handles);
     
    621622run0_Callback(hObject, eventdata, handles);
    622623
    623 
    624 %-------------------------------------------------------------------
    625 %-- called by action in RootFile edit box
    626 %-------------------------------------------------------------------
     624%------------------------------------------------------------------------
     625% --- called by action in RootFile edit box
    627626function RootFile_Callback(hObject, eventdata, handles)
     627%------------------------------------------------------------------------
    628628update_rootinfo(hObject,eventdata,handles)
    629629
    630 %-------------------------------------------------------------------
    631 %-- called by action in FileIndex edit box
    632 %-------------------------------------------------------------------
     630%------------------------------------------------------------------------
     631% --- called by action in FileIndex edit box
    633632function FileIndex_Callback(hObject, eventdata, handles)
     633%------------------------------------------------------------------------
    634634FileIndices=get(handles.FileIndex,'String');
    635635if isempty(str2num(FileIndices))
     
    647647run0_Callback(hObject, eventdata, handles)
    648648
    649 %-------------------------------------------------------------------
    650 %-- called by action in FileIndex_1 edit box
    651 %-------------------------------------------------------------------
     649%------------------------------------------------------------------------
     650% --- called by action in FileIndex_1 edit box
    652651function FileIndex_1_Callback(hObject, eventdata, handles)
    653 % FileIndices=get(handles.FileIndex_1,'String');
    654 % if isempty(str2num(FileIndices))
    655 %     [pp,ff,str1,str2,str_a,str_b]=name2display(FileIndices)
    656 % else
    657 %     str1=FileIndices;
    658 %     str2='';
    659 %     str_a='';
    660 %     str_b='';
    661 % end
    662 % set(handles.i1,'String',str1);
    663 % set(handles.i2,'String',str2);
    664 % set(handles.j1,'String',str_a);
    665 % set(handles.j2,'String',str_b);
     652%------------------------------------------------------------------------
    666653run0_Callback(hObject, eventdata, handles)
    667654
    668 %-------------------------------------------------------------------
    669 % -- update information about a new field series (indices to scan, timing, calibration from an xml file, then refresh current plots
    670 %-------------------------------------------------------------------
     655%------------------------------------------------------------------------
     656% --- update information about a new field series (indices to scan, timing, calibration from an xml file, then refresh current plots
    671657function update_rootinfo(hObject,eventdata,handles)
    672 
     658%------------------------------------------------------------------------
    673659set(handles.RootPath,'BackgroundColor',[1 1 0])
    674660drawnow
     
    678664UvData.TestInputFile=1;
    679665set(handles.fix_pair,'Value',1) % activate by default the comp_input '-'input window
    680 %FileIndex_Callback(hObject, eventdata, handles)% update field counters
    681666
    682667[FileName,RootPath,FileBase,FileIndices,FileExt,SubDir]=read_file_boxes(handles);
     
    693678TimeUnit=[];%default
    694679testima=0; %test for image input
     680imainfo=[];
     681ColorType='falsecolor'; %default
     682hhh='';
    695683if isequal(lower(FileExt),'.avi') %.avi file
    696684    testima=1;
    697     info=aviinfo([FileBase FileIndices FileExt]);
    698     nbfield=info.NumFrames;
     685    imainfo=aviinfo([FileBase FileIndices FileExt]);
     686    nbfield=imainfo.NumFrames;
    699687    nburst=1;
    700     set(handles.Dt_txt,'String',['Dt=' num2str(1000/info.FramesPerSecond) 'ms']);%display the elementary time interval in millisec
    701     XmlData.Time=(0:1/info.FramesPerSecond:(info.NumFrames-1)/info.FramesPerSecond)';
     688    set(handles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FramesPerSecond) 'ms']);%display the elementary time interval in millisec
     689    XmlData.Time=(0:1/imainfo.FramesPerSecond:(imainfo.NumFrames-1)/imainfo.FramesPerSecond)';
    702690    TimeUnit='s';
    703     set(handles.npx,'String',num2str(info.Width));%fills nbre of pixels x box
    704     set(handles.npy,'String',num2str(info.Height));%fills nbre of pixels y box
    705691    hhh=which('mmreader');
    706     if ~isequal(hhh,'')&& mmreader.isPlatformSupported()% if the function is found (recent version of matlab)
    707         UvData.MovieObject=mmreader([FileBase FileIndices FileExt]);
    708     end
     692    ColorType=imainfo.ImageType;%='truecolor' for color images
    709693elseif ~isempty(imformats(FileExt(2:end))) || isequal(FileExt,'.vol')%&& isequal(NomType,'*')% multi-frame image
    710694    testima=1;
     
    715699        imainfo=imfinfo([FileBase FileIndices FileExt]);
    716700    end
     701    ColorType=imainfo.ColorType;%='truecolor' for color images
    717702    if length(imainfo) >1 %case of image with multiple frames
    718703        nbfield=length(imainfo);
    719704        nburst=1;
    720705    end
    721     if isfield(UvData,'MovieObject')
    722         UvData=rmfield(UvData,'MovieObject');
    723     end
    724 else
    725     %set(handles.last_i,'String','');%fills last_field box
     706end
     707if ~strcmp(hhh,'')&& mmreader.isPlatformSupported()% if the function is found (recent version of matlab)
     708    UvData.MovieObject=mmreader([FileBase FileIndices FileExt]);
     709elseif isfield(UvData,'MovieObject')
     710    UvData=rmfield(UvData,'MovieObject');
     711end
     712if isfield(imainfo,'Width') && isfield(imainfo,'Height')
     713    set(handles.npx,'String',num2str(imainfo.Width));%fills nbre of pixels x box
     714    set(handles.npy,'String',num2str(imainfo.Height));%fills nbre of pixels x box
     715else
    726716    set(handles.npx,'String','');%fills nbre of pixels x box
    727     set(handles.npy,'String','');%fills nbre of pixels y box
    728     if isfield(UvData,'MovieObject')
    729         UvData=rmfield(UvData,'MovieObject');
    730     end
    731 end
     717    set(handles.npy,'String','');%fills nbre of pixels x box
     718end
     719set(handles.BW,'Value',strcmp(ColorType,'grayscale'))% select handles.BW if grayscale image
    732720
    733721% read parameters (time, geometric calibration..) from a documentation file (.xml advised)
     
    821809        set(handles.transform_fct,'Value',1); %  no transform by default
    822810    else
    823         if (isfield(GeometryCalib,'R')& ~isequal(GeometryCalib.R(2,1),0) & ~isequal(GeometryCalib.R(1,2),0)) |...
    824             (isfield(GeometryCalib,'kappa1')& ~isequal(GeometryCalib.kappa1,0))
     811        if (isfield(GeometryCalib,'R')&& ~isequal(GeometryCalib.R(2,1),0) && ~isequal(GeometryCalib.R(1,2),0)) |...
     812            (isfield(GeometryCalib,'kappa1')&& ~isequal(GeometryCalib.kappa1,0))
    825813            set(handles.pxcm,'String','var')
    826814            set(handles.pycm,'String','var')
     
    835823        end
    836824        if isfield(GeometryCalib,'SliceCoord')
     825           
    837826           siz=size(GeometryCalib.SliceCoord);
    838827           if siz(1)>1
     
    847836           end
    848837           slices_Callback(hObject, eventdata, handles)
    849     %        Coord=UvData.XmlData.GeometryCalib.SliceCoord;
    850     %        ZIndex=num_i1-NbSlice*(floor((num_i1-1)/NbSlice));
    851         end
    852 
    853            
     838        end           
    854839    end
    855840end
    856841
    857842%update the data attached to the uvmat interface
    858 % set(handles.nb_slice,'String',num2str(NbSlice))
    859843if ~isempty(TimeUnit)
    860844    set(handles.time_txt,'String',['time (' TimeUnit ')'])
    861845end
    862 %set(handles.DtUnit,'String',['10^(-3)' TimeUnit])
    863846UvData.TimeUnit=TimeUnit;
    864847UvData.XmlData=XmlData;
     
    986969end
    987970sizf=size(fileinput_1);
    988 if (~ischar(fileinput_1)|~isequal(sizf(1),1)),return;end
     971if (~ischar(fileinput_1)||~isequal(sizf(1),1)),return;end
    989972
    990973% refresh the current displayed field
     
    11971180end
    11981181TimeUnit_1=[];
    1199 % testima=0; %test for image input
     1182hhh='';%default, test for  movie reading with mmreader
     1183imainfo=[];
    12001184if isequal(lower(FileExt),'.avi') %.avi file
    1201 %     testima=1;
    1202     info=aviinfo([FileBase FileIndices FileExt]);
    1203     nbfield_1=info.NumFrames;
     1185    imainfo=aviinfo([FileBase FileIndices FileExt]);
     1186    nbfield_1=imainfo.NumFrames;
    12041187    nburst_1=1;
    1205     %set(handles.last_i,'String',num2str(info.NumFrames));%fills last_field box
    12061188    set(handles.Dt_txt,'String',['Dt=' num2str(1000/info.FramesPerSecond) 'ms']);%display the elementary time interval in millisec
    1207 %     set(handles.dt,'UserData',info.FramesPerSecond);
    1208     time=[0:1/info.FramesPerSecond:(info.NumFrames-1)/info.FramesPerSecond]';
    1209     npx=get(handles.npx,'String');
    1210     npy=get(handles.npy,'String');
    1211     if isequal(npx,'') || isequal(npy,'')
    1212         set(handles.npx,'String',num2str(info.Width));%fills nbre of pixels x box
    1213         set(handles.npy,'String',num2str(info.Height));%fills nbre of pixels y box
    1214     end
    1215 elseif ~isempty(imformats(FileExt(2:end))) %&& isequal(NomType,'*')% multi-frame image
     1189    time=[0:1/imainfo.FramesPerSecond:(imainfo.NumFrames-1)/imainfo.FramesPerSecond]';
     1190    ColorType=imainfo.ImageType;%='truecolor' for color images
     1191    hhh=which('mmreader');
     1192elseif ~isempty(imformats(FileExt(2:end)))|| isequal(FileExt,'.vol')
    12161193    testima=1;
    1217     imainfo=imfinfo([FileBase FileIndices FileExt]); 
     1194    if ~isequal(SubDir,'')
     1195        RootFile=get(handles.RootFile,'String');
     1196        imainfo=imfinfo([fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]);
     1197    else
     1198        imainfo=imfinfo([FileBase FileIndices FileExt]);
     1199    end
     1200    ColorType=imainfo.ColorType;%='truecolor' for color images
    12181201    if length(imainfo) >1 %case of image with multiple frames
    12191202        nbfield_1=length(imainfo);
    12201203        nburst_1=1;
    1221         %set(handles.last_i,'String',num2str(length(imainfo)));%fills last_field box
    1222     end       
    1223 else
    1224     %set(handles.last_i,'String','');%fills last_field box
    1225     set(handles.npx,'String','');%fills nbre of pixels x box
    1226     set(handles.npy,'String','');%fills nbre of pixels y box
     1204    end
     1205end
     1206if ~strcmp(hhh,'')&& mmreader.isPlatformSupported()% if the function is found (recent version of matlab)
     1207    UvData.MovieObject_1=mmreader([FileBase FileIndices FileExt]);
     1208elseif isfield(UvData,'MovieObject_1')
     1209    UvData=rmfield(UvData,'MovieObject_1');
     1210end
     1211if strcmp(get(handles.npx,'String'),'') || strcmp(get(handles.npy,'String'),'')%update npx and npy if it is not already filled by the first input field
     1212    if  isfield(imainfo,'Width') && isfield(imainfo,'Height')
     1213        set(handles.npx,'String',num2str(imainfo.Width));%fills nbre of pixels x box
     1214        set(handles.npy,'String',num2str(imainfo.Height));%fills nbre of pixels x box
     1215    else
     1216        set(handles.npx,'String','');%fills nbre of pixels x box
     1217        set(handles.npy,'String','');%fills nbre of pixels x box
     1218    end
     1219    set(handles.BW,'Value',strcmp(ColorType,'grayscale'))% select handles.BW if grayscale image
    12271220end
    12281221
     
    18491842end
    18501843
    1851 num_i1=stra2num(get(handles.i1,'String'));
     1844num_i1=str2double(get(handles.i1,'String'));
    18521845num_j1=stra2num(get(handles.j1,'String'));
    1853 num_i2=stra2num(get(handles.i2,'String'));
     1846num_i2=str2double(get(handles.i2,'String'));
    18541847num_j2=stra2num(get(handles.j2,'String'));
    1855 if isempty(num_j2)
     1848if isnan(num_j2)
    18561849    if isempty(num_i2)   
    18571850        msgbox_uvmat('ERROR', 'a second image index i2 or j2 is needed to show the pair as a movie')
     
    18621855    end
    18631856end
    1864 if isempty(num_i2)
     1857if isnan(num_i2)
    18651858    num_i2=num_i1;%repeat the index i1 by default
    18661859end
     
    22382231    if isequal(FileType,'netcdf')  %read the first nc field
    22392232        if isequal(FieldName,'get_field...')% read the field names on the interface get_field.
    2240             %VelType=get(handles.Fields,'UserData');
    2241             hget_field=findobj(allchild(0),'Name','get_field')%find the get_field... GUI
     2233            hget_field=findobj(allchild(0),'Name','uvmat_field');%find the get_field... GUI
    22422234            if isempty(hget_field)
    2243                 hget_field= get_field(filename);%open the get_field GUI   
    2244             end
    2245             if numel(hget_field)>1%case of several get_field GUI
    2246                 hget_field=hget_field(1);
     2235                hget_field= get_field(filename);%open the get_field GUI   
     2236                set(hget_field,'name','uvmat_field')
     2237            elseif UvData.NewSeries
     2238                delete(hget_field)
     2239                hget_field= get_field(filename);%open the get_field GUI
     2240                set(hget_field,'name','uvmat_field')
    22472241            end
    22482242            hhget_field=guidata(hget_field);
    2249             set(hhget_field.inputfile,'String',filename)% update the list of input fields in get_field
    2250             set(hhget_field.ACTION,'Value',1)% PLOT option selected
    2251             set(hhget_field.list_fig,'Value',2)% plotting axes =uvmat selected
    2252             [Field{1},errormsg]=read_get_field(hget_field); %read the names of the variables to plot in the get_field GUI
    2253             if ~isempty(errormsg)
    2254                 errormsg=['error in uvmat/run0_Callback/read_get_field: ' errormsg];
    2255                 return
    2256             end
     2243            funct_list=get(hhget_field.ACTION,'UserData');
     2244            funct_index=get(hhget_field.ACTION,'Value');
     2245            funct=funct_list{funct_index};
     2246            Field{1}=funct(hget_field); %read the names of the variables to plot in the get_field GUI
    22572247            CivStage=0;
    2258             VelType_out=[];         
     2248            VelType_out=[];   
    22592249        else
    22602250            [Field{1},VelType_out]=read_civxdata(filename,InputField,VelType);
     
    22692259    if ~isempty(filename_1) && ~test_keepdata_1 && isequal(FileType_1,'netcdf') %read the second file
    22702260        if isequal(FieldName_1,'get_field...')% read the field names on the interface get_field.
    2271             hget_field=findobj(allchild(0),'Name','get_field_1');%find the get_field... GUI
    2272              if isempty(hget_field)
    2273                  hget_field= get_field(filename_1);%open the get_field GUI
    2274                  set(hget_field,'name','get_field_1')
    2275 %                 enable_transform(handles,'off')% no field transform (possible transform in the GUI get_field)
    2276              end
    2277             hhget_field=guidata(hget_field);%handles of GUI elements in get_field
    2278             SubField=get_field('read_var_names',hObject,eventdata,hhget_field); %read the names of the variables to plot in the get_field GUI
    2279             [Field{2},var_detect]=nc2struct(filename_1,SubField.ListVarName); %read the corresponding input data               
    2280             Field{2}.VarAttribute=SubField.VarAttribute;
    2281             %update the display on get_field
    2282             set(hhget_field.inputfile,'String',filename_1)
    2283             set(hhget_field.variables,'Value',1)
    2284             Tabchar={''};%default
    2285             Tabcell=[];
    2286             if isfield(Field{2},'ListGlobalAttribute')& ~isempty(Field{2}.ListGlobalAttribute)
    2287                 for iline=1:length(Field{2}.ListGlobalAttribute)
    2288                     Tabcell{iline,1}=Field{2}.ListGlobalAttribute{iline};
    2289                     if isfield(Field{2}, Field{2}.ListGlobalAttribute{iline})
    2290                         eval(['val=Field{2}.' Field{2}.ListGlobalAttribute{iline} ';'])
    2291                         if ischar(val);
    2292                             Tabcell{iline,2}=val;
    2293                         else
    2294                             Tabcell{iline,2}=num2str(val);
    2295                         end
    2296                     end
    2297                 end
    2298                 if ~isempty(Tabcell)
    2299                     Tabchar=cell2tab(Tabcell,'=');
    2300                     Tabchar=[{''};Tabchar];
    2301                 end
     2261            hget_field_1=findobj(allchild(0),'Name','uvmat_field_1');%find the get_field... GUI
     2262            if isempty(hget_field_1)
     2263                 hget_field_1= get_field(filename_1);%open the get_field GUI
     2264                 set(hget_field_1,'name','uvmat_field_1')
    23022265            end
    2303             set(hhget_field.attributes,'String',Tabchar);%update list of global attributes in get_field
     2266            hhget_field_1=guidata(hget_field_1);%handles of GUI elements in get_field
     2267            funct_list=get(hhget_field_1.ACTION,'UserData');
     2268            funct_index=get(hhget_field_1.ACTION,'Value');
     2269            funct=funct_list{funct_index};
     2270            Field{2}=funct(hget_field_1); %read the names of the variables to plot in the get_field GUI
    23042271        else
    23052272            [Field{2},VelType_out_1]=read_civxdata(filename_1,InputField_1,VelType_1);
     
    23792346       if siz(1)>1
    23802347           NbSlice=siz(1);
    2381 %            set(handles.slices,'Visible','on')
    2382 %            set(handles.slices,'Value',1)
    23832348       else
    23842349           NbSlice=1;
    23852350       end
    2386        %set(handles.nb_slice,'String',num2str(NbSlice))
    2387 %        slices_Callback(handles.uvmat, [], handles)
    23882351end
    23892352
     
    25102473end
    25112474%case of structured coordinates
    2512 if isfield(UvData.Field,'AX') & isfield(UvData.Field,'AY')& isfield(UvData.Field,'A')
     2475if isfield(UvData.Field,'AX') && isfield(UvData.Field,'AY')&& isfield(UvData.Field,'A')
    25132476    UvData.XMax=max(UvData.Field.AX);
    25142477    UvData.XMin=min(UvData.Field.AX);
     
    25182481    UvData.Mesh=sqrt((UvData.XMax-UvData.XMin)*(UvData.YMax-UvData.YMin)/((np_A(1)-1) * (np_A(2)-1))) ;
    25192482end
    2520 if  isempty(coord_x)&~isempty(CellVarIndex)
     2483if  isempty(coord_x) && ~isempty(CellVarIndex)
    25212484    VarIndex=CellVarIndex{imax}; % list of variable indices
    25222485    DimIndex=UvData.Field.VarDimIndex{VarIndex(1)}; %list of dim indices for the variable
     
    26402603        %Projeter les champs sur l'objet:*
    26412604        ObjectData=proj_field(UvData.Field,UvData.Object{iobj},iobj);
    2642 %         if imap==2
    2643 %             UvData.ProjField_2=ObjectData;%store the projection field on uvmat: ***** WILL REPLACE THE FIELD SORED ON THE AXES: AxeData *****
    2644 %         else
    2645 %             UvData.ProjField_1=ObjectData;%store the projection field on view_field
    2646 %         end
    26472605        %use of mask
    26482606        if isfield(ObjectData,'NbDim')&isequal(ObjectData.NbDim,2)
     
    27782736testimedoc=0;
    27792737if isfield(UvData,'XmlData') && isfield(UvData.XmlData,'Time')
    2780     if isempty(num_i2)
     2738    if isempty(num_i2)||isnan(num_i2)
    27812739        num_i2=num_i1;
    27822740    end
    2783     if isempty(num_j1)
     2741    if isempty(num_j1)||isnan(num_j1)
    27842742        num_j1=1;
    27852743    end
    2786     if isempty(num_j2)
     2744    if isempty(num_j2)||isnan(num_j2)
    27872745        num_j2=num_j1;
    27882746    end
     
    28282786    end
    28292787end
    2830 
     2788%update the input file name in the get_field GUI
     2789if isequal(FieldName,'get_field...')
     2790    set(hhget_field.inputfile,'String',filename)
     2791    Tabchar={''};%default
     2792    Tabcell=[];
     2793    if isfield(Field{1},'ListGlobalAttribute')& ~isempty(Field{1}.ListGlobalAttribute)
     2794        for iline=1:length(Field{1}.ListGlobalAttribute)
     2795            Tabcell{iline,1}=Field{1}.ListGlobalAttribute{iline};
     2796            if isfield(Field{1}, Field{1}.ListGlobalAttribute{iline})
     2797                eval(['val=Field{1}.' Field{1}.ListGlobalAttribute{iline} ';'])
     2798                if ischar(val);
     2799                    Tabcell{iline,2}=val;
     2800                else
     2801                    Tabcell{iline,2}=num2str(val);
     2802                end
     2803            end
     2804        end
     2805        if ~isempty(Tabcell)
     2806            Tabchar=cell2tab(Tabcell,'=');
     2807            Tabchar=[{''};Tabchar];
     2808        end
     2809    end
     2810    set(hhget_field.attributes,'String',Tabchar);%update list of global attributes in get_field
     2811end
     2812if isequal(FieldName_1,'get_field...')
     2813    set(hhget_field_1.inputfile,'String',filename_1)
     2814    Tabchar={''};%default
     2815    Tabcell=[];
     2816    if isfield(Field{2},'ListGlobalAttribute')& ~isempty(Field{2}.ListGlobalAttribute)
     2817        for iline=1:length(Field{2}.ListGlobalAttribute)
     2818            Tabcell{iline,1}=Field{2}.ListGlobalAttribute{iline};
     2819            if isfield(Field{2}, Field{2}.ListGlobalAttribute{iline})
     2820                eval(['val=Field{2}.' Field{2}.ListGlobalAttribute{iline} ';'])
     2821                if ischar(val);
     2822                    Tabcell{iline,2}=val;
     2823                else
     2824                    Tabcell{iline,2}=num2str(val);
     2825                end
     2826            end
     2827        end
     2828        if ~isempty(Tabcell)
     2829            Tabchar=cell2tab(Tabcell,'=');
     2830            Tabchar=[{''};Tabchar];
     2831        end
     2832    end
     2833    set(hhget_field_1.attributes,'String',Tabchar);%update list of global attributes in get_field
     2834end
    28312835
    28322836
     
    28582862    set(handles.auto_xy,'BackgroundColor',[1 1 0])
    28592863    cla(handles.axes3)
    2860     update_plot(handles)
     2864    update_plot(handles);
    28612865else
    28622866    set(handles.auto_xy,'BackgroundColor',[0.7 0.7 0.7])
    2863     update_plot(handles)
     2867    update_plot(handles);
    28642868%     axis(handles.axes3,'image')
    28652869end
     
    30393043end
    30403044
    3041 % %----------------------------------------------
    3042 % %read the data displayed for the input rootfile windows (new)
    3043 % %-------------------------------------------------
     3045%------------------------------------------------------------------------
     3046% --- read the data displayed for the input rootfile windows (new)
    30443047function [FileName,RootPath,FileBase,FileIndices,FileExt,SubDir]=read_file_boxes(handles)
     3048%------------------------------------------------------------------------
    30453049RootPath=get(handles.RootPath,'String');
    30463050FileName=RootPath; %default
     
    31143118     set_veltype_display(veltype_handles,0) % unvisible civ buttons
    31153119     filename=read_file_boxes(handles);
    3116      hget_field=findobj(allchild(0),'name','get_field');
    3117      if ~isempty(hget_field)
    3118          delete(hget_field)
     3120     hget_field=findobj(allchild(0),'name','uvmat_field');
     3121     if isempty(hget_field)
     3122         hget_field=get_field(filename);
     3123         set(hget_field,'Name','uvmat_field')       
    31193124     end
    3120      get_field(filename)
    31213125    return %no action
    31223126end
     
    38493853% set(handles.slider1,'Value',col)
    38503854set_vec_col_bar(handles)
    3851 update_plot(handles)
     3855update_plot(handles);
    38523856
    38533857%----------------------------------------------------------------
     
    38593863% slider2_Callback(hObject, eventdata, handles)
    38603864set_vec_col_bar(handles)
    3861 update_plot(handles)
     3865update_plot(handles);
    38623866%------------------------------------------------------------
    38633867%update the slider values after displaying vectors
     
    38853889set_vec_col_bar(handles)
    38863890
    3887 % %--------------------------------------------
    3888 % %update the display of color code for vectors
    3889 % %--------------------------------------------
    3890 % function set_vec_col_bar(handles)
    3891 % %get the image of the color display button 'vec_col_bar' in pixels
    3892 % uni=get(handles.vec_col_bar,'Unit');
    3893 % set(handles.vec_col_bar,'Unit','pixel')
    3894 % pos_vert=get(handles.vec_col_bar,'Position');
    3895 % set(handles.vec_col_bar,'Unit','Normalized')
    3896 % width=ceil(pos_vert(3));
    3897 % height=ceil(pos_vert(4));
    3898 % %get slider indications
    3899 % colcode.min=get(handles.slider1,'Min');
    3900 % colcode.max=get(handles.slider1,'Max');
    3901 % colcode.colcode1=get(handles.slider1,'Value');
    3902 % colcode.colcode2=get(handles.slider2,'Value');
    3903 % colcode.option=get(handles.vec_col_bar,'Value');
    3904 % colcode.auto=1;
    3905 % list_code=get(handles.col_vec,'String');% list menu fields
    3906 % index_code=get(handles.col_vec,'Value');% selected string index
    3907 % colcode.CName= list_code{index_code(1)}; % selected field used for vector color
    3908 % vec_C=colcode.min+(colcode.max-colcode.min)*[0.5:width-0.5]/width;%sample of vec_C values from min to max
    3909 % [colorlist,col_vec]=set_col_vec(colcode,vec_C);
    3910 % oneheight=ones(1,height);
    3911 % A1=colorlist(col_vec,1)*oneheight;
    3912 % A2=colorlist(col_vec,2)*oneheight;
    3913 % A3=colorlist(col_vec,3)*oneheight;
    3914 % A(:,:,1)=A1';
    3915 % A(:,:,2)=A2';
    3916 % A(:,:,3)=A3';
    3917 % set(handles.vec_col_bar,'Cdata',A)
    3918 
    3919 %--------------------------------------------------------
    3920 % --- Executes on button press in cal.
    3921 function cal_Callback(hObject, eventdata, handles)
    3922 
    3923 
    3924 
    39253891%-------------------------------------------------------------
    39263892% --- Executes on selection change in transform_fct.
     
    39403906    dlg_title = 'user defined transform';
    39413907    num_lines= 1;
    3942     [FileName, PathName, filterindex] = uigetfile( ...
     3908    [FileName, PathName] = uigetfile( ...
    39433909       {'*.m', ' (*.m)';
    39443910        '*.m',  '.m files '; ...
     
    40153981list_object_2_Callback(hObject, eventdata, handles)
    40163982
    4017 
    4018 
    40193983%delete mask if it is displayed
    40203984if isequal(get(handles.mask_test,'Value'),1)%if the mask option is on
     
    41154079set(handles.AutoScal,'Value',1) %suppress auto mode
    41164080set(handles.AutoScal,'BackgroundColor',[1 1 0])
    4117 update_plot(handles)
     4081update_plot(handles);
    41184082
    41194083%-----------------------------------------------------------------
     
    41224086set(handles.AutoScal,'Value',1) %suppress auto mode
    41234087set(handles.AutoScal,'BackgroundColor',[1 1 0])
    4124 update_plot(handles)
     4088update_plot(handles);
    41254089
    41264090%-----------------------------------------------
     
    41334097    set(handles.AutoScal,'BackgroundColor',[0.7 0.7 0.7])
    41344098    update_plot(handles);
    4135 %     set(handles.MinA,'String',num2str(ScalOut.MinA,3))
    4136 %     set(handles.MaxA,'String',num2str(ScalOut.MaxA,3))
    41374099end
    41384100
     
    41404102function BW_Callback(hObject, eventdata, handles)
    41414103%-------------------------------------------------------------------
    4142 update_plot(handles)
     4104update_plot(handles);
    41434105
    41444106%-------------------------------------------------------------------
     
    41534115    set(handles.IncrA,'Visible','off')
    41544116end
    4155 update_plot(handles)
     4117update_plot(handles);
    41564118
    41574119%-------------------------------------------------------------------
    41584120function IncrA_Callback(hObject, eventdata, handles)
    41594121%-------------------------------------------------------------------
    4160 update_plot(handles)
     4122update_plot(handles);
    41614123
    41624124%-------------------------------------------------------------------
    41634125function HideWarning_Callback(hObject, eventdata, handles)
    41644126%-------------------------------------------------------------------
    4165 update_plot(handles)
     4127update_plot(handles);
    41664128
    41674129%-------------------------------------------------------------------
    41684130function HideFalse_Callback(hObject, eventdata, handles)
    41694131%-------------------------------------------------------------------
    4170 update_plot(handles)
     4132update_plot(handles);
    41714133
    41724134%-------------------------------------------------------------------
     
    41754137set(handles.AutoVec,'Value',1);
    41764138set(handles.AutoVec,'BackgroundColor',[1 1 0])
    4177 update_plot(handles)
     4139update_plot(handles);
    41784140
    41794141%-------------------------------------------------------------------
     
    41894151end
    41904152
    4191 %-------------------------------------------------------
     4153%------------------------------------------------------------------------
    41924154% --- Executes on selection change in decimate4 (nb_vec/4).
    4193 %-------------------------------------------------------
    41944155function decimate4_Callback(hObject, eventdata, handles)
    4195 update_plot(handles)
    4196 
    4197 
    4198 %-------------------------------------------------------
     4156%------------------------------------------------------------------------
     4157update_plot(handles);
     4158
     4159%------------------------------------------------------------------------
    41994160% --- Executes on selection change in color_code menu
    4200 %-------------------------------------------------------
    42014161function color_code_Callback(hObject, eventdata, handles)
     4162%------------------------------------------------------------------------
    42024163set_vec_col_bar(handles)
    42034164update_plot(handles);
    42044165
    4205 %-------------------------------------------------------
     4166%------------------------------------------------------------------------
    42064167% --- Executes on button press in AutoVecColor.
    4207 %-------------------------------------------------------
    42084168function AutoVecColor_Callback(hObject, eventdata, handles)
     4169%------------------------------------------------------------------------
    42094170test=get(handles.AutoVecColor,'Value');
    42104171if test
     
    42154176    set(handles.AutoVecColor,'BackgroundColor',[0.7 0.7 0.7])
    42164177end
    4217 %set_vec_col_bar(handles)
    4218 
    4219 %-------------------------------------------------------
     4178
     4179%------------------------------------------------------------------------
    42204180% --- Executes on selection change in max_vec.
    4221 %-------------------------------------------------------
    42224181function min_vec_Callback(hObject, eventdata, handles)
     4182%------------------------------------------------------------------------
    42234183max_vec_Callback(hObject, eventdata, handles)
    42244184
     4185%------------------------------------------------------------------------
    42254186% --- Executes on selection change in max_vec.
    42264187function max_vec_Callback(hObject, eventdata, handles)
     4188%------------------------------------------------------------------------
    42274189set(handles.AutoVecColor,'Value',1)
    42284190AutoVecColor_Callback(hObject, eventdata, handles)
     
    42374199update_plot(handles);
    42384200
    4239 %-------------------------------------------------------------------
    4240 %update the display of color code for vectors
     4201%------------------------------------------------------------------------
     4202% --- update the display of color code for vectors
    42414203function set_vec_col_bar(handles)
    4242 %-------------------------------------------------------------------
     4204%------------------------------------------------------------------------
    42434205%get the image of the color display button 'vec_col_bar' in pixels
    42444206set(handles.vec_col_bar,'Unit','pixel');
     
    42834245AxeData=get(haxes,'UserData');
    42844246PlotParam=read_plot_param(handles);
     4247PlotParam.Scalar
    42854248[PlotType,PlotParamOut]= plot_field(AxeData,haxes,PlotParam,1);
    42864249write_plot_param(handles,PlotParamOut); %update the auto plot parameters
     
    44464409%------------------------------------------------------
    44474410function MenuExportField_Callback(hObject, eventdata, handles)
    4448 global CurData
    4449 CurData=get(handles.uvmat,'UserData');
    4450 evalin('base','global CurData')%make CurData global in the workspace
     4411global Data_uvmat
     4412Data_uvmat=get(handles.uvmat,'UserData');
     4413evalin('base','global Data_uvmat')%make CurData global in the workspace
    44514414display(['current field :'])
    4452 evalin('base','CurData') %display CurData in the workspace
     4415evalin('base','Data_uvmat') %display CurData in the workspace
    44534416commandwindow; %brings the Matlab command window to the front
    44544417
     
    49764939       '*.xml',  '.xml files '; ...
    49774940        '*.mat',  '.mat matlab files '}, ...
    4978         'Pick a file',get(handles.RootPath,'String'));
     4941        'Pick an xml Object file',get(handles.RootPath,'String'));
    49794942fileinput=[PathName FileName];%complete file name
    49804943testblank=findstr(fileinput,' ');%look for blanks
Note: See TracChangeset for help on using the changeset viewer.