1 | %'civ_input': function associated with the GUI 'civ_input.fig' to set the input parameters for civ_series |
---|
2 | %------------------------------------------------------------------------ |
---|
3 | % function ParamOut = civ_input(Param) |
---|
4 | % |
---|
5 | % OUPUT: |
---|
6 | % ParamOut: Matlab structure containing the parameters set by the GUI civ_input |
---|
7 | % |
---|
8 | % INPUT: |
---|
9 | % Param: Matlab structure containing the input parameters set by the GUI |
---|
10 | |
---|
11 | %======================================================================= |
---|
12 | % Copyright 2008-2014, LEGI UMR 5519 / CNRS UJF G-INP, Grenoble, France |
---|
13 | % http://www.legi.grenoble-inp.fr |
---|
14 | % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr |
---|
15 | % |
---|
16 | % This file is part of the toolbox UVMAT. |
---|
17 | % |
---|
18 | % UVMAT is free software; you can redistribute it and/or modify |
---|
19 | % it under the terms of the GNU General Public License as published |
---|
20 | % by the Free Software Foundation; either version 2 of the license, |
---|
21 | % or (at your option) any later version. |
---|
22 | % |
---|
23 | % UVMAT is distributed in the hope that it will be useful, |
---|
24 | % but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
25 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
26 | % GNU General Public License (see LICENSE.txt) for more details. |
---|
27 | %======================================================================= |
---|
28 | |
---|
29 | function varargout = civ_input(varargin) |
---|
30 | |
---|
31 | gui_Singleton = 1; |
---|
32 | gui_State = struct('gui_Name', mfilename, ... |
---|
33 | 'gui_Singleton', gui_Singleton, ... |
---|
34 | 'gui_OpeningFcn', @civ_input_OpeningFcn, ... |
---|
35 | 'gui_OutputFcn', @civ_input_OutputFcn, ... |
---|
36 | 'gui_LayoutFcn', [] , ... |
---|
37 | 'gui_Callback', []); |
---|
38 | |
---|
39 | if nargin && ischar(varargin{1}) && ~isempty(regexp(varargin{1},'_Callback$','once')) |
---|
40 | gui_State.gui_Callback = str2func(varargin{1}); |
---|
41 | end |
---|
42 | |
---|
43 | if nargout |
---|
44 | [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); |
---|
45 | else |
---|
46 | gui_mainfcn(gui_State, varargin{:}); |
---|
47 | end |
---|
48 | |
---|
49 | % End initialization code - DO NOT EDIT |
---|
50 | |
---|
51 | %------------------------------------------------------------------------ |
---|
52 | % --- Executes just before civ_input is made visible. |
---|
53 | function civ_input_OpeningFcn(hObject, eventdata, handles, Param) |
---|
54 | %------------------------------------------------------------------------ |
---|
55 | % This function has no output args, see OutputFcn. |
---|
56 | |
---|
57 | %% General settings |
---|
58 | handles.output = Param; |
---|
59 | guidata(hObject, handles); % Update handles structure |
---|
60 | set(hObject,'WindowButtonDownFcn',{'mouse_down'}) % allows mouse action with right button (zoom for uicontrol display) |
---|
61 | set(hObject,'WindowKeyPressFcn',{@keyboard_callback,handles})%set keyboard action function |
---|
62 | %set(hObject,'KeyPressFcn',{@KeyPressFcn,handles})%set keyboard action function |
---|
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 |
---|
65 | %set(hObject,'WindowKeyPressFcn',{'keyboard_callback',handles})%set keyboard action function |
---|
66 | hseries=findobj(allchild(0),'Tag','series');% find the parent GUI 'series' |
---|
67 | hhseries=guidata(hseries); %handles of the elements in 'series' |
---|
68 | SeriesData=get(hseries,'UserData');% info stored in the GUI series |
---|
69 | |
---|
70 | %% set visibility options depending on the calling function (Param.Action.ActionName): |
---|
71 | if strcmp(Param.Action.ActionName,'civ_series')||strcmp(Param.Action.ActionName,'stereo_civ') |
---|
72 | set(handles.num_MaxDiff,'Visible','on') |
---|
73 | set(handles.num_MaxVel,'Visible','on') |
---|
74 | set(handles.title_MaxVel,'Visible','on') |
---|
75 | set(handles.title_MaxDiff,'Visible','on') |
---|
76 | set(handles.num_Nx,'Visible','off') |
---|
77 | set(handles.num_Ny,'Visible','off') |
---|
78 | set(handles.title_Nx,'Visible','off') |
---|
79 | set(handles.title_Ny,'Visible','off') |
---|
80 | set(handles.num_CorrSmooth,'Style','popupmenu') |
---|
81 | set(handles.num_CorrSmooth,'Value',1) |
---|
82 | set(handles.num_CorrSmooth,'String',{'1';'2'}) |
---|
83 | set(handles.CheckThreshold,'Visible','on') |
---|
84 | set(handles.CheckDeformation,'Value',0)% desactivate (work in progress) |
---|
85 | end |
---|
86 | switch Param.Action.ActionName |
---|
87 | case 'stereo_civ' |
---|
88 | set(handles.ListCompareMode,'Visible','off') |
---|
89 | set(handles.PairIndices,'Visible','off') |
---|
90 | case 'civ_series' |
---|
91 | set(handles.ListCompareMode,'Visible','on') |
---|
92 | set(handles.PairIndices,'Visible','on') |
---|
93 | end |
---|
94 | |
---|
95 | %% input file info |
---|
96 | NomTypeInput=Param.InputTable{1,4}; |
---|
97 | FileType='image';%fdefault |
---|
98 | FileInfo=[]; |
---|
99 | if isfield(SeriesData,'FileType')&&isfield(SeriesData,'FileInfo') |
---|
100 | FileType=SeriesData.FileType{1};%type of the first input file series |
---|
101 | FileInfo=SeriesData.FileInfo{1};% info on the first input file series |
---|
102 | else |
---|
103 | set(hhseries.REFRESH,'BackgroundColor',[1 0 1])% indicate that the file input in series needs to be refreshed |
---|
104 | end |
---|
105 | |
---|
106 | %% case of netcdf file as input, read the processing stage and look for corresponding images |
---|
107 | ind_opening=0;%default |
---|
108 | NomTypeNc=''; |
---|
109 | NomTypeImaA=NomTypeInput; |
---|
110 | iview_image=1;%line # for the input images |
---|
111 | switch FileType |
---|
112 | case {'image','multimage','video','mmreader','netcdf'} |
---|
113 | % NomTypeImaA=NomTypeInput; |
---|
114 | % iview_image=1;%line # for the input images |
---|
115 | case 'civdata' |
---|
116 | if ~strcmp(Param.Action.ActionName,'civ_series') |
---|
117 | msgbox_uvmat('ERROR','bad input data file: open an image or a nc file from civ_series') |
---|
118 | return |
---|
119 | end |
---|
120 | NomTypeNc=NomTypeInput; |
---|
121 | ind_opening=FileInfo.CivStage; |
---|
122 | if isempty(regexp(NomTypeInput,'[ab|AB|-]', 'once')) |
---|
123 | set(handles.ListCompareMode,'Value',2) %mode displacement advised if the nomencalture does not involve index pairs |
---|
124 | else |
---|
125 | set(handles.ListCompareMode,'Value',1) |
---|
126 | end |
---|
127 | [Data,tild,tild,errormsg]=nc2struct(FileInfo.FileName,[]); |
---|
128 | if ~isempty(errormsg) |
---|
129 | msgbox_uvmat('ERROR',['error in netcdf input file: ' errormsg]) |
---|
130 | return |
---|
131 | end |
---|
132 | [PathCiv1_ImageA,Civ1_ImageA,FileExtA]=fileparts(Data.Civ1_ImageA);%look for the source image A |
---|
133 | [PathCiv1_ImageB,Civ1_ImageB,FileExtA]=fileparts(Data.Civ1_ImageB);%look for the source image B |
---|
134 | if isfield(Data,'Civ2_ImageA') |
---|
135 | [PathCiv2_ImageA,Civ2_ImageA,FileExtA]=fileparts(Data.Civ2_ImageA); |
---|
136 | [PathCiv2_ImageB,Civ2_ImageB,FileExtA]=fileparts(Data.Civ2_ImageB); |
---|
137 | end |
---|
138 | if size(Param.InputTable,1)==1 |
---|
139 | series('display_file_name',hhseries,Data.Civ1_ImageA,'append');%append the image series to the input list |
---|
140 | end |
---|
141 | [RootPath,SubDir,RootFile,i1,i2,j1,j2,FileExt,NomTypeImaA]=fileparts_uvmat(Data.Civ1_ImageA); |
---|
142 | [RootPath,SubDir,RootFile,i1,i2,j1,j2,FileExt,NomTypeImaB]=fileparts_uvmat(Data.Civ1_ImageB); |
---|
143 | iview_image=2;%line # for the input images |
---|
144 | case 'civxdata'% case of civx data, |
---|
145 | msgbox_uvmat('ERROR','old civX convention, use the GUI civ') |
---|
146 | return |
---|
147 | otherwise |
---|
148 | msgbox_uvmat('ERROR','civ_series needs images, scalar fields in netcdf format, or civ data as input') |
---|
149 | return |
---|
150 | end |
---|
151 | |
---|
152 | %% reinitialise menus |
---|
153 | set(handles.ListPairMode,'Value',1) |
---|
154 | set(handles.ListPairMode,'String',{''}) |
---|
155 | set(handles.ListPairCiv1,'Value',1) |
---|
156 | set(handles.ListPairCiv1,'String',{''}) |
---|
157 | set(handles.ListPairCiv2,'Value',1) |
---|
158 | set(handles.ListPairCiv2,'String',{''}) |
---|
159 | |
---|
160 | %% prepare the GUI with input parameters |
---|
161 | % |
---|
162 | set(handles.ref_i,'String',num2str(Param.IndexRange.first_i)) |
---|
163 | if isfield(Param.IndexRange,'first_j') |
---|
164 | set(handles.ref_j,'String',num2str(Param.IndexRange.first_j)) |
---|
165 | end |
---|
166 | set(handles.ConfigSource,'String','\default') |
---|
167 | |
---|
168 | %% set the menus of image pairs and default selection for civ_input %%%%%%%%%%%%%%%%%%% |
---|
169 | |
---|
170 | %% display the min and max indices for the whole file series |
---|
171 | if isempty(Param.IndexRange.MaxIndex_i)|| isempty(Param.IndexRange.MinIndex_i) |
---|
172 | msgbox_uvmat('ERROR','REFRESH the input files in the GUI series') |
---|
173 | return |
---|
174 | end |
---|
175 | MaxIndex_i=Param.IndexRange.MaxIndex_i(iview_image); |
---|
176 | MinIndex_i=Param.IndexRange.MinIndex_i(iview_image); |
---|
177 | MaxIndex_j=1;%default |
---|
178 | MinIndex_j=1; |
---|
179 | if isfield(Param.IndexRange,'MaxIndex_j')&&isfield(Param.IndexRange,'MinIndex_j')... |
---|
180 | && numel(Param.IndexRange.MaxIndex_j')>=iview_image &&numel(Param.IndexRange.MinIndex_j')>=iview_image |
---|
181 | MaxIndex_j=Param.IndexRange.MaxIndex_j(iview_image); |
---|
182 | MinIndex_j=Param.IndexRange.MinIndex_j(iview_image); |
---|
183 | end |
---|
184 | %update the bounds if possible |
---|
185 | if isfield(SeriesData,'i1_series')&&numel(SeriesData.i1_series)>=iview_image |
---|
186 | if size(SeriesData.i1_series{iview_image},2)==2 && min(min(SeriesData.i1_series{iview_image}(:,1,:)))==0 |
---|
187 | MinIndex_j=1;% index j set to 1 by default |
---|
188 | MaxIndex_j=1; |
---|
189 | MinIndex_i=find(SeriesData.i1_series{iview_image}(1,2,:), 1 )-1;% min ref index i detected in the series (corresponding to the first non-zero value of i1_series, except for zero index) |
---|
190 | MaxIndex_i=find(SeriesData.i1_series{iview_image}(1,2,:),1,'last' )-1;%max ref index i detected in the series (corresponding to the last non-zero value of i1_series) |
---|
191 | else |
---|
192 | ref_i=squeeze(max(SeriesData.i1_series{iview_image}(1,:,:),[],2));% select ref_j index for each ref_i |
---|
193 | ref_j=squeeze(max(SeriesData.j1_series{iview_image}(1,:,:),[],3));% select ref_i index for each ref_j |
---|
194 | MinIndex_i=min(find(ref_i))-1; |
---|
195 | MaxIndex_i=max(find(ref_i))-1; |
---|
196 | MaxIndex_j=max(find(ref_j))-1; |
---|
197 | MinIndex_j=min(find(ref_j))-1; |
---|
198 | end |
---|
199 | end |
---|
200 | if ~isfield(Param.IndexRange,'first_j')||isequal(MaxIndex_j,MinIndex_j)% no possibility of j pairs |
---|
201 | set(handles.ListPairMode,'Value',1) |
---|
202 | set(handles.ListPairMode,'String',{'series(Di)'}) |
---|
203 | elseif MaxIndex_i==1 && MaxIndex_j>1% simple series in j |
---|
204 | set(handles.ListPairMode,'String',{'pair j1-j2';'series(Dj)'}) |
---|
205 | if MaxIndex_j <= 10 |
---|
206 | set(handles.ListPairMode,'Value',1)% advice 'pair j1-j2' except in MaxIndex_j is large |
---|
207 | end |
---|
208 | else |
---|
209 | set(handles.ListPairMode,'String',{'pair j1-j2';'series(Dj)';'series(Di)'})%multiple choice |
---|
210 | if strcmp(NomTypeNc,'_1-2_1') |
---|
211 | set(handles.ListPairMode,'Value',3)% advise 'series(Di)' |
---|
212 | elseif MaxIndex_j <= 10 |
---|
213 | set(handles.ListPairMode,'Value',1)% advice 'pair j1-j2' except in MaxIndex_j is large |
---|
214 | end |
---|
215 | end |
---|
216 | |
---|
217 | %% transfer the time from the GUI series, or use file index by default |
---|
218 | time=[]; |
---|
219 | TimeUnit='frame'; %default |
---|
220 | CoordUnit='';%default |
---|
221 | pxcm_search=1; |
---|
222 | if isfield(SeriesData,'Time') && ~isempty(SeriesData.Time{1}) |
---|
223 | time=SeriesData.Time{1}; |
---|
224 | end |
---|
225 | if isfield(Param.IndexRange,'TimeUnit')&&~isempty(Param.IndexRange.TimeUnit) |
---|
226 | TimeUnit=Param.IndexRange.TimeUnit; |
---|
227 | end |
---|
228 | % if isfield(SeriesData,'TimeSource') |
---|
229 | % set(handles.TimeSource,'String',SeriesData.TimeSource) |
---|
230 | % end |
---|
231 | if isfield(SeriesData,'GeometryCalib') |
---|
232 | tsai=SeriesData.GeometryCalib; |
---|
233 | if isfield(tsai,'fx_fy') |
---|
234 | pxcm_search=max(tsai.fx_fy(1),tsai.fx_fy(2));%pixels:cm estimated for the search range |
---|
235 | end |
---|
236 | if isfield(tsai,'CoordUnit') |
---|
237 | CoordUnit=tsai.CoordUnit; |
---|
238 | end |
---|
239 | end |
---|
240 | |
---|
241 | %% timing display |
---|
242 | %show the reference image edit box if relevant (not needed for movies or in the absence of time information |
---|
243 | if numel(time)>=2 % if there are at least two time values to define dt |
---|
244 | if size(time,1)<MaxIndex_i; |
---|
245 | msgbox_uvmat('WARNING','maximum i index restricted by the timing of the xml file'); |
---|
246 | elseif size(time,2)<MaxIndex_j |
---|
247 | msgbox_uvmat('WARNING','maximum j index restricted by the timing of the xml file'); |
---|
248 | end |
---|
249 | MaxIndex_i=min(size(time,1),MaxIndex_i);%possibly adjust the max index according to time data |
---|
250 | MaxIndex_j=min(size(time,2),MaxIndex_j); |
---|
251 | set(handles.TimeSource,'String',Param.IndexRange.TimeSource); |
---|
252 | else |
---|
253 | set(handles.TimeSource,'String',''); %xml file not used for timing |
---|
254 | TimeUnit='frame'; |
---|
255 | time=ones(MaxIndex_j-MinIndex_j+1,1)*(MinIndex_i:MaxIndex_i); |
---|
256 | time=time+0.001*(MinIndex_j:MaxIndex_j)'*ones(1,MaxIndex_i-MinIndex_i+1); |
---|
257 | end |
---|
258 | CivInputData.Time=time; |
---|
259 | CivInputData.NomTypeIma=NomTypeImaA; |
---|
260 | set(handles.civ_input,'UserData',CivInputData) |
---|
261 | set(handles.dt_unit,'String',['dt in m' TimeUnit]);%display dt in unit 10-3 of the time (e.g ms) |
---|
262 | set(handles.TimeUnit,'String',TimeUnit); |
---|
263 | %set(handles.CoordUnit,'String',CoordUnit) |
---|
264 | set(handles.SearchRange,'UserData', pxcm_search); |
---|
265 | |
---|
266 | % indicate the min and max indices i and j on the GUI |
---|
267 | set(handles.MinIndex_i,'String',num2str(MinIndex_i)) |
---|
268 | set(handles.MaxIndex_i,'String',num2str(MaxIndex_i)) |
---|
269 | set(handles.MinIndex_j,'String',num2str(MinIndex_j)) |
---|
270 | set(handles.MaxIndex_j,'String',num2str(MaxIndex_j)) |
---|
271 | |
---|
272 | |
---|
273 | %% set the civ_input options, depending on the input file content if a nc file has been opened |
---|
274 | ListOptions={'CheckCiv1', 'CheckFix1' 'CheckPatch1', 'CheckCiv2', 'CheckFix2', 'CheckPatch2'}; |
---|
275 | checkbox=zeros(size(ListOptions));%default |
---|
276 | checkrefresh=0; |
---|
277 | if ind_opening==0 %case of image opening, start with Civ1 |
---|
278 | for index=1:numel(ListOptions) |
---|
279 | checkbox(index)=get(handles.(ListOptions{index}),'Value'); |
---|
280 | end |
---|
281 | index_max=find(checkbox, 1, 'last' ); |
---|
282 | if isempty(index_max),index_max=1;end |
---|
283 | for index=1:index_max |
---|
284 | set(handles.(ListOptions{index}),'Value',1)% select all operations starting from CIV1 |
---|
285 | end |
---|
286 | else %case of netcdf file opening, start with the stage read in the file if the input file is being refreshed |
---|
287 | if isequal(get(hhseries.REFRESH,'BackgroundColor'),[1 1 0]) &&... |
---|
288 | ~(isfield(Param,'ActionInput') && isfield(Param.ActionInput,'ConfigSource')) |
---|
289 | for index = 1:min(ind_opening,5) |
---|
290 | set(handles.(ListOptions{index}),'value',0) |
---|
291 | fill_civ_input(Data,handles); %fill civ_input with the parameters retrieved from an input Civ file |
---|
292 | end |
---|
293 | set(handles.ConfigSource,'String',FileInfo.FileName); |
---|
294 | set(handles.(ListOptions{min(ind_opening+1,6)}),'value',1) |
---|
295 | for index = ind_opening+2:6 |
---|
296 | set(handles.(ListOptions{index}),'value',0) |
---|
297 | end |
---|
298 | checkrefresh=1; |
---|
299 | end |
---|
300 | if ind_opening>=3 |
---|
301 | set(handles.CheckCiv3,'Visible','on')% make visible the switch 'iterate/repet' for Civ2. |
---|
302 | else |
---|
303 | set(handles.CheckCiv3,'Visible','off') |
---|
304 | end |
---|
305 | end |
---|
306 | |
---|
307 | %% introduce the stored Civ parameters if available (from previous input or ImportConfig in series) |
---|
308 | if ~checkrefresh && isfield(Param,'ActionInput')&& strcmp(Param.ActionInput.Program,Param.Action.ActionName)% the program fits with the stored data |
---|
309 | fill_GUI(Param.ActionInput,hObject);%fill the GUI with the parameters retrieved from the input Param |
---|
310 | hcheckgrid=findobj(handles.civ_input,'Tag','CheckGrid'); |
---|
311 | for ilist=1:numel(hcheckgrid) |
---|
312 | if get(hcheckgrid(ilist),'Value')% if a grid is used, do not show Dx and Dy for an automatic grid |
---|
313 | hparent=get(hcheckgrid(ilist),'parent');%handles of the parent panel |
---|
314 | hchildren=get(hparent,'children'); |
---|
315 | handle_dx=findobj(hchildren,'tag','num_Dx'); |
---|
316 | handle_dy=findobj(hchildren,'tag','num_Dy'); |
---|
317 | handle_title_dx=findobj(hchildren,'tag','title_Dx'); |
---|
318 | handle_title_dy=findobj(hchildren,'tag','title_Dy'); |
---|
319 | set(handle_dx,'Visible','off'); |
---|
320 | set(handle_dy,'Visible','off'); |
---|
321 | set(handle_title_dy,'Visible','off'); |
---|
322 | set(handle_title_dx,'Visible','off'); |
---|
323 | end |
---|
324 | end |
---|
325 | end |
---|
326 | |
---|
327 | %% set the reference indices from the input file indices |
---|
328 | if ~(isfield(Param,'ActionInput') && isfield(Param.ActionInput,'ConfigSource')) |
---|
329 | update_CivOptions(handles,ind_opening)% fill the menu of possible pairs |
---|
330 | end |
---|
331 | |
---|
332 | %% list the possible index pairs, depending on the option set in ListPairMode |
---|
333 | ListPairMode_Callback([], [], handles) |
---|
334 | %ListPairCiv1_Callback(hObject, eventdata, handles) |
---|
335 | |
---|
336 | %% set the GUI to modal: wait for OK to close |
---|
337 | set(handles.civ_input,'WindowStyle','modal')% Make the GUI modal |
---|
338 | drawnow |
---|
339 | uiwait(handles.civ_input);% wait for OK action to end the function |
---|
340 | |
---|
341 | |
---|
342 | %------------------------------------------------------------------------ |
---|
343 | % --- Outputs from this function are returned to the command line. |
---|
344 | function varargout = civ_input_OutputFcn(hObject, eventdata, handles) |
---|
345 | %------------------------------------------------------------------------ |
---|
346 | % Get default command line output from handles structure |
---|
347 | varargout{1}=[];% default output when civ_input is canceled (no 'OK') |
---|
348 | if ~isempty(handles) |
---|
349 | varargout{1} = handles.output; |
---|
350 | delete(handles.civ_input) |
---|
351 | end |
---|
352 | |
---|
353 | % --- Executes when user attempts to close get_field. |
---|
354 | function civ_input_CloseRequestFcn(hObject, eventdata, handles) |
---|
355 | if isequal(get(handles.get_field, 'waitstatus'), 'waiting') |
---|
356 | % The GUI is still in UIWAIT, us UIRESUME |
---|
357 | uiresume(handles.civ_input); |
---|
358 | else |
---|
359 | % The GUI is no longer waiting, just close it |
---|
360 | delete(handles.civ_input); |
---|
361 | end |
---|
362 | |
---|
363 | %------------------------------------------------------------------------ |
---|
364 | % --- Executes on button press in SetDefaultParam. |
---|
365 | %------------------------------------------------------------------------ |
---|
366 | function SetDefaultParam_Callback(hObject, eventdata, handles) |
---|
367 | |
---|
368 | Param.ConfigSource='\default'; |
---|
369 | |
---|
370 | %% Civ1 parameters |
---|
371 | %Param.CheckCiv1=1; |
---|
372 | Param.Civ1.CorrBoxSize=[25 25]; |
---|
373 | Param.Civ1.SearchBoxSize=[55 55]; |
---|
374 | Param.Civ1.SearchBoxShift=[0 0]; |
---|
375 | Param.Civ1.CorrSmooth=1; |
---|
376 | Param.Civ1.Dx=20; |
---|
377 | Param.Civ1.Dy=20; |
---|
378 | Param.Civ1.CheckGrid=0; |
---|
379 | Param.Civ1.CheckMask=0; |
---|
380 | Param.Civ1.Mask=''; |
---|
381 | Param.Civ1.CheckThreshold=0; |
---|
382 | Param.Civ1.TestCiv1=0; |
---|
383 | |
---|
384 | %% Fix1 parameters |
---|
385 | %Param.CheckFix1=1; |
---|
386 | Param.Fix1.CheckFmin2=1; |
---|
387 | Param.Fix1.CheckF3=1; |
---|
388 | Param.Fix1.MinCorr=0.2000; |
---|
389 | |
---|
390 | %% Patch1 parameters |
---|
391 | %Param.CheckPatch1=1; |
---|
392 | Param.Patch1.FieldSmooth=10; |
---|
393 | Param.Patch1.MaxDiff=1.5000; |
---|
394 | Param.Patch1.SubDomainSize=1000; |
---|
395 | Param.Patch1.TestPatch1=0; |
---|
396 | |
---|
397 | %% Civ2 parameters |
---|
398 | %Param.CheckCiv2=1; |
---|
399 | Param.Civ2.CorrBoxSize=[21 21]; |
---|
400 | Param.Civ2.SearchBoxSize=[27 27]; |
---|
401 | Param.Civ2.CorrSmooth=1; |
---|
402 | Param.Civ2.Dx=10; |
---|
403 | Param.Civ2.Dy=10; |
---|
404 | Param.Civ2.CheckGrid=0; |
---|
405 | Param.Civ2.CheckMask=0; |
---|
406 | Param.Civ2.Mask=''; |
---|
407 | Param.Civ2.CheckThreshold=0; |
---|
408 | Param.Civ2.TestCiv2=0; |
---|
409 | |
---|
410 | %% Fix2 parameters |
---|
411 | %Param.CheckFix2=1; |
---|
412 | Param.Fix2.CheckFmin2=1; |
---|
413 | Param.Fix2.CheckF4=1; |
---|
414 | Param.Fix2.CheckF3=1; |
---|
415 | Param.Fix2.MinCorr=0.2000; |
---|
416 | |
---|
417 | %% Patch2 parameters |
---|
418 | %Param.CheckPatch2=1; |
---|
419 | Param.Patch2.FieldSmooth=2; |
---|
420 | Param.Patch2.MaxDiff=1.5000; |
---|
421 | Param.Patch2.SubDomainSize=1000; |
---|
422 | Param.Patch2.TestPatch2=0; |
---|
423 | |
---|
424 | fill_GUI(Param,handles.civ_input)% fill the elements of the GUI series with the input parameters |
---|
425 | update_CivOptions(handles,0) |
---|
426 | |
---|
427 | % ----------------------------------------------------------------------- |
---|
428 | % ----------------------------------------------------------------------- |
---|
429 | % --- Open the help html file |
---|
430 | function MenuHelp_Callback(hObject, eventdata, handles) |
---|
431 | % ----------------------------------------------------------------------- |
---|
432 | web('http://servforge.legi.grenoble-inp.fr/projects/soft-uvmat/wiki/UvmatHelp#Civ') |
---|
433 | |
---|
434 | %------------------------------------------------------------------------ |
---|
435 | % --- Executes on carriage return on the subdir checkciv1 edit window |
---|
436 | function Civ1_ImageB_Callback(hObject, eventdata, handles) |
---|
437 | %------------------------------------------------------------------------ |
---|
438 | SubDir=get(handles.Civ1_ImageB,'String'); |
---|
439 | menu_str=get(handles.ListSubdirCiv1,'String');% read the list of subdirectories for update |
---|
440 | ichoice=find(strcmp(SubDir,menu_str),1); |
---|
441 | if isempty(ichoice) |
---|
442 | ilist=numel(menu_str); %select 'new...' in the menu |
---|
443 | else |
---|
444 | ilist=ichoice; |
---|
445 | end |
---|
446 | set(handles.ListSubdirCiv1,'Value',ilist)% select the selected subdir in the menu |
---|
447 | if get(handles.CheckCiv1,'Value')% if Civ1 is performed |
---|
448 | set(handles.Civ2_ImageA,'String',SubDir);% set by default civ2 directory the same as civ1 |
---|
449 | % set(handles.ListSubdirCiv2,'Value',ilist) |
---|
450 | else % if Civ1 data already exist |
---|
451 | errormsg=find_netcpair_civ(handles,1); %update the list of available index pairs in the new directory |
---|
452 | if ~isempty(errormsg) |
---|
453 | msgbox_uvmat('ERROR',errormsg) |
---|
454 | end |
---|
455 | end |
---|
456 | |
---|
457 | %------------------------------------------------------------------------ |
---|
458 | % --- Executes on carriage return on the SubDir checkciv1 edit window |
---|
459 | function Civ2_ImageA_Callback(hObject, eventdata, handles) |
---|
460 | %------------------------------------------------------------------------ |
---|
461 | SubDir=get(handles.Civ1_ImageB,'String'); |
---|
462 | menu_str=get(handles.ListSubdirCiv2,'String');% read the list of subdirectories for update |
---|
463 | ichoice=find(strcmp(SubDir,menu_str),1); |
---|
464 | if isempty(ichoice) |
---|
465 | ilist=numel(menu_str); %select 'new...' in the menu |
---|
466 | else |
---|
467 | ilist=ichoice; |
---|
468 | end |
---|
469 | set(handles.ListSubdirCiv2,'Value',ilist)% select the selected subdir in the menu |
---|
470 | %update the list of available pairs from netcdf files in the new directory |
---|
471 | if ~get(handles.CheckCiv2,'Value') && ~get(handles.CheckCiv1,'Value') && ~get(handles.CheckFix1,'Value') && ~get(handles.CheckPatch1,'Value') |
---|
472 | errormsg=find_netcpair_civ(handles,2); |
---|
473 | if ~isempty(errormsg) |
---|
474 | msgbox_uvmat('ERROR',errormsg) |
---|
475 | end |
---|
476 | end |
---|
477 | |
---|
478 | %------------------------------------------------------------------------ |
---|
479 | % --- Executes on button press in CheckCiv1. |
---|
480 | function CheckCiv1_Callback(hObject, eventdata, handles) |
---|
481 | %------------------------------------------------------------------------ |
---|
482 | update_CivOptions(handles,0) |
---|
483 | |
---|
484 | %------------------------------------------------------------------------ |
---|
485 | % --- Executes on button press in CheckFix1. |
---|
486 | function CheckFix1_Callback(hObject, eventdata, handles) |
---|
487 | %------------------------------------------------------------------------ |
---|
488 | update_CivOptions(handles,0) |
---|
489 | |
---|
490 | %------------------------------------------------------------------------ |
---|
491 | % --- Executes on button press in CheckPatch1. |
---|
492 | function CheckPatch1_Callback(hObject, eventdata, handles) |
---|
493 | %------------------------------------------------------------------------ |
---|
494 | update_CivOptions(handles,0) |
---|
495 | |
---|
496 | %------------------------------------------------------------------------ |
---|
497 | % --- Executes on button press in CheckCiv2. |
---|
498 | function CheckCiv2_Callback(hObject, eventdata, handles) |
---|
499 | %------------------------------------------------------------------------ |
---|
500 | update_CivOptions(handles,0) |
---|
501 | |
---|
502 | %------------------------------------------------------------------------ |
---|
503 | % --- Executes on button press in CheckFix2. |
---|
504 | function CheckFix2_Callback(hObject, eventdata, handles) |
---|
505 | %------------------------------------------------------------------------ |
---|
506 | update_CivOptions(handles,0) |
---|
507 | |
---|
508 | %------------------------------------------------------------------------ |
---|
509 | % --- Executes on button press in CheckPatch2. |
---|
510 | function CheckPatch2_Callback(hObject, eventdata, handles) |
---|
511 | %------------------------------------------------------------------------ |
---|
512 | update_CivOptions(handles,0) |
---|
513 | |
---|
514 | %------------------------------------------------------------------------ |
---|
515 | % --- activated by any checkbox controling the selection of Civ1,Fix1,Patch1,Civ2,Fix2,Patch2 |
---|
516 | function update_CivOptions(handles,opening) |
---|
517 | %------------------------------------------------------------------------ |
---|
518 | if opening>0 |
---|
519 | set(handles.CheckCiv2,'UserData',opening)% store the info on the current status of the civ processing |
---|
520 | end |
---|
521 | checkbox=zeros(1,6); |
---|
522 | checkbox(1)=get(handles.CheckCiv1,'Value'); |
---|
523 | checkbox(2)=get(handles.CheckFix1,'Value'); |
---|
524 | checkbox(3)=get(handles.CheckPatch1,'Value'); |
---|
525 | checkbox(4)=get(handles.CheckCiv2,'Value'); |
---|
526 | checkbox(5)=get(handles.CheckFix2,'Value'); |
---|
527 | checkbox(6)=get(handles.CheckPatch2,'Value'); |
---|
528 | if opening==0 |
---|
529 | errormsg=find_netcpair_civ(handles,1); % select the available netcdf files |
---|
530 | if ~isempty(errormsg) |
---|
531 | msgbox_uvmat('ERROR',errormsg) |
---|
532 | end |
---|
533 | end |
---|
534 | if max(checkbox(4:6))>0% case of civ2 pair choice needed |
---|
535 | set(handles.TitlePairCiv2,'Visible','on') |
---|
536 | set(handles.ListPairCiv2,'Visible','on') |
---|
537 | if ~opening |
---|
538 | errormsg=find_netcpair_civ(handles,2); % select the available netcdf files |
---|
539 | if ~isempty(errormsg) |
---|
540 | msgbox_uvmat('ERROR',errormsg) |
---|
541 | end |
---|
542 | end |
---|
543 | else |
---|
544 | set(handles.ListPairCiv2,'Visible','off') |
---|
545 | end |
---|
546 | hseries=findobj(allchild(0),'Tag','series');% find the parent GUI 'series' |
---|
547 | hhseries=guidata(hseries); %handles of the elements in 'series' |
---|
548 | InputTable=get(hhseries.InputTable,'Data'); |
---|
549 | if size(InputTable,1)>=1 && strcmp(InputTable{1,5},'.nc') && max(checkbox(1:3))==0 %&& get(handles.CheckCiv2,'UserData')==6,% no operation asked before Civ2 and input file ready for civ3 |
---|
550 | set(handles.CheckCiv3,'Visible','on') |
---|
551 | else |
---|
552 | set(handles.CheckCiv3,'Visible','off') |
---|
553 | end |
---|
554 | |
---|
555 | %% set the visibility of the different panels |
---|
556 | options={'Civ1','Fix1','Patch1','Civ2','Fix2','Patch2'}; |
---|
557 | for ilist=1:length(options) |
---|
558 | if checkbox(ilist) |
---|
559 | set(handles.(options{ilist}),'Visible','on') |
---|
560 | else |
---|
561 | set(handles.(options{ilist}),'Visible','off') |
---|
562 | end |
---|
563 | end |
---|
564 | |
---|
565 | %------------------------------------------------------------------------ |
---|
566 | % --- Executes on button press in OK: processing on local computer |
---|
567 | function OK_Callback(hObject, eventdata, handles) |
---|
568 | %------------------------------------------------------------------------ |
---|
569 | |
---|
570 | ActionInput=read_GUI(handles.civ_input);% read the infos on the GUI civ_input |
---|
571 | |
---|
572 | %% correct input inconsistencies |
---|
573 | if isfield(ActionInput,'Civ1') |
---|
574 | checkeven=(mod(ActionInput.Civ1.CorrBoxSize,2)==0); |
---|
575 | ActionInput.Civ1.CorrBoxSize(checkeven)=ActionInput.Civ1.CorrBoxSize(checkeven)+1;% set correlation box sizes to odd values |
---|
576 | ActionInput.Civ1.SearchBoxSize=max(ActionInput.Civ1.SearchBoxSize,ActionInput.Civ1.CorrBoxSize+8);% insure that the search box size is large enough |
---|
577 | checkeven=(mod(ActionInput.Civ1.SearchBoxSize,2)==0); |
---|
578 | ActionInput.Civ1.SearchBoxSize(checkeven)=ActionInput.Civ1.SearchBoxSize(checkeven)+1;% set search box sizes to odd values |
---|
579 | end |
---|
580 | if isfield(ActionInput,'Civ2') |
---|
581 | checkeven=(mod(ActionInput.Civ2.CorrBoxSize,2)==0); |
---|
582 | ActionInput.Civ2.CorrBoxSize(checkeven)=ActionInput.Civ2.CorrBoxSize(checkeven)+1;% set correlation box sizes to odd values |
---|
583 | ActionInput.Civ2.SearchBoxSize=max(ActionInput.Civ2.SearchBoxSize,ActionInput.Civ2.CorrBoxSize+4); |
---|
584 | checkeven=(mod(ActionInput.Civ2.SearchBoxSize,2)==0); |
---|
585 | ActionInput.Civ2.SearchBoxSize(checkeven)=ActionInput.Civ2.SearchBoxSize(checkeven)+1;% set search box sizes to odd values |
---|
586 | end |
---|
587 | |
---|
588 | %% correct mask or grid name for Windows system (replace '\' by '/') |
---|
589 | if isfield(ActionInput,'Civ1') |
---|
590 | if isfield(ActionInput.Civ1,'Mask') |
---|
591 | ActionInput.Civ1.Mask=regexprep(ActionInput.Civ1.Mask,'\','/'); |
---|
592 | end |
---|
593 | if isfield(ActionInput.Civ1,'Grid') |
---|
594 | ActionInput.Civ1.Grid=regexprep(ActionInput.Civ1.Grid,'\','/'); |
---|
595 | end |
---|
596 | end |
---|
597 | if isfield(ActionInput,'Civ2') |
---|
598 | if isfield(ActionInput.Civ2,'Mask') |
---|
599 | ActionInput.Civ2.Mask=regexprep(ActionInput.Civ2.Mask,'\','/'); |
---|
600 | end |
---|
601 | if isfield(ActionInput.Civ2,'Grid') |
---|
602 | ActionInput.Civ2.Grid=regexprep(ActionInput.Civ2.Grid,'\','/'); |
---|
603 | end |
---|
604 | end |
---|
605 | |
---|
606 | %% exit the GUI and close it |
---|
607 | handles.output.ActionInput=ActionInput; |
---|
608 | guidata(hObject, handles);% Update handles structure |
---|
609 | uiresume(handles.civ_input); |
---|
610 | |
---|
611 | |
---|
612 | %------------------------------------------------------------------------ |
---|
613 | % --- Executes on button press in ListCompareMode. |
---|
614 | function ListCompareMode_Callback(hObject, eventdata, handles) |
---|
615 | %------------------------------------------------------------------------ |
---|
616 | ListCompareMode=get(handles.ListCompareMode,'String'); |
---|
617 | option=ListCompareMode{get(handles.ListCompareMode,'Value')}; |
---|
618 | hseries=findobj(allchild(0),'Tag','series'); |
---|
619 | SeriesData=get(hseries,'UserData'); |
---|
620 | check_nc=strcmp(SeriesData.FileType{1},'.nc'); |
---|
621 | ImageType=SeriesData.FileType(2:end); |
---|
622 | if check_nc |
---|
623 | ImageType=SeriesData.FileType(2:end); |
---|
624 | else |
---|
625 | ImageType=SeriesData.FileType; |
---|
626 | end |
---|
627 | hhseries=guidata(hseries); |
---|
628 | InputTable=get(hhseries.InputTable,'Data'); |
---|
629 | OriginIndex='off'; |
---|
630 | PairIndices='off'; |
---|
631 | DoubleInputSeries='off'; |
---|
632 | switch option |
---|
633 | case 'PIV' |
---|
634 | PairIndices='on';% needs to define index pairs for PIV |
---|
635 | |
---|
636 | case 'PIV volume' |
---|
637 | PairIndices='on';% needs to define index pairs for PIV |
---|
638 | set(handles.ListPairMode,'Value',1) |
---|
639 | set(handles.ListPairMode,'String',{'series(Di)'}) |
---|
640 | ListPairMode_Callback(hObject, eventdata, handles) |
---|
641 | case 'displacement' |
---|
642 | OriginIndex='on';%define a frame origin for displacement |
---|
643 | % case 'shift' |
---|
644 | % if numel(ImageType)==1 |
---|
645 | % fileinput=uigetfile_uvmat('pick a second file series for synchronous shift',InputTable{check_nc+1}); |
---|
646 | % if ~isempty(fileinput) |
---|
647 | % series( 'display_file_name',hhseries,fileinput,'append') |
---|
648 | % end |
---|
649 | % |
---|
650 | % |
---|
651 | % end |
---|
652 | end |
---|
653 | set(handles.num_OriginIndex,'Visible',OriginIndex) |
---|
654 | set(handles.OriginIndex_title,'Visible',OriginIndex) |
---|
655 | set(handles.PairIndices,'Visible',PairIndices) |
---|
656 | ListPairMode_Callback(hObject, eventdata, handles) |
---|
657 | |
---|
658 | |
---|
659 | |
---|
660 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
661 | % Callbacks in the uipanel Pair Indices |
---|
662 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
663 | %------------------------------------------------------------------------ |
---|
664 | % --- Executes on button press in ListPairMode. |
---|
665 | function ListPairMode_Callback(hObject, eventdata, handles) |
---|
666 | %------------------------------------------------------------------------ |
---|
667 | compare_list=get(handles.ListCompareMode,'String'); |
---|
668 | val=get(handles.ListCompareMode,'Value'); |
---|
669 | compare=compare_list{val}; |
---|
670 | if strcmp(compare,'displacement')||strcmp(compare,'shift') |
---|
671 | mode='displacement'; |
---|
672 | else |
---|
673 | mode_list=get(handles.ListPairMode,'String'); |
---|
674 | if ischar(mode_list) |
---|
675 | mode_list={mode_list}; |
---|
676 | end |
---|
677 | mode_value=get(handles.ListPairMode,'Value'); |
---|
678 | mode=mode_list{mode_value}; |
---|
679 | end |
---|
680 | % displ_num=[];%default |
---|
681 | ref_i=str2double(get(handles.ref_i,'String')); |
---|
682 | % last_i=str2num(get(handles.last_i,'String')); |
---|
683 | CivInputData=get(handles.civ_input,'UserData'); |
---|
684 | TimeUnit=get(handles.TimeUnit,'String'); |
---|
685 | checkframe=strcmp(TimeUnit,'frame'); |
---|
686 | time=CivInputData.Time; |
---|
687 | siztime=size(CivInputData.Time); |
---|
688 | nbfield=siztime(1)-1; |
---|
689 | nbfield2=siztime(2)-1; |
---|
690 | %indchosen=1; %%first pair selected by default |
---|
691 | %displ_num used to define the indices of the civ_input pairs |
---|
692 | % in mode 'pair j1-j2', j1 and j2 are the file indices, else the indices |
---|
693 | % are relative to the reference indices ref_i and ref_j respectively. |
---|
694 | if isequal(mode,'pair j1-j2') |
---|
695 | dt=1; |
---|
696 | displ=''; |
---|
697 | index=0; |
---|
698 | numlist_a=[]; |
---|
699 | numlist_B=[]; |
---|
700 | %get all the time intervals in bursts |
---|
701 | displ_dt=1;%default |
---|
702 | nbfield2=min(nbfield2,10);%limitate the number of pairs to 10x10 |
---|
703 | for numod_a=1:nbfield2-1 %nbfield2 always >=2 for 'pair j1-j2' mode |
---|
704 | for numod_b=(numod_a+1):nbfield2 |
---|
705 | index=index+1; |
---|
706 | numlist_a(index)=numod_a; |
---|
707 | numlist_b(index)=numod_b; |
---|
708 | if size(time,2)>1 && ~checkframe |
---|
709 | dt(numod_a,numod_b)=CivInputData.Time(ref_i+1,numod_b+1)-CivInputData.Time(ref_i+1,numod_a+1);%first time interval dt |
---|
710 | displ_dt(index)=dt(numod_a,numod_b); |
---|
711 | else |
---|
712 | displ_dt(index)=1; |
---|
713 | end |
---|
714 | end |
---|
715 | end |
---|
716 | [dtsort,indsort]=sort(displ_dt); |
---|
717 | if ~isempty(numlist_a) |
---|
718 | displ_num(1,:)=numlist_a(indsort); |
---|
719 | displ_num(2,:)=numlist_b(indsort); |
---|
720 | end |
---|
721 | displ_num(3,:)=0; |
---|
722 | displ_num(4,:)=0; |
---|
723 | enable_j(handles, 'off') |
---|
724 | elseif isequal(mode,'series(Dj)') %| isequal(mode,'st_series(Dj)') |
---|
725 | index=1:200; |
---|
726 | displ_num(1,index)=-floor(index/2); |
---|
727 | displ_num(2,index)=ceil(index/2); |
---|
728 | displ_num(3:4,index)=zeros(2,200); |
---|
729 | enable_j(handles, 'on') |
---|
730 | elseif isequal(mode,'series(Di)') %| isequal(mode,'st_series(Di)') |
---|
731 | % index=1:200; |
---|
732 | % displ_num(1:2,index)=zeros(2,200); |
---|
733 | % displ_num(3,index)=-floor(index/2); |
---|
734 | % displ_num(4,index)=ceil(index/2); |
---|
735 | enable_i(handles, 'on') |
---|
736 | if nbfield2 > 1 |
---|
737 | enable_j(handles, 'on') |
---|
738 | else |
---|
739 | enable_j(handles, 'off') |
---|
740 | end |
---|
741 | elseif isequal(mode,'displacement')%the pairs have the same indices |
---|
742 | displ_num(1,1)=0; |
---|
743 | displ_num(2,1)=0; |
---|
744 | displ_num(3,1)=0; |
---|
745 | displ_num(4,1)=0; |
---|
746 | if nbfield > 1 || nbfield==0 |
---|
747 | enable_i(handles, 'on') |
---|
748 | else |
---|
749 | enable_j(handles, 'off') |
---|
750 | end |
---|
751 | if nbfield2 > 1 |
---|
752 | enable_j(handles, 'on') |
---|
753 | else |
---|
754 | enable_j(handles, 'off') |
---|
755 | end |
---|
756 | end |
---|
757 | %set(handles.ListPairCiv1,'UserData',displ_num); |
---|
758 | errormsg=find_netcpair_civ( handles,1); |
---|
759 | if ~isempty(errormsg) |
---|
760 | msgbox_uvmat('ERROR',errormsg) |
---|
761 | end |
---|
762 | % find_netcpair_civ2(handles) |
---|
763 | |
---|
764 | function enable_i(handles, state) |
---|
765 | set(handles.itext,'Visible',state) |
---|
766 | % set(handles.MinIndex_i,'Visible',state) |
---|
767 | % set(handles.last_i,'Visible',state) |
---|
768 | % set(handles.incr_i,'Visible',state) |
---|
769 | set(handles.MaxIndex_i,'Visible',state) |
---|
770 | set(handles.ref_i,'Visible',state) |
---|
771 | |
---|
772 | function enable_j(handles, state) |
---|
773 | set(handles.jtext,'Visible',state) |
---|
774 | % set(handles.MinIndex_j,'Visible',state) |
---|
775 | % set(handles.last_j,'Visible',state) |
---|
776 | % set(handles.incr_j,'Visible',state) |
---|
777 | set(handles.MinIndex_j,'Visible',state) |
---|
778 | set(handles.MaxIndex_j,'Visible',state) |
---|
779 | set(handles.ref_j,'Visible',state) |
---|
780 | %hseries=findobj(allchild(0),'Tag','series'); |
---|
781 | %hhseries=guidata(hseries); |
---|
782 | %series('enable_j',hhseries,state); %file input with xml reading in uvmat, show the image in phys coordinates |
---|
783 | |
---|
784 | |
---|
785 | |
---|
786 | %------------------------------------------------------------------------ |
---|
787 | % --- Executes on selection change in ListPairCiv1. |
---|
788 | function ListPairCiv1_Callback(hObject, eventdata, handles) |
---|
789 | %------------------------------------------------------------------------ |
---|
790 | %reproduce by default the chosen pair in the checkciv2 menu |
---|
791 | list_pair=get(handles.ListPairCiv1,'String');%get the menu of image pairs |
---|
792 | PairString=list_pair{get(handles.ListPairCiv1,'Value')}; |
---|
793 | |
---|
794 | [ind1,ind2]=... |
---|
795 | find_pair_indices(PairString); |
---|
796 | hseries=findobj(allchild(0),'Tag','series'); |
---|
797 | hhseries=guidata(hseries); |
---|
798 | set(hhseries.num_first_j,'String',num2str(ind1)); |
---|
799 | set(hhseries.num_last_j,'String',num2str(ind2)); |
---|
800 | set(hhseries.num_incr_j,'String',num2str(ind2-ind1)); |
---|
801 | set(handles.ListPairCiv2,'Value',get(handles.ListPairCiv1,'Value'))%civ2 selection the same as civ& by default |
---|
802 | |
---|
803 | |
---|
804 | %------------------------------------------------------------------------ |
---|
805 | % --- Executes on selection change in ListPairCiv2. |
---|
806 | function ListPairCiv2_Callback(hObject, eventdata, handles) |
---|
807 | %------------------------------------------------------------------------ |
---|
808 | |
---|
809 | |
---|
810 | %------------------------------------------------------------------------ |
---|
811 | function ref_i_Callback(hObject, eventdata, handles) |
---|
812 | %------------------------------------------------------------------------ |
---|
813 | mode_list=get(handles.ListPairMode,'String'); |
---|
814 | mode_value=get(handles.ListPairMode,'Value'); |
---|
815 | mode=mode_list{mode_value}; |
---|
816 | errormsg=find_netcpair_civ(handles,1);% update the menu of pairs depending on the available netcdf files |
---|
817 | if isequal(mode,'series(Di)') || ...% we do patch2 only |
---|
818 | (get(handles.CheckCiv2,'Value')==0 && get(handles.CheckCiv1,'Value')==0 && get(handles.CheckFix1,'Value')==0 && get(handles.CheckPatch1,'Value')==0) |
---|
819 | errormsg=find_netcpair_civ( handles,2); |
---|
820 | end |
---|
821 | if isempty(errormsg) |
---|
822 | set(handles.ref_i,'BackgroundColor',[1 1 1]) |
---|
823 | set(handles.ref_j,'BackgroundColor',[1 1 1]) |
---|
824 | else |
---|
825 | msgbox_uvmat('ERROR',errormsg) |
---|
826 | end |
---|
827 | |
---|
828 | function ref_i_KeyPressFcn(hObject, eventdata, handles) |
---|
829 | set(hObject,'BackgroundColor',[1 0 1]) |
---|
830 | |
---|
831 | % %------------------------------------------------------------------------ |
---|
832 | % function ref_j_Callback(hObject, eventdata, handles) |
---|
833 | % %------------------------------------------------------------------------ |
---|
834 | % mode_list=get(handles.ListPairMode,'String'); |
---|
835 | % mode_value=get(handles.ListPairMode,'Value'); |
---|
836 | % mode=mode_list{mode_value}; |
---|
837 | % errormsg=''; |
---|
838 | % if isequal(get(handles.CheckCiv1,'Value'),0)|| isequal(mode,'series(Dj)') |
---|
839 | % errormsg=find_netcpair_civ(handles,1);% update the menu of pairs depending on the available netcdf files |
---|
840 | % end |
---|
841 | % if isequal(mode,'series(Dj)') || ... |
---|
842 | % (get(handles.CheckCiv2,'Value')==0 && get(handles.CheckCiv1,'Value')==0 && get(handles.CheckFix1,'Value')==0 && get(handles.CheckPatch1,'Value')==0) |
---|
843 | % errormsg=find_netcpair_civ(handles,2); |
---|
844 | % end |
---|
845 | % if ~isempty(errormsg) |
---|
846 | % msgbox_uvmat('ERROR',errormsg) |
---|
847 | % end |
---|
848 | % |
---|
849 | % function ref_j_KeyPressFcn(hObject, eventdata, handles) |
---|
850 | % set(handles.ref_j,'BackgroundColor',[1 0 1]) |
---|
851 | %------------------------------------------------------------------------ |
---|
852 | % determine the menu for checkciv1 pairs depending on existing netcdf file at the middle of |
---|
853 | % the field series set by MinIndex_i, incr, last_i |
---|
854 | % index=1: look for pairs for civ1 |
---|
855 | % index=2: look for pairs for civ2 |
---|
856 | function errormsg=find_netcpair_civ(handles,index) |
---|
857 | %------------------------------------------------------------------------ |
---|
858 | set(gcf,'Pointer','watch')% set the mouse pointer to 'watch' (clock) |
---|
859 | |
---|
860 | %% initialisation |
---|
861 | errormsg=''; |
---|
862 | CivInputData=get(handles.civ_input,'UserData'); |
---|
863 | %browse=get(handles.RootPath,'UserData'); |
---|
864 | compare_list=get(handles.ListCompareMode,'String'); |
---|
865 | val=get(handles.ListCompareMode,'Value'); |
---|
866 | compare=compare_list{val}; |
---|
867 | if ~strcmp(compare,'displacement')%||strcmp(compare,'shift') |
---|
868 | |
---|
869 | mode_list=get(handles.ListPairMode,'String'); |
---|
870 | mode_value=get(handles.ListPairMode,'Value'); |
---|
871 | if isempty(mode_list) |
---|
872 | return |
---|
873 | end |
---|
874 | mode=mode_list{mode_value}; |
---|
875 | end |
---|
876 | nom_type_ima=CivInputData.NomTypeIma; |
---|
877 | menu_pair=get(handles.ListPairCiv1,'String');%previous menu of ListPairCiv1 |
---|
878 | PairCiv1Init=menu_pair{get(handles.ListPairCiv1,'Value')};%previous choice of pair |
---|
879 | menu_pair=get(handles.ListPairCiv2,'String');%previous menu of ListPairCiv1 |
---|
880 | PairCiv2Init=menu_pair{get(handles.ListPairCiv2,'Value')};%previous choice of pair |
---|
881 | |
---|
882 | %% determine nom_type_nc, nomenclature type of the .nc files: |
---|
883 | %[nom_type_nc]=nomtype2pair(nom_type_ima,mode); |
---|
884 | |
---|
885 | %% reads .nc subdirectoy and image numbers from the interface |
---|
886 | %SubDirImages=get(handles.Civ1_ImageA,'String'); |
---|
887 | %TODO: determine |
---|
888 | %subdir_civ1=[SubDirImages get(handles.Civ1_ImageB,'String')];%subdirectory subdir_civ1 for the netcdf data |
---|
889 | %subdir_civ2=[SubDirImages get(handles.Civ2_ImageA,'String')];%subdirectory subdir_civ2 for the netcdf data |
---|
890 | ref_i=str2double(get(handles.ref_i,'String')); |
---|
891 | ref_j=[]; |
---|
892 | if isequal(mode,'pair j1-j2')%|isequal(mode,'st_pair j1-j2') |
---|
893 | ref_j=0; |
---|
894 | elseif strcmp(get(handles.ref_j,'Visible'),'on') |
---|
895 | ref_j=str2double(get(handles.ref_j,'String')); |
---|
896 | end |
---|
897 | if isempty(ref_j) |
---|
898 | ref_j=1; |
---|
899 | end |
---|
900 | CivInputData=get(handles.civ_input,'UserData'); |
---|
901 | TimeUnit=get(handles.TimeUnit,'String'); |
---|
902 | Time=CivInputData.Time; |
---|
903 | checkframe=strcmp(TimeUnit,'frame'); |
---|
904 | |
---|
905 | %% case with no Civ1 operation, netcdf files need to exist for reading |
---|
906 | displ_pair={''}; |
---|
907 | nbpair=200;%default |
---|
908 | select=ones(size(1:nbpair));%flag for displayed pairs =1 for display |
---|
909 | %nbpair=200; %default |
---|
910 | |
---|
911 | %% determine the menu display in .ListPairCiv1 |
---|
912 | switch mode |
---|
913 | case 'series(Di)' |
---|
914 | for ipair=1:nbpair |
---|
915 | if select(ipair) |
---|
916 | displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2))]; |
---|
917 | displ_pair_dt{ipair}=displ_pair{ipair}; |
---|
918 | if ~checkframe |
---|
919 | if size(Time,1)>=ref_i+1+ceil(ipair/2) && size(Time,2)>=ref_j+1&& ref_i-floor(ipair/2)>=0 && ref_j>=0 |
---|
920 | dt=Time(ref_i+1+ceil(ipair/2),ref_j+1)-Time(ref_i+1-floor(ipair/2),ref_j+1);%Time interval dtref_j+1 |
---|
921 | displ_pair_dt{ipair}=[displ_pair_dt{ipair} ' :dt= ' num2str(dt*1000)]; |
---|
922 | end |
---|
923 | else |
---|
924 | dt=ipair/1000; |
---|
925 | displ_pair_dt{ipair}=[displ_pair_dt{ipair} ' :dt= ' num2str(ipair)]; |
---|
926 | end |
---|
927 | else |
---|
928 | displ_pair{ipair}='...'; |
---|
929 | displ_pair_dt{ipair}='...'; %pair not displayed in the menu |
---|
930 | end |
---|
931 | end |
---|
932 | case 'series(Dj)' |
---|
933 | for ipair=1:nbpair |
---|
934 | if select(ipair) |
---|
935 | displ_pair{ipair}=['Dj= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2))]; |
---|
936 | displ_pair_dt{ipair}=displ_pair{ipair}; |
---|
937 | if ~checkframe |
---|
938 | if size(Time,2)>=ref_j+1+ceil(ipair/2) && size(Time,1)>=ref_i+1 && ref_j-floor(ipair/2)>=0 && ref_i>=0 |
---|
939 | dt=Time(ref_i+1,ref_j+1+ceil(ipair/2))-Time(ref_i+1,ref_j+1-floor(ipair/2));%Time interval dtref_j+1 |
---|
940 | displ_pair_dt{ipair}=[displ_pair_dt{ipair} ' :dt= ' num2str(dt*1000)]; |
---|
941 | end |
---|
942 | else |
---|
943 | dt=ipair/1000; |
---|
944 | displ_pair_dt{ipair}=[displ_pair_dt{ipair} ' :dt= ' num2str(dt*1000)]; |
---|
945 | end |
---|
946 | else |
---|
947 | displ_pair{ipair}='...'; %pair not displayed in the menu |
---|
948 | displ_pair_dt{ipair}='...'; %pair not displayed in the menu |
---|
949 | end |
---|
950 | end |
---|
951 | case 'pair j1-j2'%case of pairs |
---|
952 | % MinIndex_j=CivInputData.MinIndex_j; |
---|
953 | % MaxIndex_j=min(CivInputData.MaxIndex_j,10);%limitate the number of pairs to 10x10 |
---|
954 | MinIndex_j=str2num(get(handles.MinIndex_j,'String')); |
---|
955 | MaxIndex_j=str2num(get(handles.MaxIndex_j,'String')); |
---|
956 | index_pair=0; |
---|
957 | %get all the Time intervals in bursts |
---|
958 | for numod_a=MinIndex_j:MaxIndex_j-1 %nbfield2 always >=2 for 'pair j1-j2' mode |
---|
959 | for numod_b=(numod_a+1):MaxIndex_j |
---|
960 | index_pair=index_pair+1; |
---|
961 | displ_pair{index_pair}=['j= ' num2stra(numod_a,nom_type_ima) '-' num2stra(numod_b,nom_type_ima)]; |
---|
962 | displ_pair_dt{ipair}=displ_pair{ipair}; |
---|
963 | dt(index_pair)=numod_b-numod_a;%default dt |
---|
964 | if size(Time,1)>ref_i && size(Time,2)>numod_b % && ~checkframe |
---|
965 | dt(index_pair)=Time(ref_i+1,numod_b+1)-Time(ref_i+1,numod_a+1);% Time interval dt |
---|
966 | displ_pair_dt{index_pair}=[displ_pair_dt{index_pair} ' :dt= ' num2str(dt(index_pair)*1000)]; |
---|
967 | end |
---|
968 | end |
---|
969 | |
---|
970 | end |
---|
971 | [tild,indsort]=sort(dt); |
---|
972 | displ_pair=displ_pair(indsort); |
---|
973 | displ_pair_dt=displ_pair_dt(indsort); |
---|
974 | case 'displacement' |
---|
975 | displ_pair={'Di=Dj=0'}; |
---|
976 | displ_pair_dt={'Di=Dj=0'}; |
---|
977 | end |
---|
978 | if index==1 |
---|
979 | set(handles.ListPairCiv1,'String',displ_pair_dt'); |
---|
980 | end |
---|
981 | |
---|
982 | %% determine the default selection in the pair menu for Civ1 |
---|
983 | %ichoice=find(select,1);% index of first selected pair |
---|
984 | %if (isempty(ichoice) || ichoice < 1); ichoice=1; end; |
---|
985 | end_pair=regexp(PairCiv1Init,' :dt='); |
---|
986 | if ~isempty(end_pair) |
---|
987 | PairCiv1Init=PairCiv1Init(1:end_pair-1); |
---|
988 | end |
---|
989 | ichoice=find(strcmp(PairCiv1Init,displ_pair'),1); |
---|
990 | if ~isempty(ichoice) |
---|
991 | set(handles.ListPairCiv1,'Value',ichoice);% first valid pair proposed by default in the menu |
---|
992 | else |
---|
993 | set(handles.ListPairCiv1,'Value',1) |
---|
994 | end |
---|
995 | % if initial>nbpair || (numel(select)>=initial && ~isequal(select(initial),1)) |
---|
996 | % set(handles.ListPairCiv1,'Value',ichoice);% first valid pair proposed by default in the menu |
---|
997 | % end |
---|
998 | |
---|
999 | %% determine the default selection in the pair menu for Civ2 |
---|
1000 | if strcmp(get(handles.ListPairCiv2,'Visible'),'on') |
---|
1001 | end_pair=regexp(PairCiv2Init,' :dt='); |
---|
1002 | if ~isempty(end_pair) |
---|
1003 | PairCiv2Init=PairCiv2Init(1:end_pair-1); |
---|
1004 | end |
---|
1005 | ichoice=find(strcmp(PairCiv2Init,displ_pair'),1); |
---|
1006 | if ~isempty(ichoice) |
---|
1007 | set(handles.ListPairCiv2,'Value',ichoice);% first valid pair proposed by default in the menu |
---|
1008 | else |
---|
1009 | set(handles.ListPairCiv2,'Value',1) |
---|
1010 | end |
---|
1011 | else |
---|
1012 | set(handles.ListPairCiv2,'Value',get(handles.ListPairCiv1,'Value'))% initiate the choice of Civ2 as a reproduction of if civ1 |
---|
1013 | end |
---|
1014 | set(handles.ListPairCiv2,'String',displ_pair_dt'); |
---|
1015 | set(gcf,'Pointer','arrow')% Indicate that the process is finished |
---|
1016 | |
---|
1017 | |
---|
1018 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1019 | % Callbacks in the uipanel Reference Indices |
---|
1020 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1021 | %------------------------------------------------------------------------ |
---|
1022 | function MinIndex_i_Callback(hObject, eventdata, handles) |
---|
1023 | %------------------------------------------------------------------------ |
---|
1024 | first_i=str2double(get(handles.MinIndex_i,'String')); |
---|
1025 | set(handles.ref_i,'String', num2str(first_i))% reference index for pair dt = first index |
---|
1026 | ref_i_Callback(hObject, eventdata, handles)%refresh dispaly of dt for pairs (in case of non constant dt) |
---|
1027 | |
---|
1028 | % %------------------------------------------------------------------------ |
---|
1029 | % function MinIndex_j_Callback(hObject, eventdata, handles) |
---|
1030 | % %------------------------------------------------------------------------ |
---|
1031 | % first_j=str2num(get(handles.MinIndex_j,'String')); |
---|
1032 | % set(handles.ref_j,'String', num2str(first_j))% reference index for pair dt = first index |
---|
1033 | % ref_j_Callback(hObject, eventdata, handles)%refresh dispaly of dt for pairs (in case of non constant dt) |
---|
1034 | |
---|
1035 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1036 | % Callbacks in the uipanel Civ1 |
---|
1037 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1038 | %------------------------------------------------------------------------ |
---|
1039 | % --- Executes on button press in SearchRange: determine the search range num_SearchBoxSize_1,num_SearchBoxSize_2 |
---|
1040 | function SearchRange_Callback(hObject, eventdata, handles) |
---|
1041 | %------------------------------------------------------------------------ |
---|
1042 | %determine pair numbers |
---|
1043 | if strcmp(get(handles.num_UMin,'Visible'),'off') |
---|
1044 | set(handles.u_title,'Visible','on') |
---|
1045 | set(handles.v_title,'Visible','on') |
---|
1046 | set(handles.num_UMin,'Visible','on') |
---|
1047 | set(handles.num_UMax,'Visible','on') |
---|
1048 | set(handles.num_VMin,'Visible','on') |
---|
1049 | set(handles.num_VMax,'Visible','on') |
---|
1050 | %set(handles.CoordUnit,'Visible','on') |
---|
1051 | %set(handles.TimeUnit,'Visible','on') |
---|
1052 | %set(handles.slash_title,'Visible','on') |
---|
1053 | set(handles.min_title,'Visible','on') |
---|
1054 | set(handles.max_title,'Visible','on') |
---|
1055 | set(handles.unit_title,'Visible','on') |
---|
1056 | else |
---|
1057 | get_search_range(hObject, eventdata, handles) |
---|
1058 | end |
---|
1059 | |
---|
1060 | %------------------------------------------------------------------------ |
---|
1061 | % --- determine the search range num_SearchBoxSize_1,num_SearchBoxSize_2 and shift |
---|
1062 | function get_search_range(hObject, eventdata, handles) |
---|
1063 | %------------------------------------------------------------------------ |
---|
1064 | param_civ1=read_GUI(handles.Civ1); |
---|
1065 | umin=param_civ1.UMin; |
---|
1066 | umax=param_civ1.UMax; |
---|
1067 | vmin=param_civ1.VMin; |
---|
1068 | vmax=param_civ1.VMax; |
---|
1069 | %switch min_title and max_title in case of error |
---|
1070 | if umax<=umin |
---|
1071 | umin_old=umin; |
---|
1072 | umin=umax; |
---|
1073 | umax=umin_old; |
---|
1074 | set(handles.num_UMin,'String', num2str(umin)) |
---|
1075 | set(handles.num_UMax,'String', num2str(umax)) |
---|
1076 | end |
---|
1077 | if vmax<=vmin |
---|
1078 | vmin_old=vmin; |
---|
1079 | vmin=vmax; |
---|
1080 | vmax=vmin_old; |
---|
1081 | set(handles.num_VMin,'String', num2str(vmin)) |
---|
1082 | set(handles.num_VMax,'String', num2str(vmax)) |
---|
1083 | end |
---|
1084 | if ~(isempty(umin)||isempty(umax)||isempty(vmin)||isempty(vmax)) |
---|
1085 | % list_pair=get(handles.ListPairCiv1,'String');%get the menu of image pairs |
---|
1086 | % index=get(handles.ListPairCiv1,'Value'); |
---|
1087 | % pair_string=list_pair{index}; |
---|
1088 | % time=get(handles.TimeSource,'UserData'); %get the set of times |
---|
1089 | % pxcm=get(handles.SearchRange,'UserData'); |
---|
1090 | % mode_list=get(handles.ListPairMode,'String'); |
---|
1091 | % mode_value=get(handles.ListPairMode,'Value'); |
---|
1092 | % mode=mode_list{mode_value}; |
---|
1093 | % if isequal (mode, 'series(Di)' ) |
---|
1094 | % ref_i=str2double(get(handles.ref_i,'String')); |
---|
1095 | % num1=ref_i-floor(index/2);% first image numbers |
---|
1096 | % num2=ref_i+ceil(index/2); |
---|
1097 | % num_a=1; |
---|
1098 | % num_b=1; |
---|
1099 | % elseif isequal (mode, 'series(Dj)') |
---|
1100 | % num1=1; |
---|
1101 | % num2=1; |
---|
1102 | % ref_j=str2double(get(handles.ref_j,'String')); |
---|
1103 | % num_a=ref_j-floor(index/2);% first image numbers |
---|
1104 | % num_b=ref_j+ceil(index/2); |
---|
1105 | % elseif isequal(mode,'pair j1-j2') %case of bursts (png_old or png_2D) |
---|
1106 | % ref_i=str2double(get(handles.ref_i,'String')); |
---|
1107 | % num1=ref_i; |
---|
1108 | % num2=ref_i; |
---|
1109 | % r=regexp(pair_string,'(?<mode>(Di=)|(Dj=)) -*(?<num1>\d+)\|(?<num2>\d+)','names'); |
---|
1110 | % if isempty(r) |
---|
1111 | % r=regexp(pair_string,'(?<num1>\d+)(?<mode>-)(?<num2>\d+)','names'); |
---|
1112 | % end |
---|
1113 | % num_a=str2num(r.num1); |
---|
1114 | % num_b=str2num(r.num2); |
---|
1115 | % end |
---|
1116 | % dt=time(num2+1,num_b+1)-time(num1+1,num_a+1); |
---|
1117 | % ibx=str2double(get(handles.num_CorrBoxSize_1,'String')); |
---|
1118 | % iby=str2double(get(handles.num_CorrBoxSize_2,'String')); |
---|
1119 | % umin=dt*pxcm*umin; |
---|
1120 | % umax=dt*pxcm*umax; |
---|
1121 | % vmin=dt*pxcm*vmin; |
---|
1122 | % vmax=dt*pxcm*vmax; |
---|
1123 | shiftx=round((umin+umax)/2); |
---|
1124 | shifty=round((vmin+vmax)/2); |
---|
1125 | isx=(umax+2-shiftx)*2+param_civ1.CorrBoxSize(1); |
---|
1126 | isx=2*ceil(isx/2)+1; |
---|
1127 | isy=(vmax+2-shifty)*2+param_civ1.CorrBoxSize(2); |
---|
1128 | isy=2*ceil(isy/2)+1; |
---|
1129 | set(handles.num_SearchBoxShift_1,'String',num2str(shiftx)); |
---|
1130 | set(handles.num_SearchBoxShift_2,'String',num2str(shifty)); |
---|
1131 | set(handles.num_SearchBoxSize_1,'String',num2str(isx)); |
---|
1132 | set(handles.num_SearchBoxSize_2,'String',num2str(isy)); |
---|
1133 | end |
---|
1134 | |
---|
1135 | %------------------------------------------------------------------------ |
---|
1136 | % --- Executes on selection in menu CorrSmooth. |
---|
1137 | function num_CorrSmooth_Callback(hObject, eventdata, handles) |
---|
1138 | set(handles.ConfigSource,'String','NEW') |
---|
1139 | set(handles.OK,'BackgroundColor',[1 0 1]) |
---|
1140 | %------------------------------------------------------------------------ |
---|
1141 | |
---|
1142 | % --- Executes on button press in CheckDeformation. |
---|
1143 | function CheckDeformation_Callback(hObject, eventdata, handles) |
---|
1144 | set(handles.ConfigSource,'String','NEW') |
---|
1145 | set(handles.OK,'BackgroundColor',[1 0 1]) |
---|
1146 | if get(handles.CheckDeformation,'Value') |
---|
1147 | set(handles.num_CorrSmooth,'Visible','off') |
---|
1148 | else |
---|
1149 | set(handles.num_CorrSmooth,'Visible','on') |
---|
1150 | end |
---|
1151 | |
---|
1152 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1153 | % Callbacks in the uipanel Fix1 |
---|
1154 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1155 | %------------------------------------------------------------------------ |
---|
1156 | % % --- Executes on button press in CheckMask. |
---|
1157 | % function get_mask_fix1_Callback(hObject, eventdata, handles) |
---|
1158 | % %------------------------------------------------------------------------ |
---|
1159 | % maskval=get(handles.CheckMask,'Value'); |
---|
1160 | % if isequal(maskval,0) |
---|
1161 | % set(handles.Mask,'String','') |
---|
1162 | % else |
---|
1163 | % mask_displ='no mask'; %default |
---|
1164 | % filebase=get(handles.RootPath,'String'); |
---|
1165 | % [nbslice, flag_mask]=get_mask(filebase,handles); |
---|
1166 | % if isequal(flag_mask,1) |
---|
1167 | % mask_displ=[num2str(nbslice) 'mask']; |
---|
1168 | % elseif get(handles.ListCompareMode,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series |
---|
1169 | % filebase_a=get(handles.RootFile_1,'String'); |
---|
1170 | % [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); |
---|
1171 | % if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice) |
---|
1172 | % mask_displ='no mask'; |
---|
1173 | % end |
---|
1174 | % end |
---|
1175 | % if isequal(mask_displ,'no mask') |
---|
1176 | % [FileName, PathName, filterindex] = uigetfile( ... |
---|
1177 | % {'*.png', ' (*.png)'; |
---|
1178 | % '*.png', '.png files '; ... |
---|
1179 | % '*.*', 'All Files (*.*)'}, ... |
---|
1180 | % 'Pick a mask file *.png',filebase); |
---|
1181 | % mask_displ=fullfile(PathName,FileName); |
---|
1182 | % if ~exist(mask_displ,'file') |
---|
1183 | % mask_displ='no mask'; |
---|
1184 | % end |
---|
1185 | % end |
---|
1186 | % if isequal(mask_displ,'no mask') |
---|
1187 | % set(handles.CheckMask,'Value',0) |
---|
1188 | % set(handles.CheckMask,'Value',0) |
---|
1189 | % set(handles.CheckMask,'Value',0) |
---|
1190 | % else |
---|
1191 | % %set(handles.CheckMask,'Value',1) |
---|
1192 | % set(handles.CheckMask,'Value',1) |
---|
1193 | % end |
---|
1194 | % set(handles.Mask,'String',mask_displ) |
---|
1195 | % set(handles.Mask,'String',mask_displ) |
---|
1196 | % set(handles.Mask,'String',mask_displ) |
---|
1197 | % end |
---|
1198 | |
---|
1199 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1200 | % Callbacks in the uipanel Civ2 |
---|
1201 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1202 | %------------------------------------------------------------------------ |
---|
1203 | % --- Executes on button press in CheckMask: select box for mask option |
---|
1204 | function get_mask_civ2_Callback(hObject, eventdata, handles) |
---|
1205 | %------------------------------------------------------------------------ |
---|
1206 | maskval=get(handles.CheckMask,'Value'); |
---|
1207 | if isequal(maskval,0) |
---|
1208 | set(handles.Mask,'String','') |
---|
1209 | else |
---|
1210 | mask_displ='no mask'; %default |
---|
1211 | filebase=get(handles.RootPath,'String'); |
---|
1212 | [nbslice, flag_mask]=get_mask(filebase,handles); |
---|
1213 | if isequal(flag_mask,1) |
---|
1214 | mask_displ=[num2str(nbslice) 'mask']; |
---|
1215 | elseif get(handles.ListCompareMode,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series |
---|
1216 | filebase_a=get(handles.RootFile_1,'String'); |
---|
1217 | [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); |
---|
1218 | if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice) |
---|
1219 | mask_displ='no mask'; |
---|
1220 | end |
---|
1221 | end |
---|
1222 | if isequal(mask_displ,'no mask') |
---|
1223 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
1224 | {'*.png', ' (*.png)'; |
---|
1225 | '*.png', '.png files '; ... |
---|
1226 | '*.*', 'All Files (*.*)'}, ... |
---|
1227 | 'Pick a mask file *.png',filebase); |
---|
1228 | mask_displ=fullfile(PathName,FileName); |
---|
1229 | if ~exist(mask_displ,'file') |
---|
1230 | mask_displ='no mask'; |
---|
1231 | end |
---|
1232 | end |
---|
1233 | if isequal(mask_displ,'no mask') |
---|
1234 | set(handles.CheckMask,'Value',0) |
---|
1235 | set(handles.CheckMask,'Value',0) |
---|
1236 | else |
---|
1237 | set(handles.CheckMask,'Value',1) |
---|
1238 | end |
---|
1239 | set(handles.Mask,'String',mask_displ) |
---|
1240 | end |
---|
1241 | |
---|
1242 | % %------------------------------------------------------------------------ |
---|
1243 | % % --- Executes on button press in CheckMask. |
---|
1244 | % function get_mask_fix2_Callback(hObject, eventdata, handles) |
---|
1245 | % %------------------------------------------------------------------------ |
---|
1246 | % maskval=get(handles.CheckMask,'Value'); |
---|
1247 | % if isequal(maskval,0) |
---|
1248 | % set(handles.Mask,'String','') |
---|
1249 | % else |
---|
1250 | % mask_displ='no mask'; %default |
---|
1251 | % filebase=get(handles.RootPath,'String'); |
---|
1252 | % [nbslice, flag_mask]=get_mask(filebase,handles); |
---|
1253 | % if isequal(flag_mask,1) |
---|
1254 | % mask_displ=[num2str(nbslice) 'mask']; |
---|
1255 | % elseif get(handles.ListCompareMode,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series |
---|
1256 | % filebase_a=get(handles.RootFile_1,'String'); |
---|
1257 | % [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); |
---|
1258 | % if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice) |
---|
1259 | % mask_displ='no mask'; |
---|
1260 | % end |
---|
1261 | % end |
---|
1262 | % if isequal(mask_displ,'no mask') |
---|
1263 | % [FileName, PathName, filterindex] = uigetfile( ... |
---|
1264 | % {'*.png', ' (*.png)'; |
---|
1265 | % '*.png', '.png files '; ... |
---|
1266 | % '*.*', 'All Files (*.*)'}, ... |
---|
1267 | % 'Pick a mask file *.png',filebase); |
---|
1268 | % mask_displ=fullfile(PathName,FileName); |
---|
1269 | % if ~exist(mask_displ,'file') |
---|
1270 | % mask_displ='no mask'; |
---|
1271 | % end |
---|
1272 | % end |
---|
1273 | % if isequal(mask_displ,'no mask') |
---|
1274 | % set(handles.CheckMask,'Value',0) |
---|
1275 | % end |
---|
1276 | % set(handles.Mask,'String',mask_displ) |
---|
1277 | % end |
---|
1278 | |
---|
1279 | %------------------------------------------------------------------------ |
---|
1280 | % --- function called to look for mask files |
---|
1281 | function [nbslice, flag_mask]=get_mask(filebase,handles) |
---|
1282 | %------------------------------------------------------------------------ |
---|
1283 | %detect mask files, images with appropriate file base |
---|
1284 | %[filebase '_' xx 'mask'], xx=nbslice |
---|
1285 | %flag_mask=1 indicates detection |
---|
1286 | |
---|
1287 | flag_mask=0;%default |
---|
1288 | nbslice=1; |
---|
1289 | |
---|
1290 | % subdir=get(handles.Civ1_ImageB,'String'); |
---|
1291 | [Path,Name]=fileparts(filebase); |
---|
1292 | if ~isdir(Path) |
---|
1293 | msgbox_uvmat('ERROR','no path for input files') |
---|
1294 | return |
---|
1295 | end |
---|
1296 | % currentdir=pwd; |
---|
1297 | % cd(Path);%move in the dir of the root name filebase |
---|
1298 | maskfiles=dir(fullfile(Path,[Name '_*mask_*.png']));%look for mask files |
---|
1299 | % cd(currentdir);%come back to the current working directory |
---|
1300 | if ~isempty(maskfiles) |
---|
1301 | % msgbox_uvmat('ERROR','no mask available, to create it use Tools/Make mask in the upper menu bar of uvmat') |
---|
1302 | % else |
---|
1303 | flag_mask=1; |
---|
1304 | maskname=maskfiles(1).name;% take the first mask file in the list |
---|
1305 | [Path2,Name,ext]=fileparts(maskname); |
---|
1306 | Namedouble=double(Name); |
---|
1307 | val=(48>Namedouble)|(Namedouble>57);% select the non-numerical characters |
---|
1308 | ind_mask=findstr('mask',Name); |
---|
1309 | i=ind_mask-1; |
---|
1310 | while val(i)==0 && i>0 |
---|
1311 | i=i-1; |
---|
1312 | end |
---|
1313 | nbslice=str2double(Name(i+1:ind_mask-1)); |
---|
1314 | if ~isnan(nbslice) && Name(i)=='_' |
---|
1315 | flag_mask=1; |
---|
1316 | else |
---|
1317 | msgbox_uvmat('ERROR',['bad mask file ' Name ext ' found in ' Path2]) |
---|
1318 | return |
---|
1319 | nbslice=1; |
---|
1320 | end |
---|
1321 | end |
---|
1322 | |
---|
1323 | %------------------------------------------------------------------------ |
---|
1324 | % --- function called to look for grid files |
---|
1325 | function [nbslice, flag_grid]=get_grid(filebase,handles) |
---|
1326 | %------------------------------------------------------------------------ |
---|
1327 | flag_grid=0;%default |
---|
1328 | nbslice=1; |
---|
1329 | [Path,Name]=fileparts(filebase); |
---|
1330 | currentdir=pwd; |
---|
1331 | cd(Path);%move in the dir of the root name filebase |
---|
1332 | gridfiles=dir([Name '_*grid_*.grid']);%look for grid files |
---|
1333 | cd(currentdir);%come back to the current working directory |
---|
1334 | if ~isempty(gridfiles) |
---|
1335 | flag_grid=1; |
---|
1336 | gridname=gridfiles(1).name;% take the first grid file in the list |
---|
1337 | [Path2,Name,ext]=fileparts(gridname); |
---|
1338 | Namedouble=double(Name); |
---|
1339 | val=(48>Namedouble)|(Namedouble>57);% select the non-numerical characters |
---|
1340 | ind_grid=findstr('grid',Name); |
---|
1341 | i=ind_grid-1; |
---|
1342 | while val(i)==0 && i>0 |
---|
1343 | i=i-1; |
---|
1344 | end |
---|
1345 | nbslice=str2double(Name(i+1:ind_grid-1)); |
---|
1346 | if ~isnan(nbslice) && Name(i)=='_' |
---|
1347 | flag_grid=1; |
---|
1348 | else |
---|
1349 | msgbox_uvmat('ERROR',['bad grid file ' Name ext ' found in ' Path2]) |
---|
1350 | return |
---|
1351 | nbslice=1; |
---|
1352 | end |
---|
1353 | end |
---|
1354 | |
---|
1355 | %------------------------------------------------------------------------ |
---|
1356 | % --- transform numbers to letters |
---|
1357 | function str=num2stra(num,nom_type) |
---|
1358 | %------------------------------------------------------------------------ |
---|
1359 | if isempty(nom_type) |
---|
1360 | str=''; |
---|
1361 | elseif strcmp(nom_type(end),'a') |
---|
1362 | str=char(96+num); |
---|
1363 | elseif strcmp(nom_type(end),'A') |
---|
1364 | str=char(96+num); |
---|
1365 | elseif isempty(nom_type(2:end))%a single index |
---|
1366 | str=''; |
---|
1367 | else |
---|
1368 | str=num2str(num); |
---|
1369 | end |
---|
1370 | |
---|
1371 | % %------------------------------------------------------------------------ |
---|
1372 | % % --- Executes on button press in ListSubdirCiv1. |
---|
1373 | % function ListSubdirCiv1_Callback(hObject, eventdata, handles) |
---|
1374 | % %------------------------------------------------------------------------ |
---|
1375 | % list_subdir_civ1=get(handles.ListSubdirCiv1,'String'); |
---|
1376 | % val=get(handles.ListSubdirCiv1,'Value'); |
---|
1377 | % SubDir=list_subdir_civ1{val}; |
---|
1378 | % if strcmp(SubDir,'new...') |
---|
1379 | % if get(handles.CheckCiv1,'Value') |
---|
1380 | % SubDir='CIV_INPUT'; %default subdirectory |
---|
1381 | % else |
---|
1382 | % msgbox_uvmat('ERROR','select CheckCiv1 to perform a new civ_input operation') |
---|
1383 | % return |
---|
1384 | % end |
---|
1385 | % end |
---|
1386 | % set(handles.Civ1_ImageB,'String',SubDir); |
---|
1387 | % errormsg=find_netcpair_civ(handles,1); |
---|
1388 | % if ~isempty(errormsg) |
---|
1389 | % msgbox_uvmat('ERROR',errormsg) |
---|
1390 | % end |
---|
1391 | % |
---|
1392 | %------------------------------------------------------------------------ |
---|
1393 | % % --- Executes on button press in ListSubdirCiv2. |
---|
1394 | % function ListSubdirCiv2_Callback(hObject, eventdata, handles) |
---|
1395 | % %------------------------------------------------------------------------ |
---|
1396 | % list_subdir_civ2=get(handles.ListSubdirCiv2,'String'); |
---|
1397 | % val=get(handles.ListSubdirCiv2,'Value'); |
---|
1398 | % SubDir=list_subdir_civ2{val}; |
---|
1399 | % if strcmp(SubDir,'new...') |
---|
1400 | % if get(handles.CheckCiv2,'Value') |
---|
1401 | % SubDir='CIV_INPUT'; %default subdirectory |
---|
1402 | % else |
---|
1403 | % msgbox_uvmat('ERROR','select CheckCiv2 to perform a new civ_input operation') |
---|
1404 | % return |
---|
1405 | % end |
---|
1406 | % end |
---|
1407 | % set(handles.Civ2_ImageA,'String',SubDir); |
---|
1408 | |
---|
1409 | %------------------------------------------------------------------------ |
---|
1410 | % --- Executes on button press in CheckGrid. |
---|
1411 | function CheckGrid_Callback(hObject, eventdata, handles) |
---|
1412 | %------------------------------------------------------------------------ |
---|
1413 | value=get(hObject,'Value'); |
---|
1414 | hparent=get(hObject,'parent');%handles of the parent panel |
---|
1415 | hchildren=get(hparent,'children'); |
---|
1416 | handle_txtbox=findobj(hchildren,'tag','Grid');% look for the grid name box in the same panel |
---|
1417 | handle_dx=findobj(hchildren,'tag','num_Dx'); |
---|
1418 | handle_dy=findobj(hchildren,'tag','num_Dy'); |
---|
1419 | handle_title_dx=findobj(hchildren,'tag','title_Dx'); |
---|
1420 | handle_title_dy=findobj(hchildren,'tag','title_Dy'); |
---|
1421 | testgrid=0; |
---|
1422 | filegrid=''; |
---|
1423 | if value |
---|
1424 | hseries=findobj(allchild(0),'Tag','series'); |
---|
1425 | hhseries=guidata(hseries); |
---|
1426 | InputTable=get(hhseries.InputTable,'Data'); |
---|
1427 | ind_A=1;% line index of the (first) image series |
---|
1428 | if strcmp(InputTable{1,5},'.nc'); |
---|
1429 | ind_A=2; |
---|
1430 | end |
---|
1431 | filebase=InputTable{ind_A,1}; |
---|
1432 | [nbslice, flag_grid]=get_grid(filebase,handles);% look for a grid with appropriate name |
---|
1433 | if isequal(flag_grid,1) |
---|
1434 | filegrid=[num2str(nbslice) 'grid']; |
---|
1435 | testgrid=1; |
---|
1436 | else % browse for a grid |
---|
1437 | filegrid=get(hObject,'UserData');%look for previous grid name stored as UserData |
---|
1438 | if exist(filegrid,'file') |
---|
1439 | filebase=filegrid; |
---|
1440 | end |
---|
1441 | filegrid = uigetfile_uvmat('pick a grid file .grid:',filebase,'.grid'); |
---|
1442 | set(hObject,'UserData',filegrid);%store for future use |
---|
1443 | if ~isempty(filegrid) |
---|
1444 | testgrid=1; |
---|
1445 | end |
---|
1446 | set(hObject,'UserData',filegrid);%store for future use |
---|
1447 | end |
---|
1448 | end |
---|
1449 | if testgrid |
---|
1450 | set(handle_dx,'Visible','off'); |
---|
1451 | set(handle_dy,'Visible','off'); |
---|
1452 | set(handle_title_dy,'Visible','off'); |
---|
1453 | set(handle_title_dx,'Visible','off'); |
---|
1454 | set(handle_txtbox,'Visible','on') |
---|
1455 | set(handle_txtbox,'String',filegrid) |
---|
1456 | else |
---|
1457 | set(hObject,'Value',0); |
---|
1458 | set(handle_dx,'Visible','on'); |
---|
1459 | set(handle_dy,'Visible','on'); |
---|
1460 | set(handle_title_dy,'Visible','on'); |
---|
1461 | set(handle_title_dx,'Visible','on'); |
---|
1462 | set(handle_txtbox,'Visible','off') |
---|
1463 | end |
---|
1464 | |
---|
1465 | %% if hObject is on the checkciv1 frame, duplicate action for checkciv2 frame |
---|
1466 | PanelName=get(hparent,'tag'); |
---|
1467 | if strcmp(PanelName,'Civ1') |
---|
1468 | hchildren=get(handles.Civ2,'children'); |
---|
1469 | handle_checkbox=findobj(hchildren,'tag','CheckGrid'); |
---|
1470 | handle_txtbox=findobj(hchildren,'tag','Grid'); |
---|
1471 | handle_dx=findobj(hchildren,'tag','num_Dx'); |
---|
1472 | handle_dy=findobj(hchildren,'tag','num_Dy'); |
---|
1473 | handle_title_dx=findobj(hchildren,'tag','title_Dx'); |
---|
1474 | handle_title_dy=findobj(hchildren,'tag','title_Dy'); |
---|
1475 | set(handle_checkbox,'UserData',filegrid);%store for future use |
---|
1476 | if testgrid |
---|
1477 | set(handle_checkbox,'Value',1); |
---|
1478 | set(handle_dx,'Visible','off'); |
---|
1479 | set(handle_dy,'Visible','off'); |
---|
1480 | set(handle_title_dx,'Visible','off'); |
---|
1481 | set(handle_title_dy,'Visible','off'); |
---|
1482 | set(handle_txtbox,'Visible','on') |
---|
1483 | set(handle_txtbox,'String',filegrid) |
---|
1484 | end |
---|
1485 | end |
---|
1486 | set(hObject,'BackgroundColor',[1 0 1]) |
---|
1487 | set(handles.ConfigSource,'String','NEW') |
---|
1488 | set(handles.OK,'BackgroundColor',[1 0 1]) |
---|
1489 | %------------------------------------------------------------------------ |
---|
1490 | % --- Executes on button press in CheckMask: common to all panels (civ1, Civ2..) |
---|
1491 | function CheckMask_Callback(hObject, eventdata, handles) |
---|
1492 | %------------------------------------------------------------------------ |
---|
1493 | value=get(hObject,'Value'); |
---|
1494 | hparent=get(hObject,'parent'); |
---|
1495 | parent_tag=get(hparent,'Tag'); |
---|
1496 | hchildren=get(hparent,'children'); |
---|
1497 | handle_txtbox=findobj(hchildren,'tag','Mask');% look for the mask name box in the same panel |
---|
1498 | |
---|
1499 | testmask=0; |
---|
1500 | if value |
---|
1501 | hseries=findobj(allchild(0),'Tag','series'); |
---|
1502 | hhseries=guidata(hseries); |
---|
1503 | InputTable=get(hhseries.InputTable,'Data'); |
---|
1504 | ind_A=1;% line index of the (first) image series |
---|
1505 | if strcmp(InputTable{1,5},'.nc'); |
---|
1506 | ind_A=2; |
---|
1507 | end |
---|
1508 | [nbslice, flag_mask]=get_mask(InputTable{ind_A,1},handles);% look for a mask with appropriate name |
---|
1509 | if isequal(flag_mask,1) |
---|
1510 | filemask=[num2str(nbslice) 'mask']; |
---|
1511 | testmask=1; |
---|
1512 | else % browse for a mask |
---|
1513 | % filemask=get(hObject,'UserData');%look for previous mask name stored as UserData |
---|
1514 | % if exist(filemask,'file') |
---|
1515 | % filebase=filemask; |
---|
1516 | % end |
---|
1517 | filemask= uigetfile_uvmat('pick a mask image file:',InputTable{ind_A,1},'image'); |
---|
1518 | set(hObject,'UserData',filemask);%store for future use |
---|
1519 | if ~isempty(filemask) |
---|
1520 | testmask=1; |
---|
1521 | end |
---|
1522 | end |
---|
1523 | end |
---|
1524 | if testmask |
---|
1525 | set(handles.Mask,'Visible','on') |
---|
1526 | set(handles.Mask,'String',filemask) |
---|
1527 | set(handles.CheckMask,'Value',1) |
---|
1528 | else |
---|
1529 | set(hObject,'Value',0); |
---|
1530 | set(handle_txtbox,'Visible','off') |
---|
1531 | end |
---|
1532 | set(handles.ConfigSource,'String','NEW') |
---|
1533 | set(handles.ConfigSource,'BackgroundColor',[1 0 1]) |
---|
1534 | |
---|
1535 | % %------------------------------------------------------------------------ |
---|
1536 | % % --- Executes on button press in get_gridpatch1. |
---|
1537 | % function get_gridpatch1_Callback(hObject, eventdata, handles) |
---|
1538 | % %------------------------------------------------------------------------ |
---|
1539 | % filebase=get(handles.RootPath,'String'); |
---|
1540 | % [FileName, PathName, filterindex] = uigetfile( ... |
---|
1541 | % {'*.grid', ' (*.grid)'; |
---|
1542 | % '*.grid', '.grid files '; ... |
---|
1543 | % '*.*', 'All Files (*.*)'}, ... |
---|
1544 | % 'Pick a file',filebase); |
---|
1545 | % filegrid=fullfile(PathName,FileName); |
---|
1546 | % set(handles.grid_patch1,'string',filegrid); |
---|
1547 | % set(hObject,'BackgroundColor',[1 0 1]) |
---|
1548 | |
---|
1549 | %------------------------------------------------------------------------ |
---|
1550 | % --- STEREO Interp |
---|
1551 | function cmd=RUN_STINTERP(stinterpBin,filename_A_nc,filename_B_nc,filename_nc,nx_patch,ny_patch,rho_patch,subdomain_patch,thresh_value,xmlA,xmlB) |
---|
1552 | %------------------------------------------------------------------------ |
---|
1553 | namelog=[filename_nc(1:end-3) '_stinterp.log']; |
---|
1554 | cmd=[stinterpBin ' -f1 ' filename_A_nc ' -f2 ' filename_B_nc ' -f ' filename_nc ... |
---|
1555 | ' -m ' nx_patch ' -n ' ny_patch ' -ro ' rho_patch ' -nopt ' subdomain_patch ' -c1 ' xmlA ' -c2 ' xmlB ' -xy x -Nfy 1024 > ' namelog ' 2>&1']; % redirect standard output to the log file |
---|
1556 | |
---|
1557 | % %------------------------------------------------------------------------ |
---|
1558 | % %--read images and convert them to the uint16 format used for PIV |
---|
1559 | % function A=read_image(filename,type_ima,num,movieobject) |
---|
1560 | % %------------------------------------------------------------------------ |
---|
1561 | % %num is the view number needed for an avi movie |
---|
1562 | % switch type_ima |
---|
1563 | % case 'movie' |
---|
1564 | % A=read(movieobject,num); |
---|
1565 | % case 'avi' |
---|
1566 | % mov=aviread(filename,num); |
---|
1567 | % A=frame2im(mov(1)); |
---|
1568 | % case 'multimage' |
---|
1569 | % A=imread(filename,num); |
---|
1570 | % case 'image' |
---|
1571 | % A=imread(filename); |
---|
1572 | % end |
---|
1573 | % siz=size(A); |
---|
1574 | % if length(siz)==3;%color images |
---|
1575 | % A=sum(double(A),3); |
---|
1576 | % A=uint16(A); |
---|
1577 | % end |
---|
1578 | |
---|
1579 | |
---|
1580 | %------------------------------------------------------------------------ |
---|
1581 | % --- Executes on button press in get_ref_fix1. |
---|
1582 | function get_ref_fix1_Callback(hObject, eventdata, handles) |
---|
1583 | %------------------------------------------------------------------------ |
---|
1584 | filebase=get(handles.RootPath,'String'); |
---|
1585 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
1586 | {'*.nc', ' (*.nc)'; |
---|
1587 | '*.nc', 'netcdf files '; ... |
---|
1588 | '*.*', 'All Files (*.*)'}, ... |
---|
1589 | 'Pick a file',filebase); |
---|
1590 | |
---|
1591 | fileinput=[PathName FileName]; |
---|
1592 | sizf=size(fileinput); |
---|
1593 | if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end %stop if fileinput not a character string |
---|
1594 | %[Path,File,field_count,str2,str_a,str_b,ref.ext,ref.nom_type,ref.subdir]=name2display(fileinput); |
---|
1595 | [Path,ref.subdir,File,ref.num1,ref.num2,ref.num_a,ref.num_b,ref.ext,ref.nom_type]=fileparts_uvmat(fileinput); |
---|
1596 | ref.filebase=fullfile(Path,File); |
---|
1597 | % ref.num_a=stra2num(str_a); |
---|
1598 | % ref.num_b=stra2num(str_b); |
---|
1599 | % ref.num1=str2double(field_count); |
---|
1600 | % ref.num2=str2double(str2); |
---|
1601 | browse=[];%initialisation |
---|
1602 | if ~isequal(ref.ext,'.nc') |
---|
1603 | msgbox_uvmat('ERROR','the reference file must be in netcdf format (*.nc)') |
---|
1604 | return |
---|
1605 | end |
---|
1606 | set(handles.ref_fix1,'String',[fullfile(ref.subdir,File) '....nc']); |
---|
1607 | set(handles.ref_fix1,'UserData',ref) |
---|
1608 | menu_field{1}='civ1'; |
---|
1609 | Data=nc2struct(fileinput,[]); |
---|
1610 | if isfield(Data,'patch') && isequal(Data.patch,1) |
---|
1611 | menu_field{2}='filter1'; |
---|
1612 | end |
---|
1613 | if isfield(Data,'civ2') && isequal(Data.civ2,1) |
---|
1614 | menu_field{3}='civ2'; |
---|
1615 | end |
---|
1616 | if isfield(Data,'patch2') && isequal(Data.patch2,1) |
---|
1617 | menu_field{4}='filter2'; |
---|
1618 | end |
---|
1619 | set(handles.field_ref1,'String',menu_field); |
---|
1620 | set(handles.field_ref1,'Value',length(menu_field)); |
---|
1621 | set(handles.num_MinVel,'Value',2); |
---|
1622 | set(handles.num_MinVel,'String','1');%default threshold |
---|
1623 | set(handles.ref_fix1,'Enable','on') |
---|
1624 | |
---|
1625 | %------------------------------------------------------------------------ |
---|
1626 | % --- Executes on button press in get_ref_fix2. |
---|
1627 | function get_ref_fix2_Callback(hObject, eventdata, handles) |
---|
1628 | %------------------------------------------------------------------------ |
---|
1629 | if isequal(get(handles.get_ref_fix2,'Value'),1) |
---|
1630 | filebase=get(handles.RootPath,'String'); |
---|
1631 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
1632 | {'*.nc', ' (*.nc)'; |
---|
1633 | '*.nc', 'netcdf files '; ... |
---|
1634 | '*.*', 'All Files (*.*)'}, ... |
---|
1635 | 'Pick a file',filebase); |
---|
1636 | fileinput=[PathName FileName]; |
---|
1637 | sizf=size(fileinput); |
---|
1638 | if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end %stop if fileinput not a character string |
---|
1639 | %[Path,File,field_count,str2,str_a,str_b,ref.ext,ref.nom_type,ref.subdir]=name2display(fileinput); |
---|
1640 | [Path,ref.subdir,File,ref.num1,ref.num2,ref.num_a,ref.num_b,ref.ext,ref.nom_type]=fileparts_uvmat(fileinput); |
---|
1641 | ref.filebase=fullfile(Path,File); |
---|
1642 | % ref.num_a=stra2num(str_a); |
---|
1643 | % ref.num_b=stra2num(str_b); |
---|
1644 | % ref.num1=str2num(field_count); |
---|
1645 | % ref.num2=str2num(str2); |
---|
1646 | browse=[];%initialisation |
---|
1647 | if ~isequal(ref.ext,'.nc') |
---|
1648 | msgbox_uvmat('ERROR','the reference file must be in netcdf format (*.nc)') |
---|
1649 | return |
---|
1650 | end |
---|
1651 | set(handles.ref_fix2,'String',[fullfile(ref.subdir,File) '....nc']); |
---|
1652 | set(handles.ref_fix2,'UserData',ref) |
---|
1653 | menu_field{1}='civ1'; |
---|
1654 | Data=nc2struct(fileinput,[]); |
---|
1655 | if isfield(Data,'patch') && isequal(Data.patch,1) |
---|
1656 | menu_field{2}='filter1'; |
---|
1657 | end |
---|
1658 | if isfield(Data,'civ2') && isequal(Data.civ2,1) |
---|
1659 | menu_field{3}='civ2'; |
---|
1660 | end |
---|
1661 | if isfield(Data,'patch2') && isequal(Data.patch2,1) |
---|
1662 | menu_field{4}='filter2'; |
---|
1663 | end |
---|
1664 | set(handles.field_ref2,'String',menu_field); |
---|
1665 | set(handles.field_ref2,'Value',length(menu_field)); |
---|
1666 | set(handles.num_MinVel,'Value',2); |
---|
1667 | set(handles.num_MinVel,'String','1');%default threshold |
---|
1668 | set(handles.ref_fix2,'Enable','on') |
---|
1669 | set(handles.ref_fix2,'Visible','on') |
---|
1670 | set(handles.field_ref2,'Visible','on') |
---|
1671 | else |
---|
1672 | set(handles.ref_fix2,'Visible','off') |
---|
1673 | set(handles.field_ref2,'Visible','off') |
---|
1674 | end |
---|
1675 | |
---|
1676 | %------------------------------------------------------------------------ |
---|
1677 | function ref_fix1_Callback(hObject, eventdata, handles) |
---|
1678 | %------------------------------------------------------------------------ |
---|
1679 | set(handles.num_MinVel,'Value',1); |
---|
1680 | set(handles.field_ref1,'Value',1) |
---|
1681 | set(handles.field_ref1,'String',{' '}) |
---|
1682 | set(handles.ref_fix1,'UserData',[]); |
---|
1683 | set(handles.ref_fix1,'String',''); |
---|
1684 | set(handles.thresh_vel1,'String','0'); |
---|
1685 | |
---|
1686 | %------------------------------------------------------------------------ |
---|
1687 | function ref_fix2_Callback(hObject, eventdata, handles) |
---|
1688 | %------------------------------------------------------------------------ |
---|
1689 | set(handles.num_MinVel,'Value',1); |
---|
1690 | set(handles.field_ref2,'Value',1) |
---|
1691 | set(handles.field_ref2,'String',{' '}) |
---|
1692 | set(handles.ref_fix2,'UserData',[]); |
---|
1693 | set(handles.ref_fix2,'String',''); |
---|
1694 | set(handles.num_MinVel,'String','0'); |
---|
1695 | |
---|
1696 | %------------------------------------------------------------------------ |
---|
1697 | % --- TO ABANDON Executes on button press in test_stereo1. |
---|
1698 | function CheckStereo_Callback(hObject, eventdata, handles) |
---|
1699 | %------------------------------------------------------------------------ |
---|
1700 | hparent=get(hObject,'parent'); |
---|
1701 | parent_tag=get(hparent,'Tag'); |
---|
1702 | hchildren=get(hparent,'children'); |
---|
1703 | handle_txtbox=findobj(hchildren,'tag','txt_Mask'); |
---|
1704 | if isequal(get(hObject,'Value'),0) |
---|
1705 | set(handles.num_SubDomainSize,'Visible','on') |
---|
1706 | set(handles.num_FieldSmooth,'Visible','on') |
---|
1707 | else |
---|
1708 | set(handles.num_SubDomainSize,'Visible','off') |
---|
1709 | set(handles.num_FieldSmooth,'Visible','off') |
---|
1710 | end |
---|
1711 | |
---|
1712 | % %------------------------------------------------------------------------ |
---|
1713 | % % --- Executes on button press in CheckStereo. |
---|
1714 | % function StereoCheck_Callback(hObject, eventdata, handles) |
---|
1715 | % %------------------------------------------------------------------------ |
---|
1716 | % if isequal(get(handles.CheckStereo,'Value'),0) |
---|
1717 | % set(handles.num_subdomainsize,'Visible','on') |
---|
1718 | % set(handles.num_FieldSmooth,'Visible','on') |
---|
1719 | % else |
---|
1720 | |
---|
1721 | % set(handles.num_subdomainsize,'Visible','off') |
---|
1722 | % set(handles.num_FieldSmooth,'Visible','off') |
---|
1723 | % end |
---|
1724 | |
---|
1725 | |
---|
1726 | |
---|
1727 | %------------------------------------------------------------------------ |
---|
1728 | %----function introduced for the correlation window figure, activated by deleting this window |
---|
1729 | function closeview_field(gcbo,eventdata) |
---|
1730 | %------------------------------------------------------------------------ |
---|
1731 | hview_field=findobj(allchild(0),'tag','view_field');% look for view_field |
---|
1732 | if ~isempty(hview_field) |
---|
1733 | delete(hview_field) |
---|
1734 | end |
---|
1735 | |
---|
1736 | %------------------------------------------------------------------------ |
---|
1737 | % --- Executes on button press in CheckThreshold. |
---|
1738 | function CheckThreshold_Callback(hObject, eventdata, handles) |
---|
1739 | %------------------------------------------------------------------------ |
---|
1740 | huipanel=get(hObject,'parent'); |
---|
1741 | obj(1)=findobj(huipanel,'Tag','num_MinIma'); |
---|
1742 | obj(2)=findobj(huipanel,'Tag','num_MaxIma'); |
---|
1743 | obj(3)=findobj(huipanel,'Tag','title_Threshold'); |
---|
1744 | if get(hObject,'Value') |
---|
1745 | set(obj,'Visible','on') |
---|
1746 | else |
---|
1747 | set(obj,'Visible','off') |
---|
1748 | end |
---|
1749 | set(handles.ConfigSource,'String','NEW') |
---|
1750 | set(handles.OK,'BackgroundColor',[1 0 1]) |
---|
1751 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1752 | %%%%%%%%%%%%%% TEST functions |
---|
1753 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1754 | %------------------------------------------------------------------------ |
---|
1755 | % --- Executes on button press in TestCiv1: prepare the image correlation function |
---|
1756 | % activated by mouse motion |
---|
1757 | function TestCiv1_Callback(hObject, eventdata, handles) |
---|
1758 | %------------------------------------------------------------------------ |
---|
1759 | drawnow |
---|
1760 | if get(handles.TestCiv1,'Value') |
---|
1761 | set(handles.TestCiv1,'BackgroundColor',[1 1 0])% paint TestCiv1 button to yellow to confirm civ launch |
---|
1762 | set(handles.CheckFix1,'value',0)% desactivate next step |
---|
1763 | set(handles.CheckPatch1,'value',0)% desactivate next step |
---|
1764 | set(handles.CheckCiv2,'value',0)% desactivate next step |
---|
1765 | set(handles.CheckFix2,'value',0)% desactivate next step |
---|
1766 | set(handles.CheckPatch2,'value',0)% desactivate next step |
---|
1767 | update_CivOptions(handles,0) |
---|
1768 | hseries=findobj(allchild(0),'Tag','series'); |
---|
1769 | Param=read_GUI(hseries); |
---|
1770 | Param.Action.RUN=1; |
---|
1771 | Param.ActionInput=read_GUI(handles.civ_input); |
---|
1772 | if isfield(Param.ActionInput,'Fix1') |
---|
1773 | Param.ActionInput=rmfield(Param.ActionInput,'Fix1'); |
---|
1774 | end |
---|
1775 | if isfield(Param.ActionInput,'Patch1') |
---|
1776 | Param.ActionInput=rmfield(Param.ActionInput,'Patch1'); |
---|
1777 | end |
---|
1778 | if isfield(Param.ActionInput,'Civ2')%remove options that may be selected beyond Patch1 |
---|
1779 | Param.ActionInput=rmfield(Param.ActionInput,'Civ2'); |
---|
1780 | end |
---|
1781 | if isfield(Param.ActionInput,'Fix2') |
---|
1782 | Param.ActionInput=rmfield(Param.ActionInput,'Fix2'); |
---|
1783 | end |
---|
1784 | if isfield(Param.ActionInput,'Patch2') |
---|
1785 | Param.ActionInput=rmfield(Param.ActionInput,'Patch2'); |
---|
1786 | end |
---|
1787 | if isfield(Param,'OutputSubDir') |
---|
1788 | Param=rmfield(Param,'OutputSubDir'); %remove output file option from civ_series |
---|
1789 | end |
---|
1790 | Param.ActionInput.Civ1.CorrSmooth=0;% launch Civ1 with no data point (to get the image names for A and B) |
---|
1791 | [Data,errormsg]=civ_series(Param);% get the civ1+fix1 results |
---|
1792 | if ~isempty(errormsg), return, end % rmq: error msg displayed in civ_series |
---|
1793 | |
---|
1794 | %% create image data ImageData for display |
---|
1795 | ImageData.ListVarName={'ny','nx','A'}; |
---|
1796 | ImageData.VarDimName= {'ny','nx',{'ny','nx'}}; |
---|
1797 | ImageData.A=imread(Data.Civ1_ImageA); % read the first image |
---|
1798 | if ndims(ImageData.A)==3 %case of color image |
---|
1799 | ImageData.VarDimName= {'ny','nx',{'ny','nx','rgb'}}; |
---|
1800 | end |
---|
1801 | ImageData.ny=[size(ImageData.A,1) 1]; |
---|
1802 | ImageData.nx=[1 size(ImageData.A,2)]; |
---|
1803 | ImageData.CoordUnit='pixel';% used to set equal scaling for x and y in image dispa=ly |
---|
1804 | |
---|
1805 | %% create the figure view_field for image visualization |
---|
1806 | hview_field=view_field(ImageData); %view the image in the GUI view_field |
---|
1807 | set(0,'CurrentFigure',hview_field) |
---|
1808 | hhview_field=guihandles(hview_field); |
---|
1809 | set(hview_field,'CurrentAxes',hhview_field.PlotAxes) |
---|
1810 | ViewData=get(hview_field,'UserData'); |
---|
1811 | ViewData.CivHandle=handles.civ_input;% indicate the handle of the civ GUI in view_field |
---|
1812 | ViewData.PlotAxes.X=Data.Civ1_X'; |
---|
1813 | ViewData.PlotAxes.Y=Data.Civ1_Y'; |
---|
1814 | ViewData.PlotAxes.B=imread(Data.Civ1_ImageB);%store the second image in the UserData of the GUI view_field |
---|
1815 | set(hview_field,'UserData',ViewData)% store the info in the UserData of image view_field |
---|
1816 | |
---|
1817 | %% look for a current figure for image correlation display |
---|
1818 | corrfig=findobj(allchild(0),'tag','corrfig'); |
---|
1819 | if isempty(corrfig) |
---|
1820 | corrfig=figure; |
---|
1821 | set(corrfig,'tag','corrfig') |
---|
1822 | set(corrfig,'name','image correlation') |
---|
1823 | set(corrfig,'DeleteFcn',{@closeview_field})% |
---|
1824 | set(handles.TestCiv1,'BackgroundColor',[1 0 0]) |
---|
1825 | else |
---|
1826 | set(handles.TestCiv1,'BackgroundColor',[1 0 0])% paint button to red |
---|
1827 | corrfig=findobj(allchild(0),'tag','corrfig');% look for a current figure for image correlation display |
---|
1828 | if ~isempty(corrfig) |
---|
1829 | delete(corrfig) |
---|
1830 | end |
---|
1831 | hview_field=findobj(allchild(0),'tag','view_field');% look for view_field |
---|
1832 | if ~isempty(hview_field) |
---|
1833 | delete(hview_field) |
---|
1834 | end |
---|
1835 | end |
---|
1836 | else |
---|
1837 | hview_field=findobj(allchild(0),'Tag','view_field'); %view the image in the GUI view_field |
---|
1838 | if ~isempty(hview_field) |
---|
1839 | delete(hview_field) |
---|
1840 | end |
---|
1841 | end |
---|
1842 | |
---|
1843 | % -------------------------------------------------------------------- |
---|
1844 | % --- Executes on button press in TestPatch1. |
---|
1845 | % -------------------------------------------------------------------- |
---|
1846 | function TestPatch1_Callback(hObject, eventdata, handles) |
---|
1847 | |
---|
1848 | if get(handles.TestPatch1,'Value')% if TestPatch1 is activated |
---|
1849 | set(handles.TestPatch1,'BackgroundColor',[1 1 0])%paint TestPatch1 button in yellow to indicate activation |
---|
1850 | set(handles.Civ1,'BackgroundColor',[1 1 0])% indicate civ1 calculation is performed |
---|
1851 | hseries=findobj(allchild(0),'Tag','series'); |
---|
1852 | Param=read_GUI(hseries); |
---|
1853 | Param.Action.RUN=1; |
---|
1854 | Param.ActionInput=read_GUI(handles.civ_input); |
---|
1855 | if isfield(Param.ActionInput,'Civ2')%remove options that may be selected beyond Patch1 |
---|
1856 | Param.ActionInput=rmfield(Param.ActionInput,'Civ2'); |
---|
1857 | end |
---|
1858 | if isfield(Param.ActionInput,'Fix2') |
---|
1859 | Param.ActionInput=rmfield(Param.ActionInput,'Fix2'); |
---|
1860 | end |
---|
1861 | if isfield(Param.ActionInput,'Patch2') |
---|
1862 | Param.ActionInput=rmfield(Param.ActionInput,'Patch2'); |
---|
1863 | end |
---|
1864 | if isfield(Param,'OutputSubDir') |
---|
1865 | Param=rmfield(Param,'OutputSubDir'); %remove output file option from civ_series |
---|
1866 | end |
---|
1867 | ParamPatch1=Param.ActionInput.Patch1; %store the patch1 parameters |
---|
1868 | Param.ActionInput=rmfield(Param.ActionInput,'Patch1');% does not execute Patch |
---|
1869 | Param.IndexRange.first_i=str2num(get(handles.ref_i,'String')); |
---|
1870 | Param.IndexRange.last_i=Param.IndexRange.first_i; |
---|
1871 | if strcmp(get(handles.ref_j,'Visible'),'on') |
---|
1872 | Param.IndexRange.first_j=str2num(get(handles.ref_j,'String')); |
---|
1873 | Param.IndexRange.last_j=Param.IndexRange.first_j; |
---|
1874 | else |
---|
1875 | Param.IndexRange.first_j=1; |
---|
1876 | Param.IndexRange.last_j=1; |
---|
1877 | end |
---|
1878 | [Data,errormsg]=civ_series(Param);% get the civ1+fix1 results |
---|
1879 | bckcolor=get(handles.civ_input,'Color'); |
---|
1880 | set(handles.Civ1,'BackgroundColor',bckcolor)% indicate civ1 calculation is finished |
---|
1881 | |
---|
1882 | %% prepare Param for iterative Patch processing without input file reading |
---|
1883 | Param.Civ1_X=Data.Civ1_X; |
---|
1884 | Param.Civ1_Y=Data.Civ1_Y; |
---|
1885 | Param.Civ1_U=Data.Civ1_U; |
---|
1886 | Param.Civ1_V=Data.Civ1_V; |
---|
1887 | Param.Civ1_FF=Data.Civ1_FF; |
---|
1888 | Param=rmfield(Param,'InputTable');%desactivate input file reading |
---|
1889 | if isfield(Param.ActionInput,'Civ1') |
---|
1890 | Param.ActionInput=rmfield(Param.ActionInput,'Civ1');%desactivate civ1: remove civ1 input param if relevant |
---|
1891 | end |
---|
1892 | if isfield(Param.ActionInput,'Fix1') |
---|
1893 | Param.ActionInput=rmfield(Param.ActionInput,'Fix1');%desactivate fix1:remove fix1 input param if relevant |
---|
1894 | end |
---|
1895 | SmoothingParam=(ParamPatch1.FieldSmooth/10)*2.^(1:7);%scan the smoothing param from 1/10 to 12.8 current value |
---|
1896 | NbGood=numel(find(Data.Civ1_FF==0)); |
---|
1897 | NbExclude=zeros(1,7);% initialize the set of smoothing parameters |
---|
1898 | DiffVel=zeros(1,7);% initialize the rms difference between patch and civ |
---|
1899 | Param.ActionInput.Patch1=ParamPatch1;% retrieve Patch1 parameters |
---|
1900 | for irho=1:7 |
---|
1901 | Param.ActionInput.Patch1.FieldSmooth=SmoothingParam(irho); |
---|
1902 | [Data,errormsg]= civ_series(Param);%apply the processing fct |
---|
1903 | if ~isempty(errormsg) |
---|
1904 | msgbox_uvmat('ERROR',errormsg) |
---|
1905 | return |
---|
1906 | end |
---|
1907 | ind_good=find(Data.Civ1_FF==0); |
---|
1908 | Civ1_U_Diff=Data.Civ1_U(ind_good)-Data.Civ1_U_smooth(ind_good); |
---|
1909 | Civ1_V_Diff=Data.Civ1_V(ind_good)-Data.Civ1_V_smooth(ind_good); |
---|
1910 | DiffVel(irho)=sqrt(mean(Civ1_U_Diff.*Civ1_U_Diff+Civ1_V_Diff.*Civ1_V_Diff)); |
---|
1911 | NbExclude(irho)=(NbGood-numel(ind_good))/NbGood; |
---|
1912 | end |
---|
1913 | figure(1) |
---|
1914 | semilogx(SmoothingParam,DiffVel,'b',SmoothingParam,NbExclude,'r',SmoothingParam,0.2*ones(size(SmoothingParam)),'m') |
---|
1915 | grid on |
---|
1916 | legend('rms velocity diff. Patch1-Civ1 (pixels)','proportion of excluded vectors (between 0 to 1)','recommended diff Patch1-Civ1') |
---|
1917 | xlabel('smoothing parameter') |
---|
1918 | ylabel('smoothing effect') |
---|
1919 | set(handles.TestPatch1,'BackgroundColor',[0 1 0]) |
---|
1920 | else |
---|
1921 | corrfig=findobj(allchild(0),'tag','corrfig');% look for a current figure for image correlation display |
---|
1922 | if ~isempty(corrfig) |
---|
1923 | delete(corrfig) |
---|
1924 | end |
---|
1925 | hview_field=findobj(allchild(0),'tag','view_field');% look for view_field |
---|
1926 | if ~isempty(hview_field) |
---|
1927 | delete(hview_field) |
---|
1928 | end |
---|
1929 | end |
---|
1930 | |
---|
1931 | %------------------------------------------------------------------------ |
---|
1932 | % --- Executes on button press in TestCiv2. |
---|
1933 | %------------------------------------------------------------------------ |
---|
1934 | function TestCiv2_Callback(hObject, eventdata, handles) |
---|
1935 | drawnow |
---|
1936 | if get(handles.TestCiv2,'Value') |
---|
1937 | set(handles.TestCiv2,'BackgroundColor',[1 1 0])% paint TestCiv1 button to yellow to confirm civ launch |
---|
1938 | set(handles.CheckFix2,'value',0)% desactivate next step |
---|
1939 | set(handles.CheckPatch2,'value',0)% desactivate next step |
---|
1940 | update_CivOptions(handles,0) |
---|
1941 | hseries=findobj(allchild(0),'Tag','series'); |
---|
1942 | Param=read_GUI(hseries); |
---|
1943 | Param.Action.RUN=1; |
---|
1944 | Param.ActionInput=read_GUI(handles.civ_input); |
---|
1945 | if isfield(Param,'OutputSubDir') |
---|
1946 | Param=rmfield(Param,'OutputSubDir'); %remove output file option from civ_series |
---|
1947 | end |
---|
1948 | Param.ActionInput.Civ2.CorrSmooth=0;% launch Civ2 with no data point (to get the image names for A and B) |
---|
1949 | set(handles.Civ1,'BackgroundColor',[1 1 0]) |
---|
1950 | set(handles.Fix1,'BackgroundColor',[1 1 0]) |
---|
1951 | set(handles.Patch1,'BackgroundColor',[1 1 0]) |
---|
1952 | Param.IndexRange.first_i=str2num(get(handles.ref_i,'String')); |
---|
1953 | Param.IndexRange.last_i=Param.IndexRange.first_i; |
---|
1954 | if strcmp(get(handles.ref_j,'Visible'),'on') |
---|
1955 | Param.IndexRange.first_j=str2num(get(handles.ref_j,'String')); |
---|
1956 | Param.IndexRange.last_j=Param.IndexRange.first_j; |
---|
1957 | else |
---|
1958 | Param.IndexRange.first_j=1; |
---|
1959 | Param.IndexRange.last_j=1; |
---|
1960 | end |
---|
1961 | [Data,errormsg]=civ_series(Param);% get the civ1+fix1 results |
---|
1962 | |
---|
1963 | %% create image data ImageData for display |
---|
1964 | ImageData.ListVarName={'ny','nx','A'}; |
---|
1965 | ImageData.VarDimName= {'ny','nx',{'ny','nx'}}; |
---|
1966 | ImageData.A=imread(Data.Civ2_ImageA); % read the first image |
---|
1967 | if ndims(ImageData.A)==3 %case of color image |
---|
1968 | ImageData.VarDimName= {'ny','nx',{'ny','nx','rgb'}}; |
---|
1969 | end |
---|
1970 | ImageData.ny=[size(ImageData.A,1) 1]; |
---|
1971 | ImageData.nx=[1 size(ImageData.A,2)]; |
---|
1972 | ImageData.CoordUnit='pixel';% used to set equal scaling for x and y in image dispa=ly |
---|
1973 | |
---|
1974 | %% create the figure view_field for image visualization |
---|
1975 | hview_field=view_field(ImageData); %view the image in the GUI view_field |
---|
1976 | set(0,'CurrentFigure',hview_field) |
---|
1977 | % plot the boundaries of the subdomains used for patch |
---|
1978 | for isub=1:size(Data.Civ1_SubRange,3); |
---|
1979 | pos_x=Data.Civ1_SubRange(1,1,isub); |
---|
1980 | pos_y=Data.Civ1_SubRange(2,1,isub); |
---|
1981 | width=Data.Civ1_SubRange(1,2,isub)-Data.Civ1_SubRange(1,1,isub); |
---|
1982 | height=Data.Civ1_SubRange(2,2,isub)-Data.Civ1_SubRange(2,1,isub); |
---|
1983 | rectangle('Position',[pos_x pos_y width height],'EdgeColor',[0 0 1]) |
---|
1984 | end |
---|
1985 | hhview_field=guihandles(hview_field);% |
---|
1986 | set(hview_field,'CurrentAxes',hhview_field.PlotAxes) |
---|
1987 | ViewData=get(hview_field,'UserData'); % get the currently plotted field (the image A) |
---|
1988 | % store info in the UserData of view-field |
---|
1989 | ViewData.CivHandle=handles.civ_input;% indicate the handle of the civ GUI in view_field |
---|
1990 | ViewData.PlotAxes.B=imread(Data.Civ2_ImageB);%store the second image in the UserData of the GUI view_field |
---|
1991 | ViewData.PlotAxes.X=Data.Civ2_X'; |
---|
1992 | ViewData.PlotAxes.Y=Data.Civ2_Y'; |
---|
1993 | ViewData.PlotAxes.ShiftX=Data.Civ2_U';% shift at each point (from patch1) estimated by the preliminary run of civ2 |
---|
1994 | ViewData.PlotAxes.ShiftY=Data.Civ2_V'; |
---|
1995 | ViewData.PlotAxes.Civ1_SubRange=Data.Civ1_SubRange; |
---|
1996 | ViewData.PlotAxes.Civ1_NbCentres=Data.Civ1_NbCentres; |
---|
1997 | ViewData.PlotAxes.Civ1_Coord_tps=Data.Civ1_Coord_tps; |
---|
1998 | ViewData.PlotAxes.Civ1_U_tps=Data.Civ1_U_tps; |
---|
1999 | ViewData.PlotAxes.Civ1_V_tps=Data.Civ1_V_tps; |
---|
2000 | ViewData.PlotAxes.Civ1_Dt=Data.Civ1_Dt; |
---|
2001 | ViewData.PlotAxes.Civ2_Dt=Data.Civ2_Dt; |
---|
2002 | set(hview_field,'UserData',ViewData)% store the info in the UserData of image view_field |
---|
2003 | bckcolor=get(handles.civ_input,'Color'); |
---|
2004 | set(handles.Civ1,'BackgroundColor',bckcolor)% indicate civ1 calmculation is finished |
---|
2005 | set(handles.Fix1,'BackgroundColor',bckcolor) |
---|
2006 | set(handles.Patch1,'BackgroundColor',bckcolor) |
---|
2007 | drawnow |
---|
2008 | |
---|
2009 | %% look for a current figure for image correlation display |
---|
2010 | corrfig=findobj(allchild(0),'tag','corrfig'); |
---|
2011 | if isempty(corrfig) |
---|
2012 | corrfig=figure; |
---|
2013 | set(corrfig,'tag','corrfig') |
---|
2014 | set(corrfig,'name','image correlation') |
---|
2015 | set(corrfig,'DeleteFcn',{@closeview_field})% |
---|
2016 | set(handles.TestCiv1,'BackgroundColor',[1 0 0]) |
---|
2017 | else |
---|
2018 | set(handles.TestCiv1,'BackgroundColor',[1 0 0])% paint button to red |
---|
2019 | corrfig=findobj(allchild(0),'tag','corrfig');% look for a current figure for image correlation display |
---|
2020 | if ~isempty(corrfig) |
---|
2021 | delete(corrfig) |
---|
2022 | end |
---|
2023 | hview_field=findobj(allchild(0),'tag','view_field');% look for view_field |
---|
2024 | if ~isempty(hview_field) |
---|
2025 | delete(hview_field) |
---|
2026 | end |
---|
2027 | end |
---|
2028 | else |
---|
2029 | hview_field=findobj(allchild(0),'Tag','view_field'); %view the image in the GUI view_field |
---|
2030 | if ~isempty(hview_field) |
---|
2031 | delete(hview_field) |
---|
2032 | end |
---|
2033 | end |
---|
2034 | |
---|
2035 | |
---|
2036 | % --- Executes on button press in TestPatch2. |
---|
2037 | function TestPatch2_Callback(hObject, eventdata, handles) |
---|
2038 | if get(handles.TestPatch2,'Value')% if TestPatch2 is activated |
---|
2039 | set(handles.TestPatch2,'BackgroundColor',[1 1 0])%paint TestPatch2 button in yellow to indicate activation |
---|
2040 | set(handles.Civ1,'BackgroundColor',[1 1 0])% indicate civ1 calculation is activated |
---|
2041 | set(handles.Fix1,'BackgroundColor',[1 1 0])% indicate fix1 calculation is activated |
---|
2042 | set(handles.Patch1,'BackgroundColor',[1 1 0])% indicate Patch1 calculation is activated |
---|
2043 | set(handles.Civ2,'BackgroundColor',[1 1 0])% indicate civ2 calculation is activated |
---|
2044 | set(handles.Fix2,'BackgroundColor',[1 1 0])% indicate fix2 calculation is activated |
---|
2045 | hseries=findobj(allchild(0),'Tag','series'); |
---|
2046 | Param=read_GUI(hseries); |
---|
2047 | Param.Action.RUN=1; |
---|
2048 | Param.ActionInput=read_GUI(handles.civ_input); |
---|
2049 | if isfield(Param,'OutputSubDir') |
---|
2050 | Param=rmfield(Param,'OutputSubDir'); %remove output file option from civ_series |
---|
2051 | end |
---|
2052 | ParamPatch2=Param.ActionInput.Patch2; %store the patch1 parameters |
---|
2053 | Param.ActionInput=rmfield(Param.ActionInput,'Patch2');% does not execute Patch |
---|
2054 | Param.IndexRange.first_i=str2num(get(handles.ref_i,'String')); |
---|
2055 | Param.IndexRange.last_i=Param.IndexRange.first_i; |
---|
2056 | if strcmp(get(handles.ref_j,'Visible'),'on') |
---|
2057 | Param.IndexRange.first_j=str2num(get(handles.ref_j,'String')); |
---|
2058 | Param.IndexRange.last_j=Param.IndexRange.first_j; |
---|
2059 | else |
---|
2060 | Param.IndexRange.first_j=1; |
---|
2061 | Param.IndexRange.last_j=1; |
---|
2062 | end |
---|
2063 | [Data,errormsg]=civ_series(Param);% get the civ1+fix1 results |
---|
2064 | bckcolor=get(handles.civ_input,'Color'); |
---|
2065 | set(handles.Civ1,'BackgroundColor',bckcolor)% indicate civ1 calculation is finished |
---|
2066 | set(handles.Fix1,'BackgroundColor',bckcolor)% indicate fix1 calculation is finished |
---|
2067 | set(handles.Patch1,'BackgroundColor',bckcolor)% indicate Patch1 calculation is finished |
---|
2068 | set(handles.Civ2,'BackgroundColor',bckcolor)% indicate civ2 calculation is finished |
---|
2069 | set(handles.Fix2,'BackgroundColor',bckcolor)% indicate fix2 calculation is finished |
---|
2070 | |
---|
2071 | %% prepare Param for iterative Patch processing without input file reading |
---|
2072 | Param.Civ2_X=Data.Civ2_X; |
---|
2073 | Param.Civ2_Y=Data.Civ2_Y; |
---|
2074 | Param.Civ2_U=Data.Civ2_U; |
---|
2075 | Param.Civ2_V=Data.Civ2_V; |
---|
2076 | Param.Civ2_FF=Data.Civ2_FF; |
---|
2077 | Param=rmfield(Param,'InputTable');%desactivate input file reading |
---|
2078 | if isfield(Param.ActionInput,'Civ1') |
---|
2079 | Param.ActionInput=rmfield(Param.ActionInput,'Civ1');%desactivate civ1: remove civ1 input param if relevant |
---|
2080 | end |
---|
2081 | if isfield(Param.ActionInput,'Fix1') |
---|
2082 | Param.ActionInput=rmfield(Param.ActionInput,'Fix1');%desactivate fix1:remove fix1 input param if relevant |
---|
2083 | end |
---|
2084 | if isfield(Param.ActionInput,'Patch1') |
---|
2085 | Param.ActionInput=rmfield(Param.ActionInput,'Patch1');%desactivate fix1:remove fix1 input param if relevant |
---|
2086 | end |
---|
2087 | if isfield(Param.ActionInput,'Civ2') |
---|
2088 | Param.ActionInput=rmfield(Param.ActionInput,'Civ2');%desactivate civ2: remove civ2 input param if relevant |
---|
2089 | end |
---|
2090 | if isfield(Param.ActionInput,'Fix2') |
---|
2091 | Param.ActionInput=rmfield(Param.ActionInput,'Fix2');%desactivate fix1:remove fix1 input param if relevant |
---|
2092 | end |
---|
2093 | SmoothingParam=(ParamPatch2.FieldSmooth/10)*2.^(1:7);%scan the smoothing param from 1/10 to 12.8 current value |
---|
2094 | NbGood=numel(find(Data.Civ2_FF==0)); |
---|
2095 | NbExclude=zeros(1,7);% initialize the set of smoothing parameters |
---|
2096 | DiffVel=zeros(1,7);% initialize the rms difference between patch and civ |
---|
2097 | Param.ActionInput.Patch2=ParamPatch2;% retrieve Patch2 parameters |
---|
2098 | for irho=1:7 |
---|
2099 | Param.ActionInput.Patch2.FieldSmooth=SmoothingParam(irho); |
---|
2100 | [Data,errormsg]= civ_series(Param);%apply the processing fct |
---|
2101 | if ~isempty(errormsg) |
---|
2102 | msgbox_uvmat('ERROR',errormsg) |
---|
2103 | return |
---|
2104 | end |
---|
2105 | ind_good=find(Data.Civ2_FF==0); |
---|
2106 | Civ2_U_Diff=Data.Civ2_U(ind_good)-Data.Civ2_U_smooth(ind_good); |
---|
2107 | Civ2_V_Diff=Data.Civ2_V(ind_good)-Data.Civ2_V_smooth(ind_good); |
---|
2108 | DiffVel(irho)=sqrt(mean(Civ2_U_Diff.*Civ2_U_Diff+Civ2_V_Diff.*Civ2_V_Diff)); |
---|
2109 | NbExclude(irho)=(NbGood-numel(ind_good))/NbGood; |
---|
2110 | end |
---|
2111 | figure(1) |
---|
2112 | semilogx(SmoothingParam,DiffVel,'b',SmoothingParam,NbExclude,'r',SmoothingParam,0.1*ones(size(SmoothingParam)),'m') |
---|
2113 | grid on |
---|
2114 | legend('rms velocity diff. Patch2-Civ2 (pixels)','proportion of excluded vectors (between 0 to 1)','recommended value diff. Patch2-Civ2') |
---|
2115 | xlabel('smoothing parameter') |
---|
2116 | ylabel('smoothing effect') |
---|
2117 | set(handles.TestPatch2,'BackgroundColor',[0 1 0]) |
---|
2118 | else |
---|
2119 | corrfig=findobj(allchild(0),'tag','corrfig');% look for a current figure for image correlation display |
---|
2120 | if ~isempty(corrfig) |
---|
2121 | delete(corrfig) |
---|
2122 | end |
---|
2123 | hview_field=findobj(allchild(0),'tag','view_field');% look for view_field |
---|
2124 | if ~isempty(hview_field) |
---|
2125 | delete(hview_field) |
---|
2126 | end |
---|
2127 | end |
---|
2128 | |
---|
2129 | |
---|
2130 | %'nomtype2pair': creates nomencalture for index pairs knowing the image nomenclature |
---|
2131 | %--------------------------------------------------------------------- |
---|
2132 | function NomTypeNc=nomtype2pair(NomTypeIma,mode) |
---|
2133 | %--------------------------------------------------------------------- |
---|
2134 | % OUTPUT: |
---|
2135 | % NomTypeNc |
---|
2136 | %--------------------------------------------------------------------- |
---|
2137 | % INPUT: |
---|
2138 | % 'NomTypeIma': string defining the kind of nomenclature used for images |
---|
2139 | |
---|
2140 | NomTypeNc=NomTypeIma;%default |
---|
2141 | switch mode |
---|
2142 | case 'pair j1-j2' |
---|
2143 | if ~isempty(regexp(NomTypeIma,'a$')) |
---|
2144 | NomTypeNc=[NomTypeIma 'b']; |
---|
2145 | elseif ~isempty(regexp(NomTypeIma,'A$')) |
---|
2146 | NomTypeNc=[NomTypeIma 'B']; |
---|
2147 | else |
---|
2148 | r=regexp(NomTypeIma,'(?<num1>\d+)_(?<num2>\d+)$','names'); |
---|
2149 | if ~isempty(r) |
---|
2150 | NomTypeNc='_1_1-2'; |
---|
2151 | end |
---|
2152 | end |
---|
2153 | case 'series(Dj)' |
---|
2154 | % r=regexp(NomTypeIma,'(?<num1>\d+)_(?<num2>\d+)$','names'); |
---|
2155 | % if ~isempty(r) |
---|
2156 | NomTypeNc='_1_1-2'; |
---|
2157 | % end |
---|
2158 | case 'series(Di)' |
---|
2159 | r=regexp(NomTypeIma,'(?<num1>\d+)_(?<num2>\d+)$','names'); |
---|
2160 | if ~isempty(r) |
---|
2161 | NomTypeNc='_1-2_1'; |
---|
2162 | else |
---|
2163 | NomTypeNc='_1-2'; |
---|
2164 | end |
---|
2165 | end |
---|
2166 | |
---|
2167 | |
---|
2168 | %------------------------------------------------------------------------ |
---|
2169 | % --- determine the list of index pairs of processing file |
---|
2170 | function [ind1,ind2,mode]=... |
---|
2171 | find_pair_indices(str_civ,i_series,j_series,MinIndex_i,MaxIndex_i,MinIndex_j,MaxIndex_j) |
---|
2172 | %------------------------------------------------------------------------ |
---|
2173 | ind1=''; |
---|
2174 | ind2=''; |
---|
2175 | r=regexp(str_civ,'^\D(?<ind>[i|j])=( -| )(?<num1>\d+)\|(?<num2>\d+)','names'); |
---|
2176 | if ~isempty(r) |
---|
2177 | mode=['D' r.ind]; |
---|
2178 | ind1=stra2num(r.num1); |
---|
2179 | ind2=stra2num(r.num2); |
---|
2180 | else |
---|
2181 | mode='burst'; |
---|
2182 | r=regexp(str_civ,'^j= (?<num1>[a-z])-(?<num2>[a-z])','names'); |
---|
2183 | if ~isempty(r) |
---|
2184 | NomTypeNc='_1ab'; |
---|
2185 | else |
---|
2186 | r=regexp(str_civ,'^j= (?<num1>[A-Z])-(?<num2>[A-Z])','names'); |
---|
2187 | if ~isempty(r) |
---|
2188 | NomTypeNc='_1AB'; |
---|
2189 | else |
---|
2190 | r=regexp(str_civ,'^j= (?<num1>\d+)-(?<num2>\d+)','names'); |
---|
2191 | if ~isempty(r) |
---|
2192 | NomTypeNc='_1_1-2'; |
---|
2193 | end |
---|
2194 | end |
---|
2195 | end |
---|
2196 | if isempty(r) |
---|
2197 | display('wrong pair mode input option') |
---|
2198 | else |
---|
2199 | ind1=stra2num(r.num1); |
---|
2200 | ind2=stra2num(r.num2); |
---|
2201 | end |
---|
2202 | end |
---|
2203 | |
---|
2204 | %------------------------------------------------------------------------ |
---|
2205 | % --- fill civ_input with the parameters retrieved from an input Civ file |
---|
2206 | %------------------------------------------------------------------------ |
---|
2207 | function fill_civ_input(Data,handles) |
---|
2208 | |
---|
2209 | %% Civ param |
---|
2210 | % lists of parameters to enter |
---|
2211 | ListParamNum={'CorrBoxSize','SearchBoxSize','SearchBoxShift','Dx','Dy','Dz','MinIma','MaxIma'};% list of numerical values (to transform in strings) |
---|
2212 | ListParamValue={'CorrSmooth','CheckGrid','CheckMask','CheckThreshold'}; |
---|
2213 | ListParamString={'Grid','Mask'}; |
---|
2214 | % CorrSmooth ?? |
---|
2215 | option={'Civ1','Civ2'}; |
---|
2216 | for ichoice=1:2 |
---|
2217 | if isfield(Data,[option{ichoice} '_CorrBoxSize']) |
---|
2218 | fill_panel(Data,handles,option{ichoice},ListParamNum,ListParamValue,ListParamString) |
---|
2219 | end |
---|
2220 | end |
---|
2221 | |
---|
2222 | %% Fix param |
---|
2223 | option={'Fix1','Fix2'}; |
---|
2224 | for ichoice=1:2 |
---|
2225 | if isfield(Data,[option{ichoice} '_CheckFmin2']) |
---|
2226 | ListParamNum={'MinVel','MaxVel','MinCorr'};% list of numerical values (to transform in strings) |
---|
2227 | ListParamValue={'CheckFmin2','CheckF3','CheckF4'}; |
---|
2228 | ListParamString={'ref_fix_1'}; |
---|
2229 | fill_panel(Data,handles,option{ichoice},ListParamNum,ListParamValue,ListParamString) |
---|
2230 | end |
---|
2231 | end |
---|
2232 | |
---|
2233 | %% Patch param |
---|
2234 | option={'Patch1','Patch2'}; |
---|
2235 | for ichoice=1:2 |
---|
2236 | if isfield(Data,[option{ichoice} '_FieldSmooth']) |
---|
2237 | ListParamNum={'FieldSmooth','MaxDiff','SubDomainSize'};% list of numerical values (to transform in strings) |
---|
2238 | ListParamValue={}; |
---|
2239 | ListParamString={}; |
---|
2240 | fill_panel(Data,handles,option{ichoice},ListParamNum,ListParamValue,ListParamString) |
---|
2241 | end |
---|
2242 | end |
---|
2243 | %------------------------------------------------------------------------ |
---|
2244 | % --- fill a panel of civ_input with the parameters retrieved from an input Civ file |
---|
2245 | %------------------------------------------------------------------------ |
---|
2246 | function fill_panel(Data,handles,panel,ListParamNum,ListParamValue,ListParamString) |
---|
2247 | children=get(handles.(panel),'children');%handles of the children of the input GUI with handle 'GUI_handle' |
---|
2248 | handles_panel=[]; |
---|
2249 | for ichild=1:numel(children) |
---|
2250 | if ~isempty(get(children(ichild),'tag')) |
---|
2251 | handles_panel.(get(children(ichild),'tag'))=children(ichild); |
---|
2252 | end |
---|
2253 | end |
---|
2254 | for ilist=1:numel(ListParamNum) |
---|
2255 | ParamName=ListParamNum{ilist}; |
---|
2256 | CivParamName=[panel '_' ParamName]; |
---|
2257 | if isfield(Data,CivParamName) |
---|
2258 | for icoord=1:numel(Data.(CivParamName)) |
---|
2259 | if numel(Data.(CivParamName))>1 |
---|
2260 | Tag=['num_' ParamName '_' num2str(icoord)]; |
---|
2261 | else |
---|
2262 | Tag=['num_' ParamName]; |
---|
2263 | end |
---|
2264 | if isfield(handles_panel,Tag) |
---|
2265 | set(handles_panel.(Tag),'String',num2str(Data.(CivParamName)(icoord))) |
---|
2266 | set(handles_panel.(Tag),'Visible','on') |
---|
2267 | end |
---|
2268 | end |
---|
2269 | end |
---|
2270 | end |
---|
2271 | for ilist=1:numel(ListParamValue) |
---|
2272 | ParamName=ListParamValue{ilist}; |
---|
2273 | CivParamName=[panel '_' ParamName]; |
---|
2274 | if strcmp(ParamName,'CorrSmooth') |
---|
2275 | ParamName=['num_' ParamName]; |
---|
2276 | end |
---|
2277 | if isfield(Data,CivParamName) |
---|
2278 | if isfield(handles_panel,ParamName) |
---|
2279 | set(handles_panel.(ParamName),'Value',Data.(CivParamName)) |
---|
2280 | end |
---|
2281 | end |
---|
2282 | end |
---|
2283 | for ilist=1:numel(ListParamString) |
---|
2284 | ParamName=ListParamString{ilist}; |
---|
2285 | CivParamName=[panel '_' ParamName]; |
---|
2286 | if isfield(Data,CivParamName) |
---|
2287 | if isfield(handles_panel,ParamName) |
---|
2288 | set(handles_panel.(ParamName),'String',Data.(CivParamName)) |
---|
2289 | end |
---|
2290 | end |
---|
2291 | end |
---|
2292 | |
---|
2293 | %------------------------------------------------------------------------ |
---|
2294 | % --- Executes on button press in ImportParam. |
---|
2295 | %------------------------------------------------------------------------ |
---|
2296 | function ImportParam_Callback(hObject, eventdata, handles) |
---|
2297 | hseries=findobj(allchild(0),'Tag','series'); |
---|
2298 | hhseries=guidata(hseries); |
---|
2299 | InputTable=get(hhseries.InputTable,'Data');% read the input file(s) table in the GUI series |
---|
2300 | oldfile=InputTable{1,1}; |
---|
2301 | if isempty(oldfile) |
---|
2302 | % use a file name stored in prefdir |
---|
2303 | dir_perso=prefdir; |
---|
2304 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); |
---|
2305 | if exist(profil_perso,'file') |
---|
2306 | h=load (profil_perso); |
---|
2307 | if isfield(h,'RootPath') && ischar(h.RootPath) |
---|
2308 | oldfile=h.RootPath; |
---|
2309 | end |
---|
2310 | end |
---|
2311 | end |
---|
2312 | filexml=uigetfile_uvmat('pick a xml parameter file for civ',oldfile,'.xml');% get the xml file containing processing parameters |
---|
2313 | %proceed only if a file has been introduced by the browser |
---|
2314 | if ~isempty(filexml) |
---|
2315 | Param=xml2struct(filexml);% read the input xml file as a Matlab structure |
---|
2316 | |
---|
2317 | % Param.Action.RUN=0; %desactivate the input RUN=1 |
---|
2318 | if ~isfield(Param,'InputTable')||~isfield(Param,'IndexRange') |
---|
2319 | msgbox_uvmat('ERROR','invalid config file: open a file in a folder ''/0_XML''') |
---|
2320 | return |
---|
2321 | end |
---|
2322 | check_input=0; |
---|
2323 | if isfield(Param,'ActionInput') |
---|
2324 | if isfield(Param.ActionInput,'Program')&& strcmp(Param.ActionInput.Program,'civ_series') |
---|
2325 | fill_GUI(Param.ActionInput,handles.civ_input)% fill the elements of the GUI series with the input parameters |
---|
2326 | set(handles.ConfigSource,'String',filexml) |
---|
2327 | check_input=1; |
---|
2328 | update_CivOptions(handles,0) |
---|
2329 | end |
---|
2330 | end |
---|
2331 | if ~check_input |
---|
2332 | msgbox_uvmat('ERROR','invalid config file (not for civ_series') |
---|
2333 | return |
---|
2334 | end |
---|
2335 | end |
---|
2336 | |
---|
2337 | % --- Executes on selection change in CheckCiv3. |
---|
2338 | function CheckCiv3_Callback(hObject, eventdata, handles) |
---|
2339 | |
---|
2340 | |
---|
2341 | %------------------------------------------------------------------------ |
---|
2342 | % --- Executes on key press with selection of a uicontrol |
---|
2343 | %------------------------------------------------------------------------ |
---|
2344 | function keyboard_callback(hObject,eventdata,handles) |
---|
2345 | |
---|
2346 | ListExclude={'CheckCiv1','CheckFix1','CheckPatch1','CheckCiv2','CheckFix2','CheckPatch2','ref_i'}; |
---|
2347 | if isempty(find(strcmp(get(gco,'Tag'),ListExclude),1))% if the selected uicontrol is not in the Exclude list |
---|
2348 | set(handles.ConfigSource,'String','NEW')% indicate that the configuration is new |
---|
2349 | set(handles.OK,'BackgroundColor',[1 0 1])% |
---|
2350 | drawnow |
---|
2351 | end |
---|