Changeset 710


Ignore:
Timestamp:
Feb 16, 2014, 5:35:45 PM (10 years ago)
Author:
sommeria
Message:

various improvements.

Location:
trunk/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/check_files.m

    r709 r710  
    163163    svn_info.rep_rev=0;svn_info.cur_rev=0;
    164164    [tild,result]=system(['svn info ' dir_fct]); %get info fromn the svn server
    165     t=regexp(result,'R.vision\s*:\s*(?<rev>\d+)','names');%detect 'révision' or 'Revision' in the text
     165    t=regexp(result,'R.vision\s*:\s*(?<rev>\d+)','names');%detect 'rï¿œvision' or 'Revision' in the text
    166166    if ~isempty(t)
    167167        svn_info.cur_rev=str2double(t.rev); %version nbre of the current package
    168168    end
    169     [tild,result]=system(['svn info -r ''HEAD'' '  pathuvmat ' &']);
     169    [tild,result]=system(['svn info -r ''HEAD'' '  pathuvmat]);
    170170    t=regexp(result,'R.vision\s*:\s*(?<rev>\d+)','names');
    171171    if ~isempty(t)
    172172        svn_info.rep_rev=str2double(t.rev); % version nbre available on the svn repository
    173173    end
    174     [tild,result]=system(['svn status '  pathuvmat ' &']);% '&' prevents the program to stop when the system asks password
     174    [tild,result]=system(['svn status '  pathuvmat]);% '&' prevents the program to stop when the system asks password
    175175    svn_info.status=result;
    176176    checkmsg =[checkmsg {['SVN revision : ' num2str(svn_info.cur_rev)]}];%display version nbre of the current uvmat package
  • trunk/src/fill_GUI.m

    r671 r710  
    2525    end
    2626end
    27 UserData=get(GUI_handle,'UserData');
     27UserData=get(GUI_handle,'UserData');% additional information stored in 'UserData' of the GUI
    2828fields=fieldnames(Param);%list of fields in Param
    2929
     
    3333for ifield=1:numel(fields)
    3434    if isstruct(Param.(fields{ifield}))% case of a sub-structure
    35     %% case of a sub-structure --> fill a panel
     35    %% case of a sub-structure
     36        % if a panel in the GUI has the tag fields{ifield}, fill it with the sub-structure content
    3637        if isfield(handles,fields{ifield})
    3738            set(handles.(fields{ifield}),'Visible','on')
    3839            errormsg=fill_GUI(Param.(fields{ifield}),handles.(fields{ifield}));% recursively apply the function to the substructure
    39         elseif isfield(UserData,fields{ifield})&& isfield(handles,fields{ifield})&&isfield(Param.(fields{ifield}),'Name')
    40             UserData.(fields{ifield})=Param.(fields{ifield});
    41             set(handles.(fields{ifield}),'String',Param.(fields{ifield}).Name)
     40%         elseif isfield(UserData,fields{ifield}) && isfield(handles,fields{ifield}) && isfield(Param.(fields{ifield}),'Name')
     41%             UserData.(fields{ifield})=Param.(fields{ifield});
     42%             set(handles.(fields{ifield}),'String',Param.(fields{ifield}).Name)
    4243        end
    4344    else
  • trunk/src/keyboard_callback.m

    r681 r710  
    55xx=double(get(hObject,'CurrentCharacter')); %get the keyboard character
    66if ~isempty(xx)
    7 switch xx
    8     case {29,28,30,31}    %arrows for displacement
    9         AxeData=get(cur_axes,'UserData');
    10         if isfield(AxeData,'ZoomAxes')&&ishandle(AxeData.ZoomAxes)
    11            cur_axes=AxeData.ZoomAxes;% move the field of the zoom sub-plot instead of the main axes  if it exsits
    12            axes(cur_axes)
    13         end
    14         if ~isempty(cur_axes)
    15             xlimit=get(cur_axes,'XLim');
    16             ylimit=get(cur_axes,'Ylim');
    17             dx=(xlimit(2)-xlimit(1))/10;
    18             dy=(ylimit(2)-ylimit(1))/10;
    19             if isequal(xx,29)%move arrow right
    20                 xlimit=xlimit+dx;
    21             elseif isequal(xx,28)%move arrow left
    22                 xlimit=xlimit-dx;
    23             elseif isequal(xx,30)%move arrow up
    24                 ylimit=ylimit+dy;
    25             elseif isequal(xx,31)%move arrow down
    26                 ylimit=ylimit-dy;
     7    switch xx
     8        case {29,28,30,31}    %arrows for displacement
     9            AxeData=get(cur_axes,'UserData');
     10            if isfield(AxeData,'ZoomAxes')&&ishandle(AxeData.ZoomAxes)
     11                cur_axes=AxeData.ZoomAxes;% move the field of the zoom sub-plot instead of the main axes  if it exsits
     12                axes(cur_axes)
    2713            end
    28             set(cur_axes,'XLim',xlimit)
    29             set(cur_axes,'YLim',ylimit)
    30             hfig=hObject; %master figure
    31             AxeData=get(cur_axes,'UserData');
    32             if isfield(AxeData,'ParentRect')% update the position of the parent rectangle representing the field
    33                 hparentrect=AxeData.ParentRect;
    34                 rect([1 2])=[xlimit(1) ylimit(1)];
    35                 rect([3 4])=[xlimit(2)-xlimit(1) ylimit(2)-ylimit(1)];
    36                 set(hparentrect,'Position',rect)
    37             elseif isfield(AxeData,'LimEditBox')&& isequal(AxeData.LimEditBox,1)% update display of the GUI containing the axis (uvmat or view_field)
    38                 hh=guidata(hfig);
    39                 if isfield(hh,'num_MinX')
    40                     set(hh.num_MinX,'String',num2str(xlimit(1)))
    41                     set(hh.num_MaxX,'String',num2str(xlimit(2)))
    42                     set(hh.num_MinY,'String',num2str(ylimit(1)))
    43                     set(hh.num_MaxY,'String',num2str(ylimit(2)))
     14            if ~isempty(cur_axes)
     15                xlimit=get(cur_axes,'XLim');
     16                ylimit=get(cur_axes,'Ylim');
     17                dx=(xlimit(2)-xlimit(1))/10;
     18                dy=(ylimit(2)-ylimit(1))/10;
     19                if isequal(xx,29)%move arrow right
     20                    xlimit=xlimit+dx;
     21                elseif isequal(xx,28)%move arrow left
     22                    xlimit=xlimit-dx;
     23                elseif isequal(xx,30)%move arrow up
     24                    ylimit=ylimit+dy;
     25                elseif isequal(xx,31)%move arrow down
     26                    ylimit=ylimit-dy;
     27                end
     28                set(cur_axes,'XLim',xlimit)
     29                set(cur_axes,'YLim',ylimit)
     30                hfig=hObject; %master figure
     31                AxeData=get(cur_axes,'UserData');
     32                if isfield(AxeData,'ParentRect')% update the position of the parent rectangle representing the field
     33                    hparentrect=AxeData.ParentRect;
     34                    rect([1 2])=[xlimit(1) ylimit(1)];
     35                    rect([3 4])=[xlimit(2)-xlimit(1) ylimit(2)-ylimit(1)];
     36                    set(hparentrect,'Position',rect)
     37                elseif isfield(AxeData,'LimEditBox')&& isequal(AxeData.LimEditBox,1)% update display of the GUI containing the axis (uvmat or view_field)
     38                    hh=guidata(hfig);
     39                    if isfield(hh,'num_MinX')
     40                        set(hh.num_MinX,'String',num2str(xlimit(1)))
     41                        set(hh.num_MaxX,'String',num2str(xlimit(2)))
     42                        set(hh.num_MinY,'String',num2str(ylimit(1)))
     43                        set(hh.num_MaxY,'String',num2str(ylimit(2)))
     44                    end
    4445                end
    4546            end
    46         end
    47 %     case {8, 127} %if the delete or suppr key is pressed, delete the current object
    48 %         currentobject=gco;
    49 %         huvmat=findobj(allchild(0),'tag','uvmat');
    50 %         hlist_object=findobj(huvmat,'Tag','list_object_1');
    51 %         ObjIndex=get(hlist_object,'Value');
    52 %         if ObjIndex>1
    53 %             delete_object(ObjIndex)
    54 %         end
    55 %         if ishandle(currentobject)
    56 %             tag=get(currentobject,'Tag');%tag of the current selected object
    57 %             if isequal(tag,'proj_object')
    58 %                 delete_object(currentobject)
    59 %             end
    60 %         end
    61     case 112%  key 'p'
    62         uvmat('runplus_Callback',hObject,eventdata,handleshaxes)
    63     case 109%  key 'm'
    64         uvmat('runmin_Callback',hObject,eventdata,handleshaxes)
    65     otherwise
    66         set(handleshaxes.run0,'BackgroundColor',[1 0 1])%indicat that Run must be activated (todo: rplace by REFRESH)
     47        case 112%  key 'p'
     48            uvmat('runplus_Callback',hObject,eventdata,handleshaxes)
     49        case 109%  key 'm'
     50            uvmat('runmin_Callback',hObject,eventdata,handleshaxes)
     51        otherwise
     52            switch get(gco,'tag')% tag of the current edit box
     53                case {'RootPath', 'SubDir','RootFile','FileExt','RootPath_1', 'SubDir_1','RootFile_1','FileExt_1'}
     54                    set(handleshaxes.REFRESH,'BackgroundColor',[1 0 1])%indicat that REFRESH must be activated (intyroduce the whole series)
     55                otherwise
     56                    set(handleshaxes.run0,'BackgroundColor',[1 0 1])%indicat that run0 must be activated
     57            end
     58    end
    6759end
    68 end
  • trunk/src/mouse_down.m

    r691 r710  
    150150                hhchildren=get(hchild,'Children');%handles of all objects in the selected panel
    151151                check_visible=strcmp(get(hhchildren,'Visible'),'on');%=1 if visible='on', =0 otherwise
    152                 hhchildren=hhchildren(check_visible); %keep only the visible children               
     152                hhchildren=hhchildren(check_visible); %keep only the visible children
    153153                PosChildren=get(hhchildren,'Position');
    154154                PosLength=cellfun('length',PosChildren);
     
    165165                        display_str=get(hhchild,'TooltipString');
    166166                        msgbox_uvmat(['uicontrol: ' get(hhchild,'Tag')],display_str,get(hhchild,'String'),msg_pos);
     167                    else
     168                        set(hObject,'CurrentObject',hhchild)
    167169                    end
    168170                end
    169             end           
     171            end
    170172    end
    171173end
     
    187189if strcmp(get(hObject,'SelectionType'),'alt') && strcmp(htype,'axes') && ~test_edit && ~test_create
    188190    set(0,'Unit','pixels')
    189     GUISize=get(0,'ScreenSize');% get the size of the screen, to put the fig on the upper right   
     191    %GUISize=get(0,'ScreenSize');% get the size of the screen, to put the fig on the upper right   
    190192    Width=300;% fig width in points (1/72 inch)
    191193    Height=200;
    192194    Left=GUI_pos(1)+GUI_pos(3)-Width; %right edge close to the right, with margin=40
    193195    Bottom=GUI_pos(2)+GUI_pos(4)-Height; %put fig at top right
    194     hfig_text=figure('Name','text_display','MenuBar','none','NumberTitle','off','Position',[Left,Bottom,Width,Height]);
     196   % hfig_text=figure('Name','text_display','MenuBar','none','NumberTitle','off','Position',[Left,Bottom,Width,Height]);
    195197    AxeData.htext_display=uicontrol('Style','edit','Units','normalized', 'Position', [0.05 0.05 0.9 0.9],'Max',2,'BackgroundColor',[1 1 1],...
    196198        'FontUnits','points','FontSize',14);
  • trunk/src/series.m

    r709 r710  
    123123set(hObject,'WindowButtonDownFcn',{'mouse_down'})%allows mouse action with right button (zoom for uicontrol display)
    124124set(handles.InputTable,'KeyPressFcn',{@key_press_fcn,handles})%set keyboard action function (allow action on uvmat when set_object is in front)
     125set(hObject,'DeleteFcn',{@closefcn})%
    125126
    126127% check default input data
     
    266267function varargout = series_OutputFcn(hObject, eventdata, handles)
    267268%------------------------------------------------------------------------
    268 % varargout  cell array for returning output args (see VARARGOUT);
    269 % hObject    handle to figure
    270 % eventdata  reserved - to be defined in a future version of MATLAB
    271 % handles    structure with handles and user data (see GUIDATA)
    272 % Get default command line output from handles structure
    273269varargout{1} = handles.output;
     270
     271%------------------------------------------------------------------------
     272% --- executed when closing uvmat: delete or desactivate the associated figures if exist
     273function closefcn(gcbo,eventdata)
     274%------------------------------------------------------------------------
     275
     276% delete set_object_series if detected
     277hh=findobj(allchild(0),'name','view_object_series');
     278if ~isempty(hh)
     279    delete(hh)
     280end
     281hh=findobj(allchild(0),'name','edit_object_series');
     282if ~isempty(hh)
     283    delete(hh)
     284end
     285
     286%delete the bowser if detected
     287hh=findobj(allchild(0),'tag','browser');
     288if ~isempty(hh)
     289    delete(hh)
     290end
     291
    274292
    275293%------------------------------------------------------------------------
     
    474492function InputTable_CellEditCallback(hObject, eventdata, handles)
    475493%------------------------------------------------------------------------
    476 set(handles.REFRESH,'Visible','on')
     494set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH button to magenta color to indicate that input refresh is needed
    477495% set(handles.REFRESH_title,'Visible','on')
    478496iview=eventdata.Indices(1);
     
    516534%------------------------------------------------------------------------
    517535InputTable=get(handles.InputTable,'Data');
    518 % view_set=get(handles.REFRESH,'UserData');% list of lines to refresh
    519536set(handles.REFRESH,'BackgroundColor',[1 1 0])% set REFRESH  button to yellow color (indicate activation)
    520537drawnow
     
    546563    end
    547564end
    548 set(handles.REFRESH,'Visible','off')
    549 %set(handles.REFRESH_title,'Visible','off')
     565set(handles.REFRESH,'BackgroundColor',[1 0 0])% set REFRESH  button to red color (indicate activation finished)
    550566
    551567%------------------------------------------------------------------------
     
    21632179set(handles.DeleteObject,'Visible',ProjObjectVisible)
    21642180set(handles.ViewObject,'Visible',ProjObjectVisible)
    2165 
     2181set(handles.EditObject,'Visible',ProjObjectVisible)
    21662182
    21672183%% Visibility of mask input
     
    23962412%------------------------------------------------------------------------
    23972413% --- Executes on button press in CheckObject.
    2398 %------------------------------------------------------------------------
    23992414function CheckObject_Callback(hObject, eventdata, handles)
    2400 
     2415%------------------------------------------------------------------------
    24012416hset_object=findobj(allchild(0),'tag','set_object');%find the set_object interface handle
    24022417if get(handles.CheckObject,'Value')
     
    24162431            end
    24172432            fileinput=uigetfile_uvmat('pick a xml object file (or use uvmat to create it)',defaultname,'.xml');
    2418 %             [FileName, PathName] = uigetfile( ...
    2419 %                 {'*.xml;*.mat', ' (*.xml,*.mat)';
    2420 %                 '*.xml',  '.xml files '; ...
    2421 %                 '*.mat',  '.mat matlab files '}, ...
    2422 %                 'Pick an xml object file (or use uvmat to create it)',defaultname);
    2423 %             fileinput=[PathName FileName];%complete file name
    2424 %             sizf=size(fileinput);
    2425             if isempty(fileinput),return;end
     2433            if isempty(fileinput)% exit if no object file is selected
     2434                set(handles.CheckObject,'Value',0)
     2435                return
     2436            end
    24262437            %read the file
    24272438            data=xml2struct(fileinput);
    24282439            if ~isfield(data,'Type')
    24292440                msgbox_uvmat('ERROR',[fileinput ' is not an object xml file'])
     2441                set(handles.CheckObject,'Value',0)
    24302442                return
    24312443            end
     
    24502462    set(handles.ViewObject,'Visible','off');
    24512463    if ~ishandle(hset_object)
    2452     set(handles.ViewObject,'Value',0);
     2464        set(handles.ViewObject,'Value',0);
    24532465    end
    24542466    set(handles.ProjObject,'Visible','off');
     
    24712483%------------------------------------------------------------------------
    24722484% --- Executes on button press in EditObject.
    2473 %------------------------------------------------------------------------
    24742485function EditObject_Callback(hObject, eventdata, handles)
    2475 
     2486%------------------------------------------------------------------------
    24762487if get(handles.EditObject,'Value')
    24772488    set(handles.ViewObject,'Value',0)
     
    24892500%------------------------------------------------------------------------
    24902501% --- Executes on button press in DeleteObject.
    2491 %------------------------------------------------------------------------
    24922502function DeleteObject_Callback(hObject, eventdata, handles)
    2493 
    2494 % if get(handles.DeleteObject,'Value')
    2495         SeriesData=get(handles.series,'UserData');
    2496     SeriesData.ProjObject=[];
    2497     set(handles.series,'UserData',SeriesData)
    2498     set(handles.ProjObject,'String','')
    2499     set(handles.CheckObject,'Value',0)
    2500     set(handles.ViewObject,'Visible','off')
    2501     set(handles.EditObject,'Visible','off')
    2502     hset_object=findobj(allchild(0),'Tag','set_object');
    2503     if ~isempty(hset_object)
    2504         delete(hset_object)
    2505     end
    2506     set(handles.DeleteObject,'Visible','off')
    2507 %     set(handles.DeleteObject,'Value',0)
    2508 % end
     2503%------------------------------------------------------------------------
     2504SeriesData=get(handles.series,'UserData');
     2505SeriesData.ProjObject=[];
     2506set(handles.series,'UserData',SeriesData)
     2507set(handles.ProjObject,'String','')
     2508set(handles.ProjObject,'Visible','off')
     2509set(handles.CheckObject,'Value',0)
     2510set(handles.ViewObject,'Visible','off')
     2511set(handles.EditObject,'Visible','off')
     2512hset_object=findobj(allchild(0),'Tag','set_object');
     2513if ~isempty(hset_object)
     2514    delete(hset_object)
     2515end
     2516set(handles.DeleteObject,'Visible','off')
    25092517
    25102518%------------------------------------------------------------------------
     
    26762684
    26772685%------------------------------------------------------------------------
    2678 % --- fct activated by the upper bar menu InportConfig
     2686% --- fct activated by the upper bar menu InportConfig: import
     2687%     menu settings from an xml file (stored in /0_XML for each run)
    26792688%------------------------------------------------------------------------
    26802689function MenuImportConfig_Callback(hObject, eventdata, handles)
     
    26822691InputTable=get(handles.InputTable,'Data');
    26832692filexml=uigetfile_uvmat('pick a xml parameter file',InputTable{1,1},'.xml');% get the xml file containing processing parameters
    2684 if ~isempty(filexml)%abandon if no file is introduced by the browser
    2685     Param=xml2struct(filexml);
    2686     % stop current Action if button RUN has been activated
     2693%proceed only if a file has been introduced by the browser
     2694if ~isempty(filexml)
     2695    Param=xml2struct(filexml);% read the input xml file as a Matlab structure
     2696    % ask to stop current Action if button RUN is in action (another process is already running)
    26872697    if isequal(get(handles.RUN,'Value'),1)
    26882698        answer= msgbox_uvmat('INPUT_Y-N','stop current Action process?');
     
    26932703        end
    26942704    end
    2695     Param.Action.RUN=0; %deactivate the RUN button
     2705    Param.Action.RUN=0; %desactivate the input RUN=1
    26962706    fill_GUI(Param,handles.series)% fill the elements of the GUI series with the input parameters
    2697     REFRESH_Callback([],[],handles)% refresh data relative to the input files
     2707    if isfield(Param,'CheckObject') && isequal(Param.CheckObject,1)
     2708        set(handles.ProjObject,'String',Param.ProjObject.Name)
     2709        set(handles.ViewObject,'Visible','on')
     2710        set(handles.EditObject,'Visible','on')
     2711        set(handles.DeleteObject,'Visible','on')
     2712    else     
     2713        set(handles.ProjObject,'String','')
     2714        set(handles.ProjObject,'Visible','off')
     2715        set(handles.ViewObject,'Visible','off')
     2716        set(handles.EditObject,'Visible','off')
     2717        set(handles.DeleteObject,'Visible','off')     
     2718    end     
     2719%     set(handles.REFRESH,'Visible','on')
     2720    set(handles.REFRESH,'BackgroundColor',[1 0 1]); %paint REFRESH button in magenta to indicate that it should be activated
     2721  %  REFRESH_Callback([],[],handles)% refresh data relative to the input files
    26982722    SeriesData=get(handles.series,'UserData');
    26992723    if isfield(Param,'ActionInput')%  introduce  parameters specific to an Action fct, for instance PIV parameters
     
    27082732    end
    27092733    set(handles.series,'UserData',SeriesData)
    2710     %ActionName_Callback([],[],handles)
    27112734end
    27122735
     
    29883011function series_WindowButtonMotionFcn(hObject, eventdata, handles)
    29893012set(hObject,'Pointer','arrow');
    2990 
    2991 
    2992 
    2993 function TimeName_Callback(hObject, eventdata, handles)
    2994 % hObject    handle to TimeName (see GCBO)
    2995 % eventdata  reserved - to be defined in a future version of MATLAB
    2996 % handles    structure with handles and user data (see GUIDATA)
    2997 
    2998 % Hints: get(hObject,'String') returns contents of TimeName as text
    2999 %        str2double(get(hObject,'String')) returns contents of TimeName as a double
    3000 
    3001 
    3002 % --- Executes during object creation, after setting all properties.
    3003 function TimeName_CreateFcn(hObject, eventdata, handles)
    3004 % hObject    handle to TimeName (see GCBO)
    3005 % eventdata  reserved - to be defined in a future version of MATLAB
    3006 % handles    empty - handles not created until after all CreateFcns called
    3007 
    3008 % Hint: edit controls usually have a white background on Windows.
    3009 %       See ISPC and COMPUTER.
    3010 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    3011     set(hObject,'BackgroundColor','white');
    3012 end
  • trunk/src/series/civ_input.m

    r707 r710  
    103103        if ~strcmp(Param.Action.ActionName,'civ_series')
    104104            msgbox_uvmat('ERROR','bad input data file: open an image or a nc file from civ_series')
    105             return
     105            %return
    106106        end
    107107        NomTypeNc=NomTypeInput;
     
    109109        if isempty(regexp(NomTypeInput,'[ab|AB|-]', 'once'))
    110110            set(handles.ListCompareMode,'Value',2) %mode displacement advised if the nomencalture does not involve index pairs
    111             set(handles.RootFile_1,'Visible','On');
     111%             set(handles.RootFile_1,'Visible','On');
    112112        else
    113113            set(handles.ListCompareMode,'Value',1)
    114             %            set(handles.RootFile_1,'Visible','Off');
    115114        end
    116115        imageinput='';
  • trunk/src/uvmat.m

    r709 r710  
    210210set(hObject,'DeleteFcn',{@closefcn})%
    211211set(hObject,'ResizeFcn',{@ResizeFcn,handles})%
     212% set(handles.RootPath,'ButtonDownFcn',{'@mouse_down_control'})%set mouse click action function
    212213
    213214%% initialisation
     
    319320% --- Outputs from this function are returned to the command menuline.
    320321function varargout = uvmat_OutputFcn(hObject, eventdata, handles)
     322%------------------------------------------------------------------------   
    321323varargout{1} = handles.output;% the only output argument is the handle to the GUI figure
    322324
     
    325327function closefcn(gcbo,eventdata)
    326328%------------------------------------------------------------------------
     329% delete GUI 'view_field' if detected
    327330hh=findobj(allchild(0),'tag','view_field');
    328331if ~isempty(hh)
    329332    delete(hh)
    330333end
     334% delete GUI 'geometry_calib' if detected
    331335hh=findobj(allchild(0),'tag','geometry_calib');
    332336if ~isempty(hh)
    333337    delete(hh)
    334338end
     339% desable set_object editing action if detected
    335340hh=findobj(allchild(0),'tag','set_object');
    336341if ~isempty(hh)
    337342    hhh=findobj(hh,'tag','PLOT');
    338343    set(hhh,'enable','off')
     344end
     345%delete the bowser if detected
     346hh=findobj(allchild(0),'tag','browser');
     347if ~isempty(hh)
     348    delete(hh)
    339349end
    340350
     
    450460else
    451461
    452 %% display the selected field and related information
    453 if ~isempty(fileinput)
    454     set(handles.SubField,'Value',0)
    455     desable_subfield(handles)
    456     display_file_name(handles,fileinput)
    457 end
     462    %% display the selected field and related information
     463    if ~isempty(fileinput)
     464        set(handles.SubField,'Value',0)
     465        desable_subfield(handles)
     466        display_file_name(handles,fileinput)
     467    end
    458468end
    459469
     
    564574
    565575%------------------------------------------------------------------------
    566 % --- Called by action in RootPath edit box
    567 function RootPath_Callback(hObject,eventdata,handles)
    568 %------------------------------------------------------------------------
    569 % read the current input file name:
    570 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);
    571 if ~exist(fullfile(RootPath,SubDir),'dir')
    572     msgbox_uvmat('ERROR',['directory ' fullfile(RootPath,SubDir) ' does not exist'])
    573     return
    574 end
    575 % detect the file type, get the movie object if relevant, and look for the corresponding file series:
    576 [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileType,FileInfo,MovieObject]=find_file_series(fullfile(RootPath,SubDir),[RootFile FileIndices FileExt]);
    577 % initiate the input file series and refresh the current field view:
    578 update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,MovieObject,1);
    579 
    580 %-----------------------------------------------------------------------
    581 % --- Called by action in RootPath_1 edit box
    582 function RootPath_1_Callback(hObject,eventdata,handles)
    583 % -----------------------------------------------------------------------
    584 % update_rootinfo_1(hObject,eventdata,handles)
    585 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes_1(handles);
    586 if ~exist(fullfile(RootPath,SubDir),'dir')
    587     msgbox_uvmat('ERROR',['directory ' fullfile(RootPath,SubDir) ' does not exist'])
    588     return
    589 end
    590 % detect the file type, get the movie object if relevant, and look for the corresponding file series:
    591 [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileType,MovieObject]=find_file_series(fullfile(RootPath,SubDir),[RootFile FileIndices FileExt]);
    592 % initiate the input file series and refresh the current field view:
    593 update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,MovieObject,2);
    594 
    595 %------------------------------------------------------------------------
    596 % --- Called by action in RootFile edit box
    597 function SubDir_Callback(hObject, eventdata, handles)
    598 %------------------------------------------------------------------------
    599 %refresh the menu of input fieldname
    600 FieldName_Callback(hObject, eventdata, handles);
    601 % refresh the current field view
    602 run0_Callback(hObject, eventdata, handles);
    603 
    604 %------------------------------------------------------------------------
    605 % --- Called by action in RootFile edit box
    606 function RootFile_Callback(hObject, eventdata, handles)
    607 %------------------------------------------------------------------------
    608 RootPath_Callback(hObject,eventdata,handles)
    609 
    610 %-----------------------------------------------------------------------
    611 % --- Called by action in RootFile_1 edit box
    612 function RootFile_1_Callback(hObject, eventdata, handles)
    613 % -----------------------------------------------------------------------
    614 RootPath_1_Callback(hObject,eventdata,handles)
    615 
    616 %------------------------------------------------------------------------
    617576% --- Called by action in FileIndex edit box
    618577function FileIndex_Callback(hObject, eventdata, handles)
     
    624583set(handles.j2,'String',num2str(j2));
    625584
    626 % refresh the current field view
    627 run0_Callback(hObject, eventdata, handles)
    628 
    629 %------------------------------------------------------------------------
    630 % --- Called by action in FileIndex_1 edit box
    631 function FileIndex_1_Callback(hObject, eventdata, handles)
    632 %------------------------------------------------------------------------
    633 run0_Callback(hObject, eventdata, handles)
    634585
    635586%------------------------------------------------------------------------
     
    658609% refresh the current settings and refresh the field view
    659610RootPath_1_Callback(hObject,eventdata,handles)
     611
     612%------------------------------------------------------------------------
     613% --- Executes on button press in REFRESH.
     614function REFRESH_Callback(hObject, eventdata, handles)
     615%------------------------------------------------------------------------   
     616set(handles.REFRESH,'BackgroundColor',[1 1 0])% set button color to yellow to indicate that refresh is under action
     617% read the current input file name:
     618[RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);
     619% if ~exist(fullfile(RootPath,SubDir),'dir')
     620%     msgbox_uvmat('ERROR',['directory ' fullfile(RootPath,SubDir) ' does not exist'])
     621%     return
     622% end
     623% detect the file type, get the movie object if relevant, and look for the corresponding file series:
     624[RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileType,FileInfo,MovieObject]=find_file_series(fullfile(RootPath,SubDir),[RootFile FileIndices FileExt]);
     625% initiate the input file series and refresh the current field view:
     626errormsg=update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,MovieObject,1);
     627% refresh the second series if selected
     628if get(handles.SubField,'Value')
     629    [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes_1(handles);
     630    if ~exist(fullfile(RootPath,SubDir),'dir')
     631        msgbox_uvmat('ERROR',['directory ' fullfile(RootPath,SubDir) ' does not exist'])
     632        return
     633    end
     634    % detect the file type, get the movie object if relevant, and look for the corresponding file series:
     635    [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileType,MovieObject]=find_file_series(fullfile(RootPath,SubDir),[RootFile FileIndices FileExt]);
     636    % initiate the input file series and refresh the current field view:
     637    errormsg=update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,MovieObject,2);
     638end
     639
     640if isempty(errormsg)
     641set(handles.REFRESH,'BackgroundColor',[1 0 0])% set button color to red to indicate that refresh has been updated
     642else
     643    set(handles.REFRESH,'BackgroundColor',[1 0 1])% keep button color magenta, input not succesfull
     644end
    660645
    661646%------------------------------------------------------------------------
     
    696681    set(handles.TimeValue_1,'Visible','on')
    697682end
    698 set(handles_RootPath,'BackgroundColor',[1 1 0])% paint edit box to yellow to visualise root file input
     683set(handles.REFRESH,'BackgroundColor',[1 1 0])% paint REFRESH button to yellow to visualise root file input
    699684set(handles.uvmat,'Pointer','watch') % set the mouse pointer to 'watch'
    700685drawnow
     
    840825end
    841826
    842 set(handles_RootPath,'BackgroundColor',[1 1 1])% paint back edit box to white to visualise end of root file input
     827set(handles.REFRESH,'BackgroundColor',[1 0 0])% paint back button to red to indicate update is finished
    843828set(handles.uvmat,'Pointer','arrow')% set back the mouse pointer to arrow
    844829
     
    847832% --- Update information about a new field series (indices to scan, timing,
    848833%     calibration from an xml file, then refresh current plots
    849 
    850 function update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,VideoObject,index)
    851 %------------------------------------------------------------------------
     834function errormsg=update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,VideoObject,index)
     835%------------------------------------------------------------------------
     836errormsg=''; %default error msg
    852837%% define the relevant handles depending on the index (1=first file series, 2= second file series)
    853838if ~exist('index','var')
     
    878863FileBase=fullfile(RootPath,RootFile);
    879864if ~exist(FileName,'file')
    880    msgbox_uvmat('ERROR',['input file ' FileName ' not found']);
     865    errormsg=['input file ' FileName ' not found'];
     866   msgbox_uvmat('ERROR',errormsg);   
    881867    return
    882868end
     
    930916NbSlice=1;%default
    931917ImaDoc_str='';
    932 set(handles.RootPath,'BackgroundColor',[1 1 1])
     918set(handles.REFRESH,'BackgroundColor',[1 1 0])
    933919if ~isempty(XmlFileName)
    934920    set(handles.view_xml,'Visible','on')
     
    13701356    end
    13711357    Mask.Path=MaskPath;
    1372     Mask.File=MaskFile{1};
     1358    if isempty(MaskFile)
     1359        Mask.File='';
     1360    else
     1361        Mask.File=MaskFile{1};
     1362    end
    13731363    Mask.Ext=MaskExt;
    13741364    Mask.NomType=MaskNomType;
     
    19801970set(handles.j2,'BackgroundColor',[1 1 1])% mark the edit box in white to indicate its use as input
    19811971set(handles.FileIndex,'BackgroundColor',[1 1 1])% mark the edit box in white to indicate its use as input
    1982 while get(handles.speed,'Value')~=0 && isequal(get(handles.movie_pair,'BusyAction'),'queue')%isequal(get(handles.run0,'BusyAction'),'queue'); % enable STOP command
     1972while get(handles.speed,'Value')~=0 && isequal(get(handles.movie_pair,'BusyAction'),'queue') % enable STOP command
    19831973    % read and plot the series of images in non erase mode
    19841974    set(hima,'CData',Field_b.A);
     
    48414831[RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles);
    48424832FileName=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt];
    4843 set(handles.view_xml,'Backgroundcolor',[1 1 0])%indicate the reading of the current xml file by geometry_calib
    4844 % pos_uvmat=get(handles.uvmat,'Position');
    4845 % pos_cal(1)=pos_uvmat(1)+UvData.OpenParam.PosGeometryCalib(1)*pos_uvmat(3);
    4846 % pos_cal(2)=pos_uvmat(2)+UvData.OpenParam.PosGeometryCalib(2)*pos_uvmat(4);
    4847 % pos_cal(3:4)=UvData.OpenParam.PosGeometryCalib(3:4).* pos_uvmat(3:4);
     4833set(handles.view_xml,'BackgroundColor',[1 1 0])%indicate the reading of the current xml file by geometry_calib
    48484834geometry_calib(FileName);% call the geometry_calib interface   
    4849 set(handles.view_xml,'Backgroundcolor',[1 1 1])%indicate the end of reading of the current xml file by geometry_calib
     4835set(handles.view_xml,'BackgroundColor',[1 1 1])%indicate the end of reading of the current xml file by geometry_calib
    48504836set(handles.MenuCalib,'checked','on')% indicate that MenuCalib is activated, test used by mouse action
    48514837
     
    48794865    ObjectData=UvData.ProjObject(val);
    48804866    for iobj=1:length(ObjectData)
    4881 %         if isfield(ObjectData{iobj},'Coord')
    48824867            xA(iobj)=ObjectData{iobj}.Coord(1,1);
    48834868            yA(iobj)=ObjectData{iobj}.Coord(1,2);
    48844869            xB(iobj)=ObjectData{iobj}.Coord(2,1);
    48854870            yB(iobj)=ObjectData{iobj}.Coord(2,2);
    4886 %         end
    48874871    end
    48884872end
     
    50655049            end
    50665050        end
    5067 %     end
    50685051    %mask name
    50695052    RootPath=get(handles.RootPath,'String');
     
    50765059    masknumber=num2str(length(list));
    50775060    maskindex=get(handles.masklevel,'Value');
    5078    % mask_name=fullfile_uvmat(RootPath,'',[RootFile '_' masknumber 'mask'],'.png','_1',maskindex);
    50795061    mask_name=fullfile_uvmat(RootPath,[SubDir '.mask'],'mask','.png','_1',maskindex);
    50805062    imflag=uint8(255*(0.392+0.608*flag));% =100 for flag=0 (vectors not computed when 20<imflag<200)
     
    51105092set(handles.edit_vect,'Value',0)
    51115093edit_vect_Callback(hObject, eventdata, handles)
    5112 % set(handles.CheckEditObject,'BackgroundColor',[0.7 0.7 0.7])
    51135094set(handles.ListObject,'Value',1)     
    51145095
Note: See TracChangeset for help on using the changeset viewer.