Changeset 851 for trunk/src


Ignore:
Timestamp:
Jan 19, 2015, 9:29:28 PM (10 years ago)
Author:
sommeria
Message:

various

Location:
trunk/src
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/geometry_calib.m

    r847 r851  
    12731273iline=str2num(get(handles.CoordLine,'String'));
    12741274xx=double(get(handles.geometry_calib,'CurrentCharacter'));%get the keyboard character
    1275 if ismember(xx,[28 29 30 31])% directional arrow 
     1275if ismember(xx,[28 29 30 31])% directional arrow
    12761276    Coord=get(handles.ListCoord,'Data');
    12771277    switch xx
     
    12871287else
    12881288    set(handles.APPLY,'BackgroundColor',[1 0 1])% paint APPLY in magenta to indicate that the table content has be modified
    1289 end
    1290 
     1289    if ismember(xx,[127 31])% delete, or downward
     1290        Coord=get(handles.ListCoord,'Data');
     1291        iline=str2double(get(handles.CoordLine,'String'));
     1292        if isequal(xx, 31)
     1293            if isequal(iline,size(Coord,1))% arrow downward
     1294                Coord=[Coord;zeros(1,size(Coord,2))];
     1295            end
     1296        else
     1297            Coord(iline,:)=[];% suppress the current line
     1298        end
     1299        set(handles.ListCoord,'Data',Coord);
     1300    end
     1301end
    12911302
    12921303%------------------------------------------------------------------------
  • trunk/src/msgbox_uvmat.m

    r847 r851  
    88%
    99%INPUT:
    10 % title: string indicating the type of message box:
    11 %          title= 'INPUT_TXT','INPUT_Y-N','INPUT_MENU','ERROR', 'WARNING','CONFIMATION','WAITING...',default = 'INPUT_TXT' (the title is displayed in the upper bar of the fig).
    12 %          if title='INPUT_TXT', input data is asked in an edit box
    13 %          if title='CONFIMATION'', 'ERROR', 'WARNING','RULER' the figure remains  opened until a button 'OK' is pressed
    14 %             title='RULER' is used for display of length and angle from the ruler tool.
    15 %          if title='INPUT_Y-N', an answer Yes/No is requested
    16 %          if title='WAITING...' the figure remains open until the program deletes it
     10% title: string indicating the type of message box (the title is displayed in the upper bar of the fig):
     11%                ='INPUT_TXT'(default), input data is asked in an edit box
     12%                ='CONFIMATION'', 'ERROR', 'WARNING','RULER' the figure remains  opened until a button 'OK' is pressed
     13%                ='RULER' is used for display of length and angle from the ruler tool.
     14%                ='INPUT_Y-N', an answer Yes/No is requested
     15%                ='INPUT_Y-N-Cancel'
     16%                ='WAITING...' the figure remains open until the program deletes it
    1717% display: displayed text
    1818% default_answer: default answer in the edit box (only used with title='INPUT_TXT')
     
    108108            testCancel=0; %no cancel button
    109109            testNo=1; % button No activated
     110        case 'INPUT_Y-N-Cancel'
     111            icontype='quest';
     112            testCancel=1; % cancel button introduced
     113            testNo=1; % button No activated
    110114        case 'RULER'
    111115            icontype='';
  • trunk/src/read_civdata.m

    r822 r851  
    209209end
    210210if isempty(vel_type)||strcmp(vel_type,'*')
     211    vel_type='filter2';% case CivStage >=6
    211212    switch CivStage
    212         case {6} %filter2 available
    213             vel_type='filter2';
    214213        case {4,5}% civ2 available but not filter2
    215214            if strcmp(ProjModeRequest,'derivatives')% derivatives needed
  • trunk/src/series.m

    r845 r851  
    132132ActionList={'check_data_files';'aver_stat';'time_series';'civ_series';'merge_proj'};% WARNING: fits with nb_builtin_ACTION=4 in ActionName_callback
    133133NbBuiltinAction=numel(ActionList);
     134set(handles.Action,'UserData',NbBuiltinAction)
    134135[path_series,name,ext]=fileparts(which('series'));% path to the GUI series
    135136path_series_fct=fullfile(path_series,'series');%path of the functions in subdirectroy 'series'
    136137ActionExtList={'.m';'.sh'};% default choice of extensions (Matlab fct .m or compiled version .sh
    137 ActionPathList=cell(NbBuiltinAction,numel(ActionExtList));%initiate the cell matrix of Action fct paths
     138ActionPathList=cell(NbBuiltinAction,1);%initiate the cell matrix of Action fct paths
    138139ActionPathList(:)={path_series_fct}; %set the default path to series fcts to all list members
    139140RunModeList={'local';'background'};% default choice of extensions (Matlab fct .m or compiled version .sh)
     
    148149set(handles.RunMode,'String',RunModeList)
    149150
    150 %% list of builtin transform functions in the mebu TransformName
     151%% list of builtin transform functions in the menu TransformName
    151152TransformList={'';'sub_field';'phys';'phys_polar'};% WARNING: must fit with the corresponding menu in uvmat and nb_builtin_transform=4 in  TransformName_callback
    152153NbBuiltinTransform=numel(TransformList);
     
    167168        end
    168169    end
    169     %get the list of previous camapigns in the upper bar menu Open campaign
     170    %get the list of previous campaigns in the upper bar menu Open campaign
    170171    if isfield(h,'MenuCampaign')
    171172        for ifile=1:min(length(h.MenuCampaign),5)
     
    526527    iline=eventdata.Indices(1);
    527528end
    528 set(handles.InputTable,'UserData',iline);
     529set(handles.InputLine,'String',num2str(iline));
     530% set(handles.InputTable,'UserData',iline);
    529531
    530532%------------------------------------------------------------------------
     
    535537xx=double(get(handles.series,'CurrentCharacter')); %get the keyboard character
    536538if ~isempty(xx)
    537 switch xx
    538     case 31 %downward arrow
    539         InputTable=get(handles.InputTable,'Data');
    540         iline=get(handles.InputTable,'UserData');
    541         if isequal(iline,size(InputTable,1))% arrow downward
    542             InputTable=[InputTable;InputTable(iline,:)];% create a new line as a copy of the last one
    543             set(handles.InputTable,'Data',InputTable);
    544         end
    545     case 127  %key 'Suppress'
    546          InputTable=get(handles.InputTable,'Data');
    547         iline=get(handles.InputTable,'UserData');
    548         if iline>1
    549             InputTable(iline,:)=[];% suppress the current line if not the first
    550             set(handles.InputTable,'Data',InputTable);
    551         end
    552 end
     539    switch xx
     540        case 31 %downward arrow
     541            InputTable=get(handles.InputTable,'Data');
     542            iline=str2double(get(handles.InputLine,'String'));
     543            if isequal(iline,size(InputTable,1))% arrow downward
     544                InputTable=[InputTable;InputTable(iline,:)];% create a new line as a copy of the last one
     545                set(handles.InputTable,'Data',InputTable);
     546            end
     547        case 127  %key 'Suppress'
     548            ClearLine_Callback(hObject, eventdata, handles)
     549    end
    553550end
    554551
     
    609606%------------------------------------------------------------------------
    610607% --- Function called when a new file is opened, either by series_OpeningFcn or by the browser
    611 function errormsg=display_file_name(handles,Param,iview)
    612 %------------------------------------------------------------------------ 
    613 %
     608%------------------------------------------------------------------------
    614609% INPUT:
    615610% handles: handles of elements in the GUI
     
    618613%       or 'one': refresh the list
    619614%         'append': add a new line to the input table
     615function errormsg=display_file_name(handles,Param,iview)
     616 
    620617set(handles.REFRESH,'BackgroundColor',[1 1 0])% set REFRESH  button to yellow color (indicate activation)
    621618drawnow
     
    683680    iview=size(InputTable,1)+1;% the next line in InputTable becomes the current line
    684681    InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}];
    685 %     SeriesData.ListViewMenu(iview)=zeros(1,nbview)
    686682elseif strcmp(iview,'one') % refresh the list of  input  file series
    687683    iview=1; %the first line in InputTable becomes the current line
     
    702698    SeriesData.FileInfo={};
    703699    SeriesData.Time={};
     700end
     701if iview >1
     702    set(handles.InputLine,'String',num2str(iview))
    704703end
    705704set(handles.InputTable,'Data',InputTable)
     
    14871486    check_create=1; %need to create the result directory by default
    14881487    while detect
    1489         answer=msgbox_uvmat('INPUT_Y-N',['use existing ouput directory: ' fullfile(Param.InputTable{1,1},SubDirOutNew) ', possibly delete previous data']);
     1488        answer=msgbox_uvmat('INPUT_Y-N-Cancel',['use existing ouput directory: ' fullfile(Param.InputTable{1,1},SubDirOutNew) ', possibly delete previous data']);
    14901489        if strcmp(answer,'Cancel')
    14911490            set(handles.RUN,'backgroundcolor',[1 0 0])
     
    18181817    Param=rmfield(Param,'Pairs'); %info Pairs not needed for output
    18191818end
     1819Param.IndexRange.TimeSource=Param.IndexRange.TimeTable{end,1};
    18201820Param.IndexRange=rmfield(Param.IndexRange,'TimeTable');
    18211821empty_line=false(size(Param.InputTable,1),1);
     
    18461846drawnow
    18471847
     1848%% check whether the input file(s) need to be refreshed
     1849% SeriesData=get(handles.series,'UserData');%hidden parameters
     1850% if ~isfield(SeriesData,'i1_series')
     1851%     msgbox_uvmat('ERROR','The input field series needs to be refreshed: press REFRESH');
     1852%     return
     1853% end
     1854
    18481855%% get Action name and path
    1849 nb_builtin_ACTION=4; %nbre of functions initially proposed in the menu ActionName (as defined in the Opening fct of series)
     1856NbBuiltinAction=get(handles.Action,'UserData'); %nbre of functions initially proposed in the menu ActionName (as defined in the Opening fct of series)
    18501857ActionList=get(handles.ActionName,'String');% list menu fields
    18511858ActionIndex=get(handles.ActionName,'Value');
     
    18701877        return
    18711878    end
    1872     [ActionPath,ActionName,ActionExt]=fileparts(FileName);
     1879    [tild,ActionName,ActionExt]=fileparts(FileName);
    18731880   
    18741881    % insert the choice in the menu ActionName
    18751882    ActionIndex=find(strcmp(ActionName,ActionList),1);% look for the selected function in the menu Action
    1876     if isempty(ActionIndex)%the input string does not exist in the menu
     1883    PathName=regexprep(PathName,'/$','');
     1884    if ~isempty(ActionIndex) && ~strcmp(ActionPathList{ActionIndex},PathName)%compare the path to the existing fct
     1885        ActionIndex=[]; % the selected path is different than the recorded one
     1886    end
     1887    if isempty(ActionIndex)%the qselected fct (with selected path) does not exist in the menu
    18771888        ActionIndex= length(ActionList);
    18781889        ActionList=[ActionList(1:end-1);{ActionName};ActionList(end)];% the selected function is appended in the menu, before the last item 'more...'
    1879         set(handles.ActionName,'String',ActionList)
     1890         ActionPathList=[ActionPathList; PathName];
    18801891    end
    18811892   
     
    18851896    if isempty(ActionExtIndex)
    18861897        set(handles.ActionExt,'String',[ActionExtList;{ActionExt}])
    1887         ActionExtIndex=numel(ActionExtList)+1;
    1888         ActionPathNew=cell(size(ActionPathList,1),1);%new column of ActionPath
    1889         ActionPathList=[ActionPathList ActionPathNew];
    1890     end
    1891     set(handles.ActionName,'UserData',ActionPathList);
     1898    end
    18921899
    18931900    % remove old Action options in the menu (keeping a menu length <nb_builtin_ACTION+5)
    1894     if length(ActionList)>nb_builtin_ACTION+5; %nb_builtin=nbre of functions always remaining in the initial menu
    1895         nbremove=length(ActionList)-nb_builtin_ACTION-5;
    1896         ActionList(nb_builtin_ACTION+1:end-5)=[];
    1897         ActionPathList(nb_builtin_ACTION+1:end-4,:)=[];
     1901    if length(ActionList)>NbBuiltinAction+5; %nb_builtin_ACTION=nbre of functions always remaining in the initial menu
     1902        nbremove=length(ActionList)-NbBuiltinAction-5;
     1903        ActionList(NbBuiltinAction+1:end-5)=[];
     1904        ActionPathList(NbBuiltinAction+1:end-4,:)=[];
    18981905        ActionIndex=ActionIndex-nbremove;
    18991906    end
     
    19021909    set(handles.ActionName,'Value',ActionIndex)
    19031910    set(handles.ActionName,'String',ActionList)
     1911       set(handles.ActionName,'UserData',ActionPathList);
    19041912    set(handles.ActionExt,'Value',ActionExtIndex)
    1905     ActionPathList{ActionIndex,ActionExtIndex}=PathName;
     1913%     ActionPathList{ActionIndex,ActionExtIndex}=PathName;
    19061914       
    19071915    %record the user defined menu additions in personal file profil_perso
    19081916    dir_perso=prefdir;
    19091917    profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
    1910     if nb_builtin_ACTION+1<=numel(ActionList)-1
    1911         ActionListUser=ActionList(nb_builtin_ACTION+1:numel(ActionList)-1);
    1912         ActionPathListUser=ActionPathList(nb_builtin_ACTION+1:numel(ActionList)-1,:);
     1918    if NbBuiltinAction+1<=numel(ActionList)-1
     1919        ActionListUser=ActionList(NbBuiltinAction+1:numel(ActionList)-1);
     1920        ActionPathListUser=ActionPathList(NbBuiltinAction+1:numel(ActionList)-1);
    19131921        ActionExtListUser={};
    19141922        if numel(ActionExtList)>2
     
    22592267set(handles.series,'UserData',SeriesData)
    22602268set(handles.ActionName,'BackgroundColor',[1 1 1])
    2261 
    2262 %------------------------------------------------------------------------
    2263 % --- Executes on button press in ActionInput.
    2264 function ActionInput_Callback(hObject, eventdata, handles)
    2265 %------------------------------------------------------------------------
    2266 % if get(handles.ActionInput,'Value')
    2267 ActionName_Callback(hObject, eventdata, handles)
    2268 % end
    22692269
    22702270%------------------------------------------------------------------------
     
    28032803function MenuImportConfig_Callback(hObject, eventdata, handles)
    28042804
    2805 %% use a starting file name for browserr
     2805%% use a browser to choose the xml file containing the processing config
    28062806InputTable=get(handles.InputTable,'Data');
    2807 oldfile=InputTable{1,1};
     2807oldfile=InputTable{1,1};%current path in InputTable
    28082808if isempty(oldfile)
    28092809    % use a file name stored in prefdir
     
    28182818end
    28192819filexml=uigetfile_uvmat('pick a xml parameter file',oldfile,'.xml');% get the xml file containing processing parameters
    2820 %proceed only if a file has been introduced by the browser
    2821 if ~isempty(filexml)
    2822     Param=xml2struct(filexml);% read the input xml file as a Matlab structure
    2823     % ask to stop current Action if button RUN is in action (another process is already running)
    2824     if isequal(get(handles.RUN,'Value'),1)
    2825         answer= msgbox_uvmat('INPUT_Y-N','stop current Action process?');
    2826         if strcmp(answer,'Yes')
    2827             STOP_Callback(hObject, eventdata, handles)
    2828         else
    2829             return
    2830         end
    2831     end
    2832     Param.Action.RUN=0; %desactivate the input RUN=1
    2833     fill_GUI(Param,handles.series)% fill the elements of the GUI series with the input parameters
    2834     SeriesData=get(handles.series,'UserData');
    2835     if isfield(Param,'InputFields')
    2836         ListField=Param.InputFields.FieldName;
    2837         if ischar(ListField),ListField={ListField}; end
    2838         set(handles.FieldName,'String',[ListField;{'get-field...'}])
    2839          set(handles.FieldName,'Value',1:numel(ListField))
    2840          set(handles.FieldName,'Visible','on')
    2841     end       
    2842     if isfield(Param,'ActionInput')%  introduce  parameters specific to an Action fct, for instance PIV parameters
    2843         set(handles.ActionInput,'Visible','on')
    2844         set(handles.ActionInput,'Value',0)
    2845         Param.ActionInput.ConfigSource=filexml;% record the source of config for future info
    2846         SeriesData.ActionInput=Param.ActionInput;
    2847     end
    2848     if isfield(Param,'ProjObject') %introduce projection object if relevant
    2849         SeriesData.ProjObject=Param.ProjObject;
    2850     end
    2851     set(handles.series,'UserData',SeriesData)
    2852     if isfield(Param,'CheckObject') && isequal(Param.CheckObject,1)
    2853         set(handles.ProjObject,'String',Param.ProjObject.Name)
    2854         set(handles.ViewObject,'Visible','on')
    2855         set(handles.EditObject,'Visible','on')
    2856         set(handles.DeleteObject,'Visible','on')
    2857     else     
    2858         set(handles.ProjObject,'String','')
    2859         set(handles.ProjObject,'Visible','off')
    2860         set(handles.ViewObject,'Visible','off')
    2861         set(handles.EditObject,'Visible','off')
    2862         set(handles.DeleteObject,'Visible','off')     
    2863     end     
    2864     set(handles.REFRESH,'BackgroundColor',[1 0 1]); %paint REFRESH button in magenta to indicate that it should be activated
    2865 end
    2866 
    2867 
    2868 
    2869 % --------------------------------------------------------------------
    2870 % function MenuImportParam_Callback(hObject, eventdata, handles)
    2871 % %% use a starting file name for browserr
    2872 % InputTable=get(handles.InputTable,'Data');
    2873 % oldfile=InputTable{1,1};
    2874 % if isempty(oldfile)
    2875 %     % use a file name stored in prefdir
    2876 %     dir_perso=prefdir;
    2877 %     profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
    2878 %     if exist(profil_perso,'file')
    2879 %         h=load (profil_perso);
    2880 %         if isfield(h,'RootPath') && ischar(h.RootPath)
    2881 %             oldfile=h.RootPath;
    2882 %         end
    2883 %     end
    2884 % end
    2885 % filexml=uigetfile_uvmat('pick a xml parameter file',oldfile,'.xml');% get the xml file containing processing parameters
    2886 % %proceed only if a file has been introduced by the browser
    2887 % if ~isempty(filexml)
    2888 %     Param=xml2struct(filexml);% read the input xml file as a Matlab structure
    2889 %     % ask to stop current Action if button RUN is in action (another process is already running)
    2890 %     if isequal(get(handles.RUN,'Value'),1)
    2891 %         answer= msgbox_uvmat('INPUT_Y-N','stop current Action process?');
    2892 %         if strcmp(answer,'Yes')
    2893 %             STOP_Callback(hObject, eventdata, handles)
    2894 %         else
    2895 %             return
    2896 %         end
    2897 %     end
    2898 %     Param.Action.RUN=0; %desactivate the input RUN=1
    2899 %     if ~isfield(Param,'InputTable')||~isfield(Param,'IndexRange')
    2900 %         msgbox_uvmat('ERROR','invalid config file: open a file in a folder ''/0_XML''')
    2901 %         return
    2902 %     end
    2903 %     Param=rmfield(Param,'InputTable');% do not refresh Input files and index range
    2904 %     Param=rmfield(Param,'IndexRange'); 
    2905 %     fill_GUI(Param,handles.series)% fill the elements of the GUI series with the input parameters
    2906 %     SeriesData=get(handles.series,'UserData');
    2907 %     if isfield(Param,'InputFields')
    2908 %         ListField=Param.InputFields.FieldName;
    2909 %         set(handles.FieldName,'String',[ListField;{'get-field...'}])
    2910 %          set(handles.FieldName,'Value',1:numel(ListField))
    2911 %     end       
    2912 %     if isfield(Param,'ActionInput')%  introduce  parameters specific to an Action fct, for instance PIV parameters
    2913 %         set(handles.ActionInput,'Visible','on')
    2914 %         set(handles.ActionInput,'Value',0)
    2915 %         Param.ActionInput.ConfigSource=filexml;% record the source of config for future info
    2916 %         SeriesData.ActionInput=Param.ActionInput;
    2917 %     end
    2918 %     if isfield(Param,'ProjObject') %introduce projection object if relevant
    2919 %         SeriesData.ProjObject=Param.ProjObject;
    2920 %     end
    2921 %     set(handles.series,'UserData',SeriesData)
    2922 %     if isfield(Param,'CheckObject') && isequal(Param.CheckObject,1)
    2923 %         set(handles.ProjObject,'String',Param.ProjObject.Name)
    2924 %         set(handles.ViewObject,'Visible','on')
    2925 %         set(handles.EditObject,'Visible','on')
    2926 %         set(handles.DeleteObject,'Visible','on')
    2927 %     else     
    2928 %         set(handles.ProjObject,'String','')
    2929 %         set(handles.ProjObject,'Visible','off')
    2930 %         set(handles.ViewObject,'Visible','off')
    2931 %         set(handles.EditObject,'Visible','off')
    2932 %         set(handles.DeleteObject,'Visible','off')     
    2933 %     end     
    2934 %     set(handles.REFRESH,'BackgroundColor',[1 0 1]); %paint REFRESH button in magenta to indicate that it should be activated
    2935 % end
    2936 
     2820if isempty(filexml), return, end % quit function if an xml file has not been opened
     2821
     2822%% fill the GUI series with the content of the xml file
     2823Param=xml2struct(filexml);% read the input xml file as a Matlab structure
     2824
     2825% ask to stop current Action if button RUN is in action (another process is already running)
     2826if isequal(get(handles.RUN,'Value'),1)
     2827    answer= msgbox_uvmat('INPUT_Y-N','stop current Action process?');
     2828    if strcmp(answer,'Yes')
     2829        STOP_Callback(hObject, eventdata, handles)
     2830    else
     2831        return
     2832    end
     2833end
     2834Param.Action.RUN=0; %desactivate the input RUN=1
     2835
     2836fill_GUI(Param,handles.series)% fill the elements of the GUI series with the input parameters
     2837SeriesData=get(handles.series,'UserData');
     2838if isfield(Param,'InputFields')
     2839    ListField=Param.InputFields.FieldName;
     2840    if ischar(ListField),ListField={ListField}; end
     2841    set(handles.FieldName,'String',[ListField;{'get-field...'}])
     2842     set(handles.FieldName,'Value',1:numel(ListField))
     2843     set(handles.FieldName,'Visible','on')
     2844end       
     2845if isfield(Param,'ActionInput')%  introduce  parameters specific to an Action fct, for instance PIV parameters
     2846    set(handles.ActionInput,'Visible','on')
     2847    set(handles.ActionInput,'Value',0)
     2848    Param.ActionInput.ConfigSource=filexml;% record the source of config for future info
     2849    SeriesData.ActionInput=Param.ActionInput;
     2850end
     2851if isfield(Param,'ProjObject') %introduce projection object if relevant
     2852    SeriesData.ProjObject=Param.ProjObject;
     2853end
     2854set(handles.series,'UserData',SeriesData)
     2855if isfield(Param,'CheckObject') && isequal(Param.CheckObject,1)
     2856    set(handles.ProjObject,'String',Param.ProjObject.Name)
     2857    set(handles.ViewObject,'Visible','on')
     2858    set(handles.EditObject,'Visible','on')
     2859    set(handles.DeleteObject,'Visible','on')
     2860else     
     2861    set(handles.ProjObject,'String','')
     2862    set(handles.ProjObject,'Visible','off')
     2863    set(handles.ViewObject,'Visible','off')
     2864    set(handles.EditObject,'Visible','off')
     2865    set(handles.DeleteObject,'Visible','off')     
     2866end     
     2867set(handles.REFRESH,'BackgroundColor',[1 0 1]); %paint REFRESH button in magenta to indicate that it should be activated
    29372868
    29382869
     
    31273058ActionList=get(handles.ActionName,'String');
    31283059ActionName=ActionList{get(handles.ActionName,'Value')};
    3129 % TransformPath='';
    3130 % if ~isempty(get(handles.ActionExt,'UserData'))
    3131 %     TransformPath=get(handles.ActionExt,'UserData');
    3132 % end
    3133 % if strcmp(ActionExt,'.sh')
    3134 %     set(handles.series,'Pointer','watch') % set the mouse pointer to 'watch'
    3135 %     set(handles.ActionExt,'BackgroundColor',[1 1 0])
    3136 %     ActionFullName=fullfile(get(handles.ActionPath,'String'),[ActionName '.sh']);
    3137 %     if ~exist(ActionFullName,'file')
    3138 %         answer=msgbox_uvmat('INPUT_Y-N','compiled version has not been created: compile now?');
    3139 %         if strcmp(answer,'Yes')
    3140 %             set(handles.ActionExt,'BackgroundColor',[1 1 0])
    3141 %             path_uvmat=fileparts(which('series'));
    3142 %             currentdir=pwd;
    3143 %             cd(get(handles.ActionPath,'String'))% go to the directory of Action
    3144 %             %  addpath(get(handles.TransformPath,'String'))
    3145 %             addpath(path_uvmat)% add the path to uvmat to run the fct 'compile'
    3146 %            % addpath(fullfile(path_uvmat,'transform_field'))% add the path to uvmat to run the fct 'compile'
    3147 %             compile(ActionName,TransformPath)
    3148 %             cd(currentdir)
    3149 %         end       
    3150 %     else
    3151 %         sh_file_info=dir(fullfile(get(handles.ActionPath,'String'),[ActionName '.sh']));
    3152 %         m_file_info=dir(fullfile(get(handles.ActionPath,'String'),[ActionName '.m']));
    3153 %         if isfield(m_file_info,'datenum') && m_file_info.datenum>sh_file_info.datenum
    3154 %             set(handles.ActionExt,'BackgroundColor',[1 1 0])
    3155 %             drawnow
    3156 %             answer=msgbox_uvmat('INPUT_Y-N',[ActionName '.sh needs to be updated: recompile now?']);
    3157 %             if strcmp(answer,'Yes')
    3158 %                 path_uvmat=fileparts(which('series'));
    3159 %                 currentdir=pwd;
    3160 %                 cd(get(handles.ActionPath,'String'))% go to the directory of Action
    3161 %                 %  addpath(get(handles.TransformPath,'String'))
    3162 %                 addpath(path_uvmat)% add the path to uvmat to run the fct 'compile'
    3163 %                 addpath(fullfile(path_uvmat,'transform_field'))% add the path to uvmat to run the fct 'compile'
    3164 %                 compile(ActionName,TransformPath)
    3165 %                 cd(currentdir)
    3166 %             end
    3167 %         end
    3168 %     end
    3169 %     set(handles.ActionExt,'BackgroundColor',[1 1 1])
    3170 %      set(handles.series,'Pointer','arrow') % set the mouse pointer to 'watch
    3171 % end
    3172 
    31733060
    31743061function num_NbProcess_Callback(hObject, eventdata, handles)
     
    32573144end
    32583145ref_i=str2num(get(handles.num_first_i,'String'));
    3259 ref_j=str2num(get(handles.num_first_j,'String'));
     3146ref_j=1;%default
     3147if strcmp(get(handles.num_first_j,'String'),'Visible')
     3148    ref_j=str2num(get(handles.num_first_j,'String'));
     3149end
    32603150[ModeMenu,ModeValue]=update_mode(SeriesData.i1_series{iview},SeriesData.i2_series{iview},SeriesData.j2_series{iview});
    32613151displ_pair=update_listpair(SeriesData.i1_series{iview},SeriesData.i2_series{iview},SeriesData.j1_series{iview},SeriesData.j2_series{iview},ModeMenu{ModeValue},...
     
    33753265Mode_Callback([],[])
    33763266
    3377 
     3267%------------------------------------------------------------------------
    33783268% --- Executes on button press in ClearLine.
     3269%------------------------------------------------------------------------
    33793270function ClearLine_Callback(hObject, eventdata, handles)
    3380 % hObject    handle to ClearLine (see GCBO)
    3381 % eventdata  reserved - to be defined in a future version of MATLAB
    3382 % handles    structure with handles and user data (see GUIDATA)
    3383 iline=get(handles.InputTable,'UserData');
    33843271InputTable=get(handles.InputTable,'Data');
    3385 InputTable(iline,:)=[];
    3386 set(handles.InputTable,'Data',InputTable);
     3272iline=str2double(get(handles.InputLine,'String'));
     3273if size(InputTable,1)>1
     3274    InputTable(iline,:)=[];% suppress the current line if not the first
     3275    set(handles.InputTable,'Data',InputTable);
     3276end
  • trunk/src/series/civ_input.m

    r850 r851  
    6060set(hObject,'WindowButtonDownFcn',{'mouse_down'}) % allows mouse action with right button (zoom for uicontrol display)
    6161set(hObject,'WindowKeyPressFcn',{@keyboard_callback,handles})%set keyboard action function
     62%set(hObject,'KeyPressFcn',{@KeyPressFcn,handles})%set keyboard action function
    6263set(handles.ref_i,'KeyPressFcn',{@ref_i_KeyPressFcn,handles})%set keyboard action function
     64set(handles.ref_j,'KeyPressFcn',{@ref_i_KeyPressFcn,handles})%set keyboard action function
    6365%set(hObject,'WindowKeyPressFcn',{'keyboard_callback',handles})%set keyboard action function
    6466hseries=findobj(allchild(0),'Tag','series');% find the parent GUI 'series'
     
    106108ind_opening=0;%default
    107109NomTypeNc='';
     110NomTypeImaA=NomTypeInput;
     111iview_image=1;%line # for the input images
    108112switch FileType
    109113    case {'image','multimage','video','mmreader','netcdf'}
    110         NomTypeImaA=NomTypeInput;
    111         iview_image=1;%line # for the input images
     114%         NomTypeImaA=NomTypeInput;
     115%         iview_image=1;%line # for the input images
    112116    case 'civdata'
    113117        if ~strcmp(Param.Action.ActionName,'civ_series')
    114118            msgbox_uvmat('ERROR','bad input data file: open an image or a nc file from civ_series')
    115             %return
     119            return
    116120        end
    117121        NomTypeNc=NomTypeInput;
     
    122126            set(handles.ListCompareMode,'Value',1)
    123127        end
    124 %         FileInput=SeriesData.RefFile{1};
    125128        [Data,tild,tild,errormsg]=nc2struct(FileInfo.FileName,[]);
    126129        if ~isempty(errormsg)
     
    128131            return
    129132        end
    130         [PathCiv1_ImageA,Civ1_ImageA,FileExtA]=fileparts(Data.Civ1_ImageA);
    131         [PathCiv1_ImageB,Civ1_ImageB,FileExtA]=fileparts(Data.Civ1_ImageB);
     133        [PathCiv1_ImageA,Civ1_ImageA,FileExtA]=fileparts(Data.Civ1_ImageA);%look for the source image A
     134        [PathCiv1_ImageB,Civ1_ImageB,FileExtA]=fileparts(Data.Civ1_ImageB);%look for the source image B
    132135        if isfield(Data,'Civ2_ImageA')
    133136            [PathCiv2_ImageA,Civ2_ImageA,FileExtA]=fileparts(Data.Civ2_ImageA);
     
    147150        return
    148151end
    149 % if isfield(SeriesData,'FileType') && numel(SeriesData.FileType)>=2 && strcmp(SeriesData.FileType{end-1},'image') &&   strcmp(SeriesData.FileType{end},'image')
    150 %     set(handles.ListCompareMode,'Value',3)% we compare two image series term to term ('shift')
    151 %     set(handles.PairIndices,'Visible','off')
    152 % end
    153152
    154153%% reinitialise menus
     
    195194    end
    196195end
    197 % CivInputData.MaxIndex_i=MaxIndex_i;
    198 % CivInputData.MaxIndex_j=MaxIndex_j;
    199 % CivInputData.MinIndex_i=MinIndex_i;
    200 % CivInputData.MinIndex_j=MinIndex_j;
    201196if ~isfield(Param.IndexRange,'first_j')||isequal(MaxIndex_j,MinIndex_j)% no possibility of j pairs
    202197    set(handles.ListPairMode,'Value',1)
     
    227222    TimeUnit=Param.IndexRange.TimeUnit;
    228223end
    229 if isfield(SeriesData,'TimeSource')
    230     set(handles.ImaDoc,'String',SeriesData.TimeSource)
    231 end 
     224% if isfield(SeriesData,'TimeSource')
     225%     set(handles.TimeSource,'String',SeriesData.TimeSource)
     226% end 
    232227if isfield(SeriesData,'GeometryCalib')
    233228    tsai=SeriesData.GeometryCalib;
     
    250245    MaxIndex_i=min(size(time,1),MaxIndex_i);%possibly adjust the max index according to time data
    251246    MaxIndex_j=min(size(time,2),MaxIndex_j);
    252 else
    253     set(handles.ImaDoc,'String',''); %xml file not used for timing
     247    set(handles.TimeSource,'String',Param.IndexRange.TimeSource);
     248else
     249    set(handles.TimeSource,'String',''); %xml file not used for timing
    254250    TimeUnit='frame';
    255251    time=ones(MaxIndex_j-MinIndex_j+1,1)*(MinIndex_i:MaxIndex_i);
     
    264260set(handles.SearchRange,'UserData', pxcm_search);
    265261
     262% indicate the min and max indices i and j on the GUI
     263set(handles.MinIndex_i,'String',num2str(MinIndex_i))
     264set(handles.MaxIndex_i,'String',num2str(MaxIndex_i))
     265set(handles.MinIndex_j,'String',num2str(MinIndex_j))
     266set(handles.MaxIndex_j,'String',num2str(MaxIndex_j))
     267
     268
     269%% set the civ_input options, depending on the input file content if a nc file has been opened
     270ListOptions={'CheckCiv1', 'CheckFix1' 'CheckPatch1', 'CheckCiv2', 'CheckFix2', 'CheckPatch2'};
     271checkbox=zeros(size(ListOptions));%default
     272checkrefresh=0;
     273if ind_opening==0  %case of image opening, start with Civ1
     274    for index=1:numel(ListOptions)
     275        checkbox(index)=get(handles.(ListOptions{index}),'Value');
     276    end
     277    index_max=find(checkbox, 1, 'last' );
     278    if isempty(index_max),index_max=1;end
     279    for index=1:index_max
     280        set(handles.(ListOptions{index}),'Value',1)% select all operations starting from CIV1
     281    end
     282else  %case of netcdf file opening, start with the stage read in the file if the input file is being refreshed
     283    if isequal(get(hhseries.REFRESH,'BackgroundColor'),[1 1 0]) && ~isfield(Param.ActionInput,'ConfigSource')
     284        answer=msgbox_uvmat('INPUT_Y-N',['import the civ parameters from the netcdf file']);
     285        if strcmp(answer,'Yes')
     286            for index = 1:min(ind_opening,5)
     287                set(handles.(ListOptions{index}),'value',0)
     288                fill_civ_input(Data,handles); %fill civ_input with the parameters retrieved from an input Civ file
     289            end
     290            set(handles.ConfigSource,'String',FileInfo.FileName);
     291            set(handles.(ListOptions{min(ind_opening+1,6)}),'value',1)
     292            for index = ind_opening+2:6
     293                set(handles.(ListOptions{index}),'value',0)
     294            end
     295            checkrefresh=1;
     296        end
     297    end
     298    if ind_opening>=3
     299        set(handles.iterate,'Visible','on')% make visible the switch 'iterate/repet' for Civ2.
     300    else
     301        set(handles.iterate,'Visible','off')
     302    end
     303end
     304
    266305%% introduce the stored Civ parameters  if available (from previous input or ImportConfig in series)
    267 if isfield(Param,'ActionInput')&& strcmp(Param.ActionInput.Program,Param.Action.ActionName)% the program fits with the stored data
     306if ~checkrefresh && isfield(Param,'ActionInput')&& strcmp(Param.ActionInput.Program,Param.Action.ActionName)% the program fits with the stored data
    268307    fill_GUI(Param.ActionInput,hObject);%fill the GUI with the parameters retrieved from the input Param
    269308    hcheckgrid=findobj(handles.civ_input,'Tag','CheckGrid');
     
    283322    end
    284323end
    285 % indicate the min and max indices i and j on the GUI
    286 set(handles.MinIndex_i,'String',num2str(MinIndex_i))
    287 set(handles.MaxIndex_i,'String',num2str(MaxIndex_i))
    288 set(handles.MinIndex_j,'String',num2str(MinIndex_j))
    289 set(handles.MaxIndex_j,'String',num2str(MaxIndex_j))
    290 
    291 %% set the civ_input options, depending on the input file content if a nc file has been opened
    292 ListOptions={'CheckCiv1', 'CheckFix1' 'CheckPatch1', 'CheckCiv2', 'CheckFix2', 'CheckPatch2'};
    293 checkbox=zeros(size(ListOptions));%default
    294 if ind_opening==0  %case of image opening, start with Civ1
    295     for index=1:numel(ListOptions)
    296         checkbox(index)=get(handles.(ListOptions{index}),'Value');
    297     end
    298     index_max=find(checkbox, 1, 'last' );
    299     if isempty(index_max),index_max=1;end
    300     for index=1:index_max
    301         set(handles.(ListOptions{index}),'Value',1)% select all operations starting from CIV1
    302     end
    303 else  %case of netcdf file opening, start with the stage read in the file
    304     for index = 1:min(ind_opening,5)
    305         set(handles.(ListOptions{index}),'value',0)     
    306         fill_civ_input(Data,handles); %fill civ_input with the parameters retrieved from an input Civ file
    307     end
    308     set(handles.ConfigSource,'String',FileInfo.FileName);
    309     set(handles.(ListOptions{min(ind_opening+1,6)}),'value',1)
    310     for index = ind_opening+2:6
    311         set(handles.(ListOptions{index}),'value',0)
    312     end
    313 end
    314324
    315325%% set the reference indices from the input file indices
     326if ~isfield(Param.ActionInput,'ConfigSource')
    316327update_CivOptions(handles,ind_opening)% fill the menu of possible pairs
     328end
    317329
    318330%% list the possible index pairs, depending on the option set in ListPairMode
     
    346358    delete(handles.civ_input);
    347359end
     360
     361%------------------------------------------------------------------------
     362% --- Executes on button press in SetDefaultParam.
     363%------------------------------------------------------------------------
     364function SetDefaultParam_Callback(hObject, eventdata, handles)
     365   
     366hseries=findobj(allchild(0),'Name','series');% look for the GUI series
     367hhseries=guidata(hseries);%handles of elements in the GUI series
     368SeriesData=get(hseries,'UserData');%read parameters on the GUI series
     369if isfield (SeriesData,'ActionInput')
     370    SeriesData=rmfield(SeriesData,'ActionInput');% remove recorded civ parameters
     371end
     372set(hseries,'UserData',SeriesData)
     373series('ActionName_Callback',hObject,eventdata,hhseries); %
    348374
    349375% -----------------------------------------------------------------------
     
    438464function update_CivOptions(handles,opening)
    439465%------------------------------------------------------------------------
     466if opening>0
     467    set(handles.CheckCiv2,'UserData',opening)% store the info on the current status of the civ processing
     468end
    440469checkbox=zeros(1,6);
    441470checkbox(1)=get(handles.CheckCiv1,'Value');
     
    445474checkbox(5)=get(handles.CheckFix2,'Value');
    446475checkbox(6)=get(handles.CheckPatch2,'Value');
    447 % ind_selected=find(checkbox,1);
    448 %set(handles.PairIndices,'Visible','on')% make the frame PaiIndices visible, choice of the index pairs fo civ
    449476if opening==0
    450477    errormsg=find_netcpair_civ(handles,1); % select the available netcdf files
     
    453480    end
    454481end
    455 if max(checkbox(4:6))% case of civ2 pair choice needed
     482if max(checkbox(4:6))>0% case of civ2 pair choice needed
    456483    set(handles.TitlePairCiv2,'Visible','on')
    457484    set(handles.ListPairCiv2,'Visible','on')
     
    465492    set(handles.ListPairCiv2,'Visible','off')
    466493end
     494if max(checkbox(1:3))==0 && get(handles.CheckCiv2,'UserData')==6,% no operation asked before Civ2 and input file ready for civ3
     495    set(handles.iterate,'Visible','on')
     496else
     497    set(handles.iterate,'Visible','off')
     498end
     499
     500%% set the visibility of the different panels
    467501options={'Civ1','Fix1','Patch1','Civ2','Fix2','Patch2'};
    468502for ilist=1:length(options)
     
    479513%------------------------------------------------------------------------
    480514
    481 handles.output.ActionInput=read_GUI(handles.civ_input);
     515ActionInput=read_GUI(handles.civ_input);
     516
     517%% correct inpput inconsistencies
     518if isfield(ActionInput,'Civ1')
     519    checkeven=(mod(ActionInput.Civ1.CorrBoxSize,2)==0);
     520    ActionInput.Civ1.CorrBoxSize(checkeven)=ActionInput.Civ1.CorrBoxSize(checkeven)+1;% set correlation box sizes to odd values
     521    ActionInput.Civ1.SearchBoxSize=max(ActionInput.Civ1.SearchBoxSize,ActionInput.Civ1.CorrBoxSize+10);% insure that the search box size is large enough
     522    checkeven=(mod(ActionInput.Civ1.SearchBoxSize,2)==0);
     523    ActionInput.Civ1.SearchBoxSize(checkeven)=ActionInput.Civ1.SearchBoxSize(checkeven)+1;% set search box sizes to odd values
     524end
     525if isfield(ActionInput,'Civ2')
     526    checkeven=(mod(ActionInput.Civ2.CorrBoxSize,2)==0);
     527    ActionInput.Civ2.CorrBoxSize(checkeven)=ActionInput.Civ2.CorrBoxSize(checkeven)+1;% set correlation box sizes to odd values
     528    ActionInput.Civ2.SearchBoxSize=max(ActionInput.Civ2.SearchBoxSize,ActionInput.Civ2.CorrBoxSize+10);
     529    checkeven=(mod(ActionInput.Civ2.SearchBoxSize,2)==0);
     530    ActionInput.Civ2.SearchBoxSize(checkeven)=ActionInput.Civ2.SearchBoxSize(checkeven)+1;% set search box sizes to odd values
     531end
     532
     533handles.output.ActionInput=ActionInput;
    482534% correct mask or grid name for Windows system (replace '\' by '/')
    483535if isfield(handles.output.ActionInput,'Civ1')
     
    500552uiresume(handles.civ_input);
    501553
    502 % %------------------------------------------------------------------------
    503 % % --- determine the list of index pairs of processing file
    504 % function [i1_civ1,i2_civ1,j1_civ1,j2_civ1,i1_civ2,i2_civ2,j1_civ2,j2_civ2]=...
    505 %     find_pair_indices(handles,ref_i,ref_j,mode)
    506 % %------------------------------------------------------------------------
    507 %
    508 % list_civ1=get(handles.ListPairCiv1,'String');
    509 % index_civ1=get(handles.ListPairCiv1,'Value');
    510 % str_civ1=list_civ1{index_civ1};%string defining the image pairs for civ1
    511 % if isempty(str_civ1)||isequal(str_civ1,'')
    512 %     msgbox_uvmat('ERROR','no image pair selected for civ1')
    513 %     return
    514 % end
    515 % list_civ2=get(handles.ListPairCiv2,'String');
    516 % index_civ2=get(handles.ListPairCiv2,'Value');
    517 % if index_civ2>length(list_civ2)
    518 %     list_civ2=list_civ1;
    519 %     index_civ2=index_civ1;
    520 % end
    521 % str_civ2=list_civ2{index_civ2};%string defining the image pairs for civ2
    522 %
    523 % if isequal (mode,'series(Di)')
    524 %     lastfield=str2double(get(handles.MaxIndex_i,'String'));
    525 %     i1_civ1=ref_i-floor(index_civ1/2)*ones(size(ref_i));% set of first image numbers
    526 %     i2_civ1=ref_i+ceil(index_civ1/2)*ones(size(ref_i));
    527 %     j1_civ1=ref_j;
    528 %     j2_civ1=ref_j;
    529 %     i1_civ2=ref_i-floor(index_civ2/2)*ones(size(ref_i));
    530 %     i2_civ2=ref_i+ceil(index_civ2/2)*ones(size(ref_i));
    531 %     j1_civ2=ref_j;
    532 %     j2_civ2=ref_j;
    533 %     
    534 %     % adjust the first and last field number
    535 %     lastfield=str2double(get(handles.MaxIndex_i,'String'));
    536 %     if isnan(lastfield)
    537 %         indsel=find((i1_civ1 >= 1)&(i1_civ2 >= 1));
    538 %     else
    539 %         indsel=find((i2_civ1 <= lastfield)&(i2_civ2 <= lastfield)&(i1_civ1 >= 1)&(i1_civ2 >= 1));
    540 %     end
    541 %     if length(indsel)>=1
    542 %         firstind=indsel(1);
    543 %         lastind=indsel(end);
    544 %         set(handles.MinIndex_i,'String',num2str(ref_i(firstind)))%update the display of first and last fields
    545 %         set(handles.last_i,'String',num2str(ref_i(lastind)))
    546 %         ref_i=ref_i(indsel);
    547 %         i1_civ1=i1_civ1(indsel);
    548 %         i1_civ2=i1_civ2(indsel);
    549 %         i2_civ1=i2_civ1(indsel);
    550 %         i2_civ2=i2_civ2(indsel);
    551 %     end
    552 % elseif isequal (mode,'series(Dj)')
    553 %     lastfield_j=str2double(get(handles.MaxIndex_j,'String'));
    554 %     i1_civ1=ref_i;% set of first image numbers
    555 %     i2_civ1=ref_i;
    556 %     j1_civ1=ref_j-floor(index_civ1/2)*ones(size(ref_j));
    557 %     j2_civ1=ref_j+ceil(index_civ1/2)*ones(size(ref_j));
    558 %     i1_civ2=ref_i;
    559 %     i2_civ2=ref_i;
    560 %     j1_civ2=ref_j-floor(index_civ2/2)*ones(size(ref_j));
    561 %     j2_civ2=ref_j+ceil(index_civ2/2)*ones(size(ref_j));
    562 %     % adjust the first and last field number
    563 %     if isnan(lastfield_j)
    564 %         indsel=find((j1_civ1 >= 1)&(j1_civ2 >= 1));
    565 %     else
    566 %         indsel=find((j2_civ1 <= lastfield_j)&(j2_civ2 <= lastfield_j)&(j1_civ1 >= 1)&(j1_civ2 >= 1));
    567 %     end
    568 %     if length(indsel)>=1
    569 %         firstind=indsel(1);
    570 %         lastind=indsel(end);
    571 %         set(handles.MinIndex_j,'String',num2str(ref_j(firstind)))%update the display of first and last fields
    572 %         set(handles.last_j,'String',num2str(ref_j(lastind)))
    573 %         ref_j=ref_j(indsel);
    574 %         j1_civ1=j1_civ1(indsel);
    575 %         j2_civ1=j2_civ1(indsel);
    576 %         j1_civ2=j1_civ2(indsel);
    577 %         j2_civ2=j2_civ2(indsel);
    578 %     end
    579 % elseif isequal(mode,'pair j1-j2') %case of bursts (png_old or png_2D)
    580 %     displ_num=get(handles.ListPairCiv1,'UserData');
    581 %     i1_civ1=ref_i;
    582 %     i2_civ1=ref_i;
    583 %     j1_civ1=displ_num(1,index_civ1);
    584 %     j2_civ1=displ_num(2,index_civ1);
    585 %     i1_civ2=ref_i;
    586 %     i2_civ2=ref_i;
    587 %     j1_civ2=displ_num(1,index_civ2);
    588 %     j2_civ2=displ_num(2,index_civ2);
    589 % elseif isequal(mode,'displacement')
    590 %     i1_civ1=ref_i;
    591 %     i2_civ1=ref_i;
    592 %     j1_civ1=ref_j;
    593 %     j2_civ1=ref_j;
    594 %     i1_civ2=ref_i;
    595 %     i2_civ2=ref_i;
    596 %     j1_civ2=ref_j;
    597 %     j2_civ2=ref_j;
    598 % end
    599554
    600555%------------------------------------------------------------------------
     
    794749function ListPairCiv2_Callback(hObject, eventdata, handles)
    795750%------------------------------------------------------------------------
    796 % index_pair=get(handles.ListPairCiv2,'Value');%get the selected position index in the menu
    797 %
    798 % %update MinIndex_i and last_i according to the chosen image pairs
    799 % mode_list=get(handles.ListPairMode,'String');
    800 % mode_value=get(handles.ListPairMode,'Value');
    801 % mode=mode_list{mode_value};
    802 % if isequal(mode,'series(Di)')
    803 %     first_i=str2double(get(handles.MinIndex_i,'String'));
    804 %     last_i=str2double(get(handles.MaxIndex_i,'String'));
    805 %     incr_i=str2double(get(handles.incr_i,'String'));
    806 %     num_i=first_i:incr_i:last_i;
    807 %    % lastfield=str2double(get(handles.MaxIndex_i,'String'));
    808 %     if ~isnan(last_i)
    809 %         test_find=(num_i-floor(index_pair/2)*ones(size(num_i))>0)& ...
    810 %             (num_i+ceil(index_pair/2)*ones(size(num_i))<=last_i);
    811 %         num_i=num_i(test_find);
    812 %     end
    813 %     set(handles.MinIndex_i,'String',num2str(num_i(1)));
    814 %     set(handles.MaxIndex_i,'String',num2str(num_i(end)));
    815 % elseif isequal(mode,'series(Dj)')
    816 %     first_j=str2double(get(handles.MinIndex_j,'String'));
    817 %     last_j=str2double(get(handles.last_j,'String'));
    818 %     incr_j=str2double(get(handles.incr_j,'String'));
    819 %     num_j=first_j:incr_j:last_j;
    820 %     lastfield2=str2double(get(handles.MaxIndex_j,'String'));
    821 %     if ~isnan(lastfield2)
    822 %         test_find=(num_j-floor(index_pair/2)*ones(size(num_j))>0)& ...
    823 %             (num_j+ceil(index_pair/2)*ones(size(num_j))<=lastfield2);
    824 %         num_j=num_j(test_find);
    825 %     end
    826 %     set(handles.MinIndex_j,'String',num2str(num_j(1)));
    827 %     set(handles.last_j,'String',num2str(num_j(end)));
    828 % end
     751
    829752
    830753%------------------------------------------------------------------------
     
    839762    errormsg=find_netcpair_civ( handles,2);
    840763end
    841     if ~isempty(errormsg)
     764if isempty(errormsg)
     765    set(handles.ref_i,'BackgroundColor',[1 1 1])
     766else
    842767    msgbox_uvmat('ERROR',errormsg)
    843     end
    844 
    845 %------------------------------------------------------------------------
    846 function ref_j_Callback(hObject, eventdata, handles)
    847 %------------------------------------------------------------------------
    848 mode_list=get(handles.ListPairMode,'String');
    849 mode_value=get(handles.ListPairMode,'Value');
    850 mode=mode_list{mode_value};
    851 errormsg='';
    852 if isequal(get(handles.CheckCiv1,'Value'),0)|| isequal(mode,'series(Dj)')
    853     errormsg=find_netcpair_civ(handles,1);% update the menu of pairs depending on the available netcdf files
    854 end
    855 if isequal(mode,'series(Dj)') || ...
    856         (get(handles.CheckCiv2,'Value')==0 && get(handles.CheckCiv1,'Value')==0 && get(handles.CheckFix1,'Value')==0 && get(handles.CheckPatch1,'Value')==0)
    857     errormsg=find_netcpair_civ(handles,2);
    858 end
    859 if ~isempty(errormsg)
    860     msgbox_uvmat('ERROR',errormsg)
    861 end
    862 
     768end
     769
     770function ref_i_KeyPressFcn(hObject, eventdata, handles)
     771set(hObject,'BackgroundColor',[1 0 1])
     772       
     773% %------------------------------------------------------------------------
     774% function ref_j_Callback(hObject, eventdata, handles)
     775% %------------------------------------------------------------------------
     776% mode_list=get(handles.ListPairMode,'String');
     777% mode_value=get(handles.ListPairMode,'Value');
     778% mode=mode_list{mode_value};
     779% errormsg='';
     780% if isequal(get(handles.CheckCiv1,'Value'),0)|| isequal(mode,'series(Dj)')
     781%     errormsg=find_netcpair_civ(handles,1);% update the menu of pairs depending on the available netcdf files
     782% end
     783% if isequal(mode,'series(Dj)') || ...
     784%         (get(handles.CheckCiv2,'Value')==0 && get(handles.CheckCiv1,'Value')==0 && get(handles.CheckFix1,'Value')==0 && get(handles.CheckPatch1,'Value')==0)
     785%     errormsg=find_netcpair_civ(handles,2);
     786% end
     787% if ~isempty(errormsg)
     788%     msgbox_uvmat('ERROR',errormsg)
     789% end
     790%
     791% function ref_j_KeyPressFcn(hObject, eventdata, handles)
     792% set(handles.ref_j,'BackgroundColor',[1 0 1])
    863793%------------------------------------------------------------------------
    864794% determine the menu for checkciv1 pairs depending on existing netcdf file at the middle of
     
    10961026    index=get(handles.ListPairCiv1,'Value');
    10971027    pair_string=list_pair{index};
    1098     time=get(handles.ImaDoc,'UserData'); %get the set of times
     1028    time=get(handles.TimeSource,'UserData'); %get the set of times
    10991029    pxcm=get(handles.SearchRange,'UserData');
    11001030    mode_list=get(handles.ListPairMode,'String');
     
    11431073end
    11441074
     1075%------------------------------------------------------------------------
     1076% --- Executes on button press in CheckMask.
     1077function num_CorrSmooth_Callback(hObject, eventdata, handles)
     1078set(hObject,'BackgroundColor',[1 0 1])
     1079set(handles.configSource,'String','NEW')
     1080
     1081%------------------------------------------------------------------------
     1082
    11451083%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    11461084% Callbacks in the uipanel Fix1
    11471085%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    11481086%------------------------------------------------------------------------
    1149 % --- Executes on button press in CheckMask.
    1150 function get_mask_fix1_Callback(hObject, eventdata, handles)
     1087% % --- Executes on button press in CheckMask.
     1088% function get_mask_fix1_Callback(hObject, eventdata, handles)
     1089% %------------------------------------------------------------------------
     1090% maskval=get(handles.CheckMask,'Value');
     1091% if isequal(maskval,0)
     1092%     set(handles.Mask,'String','')
     1093% else
     1094%     mask_displ='no mask'; %default
     1095%     filebase=get(handles.RootPath,'String');
     1096%     [nbslice, flag_mask]=get_mask(filebase,handles);
     1097%     if isequal(flag_mask,1)
     1098%         mask_displ=[num2str(nbslice) 'mask'];
     1099%     elseif get(handles.ListCompareMode,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series
     1100%         filebase_a=get(handles.RootFile_1,'String');
     1101%         [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles);
     1102%         if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice)
     1103%             mask_displ='no mask';
     1104%         end
     1105%     end
     1106%     if isequal(mask_displ,'no mask')
     1107%         [FileName, PathName, filterindex] = uigetfile( ...
     1108%             {'*.png', ' (*.png)';
     1109%             '*.png',  '.png files '; ...
     1110%             '*.*', 'All Files (*.*)'}, ...
     1111%             'Pick a mask file *.png',filebase);
     1112%         mask_displ=fullfile(PathName,FileName);
     1113%         if ~exist(mask_displ,'file')
     1114%             mask_displ='no mask';
     1115%         end
     1116%     end
     1117%     if isequal(mask_displ,'no mask')
     1118%         set(handles.CheckMask,'Value',0)
     1119%         set(handles.CheckMask,'Value',0)
     1120%         set(handles.CheckMask,'Value',0)
     1121%     else
     1122%         %set(handles.CheckMask,'Value',1)
     1123%         set(handles.CheckMask,'Value',1)
     1124%     end
     1125%     set(handles.Mask,'String',mask_displ)
     1126%     set(handles.Mask,'String',mask_displ)
     1127%     set(handles.Mask,'String',mask_displ)
     1128% end
     1129
     1130%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     1131% Callbacks in the uipanel Civ2
     1132%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     1133%------------------------------------------------------------------------
     1134% --- Executes on button press in CheckMask: select box for mask option
     1135function get_mask_civ2_Callback(hObject, eventdata, handles)
    11511136%------------------------------------------------------------------------
    11521137maskval=get(handles.CheckMask,'Value');
     
    11801165        set(handles.CheckMask,'Value',0)
    11811166        set(handles.CheckMask,'Value',0)
    1182         set(handles.CheckMask,'Value',0)
    1183     else
    1184         %set(handles.CheckMask,'Value',1)
    1185         set(handles.CheckMask,'Value',1)
    1186     end
    1187     set(handles.Mask,'String',mask_displ)
    1188     set(handles.Mask,'String',mask_displ)
    1189     set(handles.Mask,'String',mask_displ)
    1190 end
    1191 
    1192 %------------------------------------------------------------------------
    1193 % --- Executes on button press in CheckMask: select box for mask option
    1194 function get_mask_civ2_Callback(hObject, eventdata, handles)
    1195 %------------------------------------------------------------------------
    1196 maskval=get(handles.CheckMask,'Value');
    1197 if isequal(maskval,0)
    1198     set(handles.Mask,'String','')
    1199 else
    1200     mask_displ='no mask'; %default
    1201     filebase=get(handles.RootPath,'String');
    1202     [nbslice, flag_mask]=get_mask(filebase,handles);
    1203     if isequal(flag_mask,1)
    1204         mask_displ=[num2str(nbslice) 'mask'];
    1205     elseif get(handles.ListCompareMode,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series
    1206         filebase_a=get(handles.RootFile_1,'String');
    1207         [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles);
    1208         if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice)
    1209             mask_displ='no mask';
    1210         end
    1211     end
    1212     if isequal(mask_displ,'no mask')
    1213         [FileName, PathName, filterindex] = uigetfile( ...
    1214             {'*.png', ' (*.png)';
    1215             '*.png',  '.png files '; ...
    1216             '*.*', 'All Files (*.*)'}, ...
    1217             'Pick a mask file *.png',filebase);
    1218         mask_displ=fullfile(PathName,FileName);
    1219         if ~exist(mask_displ,'file')
    1220             mask_displ='no mask';
    1221         end
    1222     end
    1223     if isequal(mask_displ,'no mask')
    1224         set(handles.CheckMask,'Value',0)
    1225         set(handles.CheckMask,'Value',0)
    12261167    else
    12271168        set(handles.CheckMask,'Value',1)
    12281169    end
    12291170    set(handles.Mask,'String',mask_displ)
    1230     set(handles.Mask,'String',mask_displ)
    1231 end
    1232 
    1233 %------------------------------------------------------------------------
    1234 % --- Executes on button press in CheckMask.
    1235 function get_mask_fix2_Callback(hObject, eventdata, handles)
    1236 %------------------------------------------------------------------------
    1237 maskval=get(handles.CheckMask,'Value');
    1238 if isequal(maskval,0)
    1239     set(handles.Mask,'String','')
    1240 else
    1241     mask_displ='no mask'; %default
    1242     filebase=get(handles.RootPath,'String');
    1243     [nbslice, flag_mask]=get_mask(filebase,handles);
    1244     if isequal(flag_mask,1)
    1245         mask_displ=[num2str(nbslice) 'mask'];
    1246     elseif get(handles.ListCompareMode,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series
    1247         filebase_a=get(handles.RootFile_1,'String');
    1248         [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles);
    1249         if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice)
    1250             mask_displ='no mask';
    1251         end
    1252     end
    1253     if isequal(mask_displ,'no mask')
    1254         [FileName, PathName, filterindex] = uigetfile( ...
    1255             {'*.png', ' (*.png)';
    1256             '*.png',  '.png files '; ...
    1257             '*.*', 'All Files (*.*)'}, ...
    1258             'Pick a mask file *.png',filebase);
    1259         mask_displ=fullfile(PathName,FileName);
    1260         if ~exist(mask_displ,'file')
    1261             mask_displ='no mask';
    1262         end
    1263     end
    1264     if isequal(mask_displ,'no mask')
    1265         set(handles.CheckMask,'Value',0)
    1266     end
    1267     set(handles.Mask,'String',mask_displ)
    1268 end
     1171end
     1172
     1173% %------------------------------------------------------------------------
     1174% % --- Executes on button press in CheckMask.
     1175% function get_mask_fix2_Callback(hObject, eventdata, handles)
     1176% %------------------------------------------------------------------------
     1177% maskval=get(handles.CheckMask,'Value');
     1178% if isequal(maskval,0)
     1179%     set(handles.Mask,'String','')
     1180% else
     1181%     mask_displ='no mask'; %default
     1182%     filebase=get(handles.RootPath,'String');
     1183%     [nbslice, flag_mask]=get_mask(filebase,handles);
     1184%     if isequal(flag_mask,1)
     1185%         mask_displ=[num2str(nbslice) 'mask'];
     1186%     elseif get(handles.ListCompareMode,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series
     1187%         filebase_a=get(handles.RootFile_1,'String');
     1188%         [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles);
     1189%         if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice)
     1190%             mask_displ='no mask';
     1191%         end
     1192%     end
     1193%     if isequal(mask_displ,'no mask')
     1194%         [FileName, PathName, filterindex] = uigetfile( ...
     1195%             {'*.png', ' (*.png)';
     1196%             '*.png',  '.png files '; ...
     1197%             '*.*', 'All Files (*.*)'}, ...
     1198%             'Pick a mask file *.png',filebase);
     1199%         mask_displ=fullfile(PathName,FileName);
     1200%         if ~exist(mask_displ,'file')
     1201%             mask_displ='no mask';
     1202%         end
     1203%     end
     1204%     if isequal(mask_displ,'no mask')
     1205%         set(handles.CheckMask,'Value',0)
     1206%     end
     1207%     set(handles.Mask,'String',mask_displ)
     1208% end
    12691209
    12701210%------------------------------------------------------------------------
     
    14751415    end
    14761416end
     1417set(hObject,'BackgroundColor',[1 0 1])
     1418set(handles.configSource,'String','NEW')
    14771419
    14781420%------------------------------------------------------------------------
     
    14911433    hhseries=guidata(hseries);
    14921434    InputTable=get(hhseries.InputTable,'Data');
    1493      ind_A=1;% line index of the (first) image series
     1435    ind_A=1;% line index of the (first) image series
    14941436    if strcmp(InputTable{1,5},'.nc');
    14951437        ind_A=2;
    14961438    end
    1497     [nbslice, flag_mask]=get_mask(InputTable{ind_A,1},handles);% look for a mask with appropriate name 
     1439    [nbslice, flag_mask]=get_mask(InputTable{ind_A,1},handles);% look for a mask with appropriate name
    14981440    if isequal(flag_mask,1)
    14991441        filemask=[num2str(nbslice) 'mask'];
    15001442        testmask=1;
    1501     else % browse for a mask 
    1502         filemask=get(hObject,'UserData');%look for previous mask name stored as UserData
    1503         if exist(filemask,'file')
    1504             filebase=filemask;
    1505         end
    1506         filemask= uigetfile_uvmat('pick a mask image file:',InputTable{ind_A,1},'image'); 
     1443    else % browse for a mask
     1444%         filemask=get(hObject,'UserData');%look for previous mask name stored as UserData
     1445%         if exist(filemask,'file')
     1446%             filebase=filemask;
     1447%         end
     1448        filemask= uigetfile_uvmat('pick a mask image file:',InputTable{ind_A,1},'image');
    15071449        set(hObject,'UserData',filemask);%store for future use
    15081450        if ~isempty(filemask)
     
    15121454end
    15131455if testmask
    1514    % if strcmp(parent_tag,'Civ1')
    1515         set(handles.Mask,'Visible','on')
    1516         set(handles.Mask,'String',filemask)
     1456    set(handles.Mask,'Visible','on')
     1457    set(handles.Mask,'String',filemask)
    15171458    set(handles.CheckMask,'Value',1)
    1518    % end
    15191459else
    15201460    set(hObject,'Value',0);
    15211461    set(handle_txtbox,'Visible','off')
    15221462end
    1523 
    1524 %------------------------------------------------------------------------
    1525 % --- Executes on button press in get_gridpatch1.
    1526 function get_gridpatch1_Callback(hObject, eventdata, handles)
    1527 %------------------------------------------------------------------------
    1528 filebase=get(handles.RootPath,'String');
    1529 [FileName, PathName, filterindex] = uigetfile( ...
    1530     {'*.grid', ' (*.grid)';
    1531     '*.grid',  '.grid files '; ...
    1532     '*.*', 'All Files (*.*)'}, ...
    1533     'Pick a file',filebase);
    1534 filegrid=fullfile(PathName,FileName);
    1535 set(handles.grid_patch1,'string',filegrid);
    1536 
    1537 
    1538 %------------------------------------------------------------------------
    1539 % --- Executes on button press in get_gridpatch2.
    1540 function get_gridpatch2_Callback(hObject, eventdata, handles)
    1541 %------------------------------------------------------------------------
    1542 
     1463set(hObject,'BackgroundColor',[1 0 1])
     1464set(handles.configSource,'String','NEW')
     1465
     1466% %------------------------------------------------------------------------
     1467% % --- Executes on button press in get_gridpatch1.
     1468% function get_gridpatch1_Callback(hObject, eventdata, handles)
     1469% %------------------------------------------------------------------------
     1470% filebase=get(handles.RootPath,'String');
     1471% [FileName, PathName, filterindex] = uigetfile( ...
     1472%     {'*.grid', ' (*.grid)';
     1473%     '*.grid',  '.grid files '; ...
     1474%     '*.*', 'All Files (*.*)'}, ...
     1475%     'Pick a file',filebase);
     1476% filegrid=fullfile(PathName,FileName);
     1477% set(handles.grid_patch1,'string',filegrid);
     1478% set(hObject,'BackgroundColor',[1 0 1])
    15431479
    15441480%------------------------------------------------------------------------
     
    17421678    set(obj,'Visible','off')
    17431679end
    1744 
     1680set(hObject,'BackgroundColor',[1 0 1])
     1681set(handles.configSource,'String','NEW')
    17451682%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    17461683%%%%%%%%%%%%%%   TEST functions
     
    18721809end
    18731810
    1874 
     1811%------------------------------------------------------------------------
    18751812% --- Executes on button press in TestCiv2.
     1813%------------------------------------------------------------------------
    18761814function TestCiv2_Callback(hObject, eventdata, handles)
     1815drawnow
     1816if get(handles.TestCiv2,'Value')
     1817    set(handles.TestCiv2,'BackgroundColor',[1 1 0])% paint TestCiv1 button to yellow to confirm civ launch
     1818    % TO UPDATE TO UPDATE TO UPDATE TO UPDATE
     1819    [Data,Param.Civ2]=get_param_civ2(handles);
     1820    Grid=civ_matlab(Param);% get the grid of x, y positions set for PIV
     1821    hview_field=view_field(Data); %view the image in the GUI view_field
     1822    set(0,'CurrentFigure',hview_field)
     1823    hhview_field=guihandles(hview_field);
     1824    set(hview_field,'CurrentAxes',hhview_field.PlotAxes)
     1825    ViewData=get(hview_field,'UserData');
     1826    ViewData.CivHandle=handles.civ_input;% indicate the handle of the civ GUI in view_field
     1827    ViewData.PlotAxes.B=imread(Param.Civ1.ImageName_B);%store the second image in the UserData of the GUI view_field
     1828    ViewData.PlotAxes.X=Grid.Civ1_X; %keep the set of points in memeory
     1829    ViewData.PlotAxes.Y=Grid.Civ1_Y;
     1830    set(hview_field,'UserData',ViewData)
     1831    corrfig=findobj(allchild(0),'tag','corrfig');% look for a current figure for image correlation display
     1832    if isempty(corrfig)
     1833        corrfig=figure;
     1834        set(corrfig,'tag','corrfig')
     1835        set(corrfig,'name','image correlation')
     1836        set(corrfig,'DeleteFcn',{@closeview_field})%
     1837        % end
     1838        set(handles.TestCiv1,'BackgroundColor',[1 0 0])
     1839    else
     1840        set(handles.TestCiv1,'BackgroundColor',[1 0 0])% paint button to red
     1841        corrfig=findobj(allchild(0),'tag','corrfig');% look for a current figure for image correlation display
     1842        if ~isempty(corrfig)
     1843            delete(corrfig)
     1844        end
     1845        hview_field=findobj(allchild(0),'tag','view_field');% look for view_field
     1846        if ~isempty(hview_field)
     1847            delete(hview_field)
     1848        end
     1849    end
     1850else
     1851    hview_field=findobj(allchild(0),'Tag','view_field'); %view the image in the GUI view_field
     1852    if ~isempty(hview_field)
     1853        delete(hview_field)
     1854    end     
     1855end
    18771856
    18781857
     
    20402019end
    20412020
    2042 
    2043 % % --- Executes on key press with focus on civ_input and none of its controls.
    2044  function keyboard_callback(hObject,eventdata,handles)
    2045 set(handles.ConfigSource,'String','NEW')% indicate that param have been modified
    20462021
    20472022%------------------------------------------------------------------------
     
    21042079 par_civ1.ImageName_B=ImageName_B;
    21052080
     2081%------------------------------------------------------------------------
    21062082% --- Executes on button press in InportParam.
     2083%------------------------------------------------------------------------
    21072084function InportParam_Callback(hObject, eventdata, handles)
    21082085hseries=findobj(allchild(0),'Tag','series');
     
    21462123end
    21472124
    2148 
    21492125% --- Executes on selection change in iterate.
    21502126function iterate_Callback(hObject, eventdata, handles)
    2151 
     2127   
     2128%------------------------------------------------------------------------
     2129% --- Executes on key press with selection of a uicontrol
     2130%------------------------------------------------------------------------
     2131function keyboard_callback(hObject,eventdata,handles)
     2132   
     2133ListExclude={'CheckCiv1','CheckFix1','CheckPatch1','CheckCiv2','CheckFix2','CheckPatch2','ref_i'};
     2134if isempty(find(strcmp(get(gco,'Tag'),ListExclude),1))% if the selected uicontrol is not in the Exclude list
     2135    set(gco,'BackgroundColor',[1 0 1])
     2136    drawnow
     2137    set(handles.ConfigSource,'String','NEW')% indicate that the configuration is new
     2138end
  • trunk/src/series/civ_series.m

    r833 r851  
    6464    Data.OutputSubDirMode='last'; %select the last subDir in the input table as root of the output subdir name (option 'all'/'first'/'last', 'all' by default)
    6565    Data.OutputFileMode='NbInput_i';% one output file expected per value of i index (used for waitbar)
    66         % check the existence of the first file in the series: suppressed
    67 %     first_j=[];
    68 %     if isfield(Param.IndexRange,'first_j'); first_j=Param.IndexRange.first_j; end
    69 %     last_j=[];
    70 %     if isfield(Param.IndexRange,'last_j'); last_j=Param.IndexRange.last_j; end
    71 %     PairString='';
    72 %     if isfield(Param.IndexRange,'PairString'); PairString=Param.IndexRange.PairString; end
    7366    return
    7467end
     
    571564        end     
    572565       
    573         ncfile=fullfile_uvmat(RootPath_A,OutputDir,RootFile_A,'.nc',NomTypeNc,i1,i2,...
    574             j1,j2);
     566        ncfile=fullfile_uvmat(RootPath_A,OutputDir,RootFile_A,'.nc',NomTypeNc,i1,i2,j1,j2);
    575567        par_civ2.ImageWidth=FileInfo_A.Width;
    576568        par_civ2.ImageHeight=FileInfo_A.Height;
     
    599591            DVDY=zeros(size(par_civ2.Grid,1),1);
    600592        end
    601         NbSubDomain=size(Data.Civ1_SubRange,3);
    602         % get the guess from patch1
     593       
     594         % get the guess from patch1 or patch2 (case 'iterate')
     595        if isfield (par_civ2,'iterate') && strcmp(par_civ2.iterate,'iterate')
     596           SubRange= Data.Civ2_SubRange;
     597           NbCentres=Data.Civ2_NbCentres;
     598           Coord_tps=Data.Civ2_Coord_tps;
     599           U_tps=Data.Civ2_U_tps;
     600           V_tps=Data.Civ2_V_tps;
     601           CivStage=Data.CivStage;
     602           Civ1_Dt=Data.Civ2_Dt;
     603           Data=[];%reinitialise the result structure Data
     604           Data.ListGlobalAttribute={'Conventions','Program','CivStage'};
     605           Data.Conventions='uvmat/civdata';% states the conventions used for the description of field variables and attributes
     606           Data.Program='civ_series';
     607           Data.CivStage=CivStage;
     608           Data.ListVarName={};
     609           Data.VarDimName={};
     610        else
     611           SubRange= Data.Civ1_SubRange;
     612           NbCentres=Data.Civ1_NbCentres;
     613           Coord_tps=Data.Civ1_Coord_tps;
     614           U_tps=Data.Civ1_U_tps;
     615           V_tps=Data.Civ1_V_tps;
     616           Civ1_Dt=Data.Civ1_Dt;
     617        end
     618        NbSubDomain=size(SubRange,3);       
    603619        for isub=1:NbSubDomain% for each sub-domain of Patch1
    604             nbvec_sub=Data.Civ1_NbCentres(isub);% nbre of Civ1 vectors in the subdomain
    605             ind_sel=find(par_civ2.Grid(:,1)>=Data.Civ1_SubRange(1,1,isub) & par_civ2.Grid(:,1)<=Data.Civ1_SubRange(1,2,isub) &...
    606                 par_civ2.Grid(:,2)>=Data.Civ1_SubRange(2,1,isub) & par_civ2.Grid(:,2)<=Data.Civ1_SubRange(2,2,isub));
     620            nbvec_sub=NbCentres(isub);% nbre of Civ vectors in the subdomain
     621            ind_sel=find(par_civ2.Grid(:,1)>=SubRange(1,1,isub) & par_civ2.Grid(:,1)<=SubRange(1,2,isub) &...
     622                par_civ2.Grid(:,2)>=SubRange(2,1,isub) & par_civ2.Grid(:,2)<=SubRange(2,2,isub));
    607623            epoints = par_civ2.Grid(ind_sel,:);% coordinates of interpolation sites
    608             ctrs=Data.Civ1_Coord_tps(1:nbvec_sub,:,isub) ;%(=initial points) ctrs
     624            ctrs=Coord_tps(1:nbvec_sub,:,isub) ;%(=initial points) ctrs
    609625            nbval(ind_sel)=nbval(ind_sel)+1;% records the number of values for eacn interpolation point (in case of subdomain overlap)
    610             EM = tps_eval(epoints,ctrs);
    611             Shiftx(ind_sel)=Shiftx(ind_sel)+EM*Data.Civ1_U_tps(1:nbvec_sub+3,isub);
    612             Shifty(ind_sel)=Shifty(ind_sel)+EM*Data.Civ1_V_tps(1:nbvec_sub+3,isub);
     626            EM = tps_eval(epoints,ctrs);               
     627            Shiftx(ind_sel)=Shiftx(ind_sel)+EM*U_tps(1:nbvec_sub+3,isub);
     628            Shifty(ind_sel)=Shifty(ind_sel)+EM*V_tps(1:nbvec_sub+3,isub);
    613629            if par_civ2.CheckDeformation
    614630                [EMDX,EMDY] = tps_eval_dxy(epoints,ctrs);%2D matrix of distances between extrapolation points epoints and spline centres (=site points) ctrs
    615                 DUDX(ind_sel)=DUDX(ind_sel)+EMDX*Data.Civ1_U_tps(1:nbvec_sub+3,isub);
    616                 DUDY(ind_sel)=DUDY(ind_sel)+EMDY*Data.Civ1_U_tps(1:nbvec_sub+3,isub);
    617                 DVDX(ind_sel)=DVDX(ind_sel)+EMDX*Data.Civ1_V_tps(1:nbvec_sub+3,isub);
    618                 DVDY(ind_sel)=DVDY(ind_sel)+EMDY*Data.Civ1_V_tps(1:nbvec_sub+3,isub);
     631                DUDX(ind_sel)=DUDX(ind_sel)+EMDX*U_tps(1:nbvec_sub+3,isub);
     632                DUDY(ind_sel)=DUDY(ind_sel)+EMDY*U_tps(1:nbvec_sub+3,isub);
     633                DVDX(ind_sel)=DVDX(ind_sel)+EMDX*V_tps(1:nbvec_sub+3,isub);
     634                DVDY(ind_sel)=DVDY(ind_sel)+EMDY*V_tps(1:nbvec_sub+3,isub);
    619635            end
    620636        end
     
    628644        par_civ2.SearchBoxSize(2)=2*iby2+9;
    629645        Civ2_Dt=time(i2+1,j2+1)-time(i1+1,j1+1);
    630         par_civ2.SearchBoxShift=(Civ2_Dt/Data.Civ1_Dt)*[Shiftx(nbval>=1)./nbval(nbval>=1) Shifty(nbval>=1)./nbval(nbval>=1)];
     646        par_civ2.SearchBoxShift=(Civ2_Dt/Civ1_Dt)*[Shiftx(nbval>=1)./nbval(nbval>=1) Shifty(nbval>=1)./nbval(nbval>=1)];
    631647        par_civ2.Grid=[par_civ2.Grid(nbval>=1,1)-par_civ2.SearchBoxShift(:,1)/2 par_civ2.Grid(nbval>=1,2)-par_civ2.SearchBoxShift(:,2)/2];% grid taken at the extrapolated origin of the displacement vectors
    632648        if par_civ2.CheckDeformation
     
    636652            par_civ2.DVDY=DVDY./nbval;
    637653        end
    638         % caluclate velocity data (y and v in indices, reverse to y component)
     654        % calculate velocity data (y and v in indices, reverse to y component)
    639655        [xtable ytable utable vtable ctable F] = civ (par_civ2);
    640656        list_param=(fieldnames(Param.ActionInput.Civ2))';
  • trunk/src/series/extract_rdvision.m

    r844 r851  
    8181%     InputTable(:,2)=ListDir';
    8282    isel=0;
     83    InputTable=Param.InputTable;
    8384    for ilist=1:numel(ListDir)
    8485        ListStructSub=dir(fullfile(RootPath,ListDir{ilist}));
  • trunk/src/series/stereo_civ.m

    r846 r851  
    595595        Data.Civ2_FF(ind_good)=FFres;
    596596        Data.CivStage=Data.CivStage+1;
     597       
     598       
     599% %         
     600% %          % get z from u and v (displacements)
     601% %       
     602%         Data.Xphys=Rangx(1)+(Rangx(2)-Rangx(1))*(Data.Civ2_X-0.5)/(Npx-1);
     603%         Data.Yphys=Rangy(1)+(Rangy(2)-Rangy(1))*(Data.Civ2_Y-0.5)/(Npy-1);
     604%         U=Data.Civ2_U_smooth*(Rangx(2)-Rangx(1))/(Npx-1);
     605%         V=Data.Civ2_V_smooth*(Rangy(2)-Rangy(1))/(Npy-1);
     606%         [Data.Zphys,Data.Civ1_E]=shift2z(Data.Xphys,Data.Yphys,U,V,XmlData);
     607% %         if ~isempty(errormsg)
     608% %             disp_uvmat('ERROR',errormsg,checkrun)
     609% %             return
     610% %         end
     611       
    597612    end
    598613   
     
    821836                utable(ivec)=vector(1)*mesh+shiftx(ivec);
    822837                vtable(ivec)=vector(2)*mesh+shifty(ivec);
    823                 xtable(ivec)=iref+utable(ivec)/2-0.5;% convec flow (velocity taken at the point middle from imgae 1 and 2)
    824                 ytable(ivec)=jref+vtable(ivec)/2-0.5;% and position of pixel 1=0.5 (convention for image coordinates=0 at the edge)
     838%                 xtable(ivec)=iref+utable(ivec)/2-0.5;% convec flow (velocity taken at the point middle from imgae 1 and 2)
     839%                 ytable(ivec)=jref+vtable(ivec)/2-0.5;% and position of pixel 1=0.5 (convention for image coordinates=0 at the edge)
    825840                iref=round(xtable(ivec));% image index for the middle of the vector
    826841                jref=round(ytable(ivec));
     
    10341049error=0;
    10351050
     1051
    10361052%% first image
    10371053Calib_A=XmlData{1}.GeometryCalib;
    10381054R=(Calib_A.R)';
    1039 x_a=xmid- u/2;
    1040 y_a=ymid- v/2;
    1041 z_a=R(7)*x_a+R(8)*y_a+R(9)*Calib_A.SliceCoord(1,3);
    1042 X=(R(1)*x_a+R(2)*y_a+R(3)*Calib_A.SliceCoord(1,3))./z_a;
    1043 Y=(R(4)*x_a+R(5)*y_a+R(6)*Calib_A.SliceCoord(1,3))./z_a;
    1044 A_1_1=R(1)-R(7)*x_a;
    1045 A_1_2=R(2)-R(8)*x_a;
    1046 A_1_3=R(3)-R(9)*x_a;
    1047 A_2_1=R(4)-R(7)*y_a;
    1048 A_2_2=R(5)-R(8)*y_a;
    1049 A_2_3=R(6)-R(9)*y_a;
     1055x_a=xmid-u/2;
     1056y_a=ymid-v/2;
     1057z_a=R(7)*x_a+R(8)*y_a+Calib_A.Tx_Ty_Tz(1,3);
     1058Xa=(R(1)*x_a+R(2)*y_a+Calib_A.Tx_Ty_Tz(1,1))./z_a;
     1059Ya=(R(4)*x_a+R(5)*y_a+Calib_A.Tx_Ty_Tz(1,2))./z_a;
     1060
     1061A_1_1=R(1)-R(7)*Xa;
     1062A_1_2=R(2)-R(8)*Xa;
     1063A_1_3=R(3)-R(9)*Xa;
     1064A_2_1=R(4)-R(7)*Ya;
     1065A_2_2=R(5)-R(8)*Ya;
     1066A_2_3=R(6)-R(9)*Ya;
    10501067Det=A_1_1.*A_2_2-A_1_2.*A_2_1;
    10511068Dxa=(A_1_2.*A_2_3-A_2_2.*A_1_3)./Det;
     
    10531070
    10541071%% second image
    1055 Calib_A=XmlData{1}.GeometryCalib;
    1056 R=(Calib_A.R)';
    1057 x_a=xmid+ u/2;
    1058 y_a=ymid+ v/2;
    1059 z_a=R(7)*x_a+R(8)*y_a+R(9)*Calib_A.SliceCoord(1,3);
    1060 X=(R(1)*x_a+R(2)*y_a+R(3)*Calib_A.SliceCoord(1,3))./z_a;
    1061 Y=(R(4)*x_a+R(5)*y_a+R(6)*Calib_A.SliceCoord(1,3))./z_a;
    1062 A_1_1=R(1)-R(7)*x_a;
    1063 A_1_2=R(2)-R(8)*x_a;
    1064 A_1_3=R(3)-R(9)*x_a;
    1065 A_2_1=R(4)-R(7)*y_a;
    1066 A_2_2=R(5)-R(8)*y_a;
    1067 A_2_3=R(6)-R(9)*y_a;
    1068 Det=A_1_1.*A_2_2-A_1_2.*A_2_1;
    1069 Dxb=(A_1_2.*A_2_3-A_2_2.*A_1_3)./Det;
    1070 Dyb=(A_2_1.*A_1_3-A_1_1.*A_2_3)./Det;
     1072Calib_B=XmlData{2}.GeometryCalib;
     1073R=(Calib_B.R)';
     1074x_b=xmid+ u/2;
     1075y_b=ymid+ v/2;
     1076z_b=R(7)*x_b+R(8)*y_b+Calib_B.Tx_Ty_Tz(1,3);
     1077Xb=(R(1)*x_b+R(2)*y_b+Calib_B.Tx_Ty_Tz(1,1))./z_b;
     1078Yb=(R(4)*x_b+R(5)*y_b+Calib_B.Tx_Ty_Tz(1,2))./z_b;
     1079B_1_1=R(1)-R(7)*Xb;
     1080B_1_2=R(2)-R(8)*Xb;
     1081B_1_3=R(3)-R(9)*Xb;
     1082B_2_1=R(4)-R(7)*Yb;
     1083B_2_2=R(5)-R(8)*Yb;
     1084B_2_3=R(6)-R(9)*Yb;
     1085Det=B_1_1.*B_2_2-B_1_2.*B_2_1;
     1086Dxb=(B_1_2.*B_2_3-B_2_2.*B_1_3)./Det;
     1087Dyb=(B_2_1.*B_1_3-B_1_1.*B_2_3)./Det;
    10711088
    10721089%% result
     
    10741091error=((Dyb-Dya).*u-(Dxb-Dxa).*v)./Den;
    10751092z=((Dxb-Dxa).*u-(Dyb-Dya).*v)./Den;
     1093
  • trunk/src/uvmat.m

    r847 r851  
    45224522    FileType='civx';
    45234523end
     4524imin=1;
    45244525switch FileType
    45254526    case 'civx'
     
    45464547        elseif isequal(Civ,4) || isequal(Civ,5)
    45474548            imax=3;
    4548         elseif isequal(Civ,6) %patch2
     4549        elseif Civ==6 %patch2
    45494550            imax=4;
    4550         end
    4551 end
    4552 menu=menu(1:imax);
     4551        else
     4552            imax=4;imin=3;
     4553        end
     4554end
     4555menu=menu(imin:imax);
    45534556
    45544557%------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.