Changeset 851
- Timestamp:
- Jan 19, 2015, 9:29:28 PM (10 years ago)
- Location:
- trunk/src
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/geometry_calib.m
r847 r851 1273 1273 iline=str2num(get(handles.CoordLine,'String')); 1274 1274 xx=double(get(handles.geometry_calib,'CurrentCharacter'));%get the keyboard character 1275 if ismember(xx,[28 29 30 31])% directional arrow 1275 if ismember(xx,[28 29 30 31])% directional arrow 1276 1276 Coord=get(handles.ListCoord,'Data'); 1277 1277 switch xx … … 1287 1287 else 1288 1288 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 1301 end 1291 1302 1292 1303 %------------------------------------------------------------------------ -
trunk/src/msgbox_uvmat.m
r847 r851 8 8 % 9 9 %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 box13 % if title='CONFIMATION'', 'ERROR', 'WARNING','RULER' the figure remains opened until a button 'OK' is pressed14 % 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 requested16 % if title='WAITING...' the figure remains open until the program deletes it10 % 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 17 17 % display: displayed text 18 18 % default_answer: default answer in the edit box (only used with title='INPUT_TXT') … … 108 108 testCancel=0; %no cancel button 109 109 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 110 114 case 'RULER' 111 115 icontype=''; -
trunk/src/read_civdata.m
r822 r851 209 209 end 210 210 if isempty(vel_type)||strcmp(vel_type,'*') 211 vel_type='filter2';% case CivStage >=6 211 212 switch CivStage 212 case {6} %filter2 available213 vel_type='filter2';214 213 case {4,5}% civ2 available but not filter2 215 214 if strcmp(ProjModeRequest,'derivatives')% derivatives needed -
trunk/src/series.m
r845 r851 132 132 ActionList={'check_data_files';'aver_stat';'time_series';'civ_series';'merge_proj'};% WARNING: fits with nb_builtin_ACTION=4 in ActionName_callback 133 133 NbBuiltinAction=numel(ActionList); 134 set(handles.Action,'UserData',NbBuiltinAction) 134 135 [path_series,name,ext]=fileparts(which('series'));% path to the GUI series 135 136 path_series_fct=fullfile(path_series,'series');%path of the functions in subdirectroy 'series' 136 137 ActionExtList={'.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 paths138 ActionPathList=cell(NbBuiltinAction,1);%initiate the cell matrix of Action fct paths 138 139 ActionPathList(:)={path_series_fct}; %set the default path to series fcts to all list members 139 140 RunModeList={'local';'background'};% default choice of extensions (Matlab fct .m or compiled version .sh) … … 148 149 set(handles.RunMode,'String',RunModeList) 149 150 150 %% list of builtin transform functions in the me bu TransformName151 %% list of builtin transform functions in the menu TransformName 151 152 TransformList={'';'sub_field';'phys';'phys_polar'};% WARNING: must fit with the corresponding menu in uvmat and nb_builtin_transform=4 in TransformName_callback 152 153 NbBuiltinTransform=numel(TransformList); … … 167 168 end 168 169 end 169 %get the list of previous cam apigns in the upper bar menu Open campaign170 %get the list of previous campaigns in the upper bar menu Open campaign 170 171 if isfield(h,'MenuCampaign') 171 172 for ifile=1:min(length(h.MenuCampaign),5) … … 526 527 iline=eventdata.Indices(1); 527 528 end 528 set(handles.InputTable,'UserData',iline); 529 set(handles.InputLine,'String',num2str(iline)); 530 % set(handles.InputTable,'UserData',iline); 529 531 530 532 %------------------------------------------------------------------------ … … 535 537 xx=double(get(handles.series,'CurrentCharacter')); %get the keyboard character 536 538 if ~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 553 550 end 554 551 … … 609 606 %------------------------------------------------------------------------ 610 607 % --- 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 %------------------------------------------------------------------------ 614 609 % INPUT: 615 610 % handles: handles of elements in the GUI … … 618 613 % or 'one': refresh the list 619 614 % 'append': add a new line to the input table 615 function errormsg=display_file_name(handles,Param,iview) 616 620 617 set(handles.REFRESH,'BackgroundColor',[1 1 0])% set REFRESH button to yellow color (indicate activation) 621 618 drawnow … … 683 680 iview=size(InputTable,1)+1;% the next line in InputTable becomes the current line 684 681 InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}]; 685 % SeriesData.ListViewMenu(iview)=zeros(1,nbview)686 682 elseif strcmp(iview,'one') % refresh the list of input file series 687 683 iview=1; %the first line in InputTable becomes the current line … … 702 698 SeriesData.FileInfo={}; 703 699 SeriesData.Time={}; 700 end 701 if iview >1 702 set(handles.InputLine,'String',num2str(iview)) 704 703 end 705 704 set(handles.InputTable,'Data',InputTable) … … 1487 1486 check_create=1; %need to create the result directory by default 1488 1487 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']); 1490 1489 if strcmp(answer,'Cancel') 1491 1490 set(handles.RUN,'backgroundcolor',[1 0 0]) … … 1818 1817 Param=rmfield(Param,'Pairs'); %info Pairs not needed for output 1819 1818 end 1819 Param.IndexRange.TimeSource=Param.IndexRange.TimeTable{end,1}; 1820 1820 Param.IndexRange=rmfield(Param.IndexRange,'TimeTable'); 1821 1821 empty_line=false(size(Param.InputTable,1),1); … … 1846 1846 drawnow 1847 1847 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 1848 1855 %% 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)1856 NbBuiltinAction=get(handles.Action,'UserData'); %nbre of functions initially proposed in the menu ActionName (as defined in the Opening fct of series) 1850 1857 ActionList=get(handles.ActionName,'String');% list menu fields 1851 1858 ActionIndex=get(handles.ActionName,'Value'); … … 1870 1877 return 1871 1878 end 1872 [ ActionPath,ActionName,ActionExt]=fileparts(FileName);1879 [tild,ActionName,ActionExt]=fileparts(FileName); 1873 1880 1874 1881 % insert the choice in the menu ActionName 1875 1882 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 1877 1888 ActionIndex= length(ActionList); 1878 1889 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]; 1880 1891 end 1881 1892 … … 1885 1896 if isempty(ActionExtIndex) 1886 1897 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 1892 1899 1893 1900 % 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 menu1895 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,:)=[]; 1898 1905 ActionIndex=ActionIndex-nbremove; 1899 1906 end … … 1902 1909 set(handles.ActionName,'Value',ActionIndex) 1903 1910 set(handles.ActionName,'String',ActionList) 1911 set(handles.ActionName,'UserData',ActionPathList); 1904 1912 set(handles.ActionExt,'Value',ActionExtIndex) 1905 ActionPathList{ActionIndex,ActionExtIndex}=PathName;1913 % ActionPathList{ActionIndex,ActionExtIndex}=PathName; 1906 1914 1907 1915 %record the user defined menu additions in personal file profil_perso 1908 1916 dir_perso=prefdir; 1909 1917 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 1910 if nb_builtin_ACTION+1<=numel(ActionList)-11911 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); 1913 1921 ActionExtListUser={}; 1914 1922 if numel(ActionExtList)>2 … … 2259 2267 set(handles.series,'UserData',SeriesData) 2260 2268 set(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 % end2269 2269 2270 2270 %------------------------------------------------------------------------ … … 2803 2803 function MenuImportConfig_Callback(hObject, eventdata, handles) 2804 2804 2805 %% use a starting file name for browserr2805 %% use a browser to choose the xml file containing the processing config 2806 2806 InputTable=get(handles.InputTable,'Data'); 2807 oldfile=InputTable{1,1}; 2807 oldfile=InputTable{1,1};%current path in InputTable 2808 2808 if isempty(oldfile) 2809 2809 % use a file name stored in prefdir … … 2818 2818 end 2819 2819 filexml=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 2820 if 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 2823 Param=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) 2826 if 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 2833 end 2834 Param.Action.RUN=0; %desactivate the input RUN=1 2835 2836 fill_GUI(Param,handles.series)% fill the elements of the GUI series with the input parameters 2837 SeriesData=get(handles.series,'UserData'); 2838 if 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') 2844 end 2845 if 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; 2850 end 2851 if isfield(Param,'ProjObject') %introduce projection object if relevant 2852 SeriesData.ProjObject=Param.ProjObject; 2853 end 2854 set(handles.series,'UserData',SeriesData) 2855 if 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') 2860 else 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') 2866 end 2867 set(handles.REFRESH,'BackgroundColor',[1 0 1]); %paint REFRESH button in magenta to indicate that it should be activated 2937 2868 2938 2869 … … 3127 3058 ActionList=get(handles.ActionName,'String'); 3128 3059 ActionName=ActionList{get(handles.ActionName,'Value')}; 3129 % TransformPath='';3130 % if ~isempty(get(handles.ActionExt,'UserData'))3131 % TransformPath=get(handles.ActionExt,'UserData');3132 % end3133 % 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 Action3144 % % 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 % end3150 % else3151 % 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.datenum3154 % set(handles.ActionExt,'BackgroundColor',[1 1 0])3155 % drawnow3156 % 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 Action3161 % % 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 % end3167 % end3168 % end3169 % set(handles.ActionExt,'BackgroundColor',[1 1 1])3170 % set(handles.series,'Pointer','arrow') % set the mouse pointer to 'watch3171 % end3172 3173 3060 3174 3061 function num_NbProcess_Callback(hObject, eventdata, handles) … … 3257 3144 end 3258 3145 ref_i=str2num(get(handles.num_first_i,'String')); 3259 ref_j=str2num(get(handles.num_first_j,'String')); 3146 ref_j=1;%default 3147 if strcmp(get(handles.num_first_j,'String'),'Visible') 3148 ref_j=str2num(get(handles.num_first_j,'String')); 3149 end 3260 3150 [ModeMenu,ModeValue]=update_mode(SeriesData.i1_series{iview},SeriesData.i2_series{iview},SeriesData.j2_series{iview}); 3261 3151 displ_pair=update_listpair(SeriesData.i1_series{iview},SeriesData.i2_series{iview},SeriesData.j1_series{iview},SeriesData.j2_series{iview},ModeMenu{ModeValue},... … … 3375 3265 Mode_Callback([],[]) 3376 3266 3377 3267 %------------------------------------------------------------------------ 3378 3268 % --- Executes on button press in ClearLine. 3269 %------------------------------------------------------------------------ 3379 3270 function ClearLine_Callback(hObject, eventdata, handles) 3380 % hObject handle to ClearLine (see GCBO)3381 % eventdata reserved - to be defined in a future version of MATLAB3382 % handles structure with handles and user data (see GUIDATA)3383 iline=get(handles.InputTable,'UserData');3384 3271 InputTable=get(handles.InputTable,'Data'); 3385 InputTable(iline,:)=[]; 3386 set(handles.InputTable,'Data',InputTable); 3272 iline=str2double(get(handles.InputLine,'String')); 3273 if size(InputTable,1)>1 3274 InputTable(iline,:)=[];% suppress the current line if not the first 3275 set(handles.InputTable,'Data',InputTable); 3276 end -
trunk/src/series/civ_input.m
r850 r851 60 60 set(hObject,'WindowButtonDownFcn',{'mouse_down'}) % allows mouse action with right button (zoom for uicontrol display) 61 61 set(hObject,'WindowKeyPressFcn',{@keyboard_callback,handles})%set keyboard action function 62 %set(hObject,'KeyPressFcn',{@KeyPressFcn,handles})%set keyboard action function 62 63 set(handles.ref_i,'KeyPressFcn',{@ref_i_KeyPressFcn,handles})%set keyboard action function 64 set(handles.ref_j,'KeyPressFcn',{@ref_i_KeyPressFcn,handles})%set keyboard action function 63 65 %set(hObject,'WindowKeyPressFcn',{'keyboard_callback',handles})%set keyboard action function 64 66 hseries=findobj(allchild(0),'Tag','series');% find the parent GUI 'series' … … 106 108 ind_opening=0;%default 107 109 NomTypeNc=''; 110 NomTypeImaA=NomTypeInput; 111 iview_image=1;%line # for the input images 108 112 switch FileType 109 113 case {'image','multimage','video','mmreader','netcdf'} 110 NomTypeImaA=NomTypeInput;111 iview_image=1;%line # for the input images114 % NomTypeImaA=NomTypeInput; 115 % iview_image=1;%line # for the input images 112 116 case 'civdata' 113 117 if ~strcmp(Param.Action.ActionName,'civ_series') 114 118 msgbox_uvmat('ERROR','bad input data file: open an image or a nc file from civ_series') 115 %return119 return 116 120 end 117 121 NomTypeNc=NomTypeInput; … … 122 126 set(handles.ListCompareMode,'Value',1) 123 127 end 124 % FileInput=SeriesData.RefFile{1};125 128 [Data,tild,tild,errormsg]=nc2struct(FileInfo.FileName,[]); 126 129 if ~isempty(errormsg) … … 128 131 return 129 132 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 132 135 if isfield(Data,'Civ2_ImageA') 133 136 [PathCiv2_ImageA,Civ2_ImageA,FileExtA]=fileparts(Data.Civ2_ImageA); … … 147 150 return 148 151 end 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 % end153 152 154 153 %% reinitialise menus … … 195 194 end 196 195 end 197 % CivInputData.MaxIndex_i=MaxIndex_i;198 % CivInputData.MaxIndex_j=MaxIndex_j;199 % CivInputData.MinIndex_i=MinIndex_i;200 % CivInputData.MinIndex_j=MinIndex_j;201 196 if ~isfield(Param.IndexRange,'first_j')||isequal(MaxIndex_j,MinIndex_j)% no possibility of j pairs 202 197 set(handles.ListPairMode,'Value',1) … … 227 222 TimeUnit=Param.IndexRange.TimeUnit; 228 223 end 229 if isfield(SeriesData,'TimeSource')230 set(handles.ImaDoc,'String',SeriesData.TimeSource)231 end224 % if isfield(SeriesData,'TimeSource') 225 % set(handles.TimeSource,'String',SeriesData.TimeSource) 226 % end 232 227 if isfield(SeriesData,'GeometryCalib') 233 228 tsai=SeriesData.GeometryCalib; … … 250 245 MaxIndex_i=min(size(time,1),MaxIndex_i);%possibly adjust the max index according to time data 251 246 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); 248 else 249 set(handles.TimeSource,'String',''); %xml file not used for timing 254 250 TimeUnit='frame'; 255 251 time=ones(MaxIndex_j-MinIndex_j+1,1)*(MinIndex_i:MaxIndex_i); … … 264 260 set(handles.SearchRange,'UserData', pxcm_search); 265 261 262 % indicate the min and max indices i and j on the GUI 263 set(handles.MinIndex_i,'String',num2str(MinIndex_i)) 264 set(handles.MaxIndex_i,'String',num2str(MaxIndex_i)) 265 set(handles.MinIndex_j,'String',num2str(MinIndex_j)) 266 set(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 270 ListOptions={'CheckCiv1', 'CheckFix1' 'CheckPatch1', 'CheckCiv2', 'CheckFix2', 'CheckPatch2'}; 271 checkbox=zeros(size(ListOptions));%default 272 checkrefresh=0; 273 if 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 282 else %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 303 end 304 266 305 %% 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 data306 if ~checkrefresh && isfield(Param,'ActionInput')&& strcmp(Param.ActionInput.Program,Param.Action.ActionName)% the program fits with the stored data 268 307 fill_GUI(Param.ActionInput,hObject);%fill the GUI with the parameters retrieved from the input Param 269 308 hcheckgrid=findobj(handles.civ_input,'Tag','CheckGrid'); … … 283 322 end 284 323 end 285 % indicate the min and max indices i and j on the GUI286 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 opened292 ListOptions={'CheckCiv1', 'CheckFix1' 'CheckPatch1', 'CheckCiv2', 'CheckFix2', 'CheckPatch2'};293 checkbox=zeros(size(ListOptions));%default294 if ind_opening==0 %case of image opening, start with Civ1295 for index=1:numel(ListOptions)296 checkbox(index)=get(handles.(ListOptions{index}),'Value');297 end298 index_max=find(checkbox, 1, 'last' );299 if isempty(index_max),index_max=1;end300 for index=1:index_max301 set(handles.(ListOptions{index}),'Value',1)% select all operations starting from CIV1302 end303 else %case of netcdf file opening, start with the stage read in the file304 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 file307 end308 set(handles.ConfigSource,'String',FileInfo.FileName);309 set(handles.(ListOptions{min(ind_opening+1,6)}),'value',1)310 for index = ind_opening+2:6311 set(handles.(ListOptions{index}),'value',0)312 end313 end314 324 315 325 %% set the reference indices from the input file indices 326 if ~isfield(Param.ActionInput,'ConfigSource') 316 327 update_CivOptions(handles,ind_opening)% fill the menu of possible pairs 328 end 317 329 318 330 %% list the possible index pairs, depending on the option set in ListPairMode … … 346 358 delete(handles.civ_input); 347 359 end 360 361 %------------------------------------------------------------------------ 362 % --- Executes on button press in SetDefaultParam. 363 %------------------------------------------------------------------------ 364 function SetDefaultParam_Callback(hObject, eventdata, handles) 365 366 hseries=findobj(allchild(0),'Name','series');% look for the GUI series 367 hhseries=guidata(hseries);%handles of elements in the GUI series 368 SeriesData=get(hseries,'UserData');%read parameters on the GUI series 369 if isfield (SeriesData,'ActionInput') 370 SeriesData=rmfield(SeriesData,'ActionInput');% remove recorded civ parameters 371 end 372 set(hseries,'UserData',SeriesData) 373 series('ActionName_Callback',hObject,eventdata,hhseries); % 348 374 349 375 % ----------------------------------------------------------------------- … … 438 464 function update_CivOptions(handles,opening) 439 465 %------------------------------------------------------------------------ 466 if opening>0 467 set(handles.CheckCiv2,'UserData',opening)% store the info on the current status of the civ processing 468 end 440 469 checkbox=zeros(1,6); 441 470 checkbox(1)=get(handles.CheckCiv1,'Value'); … … 445 474 checkbox(5)=get(handles.CheckFix2,'Value'); 446 475 checkbox(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 civ449 476 if opening==0 450 477 errormsg=find_netcpair_civ(handles,1); % select the available netcdf files … … 453 480 end 454 481 end 455 if max(checkbox(4:6)) % case of civ2 pair choice needed482 if max(checkbox(4:6))>0% case of civ2 pair choice needed 456 483 set(handles.TitlePairCiv2,'Visible','on') 457 484 set(handles.ListPairCiv2,'Visible','on') … … 465 492 set(handles.ListPairCiv2,'Visible','off') 466 493 end 494 if 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') 496 else 497 set(handles.iterate,'Visible','off') 498 end 499 500 %% set the visibility of the different panels 467 501 options={'Civ1','Fix1','Patch1','Civ2','Fix2','Patch2'}; 468 502 for ilist=1:length(options) … … 479 513 %------------------------------------------------------------------------ 480 514 481 handles.output.ActionInput=read_GUI(handles.civ_input); 515 ActionInput=read_GUI(handles.civ_input); 516 517 %% correct inpput inconsistencies 518 if 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 524 end 525 if 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 531 end 532 533 handles.output.ActionInput=ActionInput; 482 534 % correct mask or grid name for Windows system (replace '\' by '/') 483 535 if isfield(handles.output.ActionInput,'Civ1') … … 500 552 uiresume(handles.civ_input); 501 553 502 % %------------------------------------------------------------------------503 % % --- determine the list of index pairs of processing file504 % 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 civ1511 % if isempty(str_civ1)||isequal(str_civ1,'')512 % msgbox_uvmat('ERROR','no image pair selected for civ1')513 % return514 % end515 % 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 % end521 % str_civ2=list_civ2{index_civ2};%string defining the image pairs for civ2522 %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 numbers526 % 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 number535 % lastfield=str2double(get(handles.MaxIndex_i,'String'));536 % if isnan(lastfield)537 % indsel=find((i1_civ1 >= 1)&(i1_civ2 >= 1));538 % else539 % indsel=find((i2_civ1 <= lastfield)&(i2_civ2 <= lastfield)&(i1_civ1 >= 1)&(i1_civ2 >= 1));540 % end541 % if length(indsel)>=1542 % firstind=indsel(1);543 % lastind=indsel(end);544 % set(handles.MinIndex_i,'String',num2str(ref_i(firstind)))%update the display of first and last fields545 % 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 % end552 % elseif isequal (mode,'series(Dj)')553 % lastfield_j=str2double(get(handles.MaxIndex_j,'String'));554 % i1_civ1=ref_i;% set of first image numbers555 % 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 number563 % if isnan(lastfield_j)564 % indsel=find((j1_civ1 >= 1)&(j1_civ2 >= 1));565 % else566 % indsel=find((j2_civ1 <= lastfield_j)&(j2_civ2 <= lastfield_j)&(j1_civ1 >= 1)&(j1_civ2 >= 1));567 % end568 % if length(indsel)>=1569 % firstind=indsel(1);570 % lastind=indsel(end);571 % set(handles.MinIndex_j,'String',num2str(ref_j(firstind)))%update the display of first and last fields572 % 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 % end579 % 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 % end599 554 600 555 %------------------------------------------------------------------------ … … 794 749 function ListPairCiv2_Callback(hObject, eventdata, handles) 795 750 %------------------------------------------------------------------------ 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 829 752 830 753 %------------------------------------------------------------------------ … … 839 762 errormsg=find_netcpair_civ( handles,2); 840 763 end 841 if ~isempty(errormsg) 764 if isempty(errormsg) 765 set(handles.ref_i,'BackgroundColor',[1 1 1]) 766 else 842 767 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 768 end 769 770 function ref_i_KeyPressFcn(hObject, eventdata, handles) 771 set(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]) 863 793 %------------------------------------------------------------------------ 864 794 % determine the menu for checkciv1 pairs depending on existing netcdf file at the middle of … … 1096 1026 index=get(handles.ListPairCiv1,'Value'); 1097 1027 pair_string=list_pair{index}; 1098 time=get(handles. ImaDoc,'UserData'); %get the set of times1028 time=get(handles.TimeSource,'UserData'); %get the set of times 1099 1029 pxcm=get(handles.SearchRange,'UserData'); 1100 1030 mode_list=get(handles.ListPairMode,'String'); … … 1143 1073 end 1144 1074 1075 %------------------------------------------------------------------------ 1076 % --- Executes on button press in CheckMask. 1077 function num_CorrSmooth_Callback(hObject, eventdata, handles) 1078 set(hObject,'BackgroundColor',[1 0 1]) 1079 set(handles.configSource,'String','NEW') 1080 1081 %------------------------------------------------------------------------ 1082 1145 1083 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1146 1084 % Callbacks in the uipanel Fix1 1147 1085 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1148 1086 %------------------------------------------------------------------------ 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 1135 function get_mask_civ2_Callback(hObject, eventdata, handles) 1151 1136 %------------------------------------------------------------------------ 1152 1137 maskval=get(handles.CheckMask,'Value'); … … 1180 1165 set(handles.CheckMask,'Value',0) 1181 1166 set(handles.CheckMask,'Value',0) 1182 set(handles.CheckMask,'Value',0)1183 else1184 %set(handles.CheckMask,'Value',1)1185 set(handles.CheckMask,'Value',1)1186 end1187 set(handles.Mask,'String',mask_displ)1188 set(handles.Mask,'String',mask_displ)1189 set(handles.Mask,'String',mask_displ)1190 end1191 1192 %------------------------------------------------------------------------1193 % --- Executes on button press in CheckMask: select box for mask option1194 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 else1200 mask_displ='no mask'; %default1201 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 series1206 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 end1211 end1212 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 end1222 end1223 if isequal(mask_displ,'no mask')1224 set(handles.CheckMask,'Value',0)1225 set(handles.CheckMask,'Value',0)1226 1167 else 1227 1168 set(handles.CheckMask,'Value',1) 1228 1169 end 1229 1170 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 1171 end 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 1269 1209 1270 1210 %------------------------------------------------------------------------ … … 1475 1415 end 1476 1416 end 1417 set(hObject,'BackgroundColor',[1 0 1]) 1418 set(handles.configSource,'String','NEW') 1477 1419 1478 1420 %------------------------------------------------------------------------ … … 1491 1433 hhseries=guidata(hseries); 1492 1434 InputTable=get(hhseries.InputTable,'Data'); 1493 1435 ind_A=1;% line index of the (first) image series 1494 1436 if strcmp(InputTable{1,5},'.nc'); 1495 1437 ind_A=2; 1496 1438 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 1498 1440 if isequal(flag_mask,1) 1499 1441 filemask=[num2str(nbslice) 'mask']; 1500 1442 testmask=1; 1501 else % browse for a mask 1502 filemask=get(hObject,'UserData');%look for previous mask name stored as UserData1503 if exist(filemask,'file')1504 filebase=filemask;1505 end1506 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'); 1507 1449 set(hObject,'UserData',filemask);%store for future use 1508 1450 if ~isempty(filemask) … … 1512 1454 end 1513 1455 if 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) 1517 1458 set(handles.CheckMask,'Value',1) 1518 % end1519 1459 else 1520 1460 set(hObject,'Value',0); 1521 1461 set(handle_txtbox,'Visible','off') 1522 1462 end 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 1463 set(hObject,'BackgroundColor',[1 0 1]) 1464 set(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]) 1543 1479 1544 1480 %------------------------------------------------------------------------ … … 1742 1678 set(obj,'Visible','off') 1743 1679 end 1744 1680 set(hObject,'BackgroundColor',[1 0 1]) 1681 set(handles.configSource,'String','NEW') 1745 1682 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1746 1683 %%%%%%%%%%%%%% TEST functions … … 1872 1809 end 1873 1810 1874 1811 %------------------------------------------------------------------------ 1875 1812 % --- Executes on button press in TestCiv2. 1813 %------------------------------------------------------------------------ 1876 1814 function TestCiv2_Callback(hObject, eventdata, handles) 1815 drawnow 1816 if 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 1850 else 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 1855 end 1877 1856 1878 1857 … … 2040 2019 end 2041 2020 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 modified2046 2021 2047 2022 %------------------------------------------------------------------------ … … 2104 2079 par_civ1.ImageName_B=ImageName_B; 2105 2080 2081 %------------------------------------------------------------------------ 2106 2082 % --- Executes on button press in InportParam. 2083 %------------------------------------------------------------------------ 2107 2084 function InportParam_Callback(hObject, eventdata, handles) 2108 2085 hseries=findobj(allchild(0),'Tag','series'); … … 2146 2123 end 2147 2124 2148 2149 2125 % --- Executes on selection change in iterate. 2150 2126 function iterate_Callback(hObject, eventdata, handles) 2151 2127 2128 %------------------------------------------------------------------------ 2129 % --- Executes on key press with selection of a uicontrol 2130 %------------------------------------------------------------------------ 2131 function keyboard_callback(hObject,eventdata,handles) 2132 2133 ListExclude={'CheckCiv1','CheckFix1','CheckPatch1','CheckCiv2','CheckFix2','CheckPatch2','ref_i'}; 2134 if 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 2138 end -
trunk/src/series/civ_series.m
r833 r851 64 64 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) 65 65 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: suppressed67 % first_j=[];68 % if isfield(Param.IndexRange,'first_j'); first_j=Param.IndexRange.first_j; end69 % last_j=[];70 % if isfield(Param.IndexRange,'last_j'); last_j=Param.IndexRange.last_j; end71 % PairString='';72 % if isfield(Param.IndexRange,'PairString'); PairString=Param.IndexRange.PairString; end73 66 return 74 67 end … … 571 564 end 572 565 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); 575 567 par_civ2.ImageWidth=FileInfo_A.Width; 576 568 par_civ2.ImageHeight=FileInfo_A.Height; … … 599 591 DVDY=zeros(size(par_civ2.Grid,1),1); 600 592 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); 603 619 for isub=1:NbSubDomain% for each sub-domain of Patch1 604 nbvec_sub= Data.Civ1_NbCentres(isub);% nbre of Civ1vectors in the subdomain605 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)); 607 623 epoints = par_civ2.Grid(ind_sel,:);% coordinates of interpolation sites 608 ctrs= Data.Civ1_Coord_tps(1:nbvec_sub,:,isub) ;%(=initial points) ctrs624 ctrs=Coord_tps(1:nbvec_sub,:,isub) ;%(=initial points) ctrs 609 625 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); 613 629 if par_civ2.CheckDeformation 614 630 [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); 619 635 end 620 636 end … … 628 644 par_civ2.SearchBoxSize(2)=2*iby2+9; 629 645 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)]; 631 647 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 632 648 if par_civ2.CheckDeformation … … 636 652 par_civ2.DVDY=DVDY./nbval; 637 653 end 638 % cal uclate velocity data (y and v in indices, reverse to y component)654 % calculate velocity data (y and v in indices, reverse to y component) 639 655 [xtable ytable utable vtable ctable F] = civ (par_civ2); 640 656 list_param=(fieldnames(Param.ActionInput.Civ2))'; -
trunk/src/series/extract_rdvision.m
r844 r851 81 81 % InputTable(:,2)=ListDir'; 82 82 isel=0; 83 InputTable=Param.InputTable; 83 84 for ilist=1:numel(ListDir) 84 85 ListStructSub=dir(fullfile(RootPath,ListDir{ilist})); -
trunk/src/series/stereo_civ.m
r846 r851 595 595 Data.Civ2_FF(ind_good)=FFres; 596 596 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 597 612 end 598 613 … … 821 836 utable(ivec)=vector(1)*mesh+shiftx(ivec); 822 837 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) 825 840 iref=round(xtable(ivec));% image index for the middle of the vector 826 841 jref=round(ytable(ivec)); … … 1034 1049 error=0; 1035 1050 1051 1036 1052 %% first image 1037 1053 Calib_A=XmlData{1}.GeometryCalib; 1038 1054 R=(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; 1055 x_a=xmid-u/2; 1056 y_a=ymid-v/2; 1057 z_a=R(7)*x_a+R(8)*y_a+Calib_A.Tx_Ty_Tz(1,3); 1058 Xa=(R(1)*x_a+R(2)*y_a+Calib_A.Tx_Ty_Tz(1,1))./z_a; 1059 Ya=(R(4)*x_a+R(5)*y_a+Calib_A.Tx_Ty_Tz(1,2))./z_a; 1060 1061 A_1_1=R(1)-R(7)*Xa; 1062 A_1_2=R(2)-R(8)*Xa; 1063 A_1_3=R(3)-R(9)*Xa; 1064 A_2_1=R(4)-R(7)*Ya; 1065 A_2_2=R(5)-R(8)*Ya; 1066 A_2_3=R(6)-R(9)*Ya; 1050 1067 Det=A_1_1.*A_2_2-A_1_2.*A_2_1; 1051 1068 Dxa=(A_1_2.*A_2_3-A_2_2.*A_1_3)./Det; … … 1053 1070 1054 1071 %% 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;1072 Calib_B=XmlData{2}.GeometryCalib; 1073 R=(Calib_B.R)'; 1074 x_b=xmid+ u/2; 1075 y_b=ymid+ v/2; 1076 z_b=R(7)*x_b+R(8)*y_b+Calib_B.Tx_Ty_Tz(1,3); 1077 Xb=(R(1)*x_b+R(2)*y_b+Calib_B.Tx_Ty_Tz(1,1))./z_b; 1078 Yb=(R(4)*x_b+R(5)*y_b+Calib_B.Tx_Ty_Tz(1,2))./z_b; 1079 B_1_1=R(1)-R(7)*Xb; 1080 B_1_2=R(2)-R(8)*Xb; 1081 B_1_3=R(3)-R(9)*Xb; 1082 B_2_1=R(4)-R(7)*Yb; 1083 B_2_2=R(5)-R(8)*Yb; 1084 B_2_3=R(6)-R(9)*Yb; 1085 Det=B_1_1.*B_2_2-B_1_2.*B_2_1; 1086 Dxb=(B_1_2.*B_2_3-B_2_2.*B_1_3)./Det; 1087 Dyb=(B_2_1.*B_1_3-B_1_1.*B_2_3)./Det; 1071 1088 1072 1089 %% result … … 1074 1091 error=((Dyb-Dya).*u-(Dxb-Dxa).*v)./Den; 1075 1092 z=((Dxb-Dxa).*u-(Dyb-Dya).*v)./Den; 1093 -
trunk/src/uvmat.m
r847 r851 4522 4522 FileType='civx'; 4523 4523 end 4524 imin=1; 4524 4525 switch FileType 4525 4526 case 'civx' … … 4546 4547 elseif isequal(Civ,4) || isequal(Civ,5) 4547 4548 imax=3; 4548 elseif isequal(Civ,6)%patch24549 elseif Civ==6 %patch2 4549 4550 imax=4; 4550 end 4551 end 4552 menu=menu(1:imax); 4551 else 4552 imax=4;imin=3; 4553 end 4554 end 4555 menu=menu(imin:imax); 4553 4556 4554 4557 %------------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.