Changeset 630


Ignore:
Timestamp:
May 6, 2013, 6:49:54 PM (11 years ago)
Author:
sommeria
Message:

generalisation of update_imadoc, improverment of the GUI get_field

Location:
trunk/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/browse_data.m

    r589 r630  
    703703                            drawnow
    704704                            xmlfullname=fullfile(CurrentPath,ExpName,DeviceName,FileName);
    705                             update_imadoc(DataviewData.GeometryCalib,xmlfullname)
     705                            update_imadoc(DataviewData.GeometryCalib,xmlfullname,'GeometryCalib')
    706706                            display([xmlfullname ' updated'])
    707707                            break
     
    720720                                    drawnow
    721721                                    xmlfullname=fullfile(CurrentPath,ExpName,DeviceName,RecordName,FileName);
    722                                     update_imadoc(DataviewData.GeometryCalib,xmlfullname)
     722                                    update_imadoc(DataviewData.GeometryCalib,xmlfullname,'GeometryCalib')
    723723                                    display([xmlfullname ' updated'])
    724724                                    break
  • trunk/src/geometry_calib.m

    r613 r630  
    188188    end
    189189end
    190 errormsg=update_imadoc(GeometryCalib,outputfile);% introduce the calibration data in the xml file
     190errormsg=update_imadoc(GeometryCalib,outputfile,'GeometryCalib');% introduce the calibration data in the xml file
    191191if ~strcmp(errormsg,'')
    192192    msgbox_uvmat('ERROR',errormsg);
     
    244244        end
    245245    end
    246     errormsg=update_imadoc(GeometryCalib,XmlName);% introduce the calibration data in the xml file
     246    errormsg=update_imadoc(GeometryCalib,XmlName,'GeometryCalib');% introduce the calibration data in the xml file
    247247    if ~strcmp(errormsg,'')
    248248        msgbox_uvmat('ERROR',errormsg);
     
    727727    end
    728728    outputfile=[filebase '.xml'];
    729     errormsg=update_imadoc(GeometryCalib,outputfile);
     729    errormsg=update_imadoc(GeometryCalib,outputfile,'GeometryCalib');
    730730    if ~strcmp(errormsg,'')
    731731        msgbox_uvmat('ERROR',errormsg);
  • trunk/src/get_field.m

    r606 r630  
    2222function varargout = get_field(varargin)
    2323
    24 % Last Modified by GUIDE v2.5 10-Mar-2013 21:19:52
     24% Last Modified by GUIDE v2.5 05-May-2013 23:54:32
    2525
    2626% Begin initialization code - DO NOT EDIT
     
    14891489
    14901490
     1491% --- Executes on button press in CheckScalar.
     1492function checkbox22_Callback(hObject, eventdata, handles)
     1493% hObject    handle to CheckScalar (see GCBO)
     1494% eventdata  reserved - to be defined in a future version of MATLAB
     1495% handles    structure with handles and user data (see GUIDATA)
     1496
     1497% Hint: get(hObject,'Value') returns toggle state of CheckScalar
     1498
     1499
     1500% --- Executes on button press in checkbox23.
     1501function checkbox23_Callback(hObject, eventdata, handles)
     1502% hObject    handle to checkbox23 (see GCBO)
     1503% eventdata  reserved - to be defined in a future version of MATLAB
     1504% handles    structure with handles and user data (see GUIDATA)
     1505
     1506% Hint: get(hObject,'Value') returns toggle state of checkbox23
  • trunk/src/proj_field.m

    r629 r630  
    935935%% initiate Matlab  structure for physical field
    936936[ProjData,errormsg]=proj_heading(FieldData,ObjectData);
     937if ~isempty(errormsg)
     938    return
     939end
    937940
    938941%% reproduce initial plane position and angle
     
    10441047        case 'scattered'
    10451048            if strcmp(ProjMode{icell},'interp_tps')
    1046                 continue %skip for interp_tps (needs tps field cell)
     1049                continue %skip for next cell (needs tps field cell)
    10471050            end
    10481051            coord_x=FieldData.(FieldData.ListVarName{CellInfo{icell}.CoordIndex(end)});% initial x coordinates
  • trunk/src/series.m

    r623 r630  
    905905%% set length of waitbar
    906906displ_time(handles)
    907 
    908907
    909908%% set default options in menu 'Fields'
     
    19071906    nb_netcdf=numel(find(strcmp('netcdf',SeriesData.FileType)));
    19081907end
     1908if nb_civ>=1
     1909    menu=set_veltype_display(SeriesData.FileInfo{1}.CivStage,SeriesData.FileType{1});
     1910    set(handles.VelType,'String',[{'*'};menu])
     1911    if nb_civ>=2
     1912        menu=set_veltype_display(SeriesData.FileInfo{2}.CivStage,SeriesData.FileType{2});
     1913        set(handles.VelType_1,'String',[{'*'};menu])
     1914    end
     1915end
     1916       
     1917   
    19091918
    19101919%% Check whether alphabetical sorting of input Subdir is alowed by the Action fct  (for multiples series entries)
     
    22472256%------------------------------------------------------------------------
    22482257% --- Executes on button press in CheckObject.
     2258%------------------------------------------------------------------------
    22492259function CheckObject_Callback(hObject, eventdata, handles)
    2250 %------------------------------------------------------------------------
     2260
    22512261hset_object=findobj(allchild(0),'tag','set_object');%find the set_object interface handle
    2252 value=get(handles.CheckObject,'Value');
    2253 if value
     2262if get(handles.CheckObject,'Value')
    22542263    SeriesData=get(handles.series,'UserData');
    2255     if ~(isfield(SeriesData,'ProjObject')&&~isempty(SeriesData.ProjObject))
     2264    if isfield(SeriesData,'ProjObject') && ~isempty(SeriesData.ProjObject)
     2265        set(handles.ViewObject,'Value',1)
     2266        ViewObject_Callback(hObject, eventdata, handles)
     2267    else
    22562268        if ishandle(hset_object)
    22572269            uistack(hset_object,'top')% show the GUI set_object if opened
     
    22882300        set(handles.series,'UserData',SeriesData);
    22892301    end
     2302    set(handles.EditObject,'Visible','on');
    22902303    set(handles.DeleteObject,'Visible','on');
    22912304    set(handles.ViewObject,'Visible','on');
    22922305    set(handles.ProjObject,'Visible','on');
    22932306else
     2307    set(handles.EditObject,'Visible','off');
    22942308    set(handles.DeleteObject,'Visible','off');
    22952309    set(handles.ViewObject,'Visible','off');
     
    22992313    set(handles.ProjObject,'Visible','off');
    23002314end
    2301 %set(handles.series,'UserData',SeriesData)
     2315
     2316%------------------------------------------------------------------------
     2317% --- Executes on button press in ViewObject.
     2318%------------------------------------------------------------------------
     2319function ViewObject_Callback(hObject, eventdata, handles)
     2320
     2321if get(handles.ViewObject,'Value')
     2322    set(handles.EditObject,'Value',0)
     2323        UserData=get(handles.series,'UserData');
     2324    hset_object=set_object(UserData.ProjObject);
     2325    set(hset_object,'Name','view_object_series')
     2326else
     2327    hset_object=findobj(allchild(0),'Tag','set_object');
     2328    if ~isempty(hset_object)
     2329        delete(hset_object)
     2330    end
     2331end
     2332
     2333%------------------------------------------------------------------------
     2334% --- Executes on button press in EditObject.
     2335%------------------------------------------------------------------------
     2336function EditObject_Callback(hObject, eventdata, handles)
     2337
     2338if get(handles.EditObject,'Value')
     2339    set(handles.ViewObject,'Value',0)
     2340        UserData=get(handles.series,'UserData');
     2341    hset_object=set_object(UserData.ProjObject);
     2342    set(hset_object,'Name','edit_object_series')
     2343    set(get(hset_object,'Children'),'Enable','on')
     2344else
     2345    hset_object=findobj(allchild(0),'Tag','set_object');
     2346    if ~isempty(hset_object)
     2347        delete(hset_object)
     2348    end
     2349end
     2350
     2351%------------------------------------------------------------------------
     2352% --- Executes on button press in DeleteObject.
     2353%------------------------------------------------------------------------
     2354function DeleteObject_Callback(hObject, eventdata, handles)
     2355
     2356if get(handles.DeleteObject,'Value')
     2357        SeriesData=get(handles.series,'UserData');
     2358    SeriesData.ProjObject=[];
     2359    set(handles.series,'UserData',SeriesData)
     2360    set(handles.ProjObject,'String','')
     2361    set(handles.CheckObject,'Value',0)
     2362    set(handles.DeleteObject,'Visible','off')
     2363    set(handles.ViewObject,'Visible','off')
     2364    set(handles.DeleteObject,'Value',0)
     2365end
    23022366
    23032367%--------------------------------------------------------------
    23042368function CheckMask_Callback(hObject, eventdata, handles)
    2305 value=get(handles.CheckMask,'Value');
    2306 if value
     2369
     2370if get(handles.CheckMask,'Value')
    23072371    msgbox_uvmat('ERROR','not implemented yet')
    23082372end
     
    27432807
    27442808
    2745 function ActionInput_Callback(hObject, eventdata, handles)
    2746 
    2747 
    2748 % --- Executes on button press in DeleteObject.
    2749 function DeleteObject_Callback(hObject, eventdata, handles)
    2750 if get(handles.DeleteObject,'Value')
    2751         SeriesData=get(handles.series,'UserData');
    2752     SeriesData.ProjObject=[];
    2753     set(handles.series,'UserData',SeriesData)
    2754     set(handles.ProjObject,'String','')
    2755     set(handles.CheckObject,'Value',0)
    2756     set(handles.DeleteObject,'Visible','off')
    2757     set(handles.ViewObject,'Visible','off')
    2758     set(handles.DeleteObject,'Value',0)
    2759 end
    2760 
    2761 % --- Executes on button press in ViewObject.
    2762 function ViewObject_Callback(hObject, eventdata, handles)
    2763 if get(handles.ViewObject,'Value')
    2764         UserData=get(handles.series,'UserData');
    2765     set_object(UserData.ProjObject)
    2766 else
    2767     hset_object=findobj(allchild(0),'Tag','set_object');
    2768     if ~isempty(hset_object)
    2769         delete(hset_object)
    2770     end
    2771 end
    27722809
    27732810
     
    27782815NbSlice=str2num(get(handles.num_NbSlice,'String'));
    27792816set(handles.num_NbProcess,'String',num2str(NbSlice))
     2817
     2818%------------------------------------------------------------------------
     2819% --- set the visibility of relevant velocity type menus:
     2820function menu=set_veltype_display(Civ,FileType)
     2821%------------------------------------------------------------------------
     2822if ~exist('FileType','var')
     2823    FileType='civx';
     2824end
     2825switch FileType
     2826    case 'civx'
     2827        menu={'civ1';'interp1';'filter1';'civ2';'interp2';'filter2'};
     2828        if isequal(Civ,0)
     2829            imax=0;
     2830        elseif isequal(Civ,1) || isequal(Civ,2)
     2831            imax=1;
     2832        elseif isequal(Civ,3)
     2833            imax=3;
     2834        elseif isequal(Civ,4) || isequal(Civ,5)
     2835            imax=4;
     2836        elseif isequal(Civ,6) %patch2
     2837            imax=6;
     2838        end
     2839    case 'civdata'
     2840        menu={'civ1';'filter1';'civ2';'filter2'};
     2841        if isequal(Civ,0)
     2842            imax=0;
     2843        elseif isequal(Civ,1) || isequal(Civ,2)
     2844            imax=1;
     2845        elseif isequal(Civ,3)
     2846            imax=2;
     2847        elseif isequal(Civ,4) || isequal(Civ,5)
     2848            imax=3;
     2849        elseif isequal(Civ,6) %patch2
     2850            imax=4;
     2851        end
     2852end
     2853menu=menu(1:imax);
     2854
  • trunk/src/set_object.m

    r627 r630  
    419419drawnow
    420420
     421%% update the object in the GUI series if relevant
     422if strcmp(get(handles.set_object,'Name'),'edit_object_series')
     423    hseries=findobj(allchild(0),'Tag','series');
     424    if ~isempty(hseries)
     425        SeriesData=get(hseries,'UserData');
     426    SeriesData.ProjObject=read_GUI(handles.set_object);%read the parameters defining the object in the GUI set_object
     427    set(hseries,'UserData',SeriesData);
     428    end
     429    set(handles.PLOT,'BackgroundColor',[1 0 0])
     430    return
     431end
     432
    421433%% read the object parameters in the GUI set_object
    422434ObjectData=read_GUI(handles.set_object);%read the parameters defining the object in the GUI set_object
     
    449461    UvData.ProjObject{IndexObj}.DisplayHandle.uvmat=hhuvmat.PlotAxes; % axes for plot_object
    450462    UvData.ProjObject{IndexObj}.DisplayHandle.view_field=[]; %no plot handle before plot_field operation
    451 else
    452     % if ~strcmp(ListObject{end},'')
    453     %     ListObject=[ListObject;{''}]; %append a blank to the list (if nort already done) to indicate the creation of a new object
    454     %     set(handles.ListObject,'String',ListObject)
    455     % end
    456     % IndexObj=length(ListObject); 
    457     % set(handles.uvmat,'UserData',UvData)   
     463else   
    458464    IndexObj=get(hhuvmat.ListObject,'Value');% index of the selected object for display in uvmat
    459465end
    460466
    461 %set or modify(edit mode) the nameof the currently selected object
     467%set or modify(edit mode) the name of the currently selected object
    462468detectname=1;
    463469ObjectNameNew=ObjectName;
     
    495501    UvData.ProjObject{IndexObj}.DisplayHandle.uvmat=hhuvmat.PlotAxes; %axes taken as object display handle by defualt
    496502end
    497 %set(hhuvmat.edit_object,'Value',1)% set the current object to edit mode
    498503
    499504%% plot the field projected on the object
  • trunk/src/update_imadoc.m

    r499 r630  
    11%'update_imadoc': update an xml file with geometric calibration parameters
    22%--------------------------------------------------------------------------
    3 %  function update_imadoc(GeometryCalib,outputfile)
     3%  function update_imadoc(Struct,outputfile)
    44%
    55%INPUT:
    6 % GeometryCalib: structure containing the calibration parameters
     6% Struct: structure containing the calibration parameters
    77% outputfile: xml file to modify
     8% StructName : Name of the field in the xml file
    89%-------------------------------------------------------------
    9 function errormsg=update_imadoc(GeometryCalib,outputfile)
     10function errormsg=update_imadoc(Struct,outputfile,StructName)
    1011errormsg='';
    1112testappend=0;
     
    2930        testappend=1;
    3031        %if the xml file is  ImaDoc
    31         uid_calib=find(t,'ImaDoc/GeometryCalib');
    32         if isempty(uid_calib)  %if GeometryCalib does not already exists, create it
    33             [t,uid_calib]=add(t,1,'element','GeometryCalib');
    34         else %if GeometryCalib already exists, delete its content
     32        uid_calib=find(t,['ImaDoc/' StructName]);
     33        if isempty(uid_calib)  %if Struct does not already exists, create it
     34            [t,uid_calib]=add(t,1,'element',StructName);
     35        else %if Struct already exists, delete its content
    3536            uid_child=children(t,uid_calib);
    3637            t=delete(t,uid_child);
     
    4445    t=set(t,1,'name','ImaDoc');
    4546    % in case of movie (avi file), copy timing info in the new xml file
    46     [pp,outputroot]=fileparts(outputfile);
     47%    [pp,outputroot]=fileparts(outputfile);
    4748    %     imainfo=[];
    48     if exist(fullfile(pp,[outputroot '.avi']),'file')
    49         FileName=fullfile(pp,[outputroot '.avi']);
    50         hhh=which('videoreader');
    51         if isempty(hhh)%use old video function of matlab
    52             imainfo=aviinfo(FileName);
    53             imainfo.FrameRate=imainfo.FramesPerSecond;
    54             imainfo.NumberOfFrames=imainfo.NumFrames;
    55         else %use video function videoreader of matlab
    56             imainfo=get(videoreader(FileName));
    57         end
    58         if ~isempty(imainfo)
    59             [t,uid_camera]=add(t,1,'element','Camera');
    60             Camera.TimeUnit='s';
    61             Camera.BurstTiming.Time=0;
    62             Camera.BurstTiming.Dti=1/imainfo.FrameRate;
    63             Camera.BurstTiming.NbDti=imainfo.NumberOfFrames-1;
    64             t=struct2xml(Camera,t,uid_camera);
    65         end
    66     end
    67     [t,uid_calib]=add(t,1,'element','GeometryCalib');
     49%     if exist(fullfile(pp,[outputroot '.avi']),'file')
     50%         FileName=fullfile(pp,[outputroot '.avi']);
     51%         hhh=which('videoreader');
     52%         if isempty(hhh)%use old video function of matlab
     53%             imainfo=aviinfo(FileName);
     54%             imainfo.FrameRate=imainfo.FramesPerSecond;
     55%             imainfo.NumberOfFrames=imainfo.NumFrames;
     56%         else %use video function videoreader of matlab
     57%             imainfo=get(videoreader(FileName));
     58%         end
     59%         if ~isempty(imainfo)
     60%             [t,uid_camera]=add(t,1,'element','Camera');
     61%             Camera.TimeUnit='s';
     62%             Camera.BurstTiming.Time=0;
     63%             Camera.BurstTiming.Dti=1/imainfo.FrameRate;
     64%             Camera.BurstTiming.NbDti=imainfo.NumberOfFrames-1;
     65%             t=struct2xml(Camera,t,uid_camera);
     66%         end
     67%     end
     68    [t,uid_calib]=add(t,1,'element',StructName);
    6869end
    6970
    7071%% save the output file
    71 t=struct2xml(GeometryCalib,t,uid_calib);
     72t=struct2xml(Struct,t,uid_calib);
    7273save(t,outputfile);
Note: See TracChangeset for help on using the changeset viewer.