Changeset 180


Ignore:
Timestamp:
Jan 18, 2011, 10:50:40 PM (13 years ago)
Author:
sommeria
Message:

rationalisation of uvmat, introduction of the new function read_field, links with get_field, several bug repairs

Location:
trunk/src
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/calc_field.m

    r156 r180  
    6767    units_cell={};
    6868    for ilist=1:length(FieldName)
    69         [VarName,Value,Role,units]=feval(FieldName{ilist},DataIn);%calculate field with appropriate function named FieldName{ilist}
    70         ListVarName=[ListVarName VarName];
    71         ValueList=[ValueList Value];
    72         RoleList=[RoleList Role];
    73         units_cell=[units_cell units];
     69        if ~isempty(FieldName{ilist})
     70            [VarName,Value,Role,units]=feval(FieldName{ilist},DataIn);%calculate field with appropriate function named FieldName{ilist}
     71            ListVarName=[ListVarName VarName];
     72            ValueList=[ValueList Value];
     73            RoleList=[RoleList Role];
     74            units_cell=[units_cell units];
     75        end
    7476    end
    7577    %erase previous data (except coordinates)
  • trunk/src/civ.m

    r179 r180  
    15981598box_test(5)=get(handles.FIX2,'Value');
    15991599box_test(6)=get(handles.PATCH2,'Value');
    1600 index=find(box_test==1);
    1601 if isempty(index)
     1600index_first=find(box_test==1,1);
     1601if isempty(index_first)
    16021602    msgbox_uvmat('ERROR','no selected operation')
    16031603    return
    16041604end
    1605 index_first=min(index);
    1606 index_last=max(index);
     1605index_last=find(box_test==1,1,'last');
    16071606box_used=box_test(index_first : index_last);
    16081607[box_missing,ind_missing]=min(box_used);
    1609 if isequal(box_missing,0)
     1608if isequal(box_missing,0); %there is a missing step in the sequence of operations
    16101609    msgbox_uvmat('ERROR',['missing' cell2mat(operations(ind_missing))]);
    16111610    return
     
    16401639%% reinitialise status callback
    16411640if isfield(handles,'status')
    1642 set(handles.status,'Value',0);%suppress status display
    1643 status_Callback(hObject, eventdata, handles)
     1641    set(handles.status,'Value',0);%suppress status display
     1642    status_Callback(hObject, eventdata, handles)
    16441643end
    16451644
    16461645%% set the list of files and check them
    16471646display('checking the files...')
    1648 %compare=get(handles.compare,'Value');%test for usual PIV (compare=1) or displacement (=2) or stereo PIV (=3)
    16491647[filecell,num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2,nom_type_nc]=...
    16501648    set_civ_filenames(handles,box_test);
     
    46234621box_test(4)=get(handles.CIV2,'Value');
    46244622box_test(5)=get(handles.FIX2,'Value');
    4625 box_test(6)=get(handles.PATCH2,'Value')
    4626 find(box_test)
    4627 option_civ=max(find(box_test))
     4623box_test(6)=get(handles.PATCH2,'Value');
     4624option_civ=find(box_test,1,'last');%last selected option (non-zero index of box_test)
    46284625filecell=get(handles.civ,'UserData');
    46294626if ~isfield(filecell,'nc')
  • trunk/src/editxml.m

    r153 r180  
    330330    head_name=get(t,1,'name');
    331331    %Path to shemas:
    332     path_uvmat=which('editxml');% check the path detected for source file uvmat
    333     path_UVMAT=fileparts(path_uvmat); %path to UVMAT
    334     xmlparam=fullfile(path_UVMAT,'PARAM.xml');
     332%     path_uvmat=which('editxml');% check the path detected for source file uvmat
     333%     path_UVMAT=fileparts(path_uvmat); %path to UVMAT
     334%     xmlparam=fullfile(path_UVMAT,'PARAM.xml');
     335    xmlparam='PARAM.xml'; %will find PARAM.xml whose path is set in priority
    335336    if exist(xmlparam,'file')
    336337        tparam=xmltree(xmlparam);
     
    350351            '*.xsd',  '.xsd files '; ...
    351352            '*.*',  'All Files (*.*)'}, ...
    352             'Pick a .xsd schema' ,schemapath); %file browser
     353            'Pick a .xsd schema' ,schemafile); %file browser
    353354            if ischar(PathName) && ischar(FileName) && exist(fullfile(PathName,FileName),'file')
    354355                DataIn.Schema=fullfile(PathName,FileName);
  • trunk/src/get_field.m

    r179 r180  
    4545%------------------------------------------------------------------------
    4646% --- Executes just before get_field is made visible.
    47 function get_field_OpeningFcn(hObject, eventdata, handles,filename,Field,haxes)
    48 %------------------------------------------------------------------------
    49 global nb_builtin
    50 
    51 %% look at the existing figues in the work space
     47function get_field_OpeningFcn(hObject, eventdata, handles,filename,multiple)
     48%------------------------------------------------------------------------
     49global nb_builtin % nbre of functions to include by default in the menu of  functions called by RUN
     50
     51%% look at the existing figures in the work space
    5252browse_fig(handles.list_fig)
    5353
     
    6161set(hObject,'WindowButtonUpFcn',{@mouse_up_gui,handles})
    6262
    63 %% prepare the list of builtin fcts and set their paths
    64 menu_str={'PLOT';'FFT';'filter_band';'histogram'}; %list of functions included by default in 'get_field.m'
     63%% prepare the list of RUN fcts and set their paths
     64% functions included by default in 'get_field.m
     65menu_str={'PLOT';'FFT';'filter_band';'histogram'};
    6566nb_builtin=numel(menu_str);
    6667path_uvmat=fileparts(which('uvmat'));%path of the function 'uvmat'
     
    7879rmpath(fullfile(path_uvmat,'get_field'))
    7980dir_perso=prefdir;
     81
     82% look for functions previously used (names and paths saved in the personal file uvmat_perso.mat):
    8083profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
    8184if exist(profil_perso,'file')
    82     % menu={'RUN';'raw2phys';'histogram';'FFT';'peaklocking'};
    8385      h=load (profil_perso);
    8486     if isfield(h,'get_field_fct') && iscell(h.get_field_fct)
     
    99101     end
    100102end
     103
    101104menu_str=menu_str(testexist==1);%=menu_str(testexist~=0)
    102105fct_handle=fct_handle(testexist==1);
     
    110113if exist('filename','var') && ischar(filename) %transfer input file name in slave mode
    111114    set(handles.inputfile,'String',filename)% prefill the input file name
    112     set(handles.inputfile,'Enable','off')% desactivate the input file edit box   
    113   %  set(handles.list_fig,'Value',2)% plotting axes =uvmat selected
    114   %  set(handles.list_fig,'Visible','off')%
    115     set(handles.RUN,'String','REFRESH')% passive mode, get_field used to define the field for uvamt
    116     set(handles.MenuOpen,'Visible','off')
    117     set(handles.MenuExport,'Visible','off')
    118     set(handles.MenuHelp,'Visible','off')
    119     inputfile_Callback(hObject, eventdata, handles)
     115    Field=nc2struct(filename);% reads the whole field
     116    if isfield(Field,'Txt')
     117        msgbox_uvmat('ERROR',Field.Txt)
     118    else
     119        set(handles.figure1,'UserData',Field);
     120        Field_input(eventdata,handles,Field);
     121    end
    120122else  %master mode
    121123    set(handles.inputfile,'String','')   
    122     set(handles.RUN,'String','RUN')%
     124%     set(handles.RUN,'String','RUN')%
    123125    % load the list of previously browsed files for the upper bar menu Open
    124126    dir_perso=prefdir;
     
    143145    end
    144146end
    145 %transfer input field  in slave mode
    146 if exist('Field','var') && isstruct(Field)
    147         Field_input(eventdata,handles,Field)
    148 %         if exist('haxes','var')
    149 %             'TESTget'
    150 %             get(haxes,'Tag')
    151 %             Field.PlotAxes=haxes;
    152 %         end
    153     set(hObject,'UserData',Field);
    154 end
    155 
     147
     148%% remove already opened get_field GUI with name get_field
     149if ~(exist('multiple','var') && isequal(multiple,1)) %set single occurrence
     150    hget_field=findobj(allchild(0),'Name','get_field'); %hget_field(1)= new GUI
     151    if length(hget_field)>1
     152        delete(hget_field(2))
     153    end
     154else
     155    set(hObject,'name','get_field_1')
     156end
    156157
    157158
     
    163164
    164165%------------------------------------------------------------------------
    165 % --- Executes on button press in browse.
    166 function browse_Callback(hObject, eventdata, handles)
    167 %------------------------------------------------------------------------
    168 
    169 %------------------------------------------------------------------------
     166% --- Executes when a new input file name is introduced.
    170167function inputfile_Callback(hObject, eventdata, handles)
    171168%------------------------------------------------------------------------
     
    178175Field_input(eventdata,handles,Field);
    179176end
    180 
    181 %------------------------------------------------------------------------
     177huvmat=findobj(allchild(0),'tag','uvmat');
     178if ~isempty(huvmat)
     179    delete(huvmat)%delete uvmat for plot reinitialisation
     180end
     181
     182%------------------------------------------------------------------------
     183% --- update the display when a new field is introduced.
    182184function Field_input(eventdata,handles,Field)
    183185%------------------------------------------------------------------------
     
    256258                set(handles.coord_y_scalar,'Value',VarType{imax}.coord_y+1)
    257259            end
     260            if ~isempty(VarType{imax}.coord_z)
     261                set(handles.coord_z_scalar,'Value',VarType{imax}.coord_z+1)
     262            end
    258263            if ~isempty(VarType{imax}.coord)
    259                 set(handles.coord_y_scalar,'Value',VarType{imax}.coord(1)+1)
    260                 if numel(VarType{imax}.coord)>=2
    261                     set(handles.coord_x_scalar,'Value',VarType{imax}.coord(2)+1)
     264                if numel(VarType{imax}.coord)>=maxdim-2
     265                    set(handles.coord_z_scalar,'Value',VarType{imax}.coord(maxdim-2)+1)
    262266                end
     267                if numel(VarType{imax}.coord)>=maxdim-1
     268                    set(handles.coord_y_scalar,'Value',VarType{imax}.coord(maxdim-1)+1)
     269                end
     270                if numel(VarType{imax}.coord)>=maxdim
     271                    set(handles.coord_x_scalar,'Value',VarType{imax}.coord(maxdim)+1)
     272                end     
    263273            end
    264274        end
     
    272282function ordinate_Callback(hObject, eventdata, handles)
    273283%------------------------------------------------------------------------
    274 %update_field(hObject, eventdata, handles)
    275 % A REVOIR
    276284hselect_field=get(handles.inputfile,'parent');
    277285Field=get(hselect_field,'UserData');
    278 % xindex=get(handles.abscissa,'Value');
    279286list=get(handles.ordinate,'String');
    280287yindex=get(handles.ordinate,'Value');
     
    298305coord_x_index=coord_x_index(coord_x_index~=0);
    299306set(handles.abscissa,'String',[{''}; (Field.ListVarName(coord_x_index))'; (Field.ListVarName(VarIndex))'])
    300 % Field.VarIndex.y=yindex;
    301 % set(hselect_field,'UserData',Field);
    302 %update_UserData(handles)
    303307
    304308%------------------------------------------------------------------------
     
    794798%---------------------------------------------------------
    795799% --- Executes on button press in RUN.
     800
    796801function RUN_Callback(hObject, eventdata, handles)
    797802%---------------------------------------------------------
     
    799804index=get(handles.list_fig,'value');
    800805figstring=figcell{index};
     806
     807% plot requested in uvmat
    801808if isequal(figstring,'uvmat')
     809    inputfile=get(handles.inputfile,'String');
    802810    huvmat=findobj(allchild(0),'tag','uvmat');
    803     hhuvmat=guidata(huvmat);
    804     uvmat('run0_Callback',hObject,eventdata,hhuvmat); % display field in uvmat
     811    if isempty(huvmat)
     812        inputfile=get(handles.inputfile,'String');
     813        uvmat(inputfile)
     814    else
     815        hhuvmat=guidata(huvmat);
     816        uvmat('run0_Callback',hObject,eventdata,hhuvmat); % display field in uvmat
     817    end
     818   
     819% other kind of plot
    805820else
    806     huvmat=findobj(allchild(0),'tag','uvmat');
    807     delete(huvmat)%
    808821    index=get(handles.ACTION,'Value');
    809822    list_func=get(handles.ACTION,'UserData');
     
    10771090set(handles.attributes,'String',Tabchar);
    10781091
    1079 % list_var=get(handles.dimensions,'String');
    1080 % val=get(handles.dimensions,'Value');
    1081 
    10821092% update dimensions;
    10831093if isfield(Field,'ListDimName')
     
    11091119end 
    11101120
     1121%------------------------------------------------------------------------
    11111122% --- Executes on button press in check_1Dplot.
    11121123function check_1Dplot_Callback(hObject, eventdata, handles)
     1124%------------------------------------------------------------------------
    11131125val=get(handles.check_1Dplot,'Value');
    11141126if isequal(val,0)
    11151127    set(handles.Panel1Dplot,'Visible','off')
    1116 %      set(handles.scalar,'Visible','off')
    1117 %     set(handles.ordinate,'Max',2.0)%allow multiple ordinate input option
    1118 %     if isequal(get(handles.check_vector,'Value'),0);
    1119 %         set(handles.coord_z_vectors_scalar,'Visible','off')
    1120 %     end
    11211128else
    11221129    set(handles.Panel1Dplot,'Visible','on')
    1123 %     set(handles.scalar,'Visible','on')
    1124 %     val=get(handles.ordinate,'Value');
    1125 %     val=val(1);
    1126 %     set(handles.ordinate,'Value',val);%suppress multiple ordinates
    1127 %     set(handles.ordinate,'Max',1.0);%suppress multiple ordinate input option
    1128 %       set(handles.coord_z_vectors_scalar,'Visible','on')
    1129 end
    1130 
     1130end
     1131
     1132%------------------------------------------------------------------------
    11311133% --- Executes on button press in check_scalar.
    11321134function check_scalar_Callback(hObject, eventdata, handles)
     1135%------------------------------------------------------------------------
    11331136val=get(handles.check_scalar,'Value');
    11341137if isequal(val,0)
     
    11381141end
    11391142
    1140 %---------------------------
     1143%------------------------------------------------------------------------
    11411144% --- Executes on button press in check_vector.
    11421145function check_vector_Callback(hObject, eventdata, handles)
     1146%------------------------------------------------------------------------
    11431147val=get(handles.check_vector,'Value');
    11441148if isequal(val,0)
     
    11481152end
    11491153
    1150 %-----------------------------
     1154%------------------------------------------------------------------------
    11511155function mouse_up_gui(ggg,eventdata,handles)
     1156%------------------------------------------------------------------------
    11521157if isequal(get(ggg,'SelectionType'),'alt')
    11531158    message=''; 
     
    11641169end
    11651170
    1166 %---------------------------------------------
     1171%------------------------------------------------------------------------
    11671172% --- Executes on selection change in ACTION.
     1173%------------------------------------------------------------------------
    11681174function ACTION_Callback(hObject, eventdata, handles)
    11691175global nb_builtin
     
    11751181% add a new function to the menu
    11761182if isequal(ACTION,'more...')
    1177 %     pathfct=fileparts(path_get_field);
    1178 %     browse_name=fullfile(path_get_field,'FIELD_FCT');
    1179 %     if length(list_path)>nb_builtin
    1180 %         browse_name=list_path{end};% initialize browser with  the path of the last introduced function
    1181 %     end
    11821183    [FileName, PathName] = uigetfile( ...
    11831184       {'*.m', ' (*.m)';
     
    13001301     end
    13011302end
    1302 list=['view_field';list];
     1303list=['uvmat';list];
    13031304set(menu_handle,'Value',1)
    13041305set(menu_handle,'String',list)
  • trunk/src/proj_field.m

    r179 r180  
    13771377                    Xbound(1)=Coord{NbDim}(1)+DXinit*(min_indx-1);
    13781378                end
    1379                 iz_str=':'; %default
    13801379                if NbDim==3
    13811380                    DimCell(1)=[]; %suppress z variable
  • trunk/src/read_civxdata.m

    r179 r180  
    6161[var,role,units,vel_type_out_cell]=varcivx_generator(FieldNames,VelType);%determine the names of constants and variables to read
    6262[Field,vardetect,ichoice]=nc2struct(filename,var);
    63 if isfield(Field,'Txt')
    64     return % error in file reading
    65 end
     63% if isfield(Field,'Txt')
     64%     return % error in file reading
     65% end
    6666if vardetect(1)==0
    6767     Field.Txt=[ 'requested field not available in ' filename '/' VelType];
    68      return
    6968end
    7069var_ind=find(vardetect);
     
    8988Field.NbCoord=Field.nb_coord;
    9089Field.NbDim=Field.nb_dim;
    91 
    92 %determine the appropriate constant for time and dt for the PIV pair
    93 test_civ1=isequal(VelTypeOut,'civ1')||isequal(VelTypeOut,'interp1')||isequal(VelTypeOut,'filter1');
    94 test_civ2=isequal(VelTypeOut,'civ2')||isequal(VelTypeOut,'interp2')||isequal(VelTypeOut,'filter2');
    95 if test_civ1
    96     Field.Time=double(Field.absolut_time_T0);
    97     Field.dt=double(Field.dt);
    98 elseif test_civ2
    99     Field.Time=double(Field.absolut_time_T0_2);
    100     Field.dt=double(Field.dt2);
    101 else
    102     Field.Txt='the input file is not civx';
    103     display(Field.Txt)
    104 end
    10590
    10691% CivStage
     
    119104end
    120105
     106%determine the appropriate constant for time and dt for the PIV pair
     107test_civ1=isequal(VelTypeOut,'civ1')||isequal(VelTypeOut,'interp1')||isequal(VelTypeOut,'filter1');
     108test_civ2=isequal(VelTypeOut,'civ2')||isequal(VelTypeOut,'interp2')||isequal(VelTypeOut,'filter2');
     109Field.Time=0; %default
     110if test_civ1
     111    if isfield(Field,'absolut_time_T0')
     112        Field.Time=double(Field.absolut_time_T0);
     113        Field.dt=double(Field.dt);
     114    else
     115       Field.Txt='the input file is not civx';
     116       Field.CivStage=0;
     117       Field.dt=0;
     118    end
     119elseif test_civ2
     120    Field.Time=double(Field.absolut_time_T0_2);
     121    Field.dt=double(Field.dt2);
     122else
     123    Field.Txt='the input file is not civx';
     124    Field.CivStage=0;
     125    Field.dt=0;
     126end
     127
     128
     129
    121130%% rescale fields to pixel coordinates
    122131if isfield(Field,'pixcmx')
  • trunk/src/set_object.m

    r179 r180  
    426426        set(handles.XObject,'TooltipString',['XObject:  x coordinate of the axis origin for the ' ObjectStyle])
    427427        set(handles.YObject,'TooltipString',['YObject:  y coordinate of the axis origin for the ' ObjectStyle])
    428         set(handles.ZMax,'TooltipString',['ZMax: range of projection normal to the plane'])
     428        set(handles.ZMax,'TooltipString','ZMax: range of projection normal to the plane')
    429429        if test3D
    430430            set(handles.Theta,'Visible','on')
     
    733733if isequal(get(hhuvmat.list_object_2,'Visible'),'on')
    734734    IndexObj_2=get(hhuvmat.list_object_2,'Value');
    735     List2=get(hhuvmat.list_object_2,'String')
     735    List2=get(hhuvmat.list_object_2,'String');
    736736    if IndexObj_2==length(List2)
    737737        IndexObj_2=[];% '...' selected
     
    803803    ObjectData.DisplayHandle_uvmat=hhuvmat.axes3;
    804804    ObjectData.DisplayHandle_view_field=[];
    805 elseif ~isfield(UvData.Object{IndexObj},'DisplayHandle_uvmat')% save the previous object graph handles
     805elseif isfield(UvData.Object{IndexObj},'DisplayHandle_uvmat')% save the previous object graph handles
    806806    ObjectData.DisplayHandle_uvmat=UvData.Object{IndexObj}.DisplayHandle_uvmat;
    807807    ObjectData.DisplayHandle_view_field=UvData.Object{IndexObj}.DisplayHandle_view_field;
  • trunk/src/sub_field.m

    r179 r180  
    289289    SubData.ListVarName=[SubData.ListVarName {XName_1_1} {YName_1_1} {AName_1_1}];
    290290    DimCell=[DimCell Field_1.VarDimName(ivar_C_1)]; %(TODO: check for dimension names)
     291    if testX_1
     292        for icell=1:numel(DimCell)
     293            if isequal(DimCell{icell}{1},SubData.VarDimName{1}{1})
     294                DimCell{icell}{1}=[DimCell{icell}{1} '_1'];
     295            end
     296        end
     297    end
    291298    SubData.VarDimName=[SubData.VarDimName DimCell];
    292299    if isfield(Field_1,'VarAttribute')
  • trunk/src/update_obj.m

    r179 r180  
    3131            hobject=Object_out{iobj}.DisplayHandle_uvmat;%graphic handle of object #iobj in the uvmat plot
    3232        end
    33         Object_out{iobj}.DisplayHandle_uvmat=plot_object(Object_out{iobj},Object_out{IndexObj_1},hobject,'m');%update the object representation
     33        Object_out{iobj}.DisplayHandle_uvmat=plot_object(Object_out{iobj},Object_out{IndexObj_1},hobject,'m');%update the object representation of Object_out{iobj} on Object_out{IndexObj_1}
    3434    end
    3535% plot view_field
  • trunk/src/uvmat.m

    r179 r180  
    212212set(hObject,'Units','Normalized')
    213213movegui(hObject,'center')
    214 UvData.PosColorbar=[0.805 0.022 0.019 0.445];
    215 UvData.SetObjectOrigin=[-0.05 -0.03]; %position for set_object
    216 UvData.SetObjectSize=[0.3 0.7];
    217 UvData.CalOrigin=[0.95 -0.03];%position for geometry_calib (TO IMPROVE)
    218 UvData.CalSize=[0.28 1];
     214UvData.OpenParam.PosColorbar=[0.805 0.022 0.019 0.445];
     215UvData.OpenParam.SetObjectOrigin=[-0.05 -0.03]; %position for set_object
     216UvData.OpenParam.SetObjectSize=[0.3 0.7];
     217UvData.OpenParam.CalOrigin=[0.95 -0.03];%position for geometry_calib (TO IMPROVE)
     218UvData.OpenParam.CalSize=[0.28 1];
    219219
    220220%functions for the mouse and keyboard
     
    235235    set(handles.list_object_1,'String',{'1-PLANE'});
    236236end
     237set(handles.Fields,'Value',1)
     238set(handles.Fields,'string',{''})%TODO:  PUT IN THE GUI
    237239
    238240%TRANSFORM menu: builtin fcts
     
    305307set(handles.uvmat,'UserData',UvData)
    306308%initiates menu of vector colors
    307 list_menu=calc_field;
    308 %list_menu=[{'ima_cor'};{'black'};{'white'};list_menu(3:end)];
    309 set(handles.col_vec,'String',list_menu)
     309% list_menu=calc_field;
     310% %list_menu=[{'ima_cor'};{'black'};{'white'};list_menu(3:end)];
     311% set(handles.col_vec,'String',list_menu)
    310312
    311313%check the path and date of modification of all functions in uvmat
     
    346348        display_file_name(hObject, eventdata, handles,inputfile)
    347349        testinputfield=1;
    348 %     else
    349 %         UvData.TestInputFile=0;
    350     end
    351     if ~isempty(Field)
    352         set(handles.Fields,'Value',1)
    353         set(handles.Fields,'String',{'get_field...'})   
    354         testinputfield=1;
    355        
    356         % set the colorbar position on the interface:
    357        % UvData.PosColorbar=[0.805 0.022 0.019 0.445];
    358     elseif ischar(input)
    359         scan_i_Callback(handles.scan_i, eventdata, handles);       
    360     end
     350    end
     351%     if ~isempty(Field)
     352%         menu_str=update_menu(handles.Fields,'get_field...');
     353% %         set(handles.Fields,'Value',1)
     354% %         set(handles.Fields,'String',{'get_field...'})   
     355%         testinputfield=1;
     356%     elseif ischar(input)
     357%         scan_i_Callback(handles.scan_i, eventdata, handles);   
     358%     end
    361359else
    362360   if ishandle(handles.UVMAT_title)
     
    391389            msgbox_uvmat('ERROR',errormsg)
    392390        end
    393     else
    394         update_rootinfo(hObject,eventdata,handles);
    395391    end
    396392end
     
    874870
    875871% set default options in menu 'Fields'
     872
    876873if testima
    877    set(handles.Fields,'Value',1) % set menu to 'image'
    878    set(handles.Fields,'String',{'image';'get_field...';'velocity';'vort';'div';'more...'})
     874%   set(handles.Fields,'Value',1) % set menu to 'image'
     875%    set(handles.Fields,'String',{'image';'get_field...';'velocity';'vort';'div';'more...'})
    879876elseif isequal(FileExt,'.nc')||isequal(FileExt,'.cdf')
    880877   Data=nc2struct(FileName,'ListGlobalAttribute','absolut_time_T0','civ');
    881    col_vec=get(handles.col_vec,'String');
    882    if ~isempty(Data.absolut_time_T0)&& ~isequal(Data.civ,0)
    883        set(handles.Fields,'String',{'image';'get_field...';'velocity';'vort';'div';'more...'})
    884        set(handles.Fields,'Value',3) % set menu to 'velocity'
    885        col_vec{1}='ima_cor';
     878   %col_vec=get(handles.col_vec,'String');
     879   if ~isempty(Data.absolut_time_T0)&& ~isequal(Data.civ,0)%if the new input is Civx
     880       FieldList=calc_field;
     881       set(handles.Fields,'String',[{'image'};FieldList;{'get_field...'}]);%standard menu for civx data
     882       set(handles.Fields,'Value',2) % set menu to 'velocity'
     883       col_vec=FieldList;
     884       col_vec(1)=[];%remove 'velocity' option for vector color (must be a scalar)
    886885   else %general netcdf file (not civx)
    887886       set(handles.Fields,'Value',1) % set menu to 'get_field...
    888887       set(handles.Fields,'String',{'get_field...'})
    889        col_vec{1}='get_field...';
     888       col_vec={'get_field...'};
     889       hget_field=findobj('Name','get_field');
     890       if ~isempty(hget_field)%delete any existing get_field GUI for reinitialisation withthe new file series
     891           hhget_field=guidata(hget_field);
     892           if ~strcmp(get(hhget_field.inputfile,'String'),FileName)%delete any existing get_field GUI with file name different than the input
     893                delete(hget_field)
     894           end
     895       end
    890896   end
    891897   set(handles.col_vec,'String',col_vec)
     
    963969%     search the files, recognize their type according to their name and fill the rootfile input windows
    964970function MenuBrowse_1_Callback(hObject, eventdata, handles)
    965 %-------------------------------------------------------------------
     971%------------------------------------------------------------------------
    966972% huvmat=get(handles.run0,'parent');
    967973UvData=get(handles.uvmat,'UserData');
     
    10311037% --- Open again as second field the file whose name has been recorded in MenuFile_1
    10321038function MenuFile_1_1_Callback(hObject, eventdata, handles)
     1039% -----------------------------------------------------------------------
    10331040fileinput_1=get(handles.MenuFile_1_1,'Label');
    10341041display_file_name_1(hObject,eventdata,handles,fileinput_1)
     
    10371044% --- Open again as second field the file whose name has been recorded in MenuFile_2
    10381045function MenuFile_2_1_Callback(hObject, eventdata, handles)
     1046% -----------------------------------------------------------------------
    10391047fileinput_1=get(handles.MenuFile_2_1,'Label');
    10401048display_file_name_1(hObject,eventdata,handles,fileinput_1)
     
    10431051% --- Open again as second field the file whose name has been recorded in MenuFile_3
    10441052function MenuFile_3_1_Callback(hObject, eventdata, handles)
     1053% -----------------------------------------------------------------------
    10451054fileinput_1=get(handles.MenuFile_3_1,'Label');
    10461055display_file_name_1(hObject,eventdata,handles,fileinput_1)
     
    10491058% --- Open again as second field the file whose name has been recorded in MenuFile_4
    10501059function MenuFile_4_1_Callback(hObject, eventdata, handles)
     1060% -----------------------------------------------------------------------
    10511061fileinput_1=get(handles.MenuFile_4_1,'Label');
    10521062display_file_name_1(hObject,eventdata,handles,fileinput_1)
     
    10551065% --- Open again as second field the file whose name has been recorded in MenuFile_5
    10561066function MenuFile_5_1_Callback(hObject, eventdata, handles)
     1067% -----------------------------------------------------------------------
    10571068fileinput_1=get(handles.MenuFile_5_1,'Label');
    10581069display_file_name_1(hObject,eventdata,handles,fileinput_1)
     
    11601171% default choice of fields
    11611172if isequal(ext_test,'.image')
    1162    set(handles.Fields_1,'String',{'';'image';'get_field...';'velocity';'vort';'div';'more...'})
    1163    set(handles.Fields_1,'Value',2) % set menu to 'image'
     1173%    set(handles.Fields_1,'String',{'';'image';'get_field...';'velocity';'vort';'div';'more...'})
     1174%    set(handles.Fields_1,'Value',2) % set menu to 'image'
    11641175elseif strcmp(FileExt_1,'.nc')||strcmp(FileExt_1,'.cdf')
    11651176   Data=nc2struct(fileinput_1,[]);
    1166    if isfield(Data,'absolut_time_T0')
    1167        set(handles.Fields_1,'String',{'';'image';'get_field...';'velocity';'vort';'div';'more...'})
    1168        set(handles.Fields_1,'Value',4) % set menu to 'velocity'
    1169    else   
    1170        set(handles.Fields_1,'Value',2) % set menu to 'get_field...'
    1171        set(handles.Fields_1,'String',{'';'get_field...'});
    1172    end
     1177%    if isfield(Data,'absolut_time_T0')
     1178%        set(handles.Fields_1,'String',{'';'image';'get_field...';'velocity';'vort';'div';'more...'})
     1179%        set(handles.Fields_1,'Value',4) % set menu to 'velocity'
     1180%    else   
     1181%        set(handles.Fields_1,'Value',2) % set menu to 'get_field...'
     1182%        set(handles.Fields_1,'String',{'';'get_field...'});
     1183%    end
    11731184end 
    11741185set(handles.SubField,'Visible','on')
     
    11791190% --- Called by action in RootPath_1 edit box
    11801191function RootPath_1_Callback(hObject,eventdata,handles)
     1192% -----------------------------------------------------------------------
    11811193update_rootinfo_1(hObject,eventdata,handles)
    11821194
     
    11841196% --- Called by action in RootFile_1 edit box
    11851197function RootFile_1_Callback(hObject, eventdata, handles)
     1198% -----------------------------------------------------------------------
    11861199update_rootinfo_1(hObject,eventdata,handles)
    1187 %-----------------------------------------------------------------------
    11881200
    11891201%------------------------------------------------------------------------
     
    11911203function FileIndex_1_Callback(hObject, eventdata, handles)
    11921204%------------------------------------------------------------------------
    1193 
    11941205run0_Callback(hObject, eventdata, handles)
    11951206
     
    11981209%     calibration from an xml file, then refresh current plots
    11991210function update_rootinfo_1(hObject,eventdata,handles) %A REVOIR
    1200 
     1211% -----------------------------------------------------------------------
    12011212set(handles.RootPath_1,'BackgroundColor',[1 1 0])% indicate active program by yellow color
    12021213drawnow
     
    14721483set(handles.masklevel,'Value',z)
    14731484
    1474 %-------------------------------------------------------------------
     1485%------------------------------------------------------------------------
    14751486% --- Executes on button press in view_xml.
    14761487function view_xml_Callback(hObject, eventdata, handles)
     1488%------------------------------------------------------------------------
    14771489[FileName,RootPath,FileBase,FileIndices,FileExt]=read_file_boxes(handles);
    14781490option=get(handles.view_xml,'String');
     
    14821494end
    14831495
    1484 %-------------------------------------------------------------------
     1496%------------------------------------------------------------------------
    14851497% --- Executes on button press in mask_test.
    14861498function mask_test_Callback(hObject, eventdata, handles)
    1487 %-------------------------------------------------------------------
     1499%------------------------------------------------------------------------
    14881500%case of view mask selection
    14891501if isequal(get(handles.mask_test,'Value'),1)
     
    20612073%------------------------------------------------------------------------
    20622074
    2063 %initialisation
    2064 % errormsg=[]; % default error message
     2075%% initialisation
    20652076abstime=[];
    20662077abstime_1=[];
     
    20702081end
    20712082UvData=get(handles.uvmat,'UserData');
    2072 
    2073 
    20742083if ishandle(handles.UVMAT_title) %remove title panel on uvmat
    20752084    delete(handles.UVMAT_title)
     
    20782087%% determine the main input file information for action
    20792088FileType=[];%default
     2089if ~exist(filename,'file')
     2090    errormsg=['input file ' filename ' does not exist'];
     2091    return
     2092end
     2093%Ext=get(handles.FileExt,'String');
     2094NomType=get(handles.FileIndex,'UserData');
     2095%update the z position index
     2096nbslice_str=get(handles.nb_slice,'String');
     2097if isequal(nbslice_str,'volume')
     2098    z_index=num_j1;
     2099    set(handles.z_index,'String',num2str(z_index))
     2100else
     2101    nbslice=str2num(nbslice_str);
     2102    z_index=mod(num_i1-1,nbslice)+1;
     2103    set(handles.z_index,'String',num2str(z_index))
     2104end
     2105% refresh menu for save_mask if relevant
     2106masknumber=get(handles.masklevel,'String');
     2107if length(masknumber)>=z_index
     2108    set(handles.masklevel,'Value',z_index)
     2109end
     2110
     2111%% read the first input field if a filename has been introduced
    20802112if ~isempty(filename)
    2081     if ~exist(filename,'file')
    2082         errormsg=['input file ' filename ' does not exist'];
    2083         return
    2084     end
     2113    ObjectName=filename;
     2114    FieldName=[];%default
     2115    VelType=[];%default
    20852116    Ext=get(handles.FileExt,'String');
    2086     NomType=get(handles.FileIndex,'UserData');
    2087     %update the z position index
    2088     nbslice_str=get(handles.nb_slice,'String');
    2089    % z_index=1;%default
    2090     if isequal(nbslice_str,'volume')
    2091         z_index=num_j1;
    2092         set(handles.z_index,'String',num2str(z_index))
    2093     else
    2094         nbslice=str2num(nbslice_str);
    2095         z_index=mod(num_i1-1,nbslice)+1;
    2096         set(handles.z_index,'String',num2str(z_index))
    2097     end
    2098     % refresh menu for save_mask if relevant
    2099     masknumber=get(handles.masklevel,'String');
    2100     if length(masknumber)>=z_index
    2101         set(handles.masklevel,'Value',z_index)
    2102     end
    2103 
    2104     % determine the input file type
    2105     if isequal(Ext,'.nc')||isequal(Ext,'.cdf')
     2117    if strcmp(Ext,'.nc')||strcmp(Ext,'.cdf')
    21062118        FileType='netcdf';
     2119        list_fields=get(handles.Fields,'String');% list menu fields
     2120        index_fields=get(handles.Fields,'Value');% selected string index
     2121        FieldName= list_fields{index_fields}; % selected field
     2122        if ~strcmp(FieldName,'get_field...')% read the field names on the interface get_field...
     2123           VelType=setfield(handles);
     2124        end
     2125        if strcmp(FieldName,'velocity')
     2126            list_code=get(handles.color_code,'String');% list menu fields
     2127            index_code=get(handles.color_code,'Value');% selected string index
     2128            if  ~strcmp(list_code{index_code},'black') &&  ~strcmp(list_code{index_code},'white')
     2129                list_code=get(handles.col_vec,'String');% list menu fields
     2130                index_code=get(handles.col_vec,'Value');% selected string index
     2131                ParamIn.ColorVar= list_code{index_code}; % selected field
     2132            end
     2133        end
    21072134    elseif isfield(UvData,'MovieObject')
     2135        ObjectName=UvData.MovieObject;
    21082136        FileType='movie';
    2109         FieldName='image';
    21102137    elseif isequal(lower(Ext),'.avi')
    21112138        FileType='avi';
    2112         FieldName='image';
    21132139    elseif isequal(lower(Ext),'.vol')
    21142140        FileType='vol';
    2115         FieldName='image';
     2141        if isfield(UvData.XmlData,'Npy') && isfield(UvData.XmlData,'Npx')
     2142            ParamIn.Npy=UvData.XmlData.Npy;
     2143            ParamIn.Npx=UvData.XmlData.Npx;
     2144        else
     2145            errormsg='Npx and Npy need to be defined in the xml file for volume images .vol';
     2146            return
     2147        end
    21162148    else
    21172149       form=imformats(Ext(2:end));
     
    21222154               FileType='image';
    21232155           end
    2124            FieldName='image';
    21252156       end
    21262157    end
    2127 else
    2128     FileType='netcdf';
    2129     FieldName='get_field...';
    2130 end
    2131 VelType=[];%default
    2132 if isequal(FileType,'netcdf')
    2133     list_fields=get(handles.Fields,'String');% list menu fields
    2134     index_fields=get(handles.Fields,'Value');% selected string index
    2135     FieldName= list_fields{index_fields}; % selected field
    2136     if ~isequal(FieldName,'get_field...')% read the field names on the interface get_field...
    2137        VelType=setfield(handles);
    2138     end
    2139 end
    2140 
    2141 %% choose a second field if Subfield option is 'on'
     2158    ParamIn.FieldName=FieldName;
     2159    ParamIn.VelType=VelType;
     2160    ParamIn.GUIName='get_field';
     2161    [Field{1},ParamOut,errormsg] = read_field(ObjectName,FileType,ParamIn);
     2162    if isfield(ParamOut,'Npx')&& isfield(ParamOut,'Npy')
     2163        set(handles.npx,'String',num2str(ParamOut.Npx));% display image size on the interface
     2164        set(handles.npy,'String',num2str(ParamOut.Npy));
     2165    end
     2166end
     2167
     2168%% choose a second field if Subfield option is 'on', and if the field has changed
     2169VelType_1=[];%default
    21422170FieldName_1=[];
    2143 scal_color=[];
    2144 VelType_1=setfield_1(handles);
    2145 % sub_value=get(handles.SubField,'Value');
    2146 FileType_1='none';%default
     2171ParamOut_1=[];
    21472172if ~isempty(filename_1)
    2148     % test for a constant second field (comparison with a fixed field)
    2149     NomType_1=get(handles.FileIndex_1,'UserData');
    2150     Ext_1=get(handles.FileExt_1,'String');
    2151     % determine the input file type
    2152     if isequal(Ext_1,'.nc')||isequal(Ext_1,'.cdf')
    2153         FileType_1='netcdf';
    2154     elseif isfield(UvData,'MovieObject_1')
    2155         FileType_1='movie';
    2156         FieldName_1='image';
    2157     elseif isequal(lower(Ext_1),'.avi')
    2158         FileType='avi';
    2159         FieldName_1='image';
    2160     elseif isequal(lower(Ext_1),'.vol')
    2161         FileType_1='vol';
    2162         FieldName_1='image';
    2163     elseif length(Ext_1)>1
    2164        form=imformats(Ext_1(2:end));
    2165        if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab
    2166            if isequal(NomType_1,'*');
    2167                FileType_1='multimage';
    2168            else
    2169                FileType_1='image';
    2170            end
    2171            FieldName_1='image';
    2172        end
    2173     end
    2174     if ~isequal(FieldName_1,'image')
    2175         list_fields=get(handles.Fields_1,'String');% list menu fields
    2176         index_fields=get(handles.Fields_1,'Value');% selected string index
    2177         FieldName_1= list_fields{index_fields}; % selected field
    2178         if isequal(VelType_1,'*')% free veltype choice
    2179             VelType_1=[];
    2180         elseif isequal(VelType_1,'"')% veltype the same as for the first field
    2181             if isempty(VelType)
    2182                 VelType_1=[];
    2183             else
    2184                 VelType_1=VelType;
    2185             end
    2186         end
    2187     end
    2188     test_keepdata_1=0;% test for keeping the previous stored data if the input files are unchanged
    2189     if ~isequal(NomType_1,'*')%in case of a series of files (not avi movie)
    2190         if isfield(UvData,'filename_1')&& isfield(UvData,'VelType_1') && isfield(UvData,'FieldName_1')
    2191             test_keepdata_1= isequal(filename_1,UvData.filename_1)&&...
    2192                 isequal(VelType_1,UvData.filename_1) && isequal(FieldName_1,UvData.FieldName_1);
    2193         end
    2194     end
    2195     if test_keepdata_1
    2196         Field{2}=UvData.Field_1;   
    2197     elseif ~exist(filename_1,'file')
     2173    if ~exist(filename_1,'file')
    21982174        errormsg=['second file ' filename_1 ' does not exist'];
    21992175        return
    2200     end
    2201 end
    2202 
    2203 %% read the input field(s)
    2204 %read images
    2205 if ~isempty(filename) && isequal(FieldName,'image')
    2206     Npz=1;%default
    2207      switch FileType
    2208         case 'movie'
    2209             try
    2210                 A=read(UvData.MovieObject,num_i1);
    2211             catch
    2212                 errormsg=lasterr;
     2176    else
     2177        Name=filename_1;
     2178        FieldName_1=[];%default
     2179        VelType_1=[];%default
     2180        Ext_1=get(handles.FileExt_1,'String');
     2181        NomType_1=get(handles.FileIndex_1,'UserData');
     2182        if isequal(Ext_1,'.nc')||isequal(Ext_1,'.cdf')
     2183            FileType_1='netcdf';
     2184        elseif isfield(UvData,'MovieObject_1')
     2185            Name=UvData.MovieObject_1;
     2186            FileType_1='movie';
     2187        elseif isequal(lower(Ext_1),'.avi')
     2188            FileType_1='avi';
     2189        elseif isequal(lower(Ext_1),'.vol')
     2190            FileType_1='vol';
     2191            if isfield(UvData.XmlData_1,'Npy') && isfield(UvData.XmlData_1,'Npx')
     2192                ParamIn.Npy=UvData.XmlData_1.Npy;
     2193                ParamIn.Npx=UvData.XmlData_1.Npx;
     2194            else
     2195                errormsg='Npx and Npy need to be defined in the xml file for volume images .vol';
    22132196                return
    22142197            end
    2215         case 'avi'
    2216             try
    2217                 mov=aviread(filename,num_i1);
    2218             catch
    2219                 errormsg=lasterr;
    2220                 return
     2198        else
     2199           form=imformats(Ext_1(2:end));
     2200           if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab
     2201               if isequal(NomType_1,'*');
     2202                   FileType_1='multimage';
     2203               else
     2204                   FileType_1='image';
     2205               end
     2206           end
     2207        end
     2208        if strcmp(FileType_1,'netcdf')
     2209            list_fields=get(handles.Fields_1,'String');% list menu fields
     2210            index_fields=get(handles.Fields_1,'Value');% selected string index
     2211            FieldName_1= list_fields{index_fields}; % selected field
     2212            if ~isequal(FieldName_1,'get_field...')% read the field names on the interface get_field...
     2213                VelType_1=setfield_1(handles);
    22212214            end
    2222             A=frame2im(mov(1));
    2223         case 'vol'
    2224             A=imread(filename);
    2225             if isfield(UvData.XmlData,'Npy')
    2226                 Npz=size(A,1)/UvData.XmlData.Npy;
    2227                 A=reshape(A',UvData.XmlData.Npx,UvData.XmlData.Npy,Npz);
    2228                 A=permute(A,[3 2 1]);
     2215            if strcmp(VelType_1,'*')% free veltype choice
     2216                VelType_1=[];
     2217            elseif strcmp(VelType_1,'"')% veltype the same as for the first field
     2218                if isempty(VelType)
     2219                    VelType_1=[];
     2220                else
     2221                    VelType_1=VelType;
     2222                end
    22292223            end
    2230         case 'multimage'
    2231             A=imread(filename,num_i1);
    2232         case 'image'
    2233             A=imread(filename);
    2234     end
    2235     npxy=size(A);
    2236     set(handles.npx,'String',num2str(npxy(2)));% display image size on the interface
    2237     set(handles.npy,'String',num2str(npxy(1)));
    2238     Rangx=[0.5 npxy(2)-0.5]; % coordinates of the first and last pixel centers
    2239     Rangy=[npxy(1)-0.5 0.5]; %
    2240     Field{1}.NbDim=2;%default
    2241     Field{1}.AName='image';
    2242     Field{1}.ListVarName={'AY','AX','A'}; %
    2243     if ndims(A)==3
    2244         if Npz==1;%color
    2245              Field{1}.VarDimName={'AY','AX',{'AY','AX','rgb'}}; %
    2246              Field{1}.AY=[npxy(1)-0.5 0.5];
    2247              Field{1}.AX=[0.5 npxy(2)-0.5]; % coordinates of the first and last pixel centers
     2224            if strcmp(FieldName_1,'velocity')
     2225                list_code=get(handles.color_code,'String');% list menu fields
     2226                index_code=get(handles.color_code,'Value');% selected string index
     2227                if  ~strcmp(list_code{index_code},'black') &&  ~strcmp(list_code{index_code},'white')
     2228                    list_code=get(handles.col_vec,'String');% list menu fields
     2229                    index_code=get(handles.col_vec,'Value');% selected string index
     2230                    ParamIn.ColorVar= list_code{index_code}; % selected field
     2231                end
     2232            end
     2233        end
     2234        test_keepdata_1=0;% test for keeping the previous stored data if the input files are unchanged
     2235        if ~isequal(NomType_1,'*')%in case of a series of files (not avi movie)
     2236            if isfield(UvData,'filename_1')&& isfield(UvData,'VelType_1') && isfield(UvData,'FieldName_1')
     2237                test_keepdata_1= strcmp(filename_1,UvData.filename_1) && strcmp(VelType_1,UvData.VelType_1) && strcmp(FieldName_1,UvData.FieldName_1);
     2238            end
     2239        end
     2240        if test_keepdata_1
     2241            Field{2}=UvData.Field_1;
    22482242        else
    2249             Field{1}.NbDim=3;
    2250             Field{1}.ListVarName=['AZ' Field{1}.ListVarName];
    2251             Field{1}.VarDimName={'AZ','AY','AX',{'AZ','AY','AX'}};
    2252             Field{1}.AZ=[npxy(1)-0.5 0.5];
    2253             Field{1}.AY=[npxy(2)-0.5 0.5];
    2254             Field{1}.AX=[0.5 npxy(3)-0.5]; % coordinates of the first and last pixel centers
    2255         end
    2256     else
    2257         Field{1}.VarDimName={'AY','AX',{'AY','AX'}}; %
    2258         Field{1}.AY=[npxy(1)-0.5 0.5];
    2259        Field{1}.AX=[0.5 npxy(2)-0.5]; % coordinates of the first and last pixel centers
    2260     end
    2261     Field{1}.A=A;
    2262     Field{1}.CoordUnit='pixel'; %used for mouse_motion
    2263 end
    2264 
    2265 %read a second image
    2266 if  ~isempty(filename_1) && ~test_keepdata_1 && isequal(FieldName_1,'image')
    2267     switch FileType_1
    2268         case 'movie'
    2269             A=read(UvData.MovieObject_1,num_i1);
    2270         case 'avi'
    2271             mov=aviread(filename_1,num_i1);
    2272             A=frame2im(mov(1));
    2273         case 'vol'
    2274             A=imread(filename_1);
    2275         case 'multimage'
    2276             A=imread(filename_1,num_i1);
    2277         case 'image'
    2278             A=imread(filename_1);
    2279         case 'netcdf'
    2280         otherwise
    2281             errormsg=['unknown input file type ' filename_1];
    2282     end
    2283     npxy=size(A);
    2284     set(handles.npx,'String',num2str(npxy(2)));% display image size on the interface
    2285     set(handles.npy,'String',num2str(npxy(1)));
    2286     Rangx=[0.5 npxy(2)-0.5]; % coordinates of the first and last pixel centers
    2287     Rangy=[npxy(1)-0.5 0.5]; %
    2288     Field{2}.AName='image';
    2289     Field{2}.ListVarName={'AY','AX','A'}; %
    2290     if size(A,3)==3;%color
    2291         Field{2}.VarDimName={'AY','AX',{'AY','AX','rgb'}}; %
    2292     else
    2293         Field{2}.VarDimName={'AY','AX',{'AY','AX'}}; %
    2294     end
    2295     Field{2}.AY=Rangy;
    2296     Field{2}.AX=Rangx;
    2297     Field{2}.A=A;
    2298     Field{2}.CoordType='px'; %used for mouse_motion
    2299     Field{2}.CoordUnit='px'; %used for move_mou
    2300 end
    2301 
    2302 %read ncfile(s)
    2303 CivStage_1=0;%default
    2304 VelType_out_1=[];
    2305 InputField={FieldName};
    2306 InputField_1={FieldName_1};
    2307 if (~isempty(filename)&& isequal(FileType,'netcdf')) || (~isempty(filename_1)&& isequal(FileType_1,'netcdf')) ;
    2308     %read the velocity field(s) from netcdf rootfile(s)
    2309     list_code=get(handles.col_vec,'String');% list menu fields
    2310     index_code=get(handles.col_vec,'Value');% selected string index
    2311     scal_color= list_code{index_code(1)}; % selected field
    2312     if isequal(FieldName,'velocity')&& ~isequal(scal_color,'black') && ~isequal(scal_color,'white')
    2313         InputField=[InputField scal_color];
    2314     end
    2315     if isequal(FieldName_1,'velocity') && ~isequal(scal_color,'black') && ~isequal(scal_color,'white')
    2316         InputField_1=[InputField_1 scal_color];
    2317     end
    2318     if isequal(FileType,'netcdf')  %read the first nc field
    2319         if isequal(FieldName,'get_field...')% read the field names on the interface get_field.
    2320             hget_field=findobj(allchild(0),'Name','get_field');%find the get_field... GUI
    2321             if isempty(hget_field)
    2322                 hget_field= get_field(filename);%open the get_field GUI   
    2323               %  set(hget_field,'name','get_field')
    2324             elseif UvData.NewSeries% refresh the fet_field GUI for a new series
    2325                 delete(hget_field)
    2326                 hget_field= get_field(filename);%open the get_field GUI
    2327                 set(hget_field,'name','get_field')%rename  get_field GUI for the 'slave' mode
    2328             end
    2329             hhget_field=guidata(hget_field);
    2330             set(hhget_field.list_fig,'Value',1)
    2331             set(hhget_field.list_fig,'String',{'uvmat'})
    2332             funct_list=get(hhget_field.ACTION,'UserData');
    2333             funct_index=get(hhget_field.ACTION,'Value');
    2334             funct=funct_list{funct_index};%select  the current action in get_field, e;g. PLOT
    2335             Field{1}=funct(hget_field); %%activate the current action selected in get_field, e;g.read the names of the variables to plot
    2336             CivStage=0;
    2337             VelType_out=[];   
    2338         else
    2339             [Field{1},VelType_out]=read_civxdata(filename,InputField,VelType);
    2340             if isfield(Field{1},'Txt')
    2341                 errormsg=Field{1}.Txt;
    2342                 return
    2343             end
    2344             CivStage=Field{1}.CivStage;
    2345             %UvData.NbDim=Field{1}.NbDim;
    2346         end
    2347     end
    2348     if ~isempty(filename_1) && ~test_keepdata_1 && isequal(FileType_1,'netcdf') %read the second file
    2349         if isequal(FieldName_1,'get_field...')% read the field names on the interface get_field.
    2350             hget_field_1=findobj(allchild(0),'Name','get_field_1');%find the get_field... GUI
    2351             if isempty(hget_field_1)
    2352                  hget_field_1= get_field(filename_1);%open the get_field GUI
    2353                  set(hget_field_1,'name','get_field_1')
    2354             elseif UvData.NewSeries% refresh the fet_field GUI for a new series
    2355                 delete(hget_field_1)
    2356                 hget_field_1= get_field(filename);%open the get_field GUI
    2357                 set(hget_field_1,'name','get_field_1')%rename  get_field GUI for the 'slave' mode
    2358             end
    2359             hhget_field_1=guidata(hget_field_1);%handles of GUI elements in get_field
    2360             set(hhget_field_1.list_fig,'Value',1)
    2361             set(hhget_field_1.list_fig,'String',{'uvmat'})
    2362             funct_list=get(hhget_field_1.ACTION,'UserData');
    2363             funct_index=get(hhget_field_1.ACTION,'Value');
    2364             funct=funct_list{funct_index};
    2365             Field{2}=funct(hget_field_1); %read the names of the variables to plot in the get_field GUI
    2366         else
    2367             [Field{2},VelType_out_1]=read_civxdata(filename_1,InputField_1,VelType_1);
    2368             CivStage_1=Field{2}.CivStage;
    2369         end
    2370         if ~isequal(FileType,'netcdf')
    2371             VelType_out=VelType_out_1;
    2372         end
    2373     end
    2374 end
    2375 
    2376 %store the second field for possible latter use
    2377 if numel(Field)==2
    2378     UvData.Field_1=Field{2};
     2243            ParamIn.FieldName=FieldName_1;
     2244            ParamIn.VelType=VelType_1;
     2245            ParamIn.GUIName='get_field_1';
     2246            [Field{2},ParamOut_1,errormsg] = read_field(Name,FileType_1,ParamIn);         
     2247            UvData.Field_1=Field{2}; %store the second field for possible use at next RUN
     2248        end
     2249    end
     2250end
     2251
     2252%% update uvmat interface
     2253if isfield(ParamOut,'Npx')
     2254    set(handles.npx,'String',num2str(ParamOut.Npx));% display image size on the interface
     2255    set(handles.npy,'String',num2str(ParamOut.Npy));
     2256elseif isfield(ParamOut_1,'Npx')
     2257    set(handles.npx,'String',num2str(ParamOut_1.Npx));% display image size on the interface
     2258    set(handles.npy,'String',num2str(ParamOut_1.Npy));
    23792259end
    23802260
    23812261%% update the display buttons for the first velocity type (first menuline)
    23822262veltype_handles=[handles.civ1 handles.interp1 handles.filter1 handles.civ2 handles.interp2 handles.filter2];
    2383 if ~isequal(FileType,'netcdf')
    2384     reset_vel_type(veltype_handles)
    2385 elseif isempty(VelType) && ~isequal(FieldName,'get_field...')
    2386     set_veltype_display(veltype_handles,CivStage)%update the display of available velocity types for the first field
    2387     if isempty(VelType_out)
     2263if ~isequal(FileType,'netcdf')|| isequal(FieldName,'get_field...')
     2264%     reset_vel_type(veltype_handles)
     2265    set(veltype_handles,'Visible','off')
     2266else% if isempty(ParamOut.VelType) && ~isequal(FieldName,'get_field...')
     2267    set_veltype_display(veltype_handles,ParamOut.CivStage)%update the display of available velocity types for the first field
     2268    if isempty(ParamOut.VelType)
    23882269        reset_vel_type(veltype_handles)
    23892270    else
    2390         handle1=eval(['handles.' VelType_out]);
     2271        handle1=eval(['handles.' ParamOut.VelType]);
    23912272        reset_vel_type(veltype_handles,handle1)
    23922273    end
    23932274end
     2275field_index=strcmp(ParamOut.FieldName,ParamOut.FieldList);
     2276set(handles.Fields,'String',ParamOut.FieldList); %update the field menu
     2277set(handles.Fields,'Value',find(field_index,1))
    23942278
    23952279%% update the display buttons for the second velocity type (second menuline)
    2396 veltype_handles_1=[handles.civ1_1 handles.interp1_1 handles.filter1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1];
    2397 if ~isequal(FileType_1,'netcdf')
    2398     reset_vel_type(veltype_handles_1)
    2399 elseif isempty(VelType_1) && ~isequal(FieldName_1,'get_field...')
    2400     set_veltype_display(veltype_handles_1,CivStage_1)%update the display of available velocity types for the first field
    2401     if isempty(VelType_out_1)
    2402         reset_vel_type(veltype_handles_1)
    2403     else
    2404         handle1=eval(['handles.' VelType_out_1 '_1']);
    2405         reset_vel_type(veltype_handles_1,handle1)
    2406     end
     2280if ~isempty(filename_1)
     2281    veltype_handles_1=[handles.civ1_1 handles.interp1_1 handles.filter1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1];
     2282    if ~isequal(FileType_1,'netcdf')|| isequal(FieldName_1,'get_field...')
     2283        set(veltype_handles_1,'Visible','off')
     2284        %reset_vel_type(veltype_handles_1)
     2285    else %if isempty(VelType_1) && ~isequal(FieldName_1,'get_field...')
     2286        set_veltype_display(veltype_handles_1,ParamOut_1.CivStage)%update the display of available velocity types for the first field
     2287        if isempty(ParamOut_1.VelType)
     2288            reset_vel_type(veltype_handles_1)
     2289        else
     2290            handle1=eval(['handles.' ParamOut_1.VelType '_1']);
     2291            reset_vel_type(veltype_handles_1,handle1)
     2292        end
     2293    end
     2294    field_index=strcmp(ParamOut_1.FieldName,ParamOut_1.FieldList);
     2295    set(handles.Fields_1,'String',ParamOut_1.FieldList); %update the field menu
     2296    set(handles.Fields_1,'Value',find(field_index,1))
    24072297end
    24082298
     
    24322322end           
    24332323
    2434 %multislice case
    2435 % if ~isempty(filename) &&(~isfield(UvData,'NbDim') || isequal(UvData.NbDim,2))&&...%2D case
    2436 %       isfield(UvData,'XmlData') && isfield(UvData.XmlData,'GeometryCalib')&& isfield(UvData.XmlData.GeometryCalib,'SliceCoord')
    2437 %        siz=size(UvData.XmlData.GeometryCalib.SliceCoord);
    2438 % end
    2439 
    2440 %store the current open names, fields and vel types in uvmat interface
    2441 UvData.filename=filename;
     2324%% store the current open names, fields and vel types in uvmat interface
    24422325UvData.filename_1=filename_1;
    2443 UvData.VelType=VelType;
    2444 UvData.VelType_1=VelType_1;
    2445 UvData.FieldName=FieldName;
    2446 UvData.FieldName_1=FieldName_1;
    2447 if ~isempty(scal_color)
    2448     UvData.CName=scal_color;
    2449 end
    2450 
    2451 %% coordinate transform or user fct
     2326UvData.VelType_1=[];%default
     2327UvData.FieldName_1=[];
     2328if isfield(ParamOut_1,VelType)
     2329    UvData.VelType_1=ParamOut_1.VelType;
     2330end
     2331if isfield(ParamOut_1,FieldName)
     2332    UvData.FieldName_1=ParamOut_1.FieldName;
     2333end
     2334
     2335%% apply coordinate transform or other user fct
    24522336XmlData=[];%default
    24532337if isfield(UvData,'XmlData')%use geometry calib recorded from the ImaDoc xml file as first priority
     
    24802364
    24812365%% calculate scalar
    2482 if isequal(FileType,'netcdf') && ~isequal(FieldName,'get_field...')%
    2483     Field{1}=calc_field(InputField,Field{1});
    2484 end
    2485 if length(Field)==2 && ~test_keepdata_1 && isequal(FileType_1,'netcdf') && ~isequal(FieldName_1,'get_field...')
    2486     Field{2}=calc_field(InputField_1,Field{2});
     2366if isequal(FileType,'netcdf') && ~isequal(ParamOut.CivStage,0)%&&~isempty(FieldName)%
     2367    Field{1}=calc_field([{ParamOut.FieldName} {ParamOut.ColorVar}],Field{1});
     2368end
     2369if length(Field)==2 && ~test_keepdata_1 && isequal(FileType_1,'netcdf') && ~isequal(ParamOut_1.FieldName,'get_field...')%&&~isempty(FieldName_1)
     2370    Field{2}=calc_field([{ParamOut_1.FieldName} {ParamOut_1.ColorVar}],Field{2});
    24872371end
    24882372
     
    24942378end
    24952379
    2496 %% test 3D , default projection menuplane and typical mesh (needed to menuopen set_object)
     2380%% get bounds and mesh (needed for mouse action and to open set_object)
    24972381test_x=0;
    24982382test_z=0;% test for unstructured z coordinate
    24992383[UvData.Field,errormsg]=check_field_structure(UvData.Field);
    25002384if ~isempty(errormsg)
    2501     errormsg=['error in uvmat/run0_Callback/check_field_structure: ' errormsg];
     2385    errormsg=['error in uvmat/refresh_field/check_field_structure: ' errormsg];
    25022386    return
    25032387end
    2504 [CellVarIndex,NbDim,VarType]=find_field_indices(UvData.Field);
     2388[CellVarIndex,NbDim,VarType,errormsg]=find_field_indices(UvData.Field);
     2389if ~isempty(errormsg)
     2390    errormsg=['error in uvmat/refresh_field/find_field_indices: ' errormsg];
     2391    return
     2392end
    25052393[NbDim,imax]=max(NbDim);
    25062394if ~isempty(VarType{imax}.coord_x)  && ~isempty(VarType{imax}.coord_y)    %unstructured coordinates
     
    25582446UvData.Field.YMin=YMin;
    25592447
    2560 %% create a default projection menuplane
    2561 UvData.Object{1}.Style='plane';%main plotting plane
    2562 UvData.Object{1}.ProjMode='projection';%main plotting plane
    2563 UvData.Object{1}.DisplayHandle_uvmat=[]; %plane not visible in uvmat
    2564 
    25652448
    25662449%% 3D case (menuvolume)
    25672450if NbDim==3% && UvData.NewSeries
    25682451    test_set_object=1;
    2569     hset_object=findobj(allchild(0),'tag','set_object');
     2452    hset_object=findobj(allchild(0),'tag','set_object');% look for the set_object GUI
    25702453    ZBounds(1)=UvData.Field.ZMin; %minimum for the Z slider
    25712454    ZBounds(2)=UvData.Field.ZMax;%maximum for the Z slider
    2572     if ~isempty(hset_object)
    2573         hhset_object=guidata(hset_object);
    2574         ZBounds_old(1)=get(hhset_object.z_slider,'Min');
    2575         ZBounds_old(2)=get(hhset_object.z_slider,'Max');
    2576         if isequal(ZBounds_old,ZBounds)
    2577             test_set_object=0;
    2578         else
    2579             delete(test_set_object);
    2580         end
    2581     end
    2582     if test_set_object% reinitiate set_object
    2583         delete_object(1);
     2455    if ~isempty(hset_object) %if set_object is detected
     2456%         hhset_object=guidata(hset_object);
     2457% %         ZBounds_old(1)=get(hhset_object.z_slider,'Min');
     2458% %         ZBounds_old(2)=get(hhset_object.z_slider,'Max');
     2459% %         if isequal(ZBounds_old,ZBounds)
     2460%             test_set_object=0;% do not refresh the GUI set_object
     2461%         else
     2462            delete(hset_object);% delete the GUI set_object if it does not fit
     2463%         end
     2464    end
     2465    if test_set_object% reinitiate the GUI set_object
     2466        delete_object(1);% delete the current projection object in the list UvData.Object, delete its graphic representations and update the list displayed in handles.list_object_1 and 2
    25842467        UvData.Object{1}.Style='plane';%main plotting plane
    25852468        UvData.Object{1}.ProjMode='projection';%main plotting plane
     
    25972480        set_object(UvData.Object{1},PlotHandles,ZBounds);
    25982481        set(handles.list_object_1,'Value',1);
     2482        set(handles.list_object_1,'String',{'1-PLANE'});
     2483        set(handles.edit_object,'Value',1)% put the plane in edit mode to enable the z cursor
     2484        edit_object_Callback([],[], handles)
    25992485    end
    26002486    %multilevel case (single menuplane in a 3D space)
     
    26152501        UvData.Object{1}.ZObject=UvData.ZIndex;
    26162502    end
     2503else
     2504    % create a default projection menuplane
     2505    UvData.Object{1}.Style='plane';%main plotting plane
     2506    UvData.Object{1}.ProjMode='projection';%main plotting plane
     2507    UvData.Object{1}.DisplayHandle_uvmat=[]; %plane not visible in uvmat
     2508    set(handles.list_object_1,'Value',1);
     2509    set(handles.list_object_1,'String',{'1-PLANE'});
    26172510end
    26182511if ~isfield(UvData.Object{1},'plotaxes')
    2619     UvData.Object{1}.plotaxes=handles.axes3;%default plotting axis
    2620     set(handles.list_object_1,'Value',1);
    2621     set(handles.list_object_1,'String',{'1-PLANE'}); 
     2512    UvData.Object{1}.plotaxes=handles.axes3;%default plotting axis
    26222513end
    26232514
     
    26402531PlotParam{1}=read_plot_param(handles);%read plotting parameters on the uvmat interfac
    26412532keeplim(1)=get(handles.FixedLimits,'Value');% test for fixed graph limits
    2642 PosColorbar{1}=UvData.PosColorbar;%prescribe the colorbar position on the uvmat interface
     2533PosColorbar{1}=UvData.OpenParam.PosColorbar;%prescribe the colorbar position on the uvmat interface
    26432534
    26442535% second projection object (view_field display)
     
    27292620            hget_field=findobj(allchild(0),'name','get_field');
    27302621            if isempty(hget_field)
    2731                 get_field([],ObjectData)% the projected field cannot be automatically plotted: use get_field to specify the variablesdelete(hget_field)
    2732             else
    2733                 errormsg='The field defined by get_field cannot be plotted';
    2734                 return
     2622                get_field(filename)% the projected field cannot be automatically plotted: use get_field to specify the variablesdelete(hget_field)
    27352623            end
     2624            errormsg='The field defined by get_field cannot be plotted';
     2625            return
    27362626        end
    27372627    end
     
    28532743        set(handles.Dt_txt,'String',['Dt=' num2str(1000*dt,3) '  m' UvData.TimeUnit] )
    28542744    end
    2855 end
    2856 
    2857 %% update the input file name in the get_field GUI
    2858 if isequal(FieldName,'get_field...')
    2859     set(hhget_field.inputfile,'String',filename)
    2860     Tabchar={''};%default
    2861     Tabcell=[];
    2862     if isfield(Field{1},'ListGlobalAttribute')&& ~isempty(Field{1}.ListGlobalAttribute)
    2863         for iline=1:length(Field{1}.ListGlobalAttribute)
    2864             Tabcell{iline,1}=Field{1}.ListGlobalAttribute{iline};
    2865             if isfield(Field{1}, Field{1}.ListGlobalAttribute{iline})
    2866                 eval(['val=Field{1}.' Field{1}.ListGlobalAttribute{iline} ';'])
    2867                 if ischar(val);
    2868                     Tabcell{iline,2}=val;
    2869                 else
    2870                     Tabcell{iline,2}=num2str(val);
    2871                 end
    2872             end
    2873         end
    2874         if ~isempty(Tabcell)
    2875             Tabchar=cell2tab(Tabcell,'=');
    2876             Tabchar=[{''};Tabchar];
    2877         end
    2878     end
    2879     set(hhget_field.attributes,'String',Tabchar);%update list of global attributes in get_field
    2880 end
    2881 if isequal(FieldName_1,'get_field...')
    2882     set(hhget_field_1.inputfile,'String',filename_1)
    2883     Tabchar={''};%default
    2884     Tabcell=[];
    2885     if isfield(Field{2},'ListGlobalAttribute')&& ~isempty(Field{2}.ListGlobalAttribute)
    2886         for iline=1:length(Field{2}.ListGlobalAttribute)
    2887             Tabcell{iline,1}=Field{2}.ListGlobalAttribute{iline};
    2888             if isfield(Field{2}, Field{2}.ListGlobalAttribute{iline})
    2889                 eval(['val=Field{2}.' Field{2}.ListGlobalAttribute{iline} ';'])
    2890                 if ischar(val);
    2891                     Tabcell{iline,2}=val;
    2892                 else
    2893                     Tabcell{iline,2}=num2str(val);
    2894                 end
    2895             end
    2896         end
    2897         if ~isempty(Tabcell)
    2898             Tabchar=cell2tab(Tabcell,'=');
    2899             Tabchar=[{''};Tabchar];
    2900         end
    2901     end
    2902     set(hhget_field_1.attributes,'String',Tabchar);%update list of global attributes in get_field
    29032745end
    29042746
     
    37133555    [hset_object,UvData.sethandles]=set_object(data,PlotHandles);% call the set_object interface with action on haxes,
    37143556                                                      % associate the set_object interface handle to the plotting axes
    3715     if isfield(UvData,'SetObjectOrigin')                                               
     3557    if isfield(UvData.OpenParam,'SetObjectOrigin')                                               
    37163558    pos_uvmat=get(huvmat,'Position');
    3717     pos_set_object(1:2)=UvData.SetObjectOrigin + pos_uvmat(1:2);
    3718     pos_set_object(3:4)=UvData.SetObjectSize .* pos_uvmat(3:4); 
     3559    pos_set_object(1:2)=UvData.OpenParam.SetObjectOrigin + pos_uvmat(1:2);
     3560    pos_set_object(3:4)=UvData.OpenParam.SetObjectSize .* pos_uvmat(3:4); 
    37193561    set(hset_object,'Position',pos_set_object)
    37203562    end
     
    43654207    UvData.MouseAction='none';
    43664208    set(handles.edit_object,'BackgroundColor',[0.7,0.7,0.7])   
     4209    hset_object=findobj(allchild(0),'tag','set_object');% look for the set_object GUI
     4210    if ~isempty(hset_object)
     4211        delete(hset_object)% delete the current GUI set_object
     4212    end
    43674213end
    43684214set(handles.uvmat,'UserData',UvData);
     
    44104256function update_object(handles,IndexObj,option,ObjectName)
    44114257%------------------------------------------------------------------------
    4412 UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface 
     4258UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface
    44134259if numel(UvData.Object)<IndexObj;
    44144260    return
     
    44204266end
    44214267ZBounds=0; % default
    4422     if isfield(UvData,'ZMin') && isfield(UvData,'ZMax')
    4423         ZBounds(1)=UvData.ZMin; %minimum for the Z slider
    4424         ZBounds(2)=UvData.ZMax;%maximum for the Z slider
    4425     end
     4268if isfield(UvData.Field,'ZMin') && isfield(UvData.Field,'ZMax')
     4269    ZBounds(1)=UvData.Field.ZMin; %minimum for the Z slider
     4270    ZBounds(2)=UvData.Field.ZMax;%maximum for the Z slider
     4271end
    44264272hset_object=findobj(allchild(0),'tag','set_object');
    44274273if ~isempty(hset_object)
    44284274    delete(hset_object)% delete existing version of set_object
     4275end
     4276edit_test=get(handles.edit_object,'Value');
     4277if edit_test
     4278    ObjectData.enable_plot=1;
     4279else
     4280        if isfield(ObjectData,'enable_plot')
     4281        ObjectData=rmfield(ObjectData,'enable_plot');
     4282    end
    44294283end
    44304284hset_object=set_object(ObjectData,[],ZBounds);% call the set_object interface,
     
    44344288if option==1%length(UvData.Object)>= IndexObj && isfield(UvData.Object{IndexObj},'plotaxes')&& ishandle(UvData.Object{IndexObj}.plotaxes)
    44354289    PlotHandles=handles;
    4436 %     UvData.Object{IndexObj}.plotaxes=handles.axes3;
    44374290else
    44384291    hview_field=findobj(allchild(0),'tag','view_field');
     
    44414294    end
    44424295    PlotHandles=guidata(hview_field);
    4443 %     hview_field=view_field(ProjData);
    4444 %     hhviewfield=guidata(hviewfield);
    4445    % UvData.Object{IndexObj}.plotaxes=hhviewfield.axes3;
    44464296end
    44474297if ~isempty(ProjData)
    4448 plot_field(ProjData,PlotHandles.axes3,PlotHandles);
     4298    plot_field(ProjData,PlotHandles.axes3,PlotHandles);
    44494299end
    44504300set(handles.uvmat,'UserData',UvData)
     
    44574307        end
    44584308    elseif isequal(get(hother(iobj),'Type'),'image')
    4459            Acolor=get(hother(iobj),'CData');
    4460            Acolor(:,:,1)=zeros(size(Acolor,1),size(Acolor,2));
    4461            set(hother(iobj),'CData',Acolor);
     4309        Acolor=get(hother(iobj),'CData');
     4310        Acolor(:,:,1)=zeros(size(Acolor,1),size(Acolor,2));
     4311        set(hother(iobj),'CData',Acolor);
    44624312    else
    4463          set(hother(iobj),'Color','b')
     4313        set(hother(iobj),'Color','b')
    44644314    end
    44654315    set(hother(iobj),'Selected','off')
     
    44674317hother=findobj('Tag','DeformPoint');
    44684318set(hother,'Color','b');
    4469 set(hother,'Selected','off')   
     4319set(hother,'Selected','off')
    44704320if isfield(ObjectData,'DisplayHandle_uvmat')
    4471 %     for iview=1:length(ObjectData.HandlesDisplay)
    4472         if ishandle(ObjectData.DisplayHandle_uvmat)
    4473             uistack(ObjectData.DisplayHandle_uvmat,'top')
    4474             linetype=get(ObjectData.DisplayHandle_uvmat,'Type');
    4475             if isequal(linetype,'line')
    4476                 set(ObjectData.DisplayHandle_uvmat,'Color','m'); %set the selected object to magenta color
    4477             elseif isequal(linetype,'rectangle')
    4478                 set(ObjectData.DisplayHandle_uvmat,'EdgeColor','m'); %set the selected object to magenta color
    4479             elseif isequal(linetype,'patch')
    4480                 set(ObjectData.DisplayHandle_uvmat,'FaceColor','m'); %set the selected object to magenta color
    4481             end
    4482             SubObjectData=get(ObjectData.DisplayHandle_uvmat,'UserData');
    4483             if isfield(SubObjectData,'SubObject') & ishandle(SubObjectData.SubObject)
    4484                 uistack(SubObjectData.SubObject,'top')
    4485                 for iobj=1:length(SubObjectData.SubObject)
    4486                     hsub=SubObjectData.SubObject(iobj);
    4487                     if isequal(get(hsub,'Type'),'rectangle')
    4488                         set(hsub,'EdgeColor','m'); %set the selected object to magenta color
    4489                     elseif isequal(get(hsub,'Type'),'image')
    4490                        Acolor=get(hsub,'CData');
    4491                        Acolor(:,:,1)=Acolor(:,:,3);
    4492                        set(hsub,'CData',Acolor);
    4493                     else
    4494                         set(hsub,'Color','m')
    4495                     end
     4321    if ishandle(ObjectData.DisplayHandle_uvmat)
     4322        uistack(ObjectData.DisplayHandle_uvmat,'top')
     4323        linetype=get(ObjectData.DisplayHandle_uvmat,'Type');
     4324        if isequal(linetype,'line')
     4325            set(ObjectData.DisplayHandle_uvmat,'Color','m'); %set the selected object to magenta color
     4326        elseif isequal(linetype,'rectangle')
     4327            set(ObjectData.DisplayHandle_uvmat,'EdgeColor','m'); %set the selected object to magenta color
     4328        elseif isequal(linetype,'patch')
     4329            set(ObjectData.DisplayHandle_uvmat,'FaceColor','m'); %set the selected object to magenta color
     4330        end
     4331        SubObjectData=get(ObjectData.DisplayHandle_uvmat,'UserData');
     4332        if isfield(SubObjectData,'SubObject') & ishandle(SubObjectData.SubObject)
     4333            uistack(SubObjectData.SubObject,'top')
     4334            for iobj=1:length(SubObjectData.SubObject)
     4335                hsub=SubObjectData.SubObject(iobj);
     4336                if isequal(get(hsub,'Type'),'rectangle')
     4337                    set(hsub,'EdgeColor','m'); %set the selected object to magenta color
     4338                elseif isequal(get(hsub,'Type'),'image')
     4339                    Acolor=get(hsub,'CData');
     4340                    Acolor(:,:,1)=Acolor(:,:,3);
     4341                    set(hsub,'CData',Acolor);
     4342                else
     4343                    set(hsub,'Color','m')
    44964344                end
    44974345            end
    4498             if isfield(SubObjectData,'DeformPoint') & ishandle(SubObjectData.DeformPoint)
    4499                 set(SubObjectData.DeformPoint,'Color','m')
    4500             end
    4501         end
    4502 %     end
     4346        end
     4347        if isfield(SubObjectData,'DeformPoint') & ishandle(SubObjectData.DeformPoint)
     4348            set(SubObjectData.DeformPoint,'Color','m')
     4349        end
     4350    end
     4351    %     end
    45034352end
    45044353pause(0.1)
     
    45454394end
    45464395
    4547 
     4396%------------------------------------------------------------------------
    45484397% --------------------------------------------------------------------
    45494398function MenuExportMovie_Callback(hObject, eventdata, handles)
     
    46314480msgbox_uvmat('CONFIRMATION',{['movie ' aviname ' created '];['with ' num2str(imax) ' frames']})
    46324481
    4633 
    4634 % ------------------------------------------------------------------
     4482%------------------------------------------------------------------------
    46354483function MenuCalib_Callback(hObject, eventdata, handles)
     4484%------------------------------------------------------------------------
    46364485
    46374486UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface
     
    46514500[FileName,RootPath,FileBase,FileIndices,FileExt,SubDir]=read_file_boxes(handles);
    46524501set(handles.view_xml,'Backgroundcolor',[1 1 0])%indicate the reading of the current xml file by geometry_calib
    4653 if isfield(UvData,'CalOrigin')
     4502if isfield(UvData.OpenParam,'CalOrigin')
    46544503    pos_uvmat=get(handles.uvmat,'Position');
    4655     pos_cal(1)=pos_uvmat(1)+UvData.CalOrigin(1)*pos_uvmat(3);
    4656     pos_cal(2)=pos_uvmat(2)+UvData.CalOrigin(2)*pos_uvmat(4);
    4657     pos_cal(3:4)=UvData.CalSize .* pos_uvmat(3:4);
     4504    pos_cal(1)=pos_uvmat(1)+UvData.OpenParam.CalOrigin(1)*pos_uvmat(3);
     4505    pos_cal(2)=pos_uvmat(2)+UvData.OpenParam.CalOrigin(2)*pos_uvmat(4);
     4506    pos_cal(3:4)=UvData.OpenParam.CalSize .* pos_uvmat(3:4);
    46584507end
    46594508geometry_calib(FileName,pos_cal);% call the geometry_calib interface   
     
    46614510set(handles.MenuCalib,'checked','on')% indicate that MenuCalib is activated, test used by mouse action
    46624511
    4663 
    4664 % ------------------------------------------------------------------
     4512%------------------------------------------------------------------------
    46654513function MenuMask_Callback(hObject, eventdata, handles)
     4514%------------------------------------------------------------------------
    46664515UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface
    46674516ListObj=UvData.Object;
     
    47664615end
    47674616
    4768 %set(handles.uvmat,'UserData',UvData);
    4769 
    4770 % ------------------------------------------------------------------
     4617%------------------------------------------------------------------------
    47714618%-- open the GUI set_grid.fig to create grid
    47724619function MenuGrid_Callback(hObject, eventdata, handles)
     4620%------------------------------------------------------------------------
    47734621%UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface
    47744622
     
    47864634%set(handles.uvmat,'UserData',UvData);
    47874635
    4788 %----------------------------------------------------------------
     4636%------------------------------------------------------------------------
    47894637% open the GUI 'series'
    4790 %----------------------------------------------------------------
    47914638function MenuSeries_Callback(hObject, eventdata, handles)
    4792 %-------------------------------------------------------------------
     4639%------------------------------------------------------------------------
    47934640series; %first display of the GUI to fill waiting time
    47944641[param.FileName]=read_file_boxes(handles);
     
    48354682series(param); %run the series interface
    48364683
    4837 % ------------------------------------------------------------------
     4684%------------------------------------------------------------------------
    48384685% -- open the GUI civ.fig for civx (PIV)
    4839 % ------------------------------------------------------------------
    48404686function MenuPIV_Callback(hObject, eventdata, handles)
     4687%------------------------------------------------------------------------
    48414688 
    48424689[FileName,RootPath,filebase,FileIndices,ext,SubDir]=read_file_boxes(handles);
     
    48744721param.ImaExt=ext;
    48754722civ(param);% interface de civ(not in the uvmat file)
    4876    
    4877 % ------------------------------------------------------------------
     4723
     4724%------------------------------------------------------------------------
    48784725function MenuTools_Callback(hObject, eventdata, handles)
    4879 
    4880 % ------------------------------------------------------------------
     4726%------------------------------------------------------------------------
     4727
     4728%------------------------------------------------------------------------
    48814729function MenuEditObject_Callback(hObject, eventdata, handles)
     4730%------------------------------------------------------------------------
    48824731set(handles.edit_object,'Value',1)
    48834732edit_Callback(hObject, eventdata, handles)
    48844733
    4885 %--------------------------------------------------------------------------
     4734%------------------------------------------------------------------------
    48864735function enable_transform(handles,state)
     4736%------------------------------------------------------------------------
    48874737set(handles.transform_fct,'Visible',state)
    48884738set(handles.TRANSFORM_txt,'Visible',state)   
     
    48974747function MenuEditVectors_Callback(hObject, eventdata, handles)
    48984748%------------------------------------------------------------------------
    4899 % set(handles.MenuEditVectors,'checked','on')
    49004749set(handles.edit_vect,'Visible','on')
    49014750set(handles.edit_vect,'Value',1)
    49024751edit_vect_Callback(hObject, eventdata, handles)
    49034752
    4904 % --------------------------------------------------------------------
     4753% -----------------------------------------------------------------------
    49054754function Menupoints_Callback(hObject, eventdata, handles)
     4755%------------------------------------------------------------------------
    49064756data.Style='points';
    49074757data.ProjMode='projection';%default
    49084758create_object(data,handles)
    49094759
    4910 % --------------------------------------------------------------------
     4760% -----------------------------------------------------------------------
    49114761function Menuline_Callback(hObject, eventdata, handles)
    4912 % set(handles.create,'Visible','on')
    4913 % set(handles.create,'Value',1)
    4914 % LINE_Callback(hObject,eventdata,handles)
     4762%------------------------------------------------------------------------
    49154763data.Style='line';
    49164764data.ProjMode='projection';%default
     
    49544802create_object(data,handles)
    49554803
    4956 % ------------------------------------------------------------------
     4804%------------------------------------------------------------------------
    49574805function Menuplane_Callback(hObject, eventdata, handles)
     4806%------------------------------------------------------------------------
    49584807data.Style='plane';
    49594808data.ProjMode='projection';%default
     
    49614810create_object(data,handles)
    49624811
    4963 % ------------------------------------------------------------------
     4812%------------------------------------------------------------------------
    49644813function Menuvolume_Callback(hObject, eventdata, handles)
     4814%------------------------------------------------------------------------
    49654815data.Style='volume';
    49664816data.ProjMode='interp';%default
     
    51094959end
    51104960
    5111 
     4961%------------------------------------------------------------------------
    51124962% --- Executes on button press in delete_object.
    51134963function delete_object_Callback(hObject, eventdata, handles)
     4964%------------------------------------------------------------------------
    51144965IndexObj=get(handles.list_object_2,'Value');
    5115     if IndexObj>1
    5116         delete_object(IndexObj)
    5117     end
     4966if IndexObj>1
     4967    delete_object(IndexObj)
     4968end
    51184969   
    51194970
  • trunk/src/view_field.m

    r158 r180  
    7474    hhuvmat=guidata(huvmat);
    7575    set(hhuvmat.list_object_2,'Visible','on')
     76    set(hhuvmat.view_field_title,'Visible','on')
    7677    % handles_mouse.create=hhuvmat.create;
    7778    handles_mouse.edit=hhuvmat.edit_object;
Note: See TracChangeset for help on using the changeset viewer.