1 | %'stereo_input': function associated with the GUI 'stereo_input.fig' to set the input parameters for stereo_civ |
---|
2 | %------------------------------------------------------------------------ |
---|
3 | % function ParamOut = stereo_input(Param) |
---|
4 | % |
---|
5 | % OUPUT: |
---|
6 | % ParamOut: Matlab structure containing the parameters set by the GUI stereo_input |
---|
7 | % |
---|
8 | % INPUT: |
---|
9 | % Param: Matlab structure containing the input parameters set by the GUI |
---|
10 | |
---|
11 | %======================================================================= |
---|
12 | % Copyright 2008-2022, LEGI UMR 5519 / CNRS UGA 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 = stereo_input(varargin) |
---|
30 | |
---|
31 | gui_Singleton = 1; |
---|
32 | gui_State = struct('gui_Name', mfilename, ... |
---|
33 | 'gui_Singleton', gui_Singleton, ... |
---|
34 | 'gui_OpeningFcn', @stereo_input_OpeningFcn, ... |
---|
35 | 'gui_OutputFcn', @stereo_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 stereo_input is made visible. |
---|
53 | function stereo_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 | %set(handles.CheckDecimal,'Value',0)% desactivate (work in progress) |
---|
86 | end |
---|
87 | switch Param.Action.ActionName |
---|
88 | case 'stereo_civ' |
---|
89 | set(handles.ListCompareMode,'Visible','off') |
---|
90 | set(handles.PairIndices,'Visible','off') |
---|
91 | case 'civ_series' |
---|
92 | set(handles.ListCompareMode,'Visible','on') |
---|
93 | set(handles.PairIndices,'Visible','on') |
---|
94 | end |
---|
95 | |
---|
96 | %% input file info |
---|
97 | NomTypeInput=Param.InputTable{1,4}; |
---|
98 | FileType='image';%fdefault |
---|
99 | FileInfo=[]; |
---|
100 | if isfield(SeriesData,'FileType')&&isfield(SeriesData,'FileInfo') |
---|
101 | FileType=SeriesData.FileType{1};%type of the first input file series |
---|
102 | FileInfo=SeriesData.FileInfo{1};% info on the first input file series |
---|
103 | else |
---|
104 | set(hhseries.REFRESH,'BackgroundColor',[1 0 1])% indicate that the file input in series needs to be refreshed |
---|
105 | end |
---|
106 | |
---|
107 | %% case of netcdf file as input, read the processing stage and look for corresponding images |
---|
108 | ind_opening=0;%default |
---|
109 | NomTypeNc=''; |
---|
110 | NomTypeImaA=NomTypeInput; |
---|
111 | iview_image=1;%line # for the input images |
---|
112 | switch FileType |
---|
113 | case {'image','multimage','video','mmreader','cine_phantom','netcdf'} |
---|
114 | % NomTypeImaA=NomTypeInput; |
---|
115 | % iview_image=1;%line # for the input images |
---|
116 | case 'civdata' |
---|
117 | if ~strcmp(Param.Action.ActionName,'civ_series') |
---|
118 | msgbox_uvmat('ERROR','bad input data file: open an image or a nc file from civ_series') |
---|
119 | return |
---|
120 | end |
---|
121 | NomTypeNc=NomTypeInput; |
---|
122 | ind_opening=FileInfo.CivStage; |
---|
123 | if isempty(regexp(NomTypeInput,'[ab|AB|-]', 'once')) |
---|
124 | set(handles.ListCompareMode,'Value',2) %mode displacement advised if the nomencalture does not involve index pairs |
---|
125 | else |
---|
126 | set(handles.ListCompareMode,'Value',1) |
---|
127 | end |
---|
128 | [Data,tild,tild,errormsg]=nc2struct(FileInfo.FileName,[]); |
---|
129 | if ~isempty(errormsg) |
---|
130 | msgbox_uvmat('ERROR',['error in netcdf input file: ' errormsg]) |
---|
131 | return |
---|
132 | end |
---|
133 | [PathCiv1_ImageA,Civ1_ImageA,FileExtA]=fileparts(Data.Civ1_ImageA);%look for the source image A |
---|
134 | [PathCiv1_ImageB,Civ1_ImageB,FileExtA]=fileparts(Data.Civ1_ImageB);%look for the source image B |
---|
135 | if isfield(Data,'Civ2_ImageA') |
---|
136 | [PathCiv2_ImageA,Civ2_ImageA,FileExtA]=fileparts(Data.Civ2_ImageA); |
---|
137 | [PathCiv2_ImageB,Civ2_ImageB,FileExtA]=fileparts(Data.Civ2_ImageB); |
---|
138 | end |
---|
139 | if size(Param.InputTable,1)==1 |
---|
140 | series('display_file_name',hhseries,Data.Civ1_ImageA,'append');%append the image series to the input list |
---|
141 | end |
---|
142 | [RootPath,SubDir,RootFile,i1,i2,j1,j2,FileExt,NomTypeImaA]=fileparts_uvmat(Data.Civ1_ImageA); |
---|
143 | [RootPath,SubDir,RootFile,i1,i2,j1,j2,FileExt,NomTypeImaB]=fileparts_uvmat(Data.Civ1_ImageB); |
---|
144 | iview_image=2;%line # for the input images |
---|
145 | case 'civxdata'% case of civx data, |
---|
146 | msgbox_uvmat('ERROR','old civX convention, use the GUI civ') |
---|
147 | return |
---|
148 | otherwise |
---|
149 | msgbox_uvmat('ERROR','civ_series needs images, scalar fields in netcdf format, or civ data as input') |
---|
150 | return |
---|
151 | end |
---|
152 | |
---|
153 | %% reinitialise menus |
---|
154 | set(handles.ListPairMode,'Value',1) |
---|
155 | set(handles.ListPairMode,'String',{''}) |
---|
156 | set(handles.ListPairCiv1,'Value',1) |
---|
157 | set(handles.ListPairCiv1,'String',{''}) |
---|
158 | set(handles.ListPairCiv2,'Value',1) |
---|
159 | set(handles.ListPairCiv2,'String',{''}) |
---|
160 | |
---|
161 | %% prepare the GUI with input parameters |
---|
162 | % |
---|
163 | set(handles.ref_i,'String',num2str(Param.IndexRange.first_i)) |
---|
164 | if isfield(Param.IndexRange,'first_j') |
---|
165 | set(handles.ref_j,'String',num2str(Param.IndexRange.first_j)) |
---|
166 | end |
---|
167 | set(handles.ConfigSource,'String','\default') |
---|
168 | |
---|
169 | %% set the menus of image pairs and default selection for stereo_input %%%%%%%%%%%%%%%%%%% |
---|
170 | |
---|
171 | %% display the min and max indices for the whole file series |
---|
172 | if isempty(Param.IndexRange.MaxIndex_i)|| isempty(Param.IndexRange.MinIndex_i) |
---|
173 | msgbox_uvmat('ERROR','REFRESH the input files in the GUI series') |
---|
174 | return |
---|
175 | end |
---|
176 | MaxIndex_i=Param.IndexRange.MaxIndex_i(iview_image); |
---|
177 | MinIndex_i=Param.IndexRange.MinIndex_i(iview_image); |
---|
178 | MaxIndex_j=1;%default |
---|
179 | MinIndex_j=1; |
---|
180 | if isfield(Param.IndexRange,'MaxIndex_j')&&isfield(Param.IndexRange,'MinIndex_j')... |
---|
181 | && numel(Param.IndexRange.MaxIndex_j')>=iview_image &&numel(Param.IndexRange.MinIndex_j')>=iview_image |
---|
182 | MaxIndex_j=Param.IndexRange.MaxIndex_j(iview_image); |
---|
183 | MinIndex_j=Param.IndexRange.MinIndex_j(iview_image); |
---|
184 | end |
---|
185 | %update the bounds if possible |
---|
186 | if isfield(SeriesData,'i1_series')&&numel(SeriesData.i1_series)>=iview_image |
---|
187 | if size(SeriesData.i1_series{iview_image},2)==2 && min(min(SeriesData.i1_series{iview_image}(:,1,:)))==0 |
---|
188 | MinIndex_j=1;% index j set to 1 by default |
---|
189 | MaxIndex_j=1; |
---|
190 | 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) |
---|
191 | 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) |
---|
192 | else |
---|
193 | ref_i=squeeze(max(SeriesData.i1_series{iview_image}(1,:,:),[],2));% select ref_j index for each ref_i |
---|
194 | ref_j=squeeze(max(SeriesData.j1_series{iview_image}(1,:,:),[],3));% select ref_i index for each ref_j |
---|
195 | MinIndex_i=min(find(ref_i))-1; |
---|
196 | MaxIndex_i=max(find(ref_i))-1; |
---|
197 | MaxIndex_j=max(find(ref_j))-1; |
---|
198 | MinIndex_j=min(find(ref_j))-1; |
---|
199 | end |
---|
200 | end |
---|
201 | if ~isfield(Param.IndexRange,'first_j')||isequal(MaxIndex_j,MinIndex_j)% no possibility of j pairs |
---|
202 | set(handles.ListPairMode,'Value',1) |
---|
203 | set(handles.ListPairMode,'String',{'series(Di)'}) |
---|
204 | elseif MaxIndex_i==1 && MaxIndex_j>1% simple series in j |
---|
205 | set(handles.ListPairMode,'String',{'pair j1-j2';'series(Dj)'}) |
---|
206 | if MaxIndex_j <= 10 |
---|
207 | set(handles.ListPairMode,'Value',1)% advice 'pair j1-j2' except in MaxIndex_j is large |
---|
208 | end |
---|
209 | else |
---|
210 | set(handles.ListPairMode,'String',{'pair j1-j2';'series(Dj)';'series(Di)'})%multiple choice |
---|
211 | if strcmp(NomTypeNc,'_1-2_1') |
---|
212 | set(handles.ListPairMode,'Value',3)% advise 'series(Di)' |
---|
213 | elseif MaxIndex_j <= 10 |
---|
214 | set(handles.ListPairMode,'Value',1)% advice 'pair j1-j2' except in MaxIndex_j is large |
---|
215 | end |
---|
216 | end |
---|
217 | |
---|
218 | %% transfer the time from the GUI series, or use file index by default |
---|
219 | time=[]; |
---|
220 | TimeUnit='frame'; %default |
---|
221 | CoordUnit='';%default |
---|
222 | pxcm_search=1; |
---|
223 | if isfield(SeriesData,'Time') && ~isempty(SeriesData.Time{1}) |
---|
224 | time=SeriesData.Time{1}; |
---|
225 | end |
---|
226 | if isfield(Param.IndexRange,'TimeUnit')&&~isempty(Param.IndexRange.TimeUnit) |
---|
227 | TimeUnit=Param.IndexRange.TimeUnit; |
---|
228 | end |
---|
229 | % if isfield(SeriesData,'TimeSource') |
---|
230 | % set(handles.TimeSource,'String',SeriesData.TimeSource) |
---|
231 | % end |
---|
232 | if isfield(SeriesData,'GeometryCalib') |
---|
233 | tsai=SeriesData.GeometryCalib; |
---|
234 | if isfield(tsai,'fx_fy') |
---|
235 | pxcm_search=max(tsai.fx_fy(1),tsai.fx_fy(2));%pixels:cm estimated for the search range |
---|
236 | end |
---|
237 | if isfield(tsai,'CoordUnit') |
---|
238 | CoordUnit=tsai.CoordUnit; |
---|
239 | end |
---|
240 | end |
---|
241 | |
---|
242 | %% timing display |
---|
243 | %show the reference image edit box if relevant (not needed for movies or in the absence of time information |
---|
244 | if numel(time)>=2 % if there are at least two time values to define dt |
---|
245 | if size(time,1)<MaxIndex_i; |
---|
246 | msgbox_uvmat('WARNING','maximum i index restricted by the timing of the xml file'); |
---|
247 | elseif size(time,2)<MaxIndex_j |
---|
248 | msgbox_uvmat('WARNING','maximum j index restricted by the timing of the xml file'); |
---|
249 | end |
---|
250 | MaxIndex_i=min(size(time,1),MaxIndex_i);%possibly adjust the max index according to time data |
---|
251 | MaxIndex_j=min(size(time,2),MaxIndex_j); |
---|
252 | set(handles.TimeSource,'String',Param.IndexRange.TimeSource); |
---|
253 | else |
---|
254 | set(handles.TimeSource,'String',''); %xml file not used for timing |
---|
255 | TimeUnit='frame'; |
---|
256 | time=ones(MaxIndex_j-MinIndex_j+1,1)*(MinIndex_i:MaxIndex_i); |
---|
257 | time=time+0.001*(MinIndex_j:MaxIndex_j)'*ones(1,MaxIndex_i-MinIndex_i+1); |
---|
258 | end |
---|
259 | CivInputData.Time=time; |
---|
260 | CivInputData.NomTypeIma=NomTypeImaA; |
---|
261 | set(handles.civ_input,'UserData',CivInputData) |
---|
262 | set(handles.dt_unit,'String',['dt in m' TimeUnit]);%display dt in unit 10-3 of the time (e.g ms) |
---|
263 | set(handles.TimeUnit,'String',TimeUnit); |
---|
264 | %set(handles.CoordUnit,'String',CoordUnit) |
---|
265 | set(handles.SearchRange,'UserData', pxcm_search); |
---|
266 | |
---|
267 | % indicate the min and max indices i and j on the GUI |
---|
268 | set(handles.MinIndex_i,'String',num2str(MinIndex_i)) |
---|
269 | set(handles.MaxIndex_i,'String',num2str(MaxIndex_i)) |
---|
270 | set(handles.MinIndex_j,'String',num2str(MinIndex_j)) |
---|
271 | set(handles.MaxIndex_j,'String',num2str(MaxIndex_j)) |
---|
272 | |
---|
273 | |
---|
274 | %% set the stereo_input options, depending on the input file content if a nc file has been opened |
---|
275 | ListOptions={'CheckCiv1', 'CheckFix1' 'CheckPatch1', 'CheckCiv2', 'CheckFix2', 'CheckPatch2', 'CheckCiv3', 'CheckFix3', 'CheckPatch3'}; |
---|
276 | checkbox=zeros(size(ListOptions));%default |
---|
277 | checkrefresh=0; |
---|
278 | if ind_opening==0 %case of image opening, start with Civ1 |
---|
279 | for index=1:numel(ListOptions) |
---|
280 | checkbox(index)=get(handles.(ListOptions{index}),'Value'); |
---|
281 | end |
---|
282 | index_max=find(checkbox, 1, 'last' ); |
---|
283 | if isempty(index_max),index_max=1;end |
---|
284 | for index=1:index_max |
---|
285 | set(handles.(ListOptions{index}),'Value',1)% select all operations starting from CIV1 |
---|
286 | end |
---|
287 | else %case of netcdf file opening, start with the stage read in the file if the input file is being refreshed |
---|
288 | if isequal(get(hhseries.REFRESH,'BackgroundColor'),[1 1 0]) &&... |
---|
289 | ~(isfield(Param,'ActionInput') && isfield(Param.ActionInput,'ConfigSource')) |
---|
290 | % answer=msgbox_uvmat('INPUT_Y-N',['import the civ parameters from the netcdf file']); |
---|
291 | % if strcmp(answer,'Yes') |
---|
292 | for index = 1:min(ind_opening,5) |
---|
293 | set(handles.(ListOptions{index}),'value',0) |
---|
294 | fill_civ_input(Data,handles); %fill civ_input with the parameters retrieved from an input Civ file |
---|
295 | end |
---|
296 | set(handles.ConfigSource,'String',FileInfo.FileName); |
---|
297 | set(handles.(ListOptions{min(ind_opening+1,6)}),'value',1) |
---|
298 | for index = ind_opening+2:6 |
---|
299 | set(handles.(ListOptions{index}),'value',0) |
---|
300 | end |
---|
301 | checkrefresh=1; |
---|
302 | % end |
---|
303 | end |
---|
304 | if ind_opening>=3 |
---|
305 | set(handles.CheckCiv3,'Visible','on')% make visible the switch 'iterate/repet' for Civ2. |
---|
306 | else |
---|
307 | set(handles.CheckCiv3,'Visible','off') |
---|
308 | end |
---|
309 | end |
---|
310 | |
---|
311 | %% introduce the stored Civ parameters if available (from previous input or ImportConfig in series) |
---|
312 | if ~checkrefresh && isfield(Param,'ActionInput')&& strcmp(Param.ActionInput.Program,Param.Action.ActionName)% the program fits with the stored data |
---|
313 | fill_GUI(Param.ActionInput,hObject);%fill the GUI with the parameters retrieved from the input Param |
---|
314 | hcheckgrid=findobj(handles.civ_input,'Tag','CheckGrid'); |
---|
315 | for ilist=1:numel(hcheckgrid) |
---|
316 | if get(hcheckgrid(ilist),'Value')% if a grid is used, do not show Dx and Dy for an automatic grid |
---|
317 | hparent=get(hcheckgrid(ilist),'parent');%handles of the parent panel |
---|
318 | hchildren=get(hparent,'children'); |
---|
319 | handle_dx=findobj(hchildren,'tag','num_Dx'); |
---|
320 | handle_dy=findobj(hchildren,'tag','num_Dy'); |
---|
321 | handle_title_dx=findobj(hchildren,'tag','title_Dx'); |
---|
322 | handle_title_dy=findobj(hchildren,'tag','title_Dy'); |
---|
323 | set(handle_dx,'Visible','off'); |
---|
324 | set(handle_dy,'Visible','off'); |
---|
325 | set(handle_title_dy,'Visible','off'); |
---|
326 | set(handle_title_dx,'Visible','off'); |
---|
327 | end |
---|
328 | end |
---|
329 | end |
---|
330 | |
---|
331 | %% set the reference indices from the input file indices |
---|
332 | ind_opening=9; |
---|
333 | % if ~(isfield(Param,'ActionInput') && isfield(Param.ActionInput,'ConfigSource')) |
---|
334 | update_CivOptions(handles,ind_opening)% fill the menu of possible pairs |
---|
335 | % % end |
---|
336 | |
---|
337 | %% list the possible index pairs, depending on the option set in ListPairMode |
---|
338 | ListPairMode_Callback([], [], handles) |
---|
339 | ListPairCiv1_Callback(hObject, eventdata, handles) |
---|
340 | |
---|
341 | %% set the GUI to modal: wait for OK to close |
---|
342 | set(handles.civ_input,'WindowStyle','modal')% Make the GUI modal |
---|
343 | |
---|
344 | set(handles.Civ3,'Visible','on') |
---|
345 | set(handles.Fix3,'Visible','on') |
---|
346 | set(handles.Patch3,'Visible','on') |
---|
347 | |
---|
348 | |
---|
349 | drawnow |
---|
350 | uiwait(handles.civ_input);% wait for OK action to end the function |
---|
351 | |
---|
352 | |
---|
353 | %------------------------------------------------------------------------ |
---|
354 | % --- Outputs from this function are returned to the command line. |
---|
355 | function varargout = stereo_input_OutputFcn(hObject, eventdata, handles) |
---|
356 | %------------------------------------------------------------------------ |
---|
357 | % Get default command line output from handles structure |
---|
358 | varargout{1}=[];% default output when civ_input is canceled (no 'OK') |
---|
359 | if ~isempty(handles) |
---|
360 | varargout{1} = handles.output; |
---|
361 | delete(handles.civ_input) |
---|
362 | end |
---|
363 | |
---|
364 | % --- Executes when user attempts to close get_field. |
---|
365 | function civ_input_CloseRequestFcn(hObject, eventdata, handles) |
---|
366 | if isequal(get(handles.get_field, 'waitstatus'), 'waiting') |
---|
367 | % The GUI is still in UIWAIT, us UIRESUME |
---|
368 | uiresume(handles.civ_input); |
---|
369 | else |
---|
370 | % The GUI is no longer waiting, just close it |
---|
371 | delete(handles.civ_input); |
---|
372 | end |
---|
373 | |
---|
374 | %------------------------------------------------------------------------ |
---|
375 | % --- Executes on button press in SetDefaultParam. |
---|
376 | %------------------------------------------------------------------------ |
---|
377 | function SetDefaultParam_Callback(hObject, eventdata, handles) |
---|
378 | |
---|
379 | Param.ConfigSource='\default'; |
---|
380 | |
---|
381 | %% Civ1 parameters |
---|
382 | Param.Civ1.CorrBoxSize=[25 25]; |
---|
383 | Param.Civ1.SearchBoxSize=[55 55]; |
---|
384 | Param.Civ1.SearchBoxShift=[0 0]; |
---|
385 | Param.Civ1.CorrSmooth=1; |
---|
386 | Param.Civ1.Dx=20; |
---|
387 | Param.Civ1.Dy=20; |
---|
388 | Param.Civ1.CheckGrid=0; |
---|
389 | Param.Civ1.CheckMask=0; |
---|
390 | Param.Civ1.CheckThreshold=0; |
---|
391 | Param.Civ1.TestCiv1=0; |
---|
392 | |
---|
393 | %% Fix1 parameters |
---|
394 | Param.Fix1.CheckFmin2=1; |
---|
395 | Param.Fix1.CheckF3=1; |
---|
396 | Param.Fix1.MinCorr=0.2000; |
---|
397 | |
---|
398 | %% Patch1 parameters |
---|
399 | Param.Patch1.FieldSmooth=10; |
---|
400 | Param.Patch1.MaxDiff=1.5000; |
---|
401 | Param.Patch1.SubDomainSize=1000; |
---|
402 | Param.Patch1.TestPatch1=0; |
---|
403 | |
---|
404 | %% Civ2 parameters |
---|
405 | Param.Civ2.CorrBoxSize=[21 21]; |
---|
406 | Param.Civ2.SearchBoxSize=[27 27]; |
---|
407 | Param.Civ2.CorrSmooth=1; |
---|
408 | Param.Civ2.Dx=10; |
---|
409 | Param.Civ2.Dy=10; |
---|
410 | Param.Civ2.CheckGrid=0; |
---|
411 | Param.Civ2.CheckMask=0; |
---|
412 | Param.Civ2.CheckThreshold=0; |
---|
413 | Param.Civ2.TestCiv2=0; |
---|
414 | |
---|
415 | %% Fix2 parameters |
---|
416 | Param.Fix2.CheckFmin2=1; |
---|
417 | Param.Fix2.CheckF4=1; |
---|
418 | Param.Fix2.CheckF3=1; |
---|
419 | Param.Fix2.MinCorr=0.2000; |
---|
420 | |
---|
421 | %% Patch2 parameters |
---|
422 | Param.Patch2.FieldSmooth=2; |
---|
423 | Param.Patch2.MaxDiff=1.5000; |
---|
424 | Param.Patch2.SubDomainSize=1000; |
---|
425 | Param.Patch2.TestPatch2=0; |
---|
426 | |
---|
427 | fill_GUI(Param,handles.civ_input)% fill the elements of the GUI series with the input parameters |
---|
428 | |
---|
429 | % ----------------------------------------------------------------------- |
---|
430 | % ----------------------------------------------------------------------- |
---|
431 | % --- Open the help html file |
---|
432 | function MenuHelp_Callback(hObject, eventdata, handles) |
---|
433 | % ----------------------------------------------------------------------- |
---|
434 | web('http://servforge.legi.grenoble-inp.fr/projects/soft-uvmat/wiki/UvmatHelp#Civ') |
---|
435 | |
---|
436 | %------------------------------------------------------------------------ |
---|
437 | % --- Executes on carriage return on the subdir checkciv1 edit window |
---|
438 | function Civ1_ImageB_Callback(hObject, eventdata, handles) |
---|
439 | %------------------------------------------------------------------------ |
---|
440 | SubDir=get(handles.Civ1_ImageB,'String'); |
---|
441 | menu_str=get(handles.ListSubdirCiv1,'String');% read the list of subdirectories for update |
---|
442 | ichoice=find(strcmp(SubDir,menu_str),1); |
---|
443 | if isempty(ichoice) |
---|
444 | ilist=numel(menu_str); %select 'new...' in the menu |
---|
445 | else |
---|
446 | ilist=ichoice; |
---|
447 | end |
---|
448 | set(handles.ListSubdirCiv1,'Value',ilist)% select the selected subdir in the menu |
---|
449 | if get(handles.CheckCiv1,'Value')% if Civ1 is performed |
---|
450 | set(handles.Civ2_ImageA,'String',SubDir);% set by default civ2 directory the same as civ1 |
---|
451 | % set(handles.ListSubdirCiv2,'Value',ilist) |
---|
452 | else % if Civ1 data already exist |
---|
453 | errormsg=find_netcpair_civ(handles,1); %update the list of available index pairs in the new directory |
---|
454 | if ~isempty(errormsg) |
---|
455 | msgbox_uvmat('ERROR',errormsg) |
---|
456 | end |
---|
457 | end |
---|
458 | |
---|
459 | %------------------------------------------------------------------------ |
---|
460 | % --- Executes on carriage return on the SubDir checkciv1 edit window |
---|
461 | function Civ2_ImageA_Callback(hObject, eventdata, handles) |
---|
462 | %------------------------------------------------------------------------ |
---|
463 | SubDir=get(handles.Civ1_ImageB,'String'); |
---|
464 | menu_str=get(handles.ListSubdirCiv2,'String');% read the list of subdirectories for update |
---|
465 | ichoice=find(strcmp(SubDir,menu_str),1); |
---|
466 | if isempty(ichoice) |
---|
467 | ilist=numel(menu_str); %select 'new...' in the menu |
---|
468 | else |
---|
469 | ilist=ichoice; |
---|
470 | end |
---|
471 | set(handles.ListSubdirCiv2,'Value',ilist)% select the selected subdir in the menu |
---|
472 | %update the list of available pairs from netcdf files in the new directory |
---|
473 | if ~get(handles.CheckCiv2,'Value') && ~get(handles.CheckCiv1,'Value') && ~get(handles.CheckFix1,'Value') && ~get(handles.CheckPatch1,'Value') |
---|
474 | errormsg=find_netcpair_civ(handles,2); |
---|
475 | if ~isempty(errormsg) |
---|
476 | msgbox_uvmat('ERROR',errormsg) |
---|
477 | end |
---|
478 | end |
---|
479 | |
---|
480 | %------------------------------------------------------------------------ |
---|
481 | % --- Executes on button press in CheckCiv1. |
---|
482 | function CheckCiv1_Callback(hObject, eventdata, handles) |
---|
483 | %------------------------------------------------------------------------ |
---|
484 | % update_CivOptions(handles,0) |
---|
485 | if get(hObject,'Value')==1 |
---|
486 | set(handles.Civ1,'Visible','on') |
---|
487 | else |
---|
488 | set(handles.Civ1,'Visible','off') |
---|
489 | end |
---|
490 | |
---|
491 | %------------------------------------------------------------------------ |
---|
492 | % --- Executes on button press in CheckFix1. |
---|
493 | function CheckFix1_Callback(hObject, eventdata, handles) |
---|
494 | %------------------------------------------------------------------------ |
---|
495 | % update_CivOptions(handles,0) |
---|
496 | if get(hObject,'Value')==1 |
---|
497 | set(handles.Fix1,'Visible','on') |
---|
498 | else |
---|
499 | set(handles.Fix1,'Visible','off') |
---|
500 | end |
---|
501 | |
---|
502 | %------------------------------------------------------------------------ |
---|
503 | % --- Executes on button press in CheckPatch1. |
---|
504 | function CheckPatch1_Callback(hObject, eventdata, handles) |
---|
505 | %------------------------------------------------------------------------ |
---|
506 | % update_CivOptions(handles,0) |
---|
507 | if get(hObject,'Value')==1 |
---|
508 | set(handles.Patch1,'Visible','on') |
---|
509 | else |
---|
510 | set(handles.Patch1,'Visible','off') |
---|
511 | end |
---|
512 | %------------------------------------------------------------------------ |
---|
513 | % --- Executes on button press in CheckCiv2. |
---|
514 | function CheckCiv2_Callback(hObject, eventdata, handles) |
---|
515 | %------------------------------------------------------------------------ |
---|
516 | % update_CivOptions(handles,0) |
---|
517 | if get(hObject,'Value')==1 |
---|
518 | set(handles.Civ2,'Visible','on') |
---|
519 | else |
---|
520 | set(handles.Civ2,'Visible','off') |
---|
521 | end |
---|
522 | %------------------------------------------------------------------------ |
---|
523 | % --- Executes on button press in CheckFix2. |
---|
524 | function CheckFix2_Callback(hObject, eventdata, handles) |
---|
525 | %------------------------------------------------------------------------ |
---|
526 | % update_CivOptions(handles,0) |
---|
527 | if get(hObject,'Value')==1 |
---|
528 | set(handles.Fix2,'Visible','on') |
---|
529 | else |
---|
530 | set(handles.Fix2,'Visible','off') |
---|
531 | end |
---|
532 | %------------------------------------------------------------------------ |
---|
533 | % --- Executes on button press in CheckPatch2. |
---|
534 | function CheckPatch2_Callback(hObject, eventdata, handles) |
---|
535 | %------------------------------------------------------------------------ |
---|
536 | %update_CivOptions(handles,0) |
---|
537 | if get(hObject,'Value')==1 |
---|
538 | set(handles.Patch2,'Visible','on') |
---|
539 | else |
---|
540 | set(handles.Patch2,'Visible','off') |
---|
541 | end |
---|
542 | %------------------------------------------------------------------------ |
---|
543 | % --- Executes on button press in CheckCiv3. |
---|
544 | function CheckCiv3_Callback(hObject, eventdata, handles) |
---|
545 | %------------------------------------------------------------------------ |
---|
546 | % update_CivOptions(handles,0) |
---|
547 | if get(hObject,'Value')==1 |
---|
548 | set(handles.Civ3,'Visible','on') |
---|
549 | else |
---|
550 | set(handles.Civ3,'Visible','off') |
---|
551 | end |
---|
552 | %------------------------------------------------------------------------ |
---|
553 | % --- Executes on button press in CheckFix3. |
---|
554 | function CheckFix3_Callback(hObject, eventdata, handles) |
---|
555 | %------------------------------------------------------------------------ |
---|
556 | % update_CivOptions(handles,0) |
---|
557 | if get(hObject,'Value')==1 |
---|
558 | set(handles.Fix3,'Visible','on') |
---|
559 | else |
---|
560 | set(handles.Fix3,'Visible','off') |
---|
561 | end |
---|
562 | %------------------------------------------------------------------------ |
---|
563 | % --- Executes on button press in CheckPatch3. |
---|
564 | function CheckPatch3_Callback(hObject, eventdata, handles) |
---|
565 | %------------------------------------------------------------------------ |
---|
566 | %update_CivOptions(handles,0) |
---|
567 | if get(hObject,'Value')==1 |
---|
568 | set(handles.Patch3,'Visible','on') |
---|
569 | else |
---|
570 | set(handles.Patch3,'Visible','off') |
---|
571 | end |
---|
572 | %------------------------------------------------------------------------ |
---|
573 | |
---|
574 | % --- activated by any checkbox controling the selection of Civ1,Fix1,Patch1,Civ2,Fix2,Patch2 |
---|
575 | function update_CivOptions(handles,opening) |
---|
576 | %------------------------------------------------------------------------ |
---|
577 | % if opening>0 |
---|
578 | % set(handles.CheckCiv2,'UserData',opening)% store the info on the current status of the civ processing |
---|
579 | % % end |
---|
580 | % checkbox=zeros(1,9); |
---|
581 | % checkbox(1)=get(handles.CheckCiv1,'Value'); |
---|
582 | % checkbox(2)=get(handles.CheckFix1,'Value'); |
---|
583 | % checkbox(3)=get(handles.CheckPatch1,'Value'); |
---|
584 | % checkbox(4)=get(handles.CheckCiv2,'Value'); |
---|
585 | % checkbox(5)=get(handles.CheckFix2,'Value'); |
---|
586 | % checkbox(6)=get(handles.CheckPatch2,'Value'); |
---|
587 | % checkbox(7)=get(handles.CheckCiv3,'Value'); |
---|
588 | % checkbox(8)=get(handles.CheckFix3,'Value'); |
---|
589 | % checkbox(9)=get(handles.CheckPatch3,'Value'); |
---|
590 | % if opening==0 |
---|
591 | % errormsg=find_netcpair_civ(handles,1); % select the available netcdf files |
---|
592 | % if ~isempty(errormsg) |
---|
593 | % msgbox_uvmat('ERROR',errormsg) |
---|
594 | % end |
---|
595 | % end |
---|
596 | % if max(checkbox(4:6))>0% case of civ2 pair choice needed |
---|
597 | % set(handles.TitlePairCiv2,'Visible','on') |
---|
598 | % set(handles.ListPairCiv2,'Visible','on') |
---|
599 | % if ~opening |
---|
600 | % errormsg=find_netcpair_civ(handles,2); % select the available netcdf files |
---|
601 | % if ~isempty(errormsg) |
---|
602 | % msgbox_uvmat('ERROR',errormsg) |
---|
603 | % end |
---|
604 | % end |
---|
605 | % else |
---|
606 | % set(handles.ListPairCiv2,'Visible','off') |
---|
607 | % end |
---|
608 | % |
---|
609 | % |
---|
610 | % %% set the visibility of the different panels |
---|
611 | % options={'Civ1','Fix1','Patch1','Civ2','Fix2','Patch2','Civ3','Fix3','Patch3'}; |
---|
612 | % for ilist=1:length(options) |
---|
613 | % % if checkbox(ilist) |
---|
614 | % set(handles.(options{ilist}),'Visible','on') |
---|
615 | % % else |
---|
616 | % % set(handles.(options{ilist}),'Visible','off') |
---|
617 | % % end |
---|
618 | % end |
---|
619 | |
---|
620 | %------------------------------------------------------------------------ |
---|
621 | % --- Executes on button press in OK: processing on local computer |
---|
622 | function OK_Callback(hObject, eventdata, handles) |
---|
623 | %------------------------------------------------------------------------ |
---|
624 | |
---|
625 | ActionInput=read_GUI(handles.civ_input);% read the infos on the GUI civ_input |
---|
626 | |
---|
627 | %% correct input inconsistencies |
---|
628 | if isfield(ActionInput,'Civ1') |
---|
629 | checkeven=(mod(ActionInput.Civ1.CorrBoxSize,2)==0); |
---|
630 | ActionInput.Civ1.CorrBoxSize(checkeven)=ActionInput.Civ1.CorrBoxSize(checkeven)+1;% set correlation box sizes to odd values |
---|
631 | ActionInput.Civ1.SearchBoxSize=max(ActionInput.Civ1.SearchBoxSize,ActionInput.Civ1.CorrBoxSize+8);% insure that the search box size is large enough |
---|
632 | checkeven=(mod(ActionInput.Civ1.SearchBoxSize,2)==0); |
---|
633 | ActionInput.Civ1.SearchBoxSize(checkeven)=ActionInput.Civ1.SearchBoxSize(checkeven)+1;% set search box sizes to odd values |
---|
634 | end |
---|
635 | if isfield(ActionInput,'Civ2') |
---|
636 | checkeven=(mod(ActionInput.Civ2.CorrBoxSize,2)==0); |
---|
637 | ActionInput.Civ2.CorrBoxSize(checkeven)=ActionInput.Civ2.CorrBoxSize(checkeven)+1;% set correlation box sizes to odd values |
---|
638 | ActionInput.Civ2.SearchBoxSize=max(ActionInput.Civ2.SearchBoxSize,ActionInput.Civ2.CorrBoxSize+4); |
---|
639 | checkeven=(mod(ActionInput.Civ2.SearchBoxSize,2)==0); |
---|
640 | ActionInput.Civ2.SearchBoxSize(checkeven)=ActionInput.Civ2.SearchBoxSize(checkeven)+1;% set search box sizes to odd values |
---|
641 | end |
---|
642 | |
---|
643 | %% correct mask or grid name for Windows system (replace '\' by '/') |
---|
644 | if isfield(ActionInput,'Civ1') |
---|
645 | if isfield(ActionInput.Civ1,'Mask') |
---|
646 | ActionInput.Civ1.Mask=regexprep(ActionInput.Civ1.Mask,'\','/'); |
---|
647 | end |
---|
648 | if isfield(ActionInput.Civ1,'Grid') |
---|
649 | ActionInput.Civ1.Grid=regexprep(ActionInput.Civ1.Grid,'\','/'); |
---|
650 | end |
---|
651 | end |
---|
652 | if isfield(ActionInput,'Civ2') |
---|
653 | if isfield(ActionInput.Civ2,'Mask') |
---|
654 | ActionInput.Civ2.Mask=regexprep(ActionInput.Civ2.Mask,'\','/'); |
---|
655 | end |
---|
656 | if isfield(ActionInput.Civ2,'Grid') |
---|
657 | ActionInput.Civ2.Grid=regexprep(ActionInput.Civ2.Grid,'\','/'); |
---|
658 | end |
---|
659 | end |
---|
660 | |
---|
661 | %% exit the GUI and close it |
---|
662 | handles.output.ActionInput=ActionInput; |
---|
663 | guidata(hObject, handles);% Update handles structure |
---|
664 | uiresume(handles.civ_input); |
---|
665 | |
---|
666 | |
---|
667 | %------------------------------------------------------------------------ |
---|
668 | % --- Executes on button press in ListCompareMode. |
---|
669 | function ListCompareMode_Callback(hObject, eventdata, handles) |
---|
670 | %------------------------------------------------------------------------ |
---|
671 | ListCompareMode=get(handles.ListCompareMode,'String'); |
---|
672 | option=ListCompareMode{get(handles.ListCompareMode,'Value')}; |
---|
673 | hseries=findobj(allchild(0),'Tag','series'); |
---|
674 | SeriesData=get(hseries,'UserData'); |
---|
675 | check_nc=strcmp(SeriesData.FileType{1},'.nc'); |
---|
676 | ImageType=SeriesData.FileType(2:end); |
---|
677 | if check_nc |
---|
678 | ImageType=SeriesData.FileType(2:end); |
---|
679 | else |
---|
680 | ImageType=SeriesData.FileType; |
---|
681 | end |
---|
682 | hhseries=guidata(hseries); |
---|
683 | InputTable=get(hhseries.InputTable,'Data'); |
---|
684 | OriginIndex='off'; |
---|
685 | PairIndices='off'; |
---|
686 | DoubleInputSeries='off'; |
---|
687 | switch option |
---|
688 | case 'PIV' |
---|
689 | PairIndices='on';% needs to define index pairs for PIV |
---|
690 | |
---|
691 | case 'PIV volume' |
---|
692 | PairIndices='on';% needs to define index pairs for PIV |
---|
693 | set(handles.ListPairMode,'Value',1) |
---|
694 | set(handles.ListPairMode,'String',{'series(Di)'}) |
---|
695 | ListPairMode_Callback(hObject, eventdata, handles) |
---|
696 | case 'displacement' |
---|
697 | OriginIndex='on';%define a frame origin for displacement |
---|
698 | % case 'shift' |
---|
699 | % if numel(ImageType)==1 |
---|
700 | % fileinput=uigetfile_uvmat('pick a second file series for synchronous shift',InputTable{check_nc+1}); |
---|
701 | % if ~isempty(fileinput) |
---|
702 | % series( 'display_file_name',hhseries,fileinput,'append') |
---|
703 | % end |
---|
704 | % |
---|
705 | % |
---|
706 | % end |
---|
707 | end |
---|
708 | set(handles.num_OriginIndex,'Visible',OriginIndex) |
---|
709 | set(handles.OriginIndex_title,'Visible',OriginIndex) |
---|
710 | set(handles.PairIndices,'Visible',PairIndices) |
---|
711 | ListPairMode_Callback(hObject, eventdata, handles) |
---|
712 | |
---|
713 | |
---|
714 | |
---|
715 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
716 | % Callbacks in the uipanel Pair Indices |
---|
717 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
718 | %------------------------------------------------------------------------ |
---|
719 | % --- Executes on button press in ListPairMode. |
---|
720 | function ListPairMode_Callback(hObject, eventdata, handles) |
---|
721 | %------------------------------------------------------------------------ |
---|
722 | compare_list=get(handles.ListCompareMode,'String'); |
---|
723 | val=get(handles.ListCompareMode,'Value'); |
---|
724 | compare=compare_list{val}; |
---|
725 | if strcmp(compare,'displacement')||strcmp(compare,'shift') |
---|
726 | mode='displacement'; |
---|
727 | else |
---|
728 | mode_list=get(handles.ListPairMode,'String'); |
---|
729 | if ischar(mode_list) |
---|
730 | mode_list={mode_list}; |
---|
731 | end |
---|
732 | mode_value=get(handles.ListPairMode,'Value'); |
---|
733 | mode=mode_list{mode_value}; |
---|
734 | end |
---|
735 | % displ_num=[];%default |
---|
736 | ref_i=str2double(get(handles.ref_i,'String')); |
---|
737 | % last_i=str2num(get(handles.last_i,'String')); |
---|
738 | CivInputData=get(handles.civ_input,'UserData'); |
---|
739 | TimeUnit=get(handles.TimeUnit,'String'); |
---|
740 | checkframe=strcmp(TimeUnit,'frame'); |
---|
741 | time=CivInputData.Time; |
---|
742 | siztime=size(CivInputData.Time); |
---|
743 | nbfield=siztime(1)-1; |
---|
744 | nbfield2=siztime(2)-1; |
---|
745 | indchosen=1; %%first pair selected by default |
---|
746 | %displ_num used to define the indices of the stereo_input pairs |
---|
747 | % in mode 'pair j1-j2', j1 and j2 are the file indices, else the indices |
---|
748 | % are relative to the reference indices ref_i and ref_j respectively. |
---|
749 | if isequal(mode,'pair j1-j2')%| isequal(mode,'st_pair j1-j2') |
---|
750 | dt=1; |
---|
751 | displ=''; |
---|
752 | index=0; |
---|
753 | numlist_a=[]; |
---|
754 | numlist_B=[]; |
---|
755 | %get all the time intervals in bursts |
---|
756 | displ_dt=1;%default |
---|
757 | nbfield2=min(nbfield2,10);%limitate the number of pairs to 10x10 |
---|
758 | for numod_a=1:nbfield2-1 %nbfield2 always >=2 for 'pair j1-j2' mode |
---|
759 | for numod_b=(numod_a+1):nbfield2 |
---|
760 | index=index+1; |
---|
761 | numlist_a(index)=numod_a; |
---|
762 | numlist_b(index)=numod_b; |
---|
763 | if size(time,2)>1 && ~checkframe |
---|
764 | 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 |
---|
765 | displ_dt(index)=dt(numod_a,numod_b); |
---|
766 | else |
---|
767 | displ_dt(index)=1; |
---|
768 | end |
---|
769 | end |
---|
770 | end |
---|
771 | [dtsort,indsort]=sort(displ_dt); |
---|
772 | if ~isempty(numlist_a) |
---|
773 | displ_num(1,:)=numlist_a(indsort); |
---|
774 | displ_num(2,:)=numlist_b(indsort); |
---|
775 | end |
---|
776 | displ_num(3,:)=0; |
---|
777 | displ_num(4,:)=0; |
---|
778 | enable_j(handles, 'off') |
---|
779 | elseif isequal(mode,'series(Dj)') %| isequal(mode,'st_series(Dj)') |
---|
780 | index=1:200; |
---|
781 | displ_num(1,index)=-floor(index/2); |
---|
782 | displ_num(2,index)=ceil(index/2); |
---|
783 | displ_num(3:4,index)=zeros(2,200); |
---|
784 | enable_j(handles, 'on') |
---|
785 | elseif isequal(mode,'series(Di)') %| isequal(mode,'st_series(Di)') |
---|
786 | % index=1:200; |
---|
787 | % displ_num(1:2,index)=zeros(2,200); |
---|
788 | % displ_num(3,index)=-floor(index/2); |
---|
789 | % displ_num(4,index)=ceil(index/2); |
---|
790 | enable_i(handles, 'on') |
---|
791 | if nbfield2 > 1 |
---|
792 | enable_j(handles, 'on') |
---|
793 | else |
---|
794 | enable_j(handles, 'off') |
---|
795 | end |
---|
796 | elseif isequal(mode,'displacement')%the pairs have the same indices |
---|
797 | displ_num(1,1)=0; |
---|
798 | displ_num(2,1)=0; |
---|
799 | displ_num(3,1)=0; |
---|
800 | displ_num(4,1)=0; |
---|
801 | if nbfield > 1 || nbfield==0 |
---|
802 | enable_i(handles, 'on') |
---|
803 | else |
---|
804 | enable_j(handles, 'off') |
---|
805 | end |
---|
806 | if nbfield2 > 1 |
---|
807 | enable_j(handles, 'on') |
---|
808 | else |
---|
809 | enable_j(handles, 'off') |
---|
810 | end |
---|
811 | end |
---|
812 | %set(handles.ListPairCiv1,'UserData',displ_num); |
---|
813 | errormsg=find_netcpair_civ( handles,1); |
---|
814 | if ~isempty(errormsg) |
---|
815 | msgbox_uvmat('ERROR',errormsg) |
---|
816 | end |
---|
817 | % find_netcpair_civ2(handles) |
---|
818 | |
---|
819 | function enable_i(handles, state) |
---|
820 | set(handles.itext,'Visible',state) |
---|
821 | % set(handles.MinIndex_i,'Visible',state) |
---|
822 | % set(handles.last_i,'Visible',state) |
---|
823 | % set(handles.incr_i,'Visible',state) |
---|
824 | set(handles.MaxIndex_i,'Visible',state) |
---|
825 | set(handles.ref_i,'Visible',state) |
---|
826 | |
---|
827 | function enable_j(handles, state) |
---|
828 | set(handles.jtext,'Visible',state) |
---|
829 | % set(handles.MinIndex_j,'Visible',state) |
---|
830 | % set(handles.last_j,'Visible',state) |
---|
831 | % set(handles.incr_j,'Visible',state) |
---|
832 | set(handles.MinIndex_j,'Visible',state) |
---|
833 | set(handles.MaxIndex_j,'Visible',state) |
---|
834 | set(handles.ref_j,'Visible',state) |
---|
835 | %hseries=findobj(allchild(0),'Tag','series'); |
---|
836 | %hhseries=guidata(hseries); |
---|
837 | %series('enable_j',hhseries,state); %file input with xml reading in uvmat, show the image in phys coordinates |
---|
838 | |
---|
839 | |
---|
840 | |
---|
841 | %------------------------------------------------------------------------ |
---|
842 | % --- Executes on selection change in ListPairCiv1. |
---|
843 | function ListPairCiv1_Callback(hObject, eventdata, handles) |
---|
844 | %------------------------------------------------------------------------ |
---|
845 | %reproduce by default the chosen pair in the checkciv2 menu |
---|
846 | list_pair=get(handles.ListPairCiv1,'String');%get the menu of image pairs |
---|
847 | PairString=list_pair{get(handles.ListPairCiv1,'Value')}; |
---|
848 | |
---|
849 | [ind1,ind2]=... |
---|
850 | find_pair_indices(PairString); |
---|
851 | hseries=findobj(allchild(0),'Tag','series'); |
---|
852 | hhseries=guidata(hseries); |
---|
853 | set(hhseries.num_first_j,'String',num2str(ind1)); |
---|
854 | set(hhseries.num_last_j,'String',num2str(ind2)); |
---|
855 | set(hhseries.num_incr_j,'String',num2str(ind2-ind1)); |
---|
856 | set(handles.ListPairCiv2,'Value',get(handles.ListPairCiv1,'Value'))%civ2 selection the same as civ& by default |
---|
857 | |
---|
858 | |
---|
859 | %------------------------------------------------------------------------ |
---|
860 | % --- Executes on selection change in ListPairCiv2. |
---|
861 | function ListPairCiv2_Callback(hObject, eventdata, handles) |
---|
862 | %------------------------------------------------------------------------ |
---|
863 | |
---|
864 | |
---|
865 | %------------------------------------------------------------------------ |
---|
866 | function ref_i_Callback(hObject, eventdata, handles) |
---|
867 | %------------------------------------------------------------------------ |
---|
868 | mode_list=get(handles.ListPairMode,'String'); |
---|
869 | mode_value=get(handles.ListPairMode,'Value'); |
---|
870 | mode=mode_list{mode_value}; |
---|
871 | errormsg=find_netcpair_civ(handles,1);% update the menu of pairs depending on the available netcdf files |
---|
872 | if isequal(mode,'series(Di)') || ...% we do patch2 only |
---|
873 | (get(handles.CheckCiv2,'Value')==0 && get(handles.CheckCiv1,'Value')==0 && get(handles.CheckFix1,'Value')==0 && get(handles.CheckPatch1,'Value')==0) |
---|
874 | errormsg=find_netcpair_civ( handles,2); |
---|
875 | end |
---|
876 | if isempty(errormsg) |
---|
877 | set(handles.ref_i,'BackgroundColor',[1 1 1]) |
---|
878 | set(handles.ref_j,'BackgroundColor',[1 1 1]) |
---|
879 | else |
---|
880 | msgbox_uvmat('ERROR',errormsg) |
---|
881 | end |
---|
882 | |
---|
883 | function ref_i_KeyPressFcn(hObject, eventdata, handles) |
---|
884 | set(hObject,'BackgroundColor',[1 0 1]) |
---|
885 | |
---|
886 | % %------------------------------------------------------------------------ |
---|
887 | % function ref_j_Callback(hObject, eventdata, handles) |
---|
888 | % %------------------------------------------------------------------------ |
---|
889 | % mode_list=get(handles.ListPairMode,'String'); |
---|
890 | % mode_value=get(handles.ListPairMode,'Value'); |
---|
891 | % mode=mode_list{mode_value}; |
---|
892 | % errormsg=''; |
---|
893 | % if isequal(get(handles.CheckCiv1,'Value'),0)|| isequal(mode,'series(Dj)') |
---|
894 | % errormsg=find_netcpair_civ(handles,1);% update the menu of pairs depending on the available netcdf files |
---|
895 | % end |
---|
896 | % if isequal(mode,'series(Dj)') || ... |
---|
897 | % (get(handles.CheckCiv2,'Value')==0 && get(handles.CheckCiv1,'Value')==0 && get(handles.CheckFix1,'Value')==0 && get(handles.CheckPatch1,'Value')==0) |
---|
898 | % errormsg=find_netcpair_civ(handles,2); |
---|
899 | % end |
---|
900 | % if ~isempty(errormsg) |
---|
901 | % msgbox_uvmat('ERROR',errormsg) |
---|
902 | % end |
---|
903 | % |
---|
904 | % function ref_j_KeyPressFcn(hObject, eventdata, handles) |
---|
905 | % set(handles.ref_j,'BackgroundColor',[1 0 1]) |
---|
906 | %------------------------------------------------------------------------ |
---|
907 | % determine the menu for checkciv1 pairs depending on existing netcdf file at the middle of |
---|
908 | % the field series set by MinIndex_i, incr, last_i |
---|
909 | % index=1: look for pairs for civ1 |
---|
910 | % index=2: look for pairs for civ2 |
---|
911 | function errormsg=find_netcpair_civ(handles,index) |
---|
912 | %------------------------------------------------------------------------ |
---|
913 | set(gcf,'Pointer','watch')% set the mouse pointer to 'watch' (clock) |
---|
914 | |
---|
915 | %% initialisation |
---|
916 | errormsg=''; |
---|
917 | CivInputData=get(handles.civ_input,'UserData'); |
---|
918 | %browse=get(handles.RootPath,'UserData'); |
---|
919 | compare_list=get(handles.ListCompareMode,'String'); |
---|
920 | val=get(handles.ListCompareMode,'Value'); |
---|
921 | compare=compare_list{val}; |
---|
922 | if strcmp(compare,'displacement')||strcmp(compare,'shift') |
---|
923 | mode='displacement'; |
---|
924 | else |
---|
925 | mode_list=get(handles.ListPairMode,'String'); |
---|
926 | mode_value=get(handles.ListPairMode,'Value'); |
---|
927 | if isempty(mode_list) |
---|
928 | return |
---|
929 | end |
---|
930 | mode=mode_list{mode_value}; |
---|
931 | end |
---|
932 | nom_type_ima=CivInputData.NomTypeIma; |
---|
933 | |
---|
934 | %% determine nom_type_nc, nomenclature type of the .nc files: |
---|
935 | %[nom_type_nc]=nomtype2pair(nom_type_ima,mode); |
---|
936 | |
---|
937 | %% reads .nc subdirectoy and image numbers from the interface |
---|
938 | %SubDirImages=get(handles.Civ1_ImageA,'String'); |
---|
939 | %TODO: determine |
---|
940 | %subdir_civ1=[SubDirImages get(handles.Civ1_ImageB,'String')];%subdirectory subdir_civ1 for the netcdf data |
---|
941 | %subdir_civ2=[SubDirImages get(handles.Civ2_ImageA,'String')];%subdirectory subdir_civ2 for the netcdf data |
---|
942 | ref_i=str2double(get(handles.ref_i,'String')); |
---|
943 | ref_j=[]; |
---|
944 | if isequal(mode,'pair j1-j2')%|isequal(mode,'st_pair j1-j2') |
---|
945 | ref_j=0; |
---|
946 | elseif strcmp(get(handles.ref_j,'Visible'),'on') |
---|
947 | ref_j=str2double(get(handles.ref_j,'String')); |
---|
948 | end |
---|
949 | if isempty(ref_j) |
---|
950 | ref_j=1; |
---|
951 | end |
---|
952 | CivInputData=get(handles.civ_input,'UserData'); |
---|
953 | TimeUnit=get(handles.TimeUnit,'String'); |
---|
954 | Time=CivInputData.Time; |
---|
955 | checkframe=strcmp(TimeUnit,'frame'); |
---|
956 | |
---|
957 | %% case with no Civ1 operation, netcdf files need to exist for reading |
---|
958 | displ_pair={''}; |
---|
959 | nbpair=200;%default |
---|
960 | select=ones(size(1:nbpair));%flag for displayed pairs =1 for display |
---|
961 | nbpair=200; %default |
---|
962 | |
---|
963 | %% determine the menu display in .ListPairCiv1 |
---|
964 | switch mode |
---|
965 | case 'series(Di)' |
---|
966 | for ipair=1:nbpair |
---|
967 | if select(ipair) |
---|
968 | displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2))]; |
---|
969 | if ~checkframe |
---|
970 | 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 |
---|
971 | 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 |
---|
972 | displ_pair{ipair}=[displ_pair{ipair} ' :dt= ' num2str(dt*1000)]; |
---|
973 | end |
---|
974 | else |
---|
975 | dt=ipair/1000; |
---|
976 | displ_pair{ipair}=[displ_pair{ipair} ' :dt= ' num2str(ipair)]; |
---|
977 | end |
---|
978 | else |
---|
979 | displ_pair{ipair}='...'; %pair not displayed in the menu |
---|
980 | end |
---|
981 | end |
---|
982 | case 'series(Dj)' |
---|
983 | for ipair=1:nbpair |
---|
984 | if select(ipair) |
---|
985 | displ_pair{ipair}=['Dj= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2))]; |
---|
986 | if ~checkframe |
---|
987 | 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 |
---|
988 | 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 |
---|
989 | displ_pair{ipair}=[displ_pair{ipair} ' :dt= ' num2str(dt*1000)]; |
---|
990 | end |
---|
991 | else |
---|
992 | dt=ipair/1000; |
---|
993 | displ_pair{ipair}=[displ_pair{ipair} ' :dt= ' num2str(dt*1000)]; |
---|
994 | end |
---|
995 | else |
---|
996 | displ_pair{ipair}='...'; %pair not displayed in the menu |
---|
997 | end |
---|
998 | end |
---|
999 | case 'pair j1-j2'%case of pairs |
---|
1000 | % MinIndex_j=CivInputData.MinIndex_j; |
---|
1001 | % MaxIndex_j=min(CivInputData.MaxIndex_j,10);%limitate the number of pairs to 10x10 |
---|
1002 | MinIndex_j=str2num(get(handles.MinIndex_j,'String')); |
---|
1003 | MaxIndex_j=str2num(get(handles.MaxIndex_j,'String')); |
---|
1004 | index_pair=0; |
---|
1005 | %get all the Time intervals in bursts |
---|
1006 | for numod_a=MinIndex_j:MaxIndex_j-1 %nbfield2 always >=2 for 'pair j1-j2' mode |
---|
1007 | for numod_b=(numod_a+1):MaxIndex_j |
---|
1008 | index_pair=index_pair+1; |
---|
1009 | displ_pair{index_pair}=['j= ' num2stra(numod_a,nom_type_ima) '-' num2stra(numod_b,nom_type_ima)]; |
---|
1010 | dt(index_pair)=numod_b-numod_a;%default dt |
---|
1011 | if size(Time,1)>ref_i && size(Time,2)>numod_b % && ~checkframe |
---|
1012 | dt(index_pair)=Time(ref_i+1,numod_b+1)-Time(ref_i+1,numod_a+1);% Time interval dt |
---|
1013 | displ_pair{index_pair}=[displ_pair{index_pair} ' :dt= ' num2str(dt(index_pair)*1000)]; |
---|
1014 | end |
---|
1015 | end |
---|
1016 | |
---|
1017 | end |
---|
1018 | [tild,indsort]=sort(dt); |
---|
1019 | displ_pair=displ_pair(indsort); |
---|
1020 | case 'displacement' |
---|
1021 | displ_pair={'Di=Dj=0'}; |
---|
1022 | end |
---|
1023 | if index==1 |
---|
1024 | set(handles.ListPairCiv1,'String',displ_pair'); |
---|
1025 | end |
---|
1026 | |
---|
1027 | %% determine the default selection in the pair menu for Civ1 |
---|
1028 | ichoice=find(select,1);% index of first selected pair |
---|
1029 | if (isempty(ichoice) || ichoice < 1); ichoice=1; end; |
---|
1030 | initial=get(handles.ListPairCiv1,'Value');%initial choice of pair |
---|
1031 | if initial>nbpair || (numel(select)>=initial && ~isequal(select(initial),1)) |
---|
1032 | set(handles.ListPairCiv1,'Value',ichoice);% first valid pair proposed by default in the menu |
---|
1033 | end |
---|
1034 | |
---|
1035 | %% determine the default selection in the pair menu for Civ2 |
---|
1036 | if strcmp(get(handles.ListPairCiv2,'Visible'),'on') |
---|
1037 | initial=get(handles.ListPairCiv2,'Value'); |
---|
1038 | if initial>length(displ_pair')%|~isequal(select(initial),1) |
---|
1039 | if ichoice <= length(displ_pair') |
---|
1040 | set(handles.ListPairCiv2,'Value',ichoice);% same pair proposed by default for civ2 |
---|
1041 | else |
---|
1042 | set(handles.ListPairCiv2,'Value',1);% same pair proposed by default for civ2 |
---|
1043 | end |
---|
1044 | end |
---|
1045 | else |
---|
1046 | set(handles.ListPairCiv2,'Value',get(handles.ListPairCiv1,'Value'))% initiate the choice of Civ2 as a reproduction of if civ1 |
---|
1047 | end |
---|
1048 | set(handles.ListPairCiv2,'String',displ_pair'); |
---|
1049 | set(gcf,'Pointer','arrow')% Indicate that the process is finished |
---|
1050 | |
---|
1051 | |
---|
1052 | |
---|
1053 | % %------------------------------------------------------------------------ |
---|
1054 | % % call 'view_field.fig' to display the field selected in the list of 'status' |
---|
1055 | % function open_view_field(hObject, eventdata) |
---|
1056 | % %------------------------------------------------------------------------ |
---|
1057 | % list=get(hObject,'String'); |
---|
1058 | % index=get(hObject,'Value'); |
---|
1059 | % rootroot=get(hObject,'UserData'); |
---|
1060 | % filename=list{index}; |
---|
1061 | % ind_dot=strfind(filename,'...'); |
---|
1062 | % filename=filename(1:ind_dot-1); |
---|
1063 | % filename=fullfile(rootroot,filename); |
---|
1064 | % delete(get(hObject,'parent'))%delete the display figure to stop the check process |
---|
1065 | % if exist(filename,'file')%visualise the vel field if it exists |
---|
1066 | % uvmat(filename) |
---|
1067 | % set(gcbo,'Value',1) |
---|
1068 | % end |
---|
1069 | |
---|
1070 | |
---|
1071 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1072 | % Callbacks in the uipanel Reference Indices |
---|
1073 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1074 | %------------------------------------------------------------------------ |
---|
1075 | function MinIndex_i_Callback(hObject, eventdata, handles) |
---|
1076 | %------------------------------------------------------------------------ |
---|
1077 | first_i=str2double(get(handles.MinIndex_i,'String')); |
---|
1078 | set(handles.ref_i,'String', num2str(first_i))% reference index for pair dt = first index |
---|
1079 | ref_i_Callback(hObject, eventdata, handles)%refresh dispaly of dt for pairs (in case of non constant dt) |
---|
1080 | |
---|
1081 | % %------------------------------------------------------------------------ |
---|
1082 | % function MinIndex_j_Callback(hObject, eventdata, handles) |
---|
1083 | % %------------------------------------------------------------------------ |
---|
1084 | % first_j=str2num(get(handles.MinIndex_j,'String')); |
---|
1085 | % set(handles.ref_j,'String', num2str(first_j))% reference index for pair dt = first index |
---|
1086 | % ref_j_Callback(hObject, eventdata, handles)%refresh dispaly of dt for pairs (in case of non constant dt) |
---|
1087 | |
---|
1088 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1089 | % Callbacks in the uipanel Civ1 |
---|
1090 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1091 | %------------------------------------------------------------------------ |
---|
1092 | % --- Executes on button press in SearchRange: determine the search range num_SearchBoxSize_1,num_SearchBoxSize_2 |
---|
1093 | function SearchRange_Callback(hObject, eventdata, handles) |
---|
1094 | %------------------------------------------------------------------------ |
---|
1095 | %determine pair numbers |
---|
1096 | if strcmp(get(handles.num_UMin,'Visible'),'off') |
---|
1097 | set(handles.u_title,'Visible','on') |
---|
1098 | set(handles.v_title,'Visible','on') |
---|
1099 | set(handles.num_UMin,'Visible','on') |
---|
1100 | set(handles.num_UMax,'Visible','on') |
---|
1101 | set(handles.num_VMin,'Visible','on') |
---|
1102 | set(handles.num_VMax,'Visible','on') |
---|
1103 | %set(handles.CoordUnit,'Visible','on') |
---|
1104 | %set(handles.TimeUnit,'Visible','on') |
---|
1105 | %set(handles.slash_title,'Visible','on') |
---|
1106 | set(handles.min_title,'Visible','on') |
---|
1107 | set(handles.max_title,'Visible','on') |
---|
1108 | set(handles.unit_title,'Visible','on') |
---|
1109 | else |
---|
1110 | get_search_range(hObject, eventdata, handles) |
---|
1111 | end |
---|
1112 | |
---|
1113 | %------------------------------------------------------------------------ |
---|
1114 | % --- determine the search range num_SearchBoxSize_1,num_SearchBoxSize_2 and shift |
---|
1115 | function get_search_range(hObject, eventdata, handles) |
---|
1116 | %------------------------------------------------------------------------ |
---|
1117 | param_civ1=read_GUI(handles.Civ1); |
---|
1118 | umin=param_civ1.UMin; |
---|
1119 | umax=param_civ1.UMax; |
---|
1120 | vmin=param_civ1.VMin; |
---|
1121 | vmax=param_civ1.VMax; |
---|
1122 | %switch min_title and max_title in case of error |
---|
1123 | if umax<=umin |
---|
1124 | umin_old=umin; |
---|
1125 | umin=umax; |
---|
1126 | umax=umin_old; |
---|
1127 | set(handles.num_UMin,'String', num2str(umin)) |
---|
1128 | set(handles.num_UMax,'String', num2str(umax)) |
---|
1129 | end |
---|
1130 | if vmax<=vmin |
---|
1131 | vmin_old=vmin; |
---|
1132 | vmin=vmax; |
---|
1133 | vmax=vmin_old; |
---|
1134 | set(handles.num_VMin,'String', num2str(vmin)) |
---|
1135 | set(handles.num_VMax,'String', num2str(vmax)) |
---|
1136 | end |
---|
1137 | if ~(isempty(umin)||isempty(umax)||isempty(vmin)||isempty(vmax)) |
---|
1138 | % list_pair=get(handles.ListPairCiv1,'String');%get the menu of image pairs |
---|
1139 | % index=get(handles.ListPairCiv1,'Value'); |
---|
1140 | % pair_string=list_pair{index}; |
---|
1141 | % time=get(handles.TimeSource,'UserData'); %get the set of times |
---|
1142 | % pxcm=get(handles.SearchRange,'UserData'); |
---|
1143 | % mode_list=get(handles.ListPairMode,'String'); |
---|
1144 | % mode_value=get(handles.ListPairMode,'Value'); |
---|
1145 | % mode=mode_list{mode_value}; |
---|
1146 | % if isequal (mode, 'series(Di)' ) |
---|
1147 | % ref_i=str2double(get(handles.ref_i,'String')); |
---|
1148 | % num1=ref_i-floor(index/2);% first image numbers |
---|
1149 | % num2=ref_i+ceil(index/2); |
---|
1150 | % num_a=1; |
---|
1151 | % num_b=1; |
---|
1152 | % elseif isequal (mode, 'series(Dj)') |
---|
1153 | % num1=1; |
---|
1154 | % num2=1; |
---|
1155 | % ref_j=str2double(get(handles.ref_j,'String')); |
---|
1156 | % num_a=ref_j-floor(index/2);% first image numbers |
---|
1157 | % num_b=ref_j+ceil(index/2); |
---|
1158 | % elseif isequal(mode,'pair j1-j2') %case of bursts (png_old or png_2D) |
---|
1159 | % ref_i=str2double(get(handles.ref_i,'String')); |
---|
1160 | % num1=ref_i; |
---|
1161 | % num2=ref_i; |
---|
1162 | % r=regexp(pair_string,'(?<mode>(Di=)|(Dj=)) -*(?<num1>\d+)\|(?<num2>\d+)','names'); |
---|
1163 | % if isempty(r) |
---|
1164 | % r=regexp(pair_string,'(?<num1>\d+)(?<mode>-)(?<num2>\d+)','names'); |
---|
1165 | % end |
---|
1166 | % num_a=str2num(r.num1); |
---|
1167 | % num_b=str2num(r.num2); |
---|
1168 | % end |
---|
1169 | % dt=time(num2+1,num_b+1)-time(num1+1,num_a+1); |
---|
1170 | % ibx=str2double(get(handles.num_CorrBoxSize_1,'String')); |
---|
1171 | % iby=str2double(get(handles.num_CorrBoxSize_2,'String')); |
---|
1172 | % umin=dt*pxcm*umin; |
---|
1173 | % umax=dt*pxcm*umax; |
---|
1174 | % vmin=dt*pxcm*vmin; |
---|
1175 | % vmax=dt*pxcm*vmax; |
---|
1176 | shiftx=round((umin+umax)/2); |
---|
1177 | shifty=round((vmin+vmax)/2); |
---|
1178 | isx=(umax+2-shiftx)*2+param_civ1.CorrBoxSize(1); |
---|
1179 | isx=2*ceil(isx/2)+1; |
---|
1180 | isy=(vmax+2-shifty)*2+param_civ1.CorrBoxSize(2); |
---|
1181 | isy=2*ceil(isy/2)+1; |
---|
1182 | set(handles.num_SearchBoxShift_1,'String',num2str(shiftx)); |
---|
1183 | set(handles.num_SearchBoxShift_2,'String',num2str(shifty)); |
---|
1184 | set(handles.num_SearchBoxSize_1,'String',num2str(isx)); |
---|
1185 | set(handles.num_SearchBoxSize_2,'String',num2str(isy)); |
---|
1186 | end |
---|
1187 | |
---|
1188 | %------------------------------------------------------------------------ |
---|
1189 | % --- Executes on selection in menu CorrSmooth. |
---|
1190 | function num_CorrSmooth_Callback(hObject, eventdata, handles) |
---|
1191 | set(handles.configSource,'String','NEW') |
---|
1192 | set(handles.OK,'BackgroundColor',[1 0 1]) |
---|
1193 | %------------------------------------------------------------------------ |
---|
1194 | |
---|
1195 | % --- Executes on button press in CheckDeformation. |
---|
1196 | function CheckDeformation_Callback(hObject, eventdata, handles) |
---|
1197 | set(handles.ConfigSource,'String','NEW') |
---|
1198 | set(handles.OK,'BackgroundColor',[1 0 1]) |
---|
1199 | |
---|
1200 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1201 | % Callbacks in the uipanel Fix1 |
---|
1202 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1203 | %------------------------------------------------------------------------ |
---|
1204 | % % --- Executes on button press in CheckMask. |
---|
1205 | % function get_mask_fix1_Callback(hObject, eventdata, handles) |
---|
1206 | % %------------------------------------------------------------------------ |
---|
1207 | % maskval=get(handles.CheckMask,'Value'); |
---|
1208 | % if isequal(maskval,0) |
---|
1209 | % set(handles.Mask,'String','') |
---|
1210 | % else |
---|
1211 | % mask_displ='no mask'; %default |
---|
1212 | % filebase=get(handles.RootPath,'String'); |
---|
1213 | % [nbslice, flag_mask]=get_mask(filebase,handles); |
---|
1214 | % if isequal(flag_mask,1) |
---|
1215 | % mask_displ=[num2str(nbslice) 'mask']; |
---|
1216 | % elseif get(handles.ListCompareMode,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series |
---|
1217 | % filebase_a=get(handles.RootFile_1,'String'); |
---|
1218 | % [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); |
---|
1219 | % if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice) |
---|
1220 | % mask_displ='no mask'; |
---|
1221 | % end |
---|
1222 | % end |
---|
1223 | % if isequal(mask_displ,'no mask') |
---|
1224 | % [FileName, PathName, filterindex] = uigetfile( ... |
---|
1225 | % {'*.png', ' (*.png)'; |
---|
1226 | % '*.png', '.png files '; ... |
---|
1227 | % '*.*', 'All Files (*.*)'}, ... |
---|
1228 | % 'Pick a mask file *.png',filebase); |
---|
1229 | % mask_displ=fullfile(PathName,FileName); |
---|
1230 | % if ~exist(mask_displ,'file') |
---|
1231 | % mask_displ='no mask'; |
---|
1232 | % end |
---|
1233 | % end |
---|
1234 | % if isequal(mask_displ,'no mask') |
---|
1235 | % set(handles.CheckMask,'Value',0) |
---|
1236 | % set(handles.CheckMask,'Value',0) |
---|
1237 | % set(handles.CheckMask,'Value',0) |
---|
1238 | % else |
---|
1239 | % %set(handles.CheckMask,'Value',1) |
---|
1240 | % set(handles.CheckMask,'Value',1) |
---|
1241 | % end |
---|
1242 | % set(handles.Mask,'String',mask_displ) |
---|
1243 | % set(handles.Mask,'String',mask_displ) |
---|
1244 | % set(handles.Mask,'String',mask_displ) |
---|
1245 | % end |
---|
1246 | |
---|
1247 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1248 | % Callbacks in the uipanel Civ2 |
---|
1249 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1250 | %------------------------------------------------------------------------ |
---|
1251 | % --- Executes on button press in CheckMask: select box for mask option |
---|
1252 | function get_mask_civ2_Callback(hObject, eventdata, handles) |
---|
1253 | %------------------------------------------------------------------------ |
---|
1254 | maskval=get(handles.CheckMask,'Value'); |
---|
1255 | if isequal(maskval,0) |
---|
1256 | set(handles.Mask,'String','') |
---|
1257 | else |
---|
1258 | mask_displ='no mask'; %default |
---|
1259 | filebase=get(handles.RootPath,'String'); |
---|
1260 | [nbslice, flag_mask]=get_mask(filebase,handles); |
---|
1261 | if isequal(flag_mask,1) |
---|
1262 | mask_displ=[num2str(nbslice) 'mask']; |
---|
1263 | elseif get(handles.ListCompareMode,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series |
---|
1264 | filebase_a=get(handles.RootFile_1,'String'); |
---|
1265 | [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); |
---|
1266 | if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice) |
---|
1267 | mask_displ='no mask'; |
---|
1268 | end |
---|
1269 | end |
---|
1270 | if isequal(mask_displ,'no mask') |
---|
1271 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
1272 | {'*.png', ' (*.png)'; |
---|
1273 | '*.png', '.png files '; ... |
---|
1274 | '*.*', 'All Files (*.*)'}, ... |
---|
1275 | 'Pick a mask file *.png',filebase); |
---|
1276 | mask_displ=fullfile(PathName,FileName); |
---|
1277 | if ~exist(mask_displ,'file') |
---|
1278 | mask_displ='no mask'; |
---|
1279 | end |
---|
1280 | end |
---|
1281 | if isequal(mask_displ,'no mask') |
---|
1282 | set(handles.CheckMask,'Value',0) |
---|
1283 | set(handles.CheckMask,'Value',0) |
---|
1284 | else |
---|
1285 | set(handles.CheckMask,'Value',1) |
---|
1286 | end |
---|
1287 | set(handles.Mask,'String',mask_displ) |
---|
1288 | end |
---|
1289 | |
---|
1290 | % %------------------------------------------------------------------------ |
---|
1291 | % % --- Executes on button press in CheckMask. |
---|
1292 | % function get_mask_fix2_Callback(hObject, eventdata, handles) |
---|
1293 | % %------------------------------------------------------------------------ |
---|
1294 | % maskval=get(handles.CheckMask,'Value'); |
---|
1295 | % if isequal(maskval,0) |
---|
1296 | % set(handles.Mask,'String','') |
---|
1297 | % else |
---|
1298 | % mask_displ='no mask'; %default |
---|
1299 | % filebase=get(handles.RootPath,'String'); |
---|
1300 | % [nbslice, flag_mask]=get_mask(filebase,handles); |
---|
1301 | % if isequal(flag_mask,1) |
---|
1302 | % mask_displ=[num2str(nbslice) 'mask']; |
---|
1303 | % elseif get(handles.ListCompareMode,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series |
---|
1304 | % filebase_a=get(handles.RootFile_1,'String'); |
---|
1305 | % [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles); |
---|
1306 | % if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice) |
---|
1307 | % mask_displ='no mask'; |
---|
1308 | % end |
---|
1309 | % end |
---|
1310 | % if isequal(mask_displ,'no mask') |
---|
1311 | % [FileName, PathName, filterindex] = uigetfile( ... |
---|
1312 | % {'*.png', ' (*.png)'; |
---|
1313 | % '*.png', '.png files '; ... |
---|
1314 | % '*.*', 'All Files (*.*)'}, ... |
---|
1315 | % 'Pick a mask file *.png',filebase); |
---|
1316 | % mask_displ=fullfile(PathName,FileName); |
---|
1317 | % if ~exist(mask_displ,'file') |
---|
1318 | % mask_displ='no mask'; |
---|
1319 | % end |
---|
1320 | % end |
---|
1321 | % if isequal(mask_displ,'no mask') |
---|
1322 | % set(handles.CheckMask,'Value',0) |
---|
1323 | % end |
---|
1324 | % set(handles.Mask,'String',mask_displ) |
---|
1325 | % end |
---|
1326 | |
---|
1327 | %------------------------------------------------------------------------ |
---|
1328 | % --- function called to look for mask files |
---|
1329 | function [nbslice, flag_mask]=get_mask(filebase,handles) |
---|
1330 | %------------------------------------------------------------------------ |
---|
1331 | %detect mask files, images with appropriate file base |
---|
1332 | %[filebase '_' xx 'mask'], xx=nbslice |
---|
1333 | %flag_mask=1 indicates detection |
---|
1334 | |
---|
1335 | flag_mask=0;%default |
---|
1336 | nbslice=1; |
---|
1337 | |
---|
1338 | % subdir=get(handles.Civ1_ImageB,'String'); |
---|
1339 | [Path,Name]=fileparts(filebase); |
---|
1340 | if ~isdir(Path) |
---|
1341 | msgbox_uvmat('ERROR','no path for input files') |
---|
1342 | return |
---|
1343 | end |
---|
1344 | % currentdir=pwd; |
---|
1345 | % cd(Path);%move in the dir of the root name filebase |
---|
1346 | maskfiles=dir(fullfile(Path,[Name '_*mask_*.png']));%look for mask files |
---|
1347 | % cd(currentdir);%come back to the current working directory |
---|
1348 | if ~isempty(maskfiles) |
---|
1349 | % msgbox_uvmat('ERROR','no mask available, to create it use Tools/Make mask in the upper menu bar of uvmat') |
---|
1350 | % else |
---|
1351 | flag_mask=1; |
---|
1352 | maskname=maskfiles(1).name;% take the first mask file in the list |
---|
1353 | [Path2,Name,ext]=fileparts(maskname); |
---|
1354 | Namedouble=double(Name); |
---|
1355 | val=(48>Namedouble)|(Namedouble>57);% select the non-numerical characters |
---|
1356 | ind_mask=findstr('mask',Name); |
---|
1357 | i=ind_mask-1; |
---|
1358 | while val(i)==0 && i>0 |
---|
1359 | i=i-1; |
---|
1360 | end |
---|
1361 | nbslice=str2double(Name(i+1:ind_mask-1)); |
---|
1362 | if ~isnan(nbslice) && Name(i)=='_' |
---|
1363 | flag_mask=1; |
---|
1364 | else |
---|
1365 | msgbox_uvmat('ERROR',['bad mask file ' Name ext ' found in ' Path2]) |
---|
1366 | return |
---|
1367 | nbslice=1; |
---|
1368 | end |
---|
1369 | end |
---|
1370 | |
---|
1371 | %------------------------------------------------------------------------ |
---|
1372 | % --- function called to look for grid files |
---|
1373 | function [nbslice, flag_grid]=get_grid(filebase,handles) |
---|
1374 | %------------------------------------------------------------------------ |
---|
1375 | flag_grid=0;%default |
---|
1376 | nbslice=1; |
---|
1377 | [Path,Name]=fileparts(filebase); |
---|
1378 | currentdir=pwd; |
---|
1379 | cd(Path);%move in the dir of the root name filebase |
---|
1380 | gridfiles=dir([Name '_*grid_*.grid']);%look for grid files |
---|
1381 | cd(currentdir);%come back to the current working directory |
---|
1382 | if ~isempty(gridfiles) |
---|
1383 | flag_grid=1; |
---|
1384 | gridname=gridfiles(1).name;% take the first grid file in the list |
---|
1385 | [Path2,Name,ext]=fileparts(gridname); |
---|
1386 | Namedouble=double(Name); |
---|
1387 | val=(48>Namedouble)|(Namedouble>57);% select the non-numerical characters |
---|
1388 | ind_grid=findstr('grid',Name); |
---|
1389 | i=ind_grid-1; |
---|
1390 | while val(i)==0 && i>0 |
---|
1391 | i=i-1; |
---|
1392 | end |
---|
1393 | nbslice=str2double(Name(i+1:ind_grid-1)); |
---|
1394 | if ~isnan(nbslice) && Name(i)=='_' |
---|
1395 | flag_grid=1; |
---|
1396 | else |
---|
1397 | msgbox_uvmat('ERROR',['bad grid file ' Name ext ' found in ' Path2]) |
---|
1398 | return |
---|
1399 | nbslice=1; |
---|
1400 | end |
---|
1401 | end |
---|
1402 | |
---|
1403 | %------------------------------------------------------------------------ |
---|
1404 | % --- transform numbers to letters |
---|
1405 | function str=num2stra(num,nom_type) |
---|
1406 | %------------------------------------------------------------------------ |
---|
1407 | if isempty(nom_type) |
---|
1408 | str=''; |
---|
1409 | elseif strcmp(nom_type(end),'a') |
---|
1410 | str=char(96+num); |
---|
1411 | elseif strcmp(nom_type(end),'A') |
---|
1412 | str=char(96+num); |
---|
1413 | elseif isempty(nom_type(2:end))%a single index |
---|
1414 | str=''; |
---|
1415 | else |
---|
1416 | str=num2str(num); |
---|
1417 | end |
---|
1418 | |
---|
1419 | % %------------------------------------------------------------------------ |
---|
1420 | % % --- Executes on button press in ListSubdirCiv1. |
---|
1421 | % function ListSubdirCiv1_Callback(hObject, eventdata, handles) |
---|
1422 | % %------------------------------------------------------------------------ |
---|
1423 | % list_subdir_civ1=get(handles.ListSubdirCiv1,'String'); |
---|
1424 | % val=get(handles.ListSubdirCiv1,'Value'); |
---|
1425 | % SubDir=list_subdir_civ1{val}; |
---|
1426 | % if strcmp(SubDir,'new...') |
---|
1427 | % if get(handles.CheckCiv1,'Value') |
---|
1428 | % SubDir='STEREO_INPUT'; %default subdirectory |
---|
1429 | % else |
---|
1430 | % msgbox_uvmat('ERROR','select CheckCiv1 to perform a new stereo_input operation') |
---|
1431 | % return |
---|
1432 | % end |
---|
1433 | % end |
---|
1434 | % set(handles.Civ1_ImageB,'String',SubDir); |
---|
1435 | % errormsg=find_netcpair_civ(handles,1); |
---|
1436 | % if ~isempty(errormsg) |
---|
1437 | % msgbox_uvmat('ERROR',errormsg) |
---|
1438 | % end |
---|
1439 | % |
---|
1440 | %------------------------------------------------------------------------ |
---|
1441 | % % --- Executes on button press in ListSubdirCiv2. |
---|
1442 | % function ListSubdirCiv2_Callback(hObject, eventdata, handles) |
---|
1443 | % %------------------------------------------------------------------------ |
---|
1444 | % list_subdir_civ2=get(handles.ListSubdirCiv2,'String'); |
---|
1445 | % val=get(handles.ListSubdirCiv2,'Value'); |
---|
1446 | % SubDir=list_subdir_civ2{val}; |
---|
1447 | % if strcmp(SubDir,'new...') |
---|
1448 | % if get(handles.CheckCiv2,'Value') |
---|
1449 | % SubDir='STEREO_INPUT'; %default subdirectory |
---|
1450 | % else |
---|
1451 | % msgbox_uvmat('ERROR','select CheckCiv2 to perform a new stereo_input operation') |
---|
1452 | % return |
---|
1453 | % end |
---|
1454 | % end |
---|
1455 | % set(handles.Civ2_ImageA,'String',SubDir); |
---|
1456 | |
---|
1457 | %------------------------------------------------------------------------ |
---|
1458 | % --- Executes on button press in CheckGrid. |
---|
1459 | function CheckGrid_Callback(hObject, eventdata, handles) |
---|
1460 | %------------------------------------------------------------------------ |
---|
1461 | value=get(hObject,'Value'); |
---|
1462 | hparent=get(hObject,'parent');%handles of the parent panel |
---|
1463 | hchildren=get(hparent,'children'); |
---|
1464 | handle_txtbox=findobj(hchildren,'tag','Grid');% look for the grid name box in the same panel |
---|
1465 | handle_dx=findobj(hchildren,'tag','num_Dx'); |
---|
1466 | handle_dy=findobj(hchildren,'tag','num_Dy'); |
---|
1467 | handle_title_dx=findobj(hchildren,'tag','title_Dx'); |
---|
1468 | handle_title_dy=findobj(hchildren,'tag','title_Dy'); |
---|
1469 | testgrid=0; |
---|
1470 | filegrid=''; |
---|
1471 | if value |
---|
1472 | hseries=findobj(allchild(0),'Tag','series'); |
---|
1473 | hhseries=guidata(hseries); |
---|
1474 | InputTable=get(hhseries.InputTable,'Data'); |
---|
1475 | ind_A=1;% line index of the (first) image series |
---|
1476 | if strcmp(InputTable{1,5},'.nc'); |
---|
1477 | ind_A=2; |
---|
1478 | end |
---|
1479 | filebase=InputTable{ind_A,1}; |
---|
1480 | [nbslice, flag_grid]=get_grid(filebase,handles);% look for a grid with appropriate name |
---|
1481 | if isequal(flag_grid,1) |
---|
1482 | filegrid=[num2str(nbslice) 'grid']; |
---|
1483 | testgrid=1; |
---|
1484 | else % browse for a grid |
---|
1485 | filegrid=get(hObject,'UserData');%look for previous grid name stored as UserData |
---|
1486 | if exist(filegrid,'file') |
---|
1487 | filebase=filegrid; |
---|
1488 | end |
---|
1489 | filegrid = uigetfile_uvmat('pick a grid file .grid:',filebase,'.grid'); |
---|
1490 | set(hObject,'UserData',filegrid);%store for future use |
---|
1491 | if ~isempty(filegrid) |
---|
1492 | testgrid=1; |
---|
1493 | end |
---|
1494 | set(hObject,'UserData',filegrid);%store for future use |
---|
1495 | end |
---|
1496 | end |
---|
1497 | if testgrid |
---|
1498 | set(handle_dx,'Visible','off'); |
---|
1499 | set(handle_dy,'Visible','off'); |
---|
1500 | set(handle_title_dy,'Visible','off'); |
---|
1501 | set(handle_title_dx,'Visible','off'); |
---|
1502 | set(handle_txtbox,'Visible','on') |
---|
1503 | set(handle_txtbox,'String',filegrid) |
---|
1504 | else |
---|
1505 | set(hObject,'Value',0); |
---|
1506 | set(handle_dx,'Visible','on'); |
---|
1507 | set(handle_dy,'Visible','on'); |
---|
1508 | set(handle_title_dy,'Visible','on'); |
---|
1509 | set(handle_title_dx,'Visible','on'); |
---|
1510 | set(handle_txtbox,'Visible','off') |
---|
1511 | end |
---|
1512 | |
---|
1513 | %% if hObject is on the checkciv1 frame, duplicate action for checkciv2 frame |
---|
1514 | PanelName=get(hparent,'tag'); |
---|
1515 | if strcmp(PanelName,'Civ1') |
---|
1516 | hchildren=get(handles.Civ2,'children'); |
---|
1517 | handle_checkbox=findobj(hchildren,'tag','CheckGrid'); |
---|
1518 | handle_txtbox=findobj(hchildren,'tag','Grid'); |
---|
1519 | handle_dx=findobj(hchildren,'tag','num_Dx'); |
---|
1520 | handle_dy=findobj(hchildren,'tag','num_Dy'); |
---|
1521 | handle_title_dx=findobj(hchildren,'tag','title_Dx'); |
---|
1522 | handle_title_dy=findobj(hchildren,'tag','title_Dy'); |
---|
1523 | set(handle_checkbox,'UserData',filegrid);%store for future use |
---|
1524 | if testgrid |
---|
1525 | set(handle_checkbox,'Value',1); |
---|
1526 | set(handle_dx,'Visible','off'); |
---|
1527 | set(handle_dy,'Visible','off'); |
---|
1528 | set(handle_title_dx,'Visible','off'); |
---|
1529 | set(handle_title_dy,'Visible','off'); |
---|
1530 | set(handle_txtbox,'Visible','on') |
---|
1531 | set(handle_txtbox,'String',filegrid) |
---|
1532 | end |
---|
1533 | end |
---|
1534 | set(hObject,'BackgroundColor',[1 0 1]) |
---|
1535 | set(handles.configSource,'String','NEW') |
---|
1536 | set(handles.OK,'BackgroundColor',[1 0 1]) |
---|
1537 | %------------------------------------------------------------------------ |
---|
1538 | % --- Executes on button press in CheckMask: common to all panels (civ1, Civ2..) |
---|
1539 | function CheckMask_Callback(hObject, eventdata, handles) |
---|
1540 | %------------------------------------------------------------------------ |
---|
1541 | value=get(hObject,'Value'); |
---|
1542 | hparent=get(hObject,'parent'); |
---|
1543 | parent_tag=get(hparent,'Tag'); |
---|
1544 | hchildren=get(hparent,'children'); |
---|
1545 | handle_txtbox=findobj(hchildren,'tag','Mask');% look for the mask name box in the same panel |
---|
1546 | |
---|
1547 | testmask=0; |
---|
1548 | if value |
---|
1549 | hseries=findobj(allchild(0),'Tag','series'); |
---|
1550 | hhseries=guidata(hseries); |
---|
1551 | InputTable=get(hhseries.InputTable,'Data'); |
---|
1552 | ind_A=1;% line index of the (first) image series |
---|
1553 | if strcmp(InputTable{1,5},'.nc'); |
---|
1554 | ind_A=2; |
---|
1555 | end |
---|
1556 | [nbslice, flag_mask]=get_mask(InputTable{ind_A,1},handles);% look for a mask with appropriate name |
---|
1557 | if isequal(flag_mask,1) |
---|
1558 | filemask=[num2str(nbslice) 'mask']; |
---|
1559 | testmask=1; |
---|
1560 | else % browse for a mask |
---|
1561 | % filemask=get(hObject,'UserData');%look for previous mask name stored as UserData |
---|
1562 | % if exist(filemask,'file') |
---|
1563 | % filebase=filemask; |
---|
1564 | % end |
---|
1565 | filemask= uigetfile_uvmat('pick a mask image file:',InputTable{ind_A,1},'image'); |
---|
1566 | set(hObject,'UserData',filemask);%store for future use |
---|
1567 | if ~isempty(filemask) |
---|
1568 | testmask=1; |
---|
1569 | end |
---|
1570 | end |
---|
1571 | end |
---|
1572 | if testmask |
---|
1573 | set(handles.Mask,'Visible','on') |
---|
1574 | set(handles.Mask,'String',filemask) |
---|
1575 | set(handles.CheckMask,'Value',1) |
---|
1576 | else |
---|
1577 | set(hObject,'Value',0); |
---|
1578 | set(handle_txtbox,'Visible','off') |
---|
1579 | end |
---|
1580 | set(handles.configSource,'String','NEW') |
---|
1581 | set(handles.configSource,'BackgroundColor',[1 0 1]) |
---|
1582 | |
---|
1583 | % %------------------------------------------------------------------------ |
---|
1584 | % % --- Executes on button press in get_gridpatch1. |
---|
1585 | % function get_gridpatch1_Callback(hObject, eventdata, handles) |
---|
1586 | % %------------------------------------------------------------------------ |
---|
1587 | % filebase=get(handles.RootPath,'String'); |
---|
1588 | % [FileName, PathName, filterindex] = uigetfile( ... |
---|
1589 | % {'*.grid', ' (*.grid)'; |
---|
1590 | % '*.grid', '.grid files '; ... |
---|
1591 | % '*.*', 'All Files (*.*)'}, ... |
---|
1592 | % 'Pick a file',filebase); |
---|
1593 | % filegrid=fullfile(PathName,FileName); |
---|
1594 | % set(handles.grid_patch1,'string',filegrid); |
---|
1595 | % set(hObject,'BackgroundColor',[1 0 1]) |
---|
1596 | |
---|
1597 | %------------------------------------------------------------------------ |
---|
1598 | % --- STEREO Interp |
---|
1599 | 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) |
---|
1600 | %------------------------------------------------------------------------ |
---|
1601 | namelog=[filename_nc(1:end-3) '_stinterp.log']; |
---|
1602 | cmd=[stinterpBin ' -f1 ' filename_A_nc ' -f2 ' filename_B_nc ' -f ' filename_nc ... |
---|
1603 | ' -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 |
---|
1604 | |
---|
1605 | % %------------------------------------------------------------------------ |
---|
1606 | % %--read images and convert them to the uint16 format used for PIV |
---|
1607 | % function A=read_image(filename,type_ima,num,movieobject) |
---|
1608 | % %------------------------------------------------------------------------ |
---|
1609 | % %num is the view number needed for an avi movie |
---|
1610 | % switch type_ima |
---|
1611 | % case 'movie' |
---|
1612 | % A=read(movieobject,num); |
---|
1613 | % case 'avi' |
---|
1614 | % mov=aviread(filename,num); |
---|
1615 | % A=frame2im(mov(1)); |
---|
1616 | % case 'multimage' |
---|
1617 | % A=imread(filename,num); |
---|
1618 | % case 'image' |
---|
1619 | % A=imread(filename); |
---|
1620 | % end |
---|
1621 | % siz=size(A); |
---|
1622 | % if length(siz)==3;%color images |
---|
1623 | % A=sum(double(A),3); |
---|
1624 | % A=uint16(A); |
---|
1625 | % end |
---|
1626 | |
---|
1627 | |
---|
1628 | %------------------------------------------------------------------------ |
---|
1629 | % --- Executes on button press in get_ref_fix1. |
---|
1630 | function get_ref_fix1_Callback(hObject, eventdata, handles) |
---|
1631 | %------------------------------------------------------------------------ |
---|
1632 | filebase=get(handles.RootPath,'String'); |
---|
1633 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
1634 | {'*.nc', ' (*.nc)'; |
---|
1635 | '*.nc', 'netcdf files '; ... |
---|
1636 | '*.*', 'All Files (*.*)'}, ... |
---|
1637 | 'Pick a file',filebase); |
---|
1638 | |
---|
1639 | fileinput=[PathName FileName]; |
---|
1640 | sizf=size(fileinput); |
---|
1641 | if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end %stop if fileinput not a character string |
---|
1642 | %[Path,File,field_count,str2,str_a,str_b,ref.ext,ref.nom_type,ref.subdir]=name2display(fileinput); |
---|
1643 | [Path,ref.subdir,File,ref.num1,ref.num2,ref.num_a,ref.num_b,ref.ext,ref.nom_type]=fileparts_uvmat(fileinput); |
---|
1644 | ref.filebase=fullfile(Path,File); |
---|
1645 | % ref.num_a=stra2num(str_a); |
---|
1646 | % ref.num_b=stra2num(str_b); |
---|
1647 | % ref.num1=str2double(field_count); |
---|
1648 | % ref.num2=str2double(str2); |
---|
1649 | browse=[];%initialisation |
---|
1650 | if ~isequal(ref.ext,'.nc') |
---|
1651 | msgbox_uvmat('ERROR','the reference file must be in netcdf format (*.nc)') |
---|
1652 | return |
---|
1653 | end |
---|
1654 | set(handles.ref_fix1,'String',[fullfile(ref.subdir,File) '....nc']); |
---|
1655 | set(handles.ref_fix1,'UserData',ref) |
---|
1656 | menu_field{1}='civ1'; |
---|
1657 | Data=nc2struct(fileinput,[]); |
---|
1658 | if isfield(Data,'patch') && isequal(Data.patch,1) |
---|
1659 | menu_field{2}='filter1'; |
---|
1660 | end |
---|
1661 | if isfield(Data,'civ2') && isequal(Data.civ2,1) |
---|
1662 | menu_field{3}='civ2'; |
---|
1663 | end |
---|
1664 | if isfield(Data,'patch2') && isequal(Data.patch2,1) |
---|
1665 | menu_field{4}='filter2'; |
---|
1666 | end |
---|
1667 | set(handles.field_ref1,'String',menu_field); |
---|
1668 | set(handles.field_ref1,'Value',length(menu_field)); |
---|
1669 | set(handles.num_MinVel,'Value',2); |
---|
1670 | set(handles.num_MinVel,'String','1');%default threshold |
---|
1671 | set(handles.ref_fix1,'Enable','on') |
---|
1672 | |
---|
1673 | %------------------------------------------------------------------------ |
---|
1674 | % --- Executes on button press in get_ref_fix2. |
---|
1675 | function get_ref_fix2_Callback(hObject, eventdata, handles) |
---|
1676 | %------------------------------------------------------------------------ |
---|
1677 | if isequal(get(handles.get_ref_fix2,'Value'),1) |
---|
1678 | filebase=get(handles.RootPath,'String'); |
---|
1679 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
1680 | {'*.nc', ' (*.nc)'; |
---|
1681 | '*.nc', 'netcdf files '; ... |
---|
1682 | '*.*', 'All Files (*.*)'}, ... |
---|
1683 | 'Pick a file',filebase); |
---|
1684 | fileinput=[PathName FileName]; |
---|
1685 | sizf=size(fileinput); |
---|
1686 | if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end %stop if fileinput not a character string |
---|
1687 | %[Path,File,field_count,str2,str_a,str_b,ref.ext,ref.nom_type,ref.subdir]=name2display(fileinput); |
---|
1688 | [Path,ref.subdir,File,ref.num1,ref.num2,ref.num_a,ref.num_b,ref.ext,ref.nom_type]=fileparts_uvmat(fileinput); |
---|
1689 | ref.filebase=fullfile(Path,File); |
---|
1690 | % ref.num_a=stra2num(str_a); |
---|
1691 | % ref.num_b=stra2num(str_b); |
---|
1692 | % ref.num1=str2num(field_count); |
---|
1693 | % ref.num2=str2num(str2); |
---|
1694 | browse=[];%initialisation |
---|
1695 | if ~isequal(ref.ext,'.nc') |
---|
1696 | msgbox_uvmat('ERROR','the reference file must be in netcdf format (*.nc)') |
---|
1697 | return |
---|
1698 | end |
---|
1699 | set(handles.ref_fix2,'String',[fullfile(ref.subdir,File) '....nc']); |
---|
1700 | set(handles.ref_fix2,'UserData',ref) |
---|
1701 | menu_field{1}='civ1'; |
---|
1702 | Data=nc2struct(fileinput,[]); |
---|
1703 | if isfield(Data,'patch') && isequal(Data.patch,1) |
---|
1704 | menu_field{2}='filter1'; |
---|
1705 | end |
---|
1706 | if isfield(Data,'civ2') && isequal(Data.civ2,1) |
---|
1707 | menu_field{3}='civ2'; |
---|
1708 | end |
---|
1709 | if isfield(Data,'patch2') && isequal(Data.patch2,1) |
---|
1710 | menu_field{4}='filter2'; |
---|
1711 | end |
---|
1712 | set(handles.field_ref2,'String',menu_field); |
---|
1713 | set(handles.field_ref2,'Value',length(menu_field)); |
---|
1714 | set(handles.num_MinVel,'Value',2); |
---|
1715 | set(handles.num_MinVel,'String','1');%default threshold |
---|
1716 | set(handles.ref_fix2,'Enable','on') |
---|
1717 | set(handles.ref_fix2,'Visible','on') |
---|
1718 | set(handles.field_ref2,'Visible','on') |
---|
1719 | else |
---|
1720 | set(handles.ref_fix2,'Visible','off') |
---|
1721 | set(handles.field_ref2,'Visible','off') |
---|
1722 | end |
---|
1723 | |
---|
1724 | %------------------------------------------------------------------------ |
---|
1725 | function ref_fix1_Callback(hObject, eventdata, handles) |
---|
1726 | %------------------------------------------------------------------------ |
---|
1727 | set(handles.num_MinVel,'Value',1); |
---|
1728 | set(handles.field_ref1,'Value',1) |
---|
1729 | set(handles.field_ref1,'String',{' '}) |
---|
1730 | set(handles.ref_fix1,'UserData',[]); |
---|
1731 | set(handles.ref_fix1,'String',''); |
---|
1732 | set(handles.thresh_vel1,'String','0'); |
---|
1733 | |
---|
1734 | %------------------------------------------------------------------------ |
---|
1735 | function ref_fix2_Callback(hObject, eventdata, handles) |
---|
1736 | %------------------------------------------------------------------------ |
---|
1737 | set(handles.num_MinVel,'Value',1); |
---|
1738 | set(handles.field_ref2,'Value',1) |
---|
1739 | set(handles.field_ref2,'String',{' '}) |
---|
1740 | set(handles.ref_fix2,'UserData',[]); |
---|
1741 | set(handles.ref_fix2,'String',''); |
---|
1742 | set(handles.num_MinVel,'String','0'); |
---|
1743 | |
---|
1744 | %------------------------------------------------------------------------ |
---|
1745 | % --- TO ABANDON Executes on button press in test_stereo1. |
---|
1746 | function CheckStereo_Callback(hObject, eventdata, handles) |
---|
1747 | %------------------------------------------------------------------------ |
---|
1748 | hparent=get(hObject,'parent'); |
---|
1749 | parent_tag=get(hparent,'Tag'); |
---|
1750 | hchildren=get(hparent,'children'); |
---|
1751 | handle_txtbox=findobj(hchildren,'tag','txt_Mask'); |
---|
1752 | if isequal(get(hObject,'Value'),0) |
---|
1753 | set(handles.num_SubDomainSize,'Visible','on') |
---|
1754 | set(handles.num_FieldSmooth,'Visible','on') |
---|
1755 | else |
---|
1756 | set(handles.num_SubDomainSize,'Visible','off') |
---|
1757 | set(handles.num_FieldSmooth,'Visible','off') |
---|
1758 | end |
---|
1759 | |
---|
1760 | % %------------------------------------------------------------------------ |
---|
1761 | % % --- Executes on button press in CheckStereo. |
---|
1762 | % function StereoCheck_Callback(hObject, eventdata, handles) |
---|
1763 | % %------------------------------------------------------------------------ |
---|
1764 | % if isequal(get(handles.CheckStereo,'Value'),0) |
---|
1765 | % set(handles.num_subdomainsize,'Visible','on') |
---|
1766 | % set(handles.num_FieldSmooth,'Visible','on') |
---|
1767 | % else |
---|
1768 | |
---|
1769 | % set(handles.num_subdomainsize,'Visible','off') |
---|
1770 | % set(handles.num_FieldSmooth,'Visible','off') |
---|
1771 | % end |
---|
1772 | |
---|
1773 | |
---|
1774 | |
---|
1775 | %------------------------------------------------------------------------ |
---|
1776 | %----function introduced for the correlation window figure, activated by deleting this window |
---|
1777 | function closeview_field(gcbo,eventdata) |
---|
1778 | %------------------------------------------------------------------------ |
---|
1779 | hview_field=findobj(allchild(0),'tag','view_field');% look for view_field |
---|
1780 | if ~isempty(hview_field) |
---|
1781 | delete(hview_field) |
---|
1782 | end |
---|
1783 | |
---|
1784 | %------------------------------------------------------------------------ |
---|
1785 | % --- Executes on button press in CheckThreshold. |
---|
1786 | function CheckThreshold_Callback(hObject, eventdata, handles) |
---|
1787 | %------------------------------------------------------------------------ |
---|
1788 | huipanel=get(hObject,'parent'); |
---|
1789 | obj(1)=findobj(huipanel,'Tag','num_MinIma'); |
---|
1790 | obj(2)=findobj(huipanel,'Tag','num_MaxIma'); |
---|
1791 | obj(3)=findobj(huipanel,'Tag','title_Threshold'); |
---|
1792 | if get(hObject,'Value') |
---|
1793 | set(obj,'Visible','on') |
---|
1794 | else |
---|
1795 | set(obj,'Visible','off') |
---|
1796 | end |
---|
1797 | set(handles.configSource,'String','NEW') |
---|
1798 | set(handles.OK,'BackgroundColor',[1 0 1]) |
---|
1799 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1800 | %%%%%%%%%%%%%% TEST functions |
---|
1801 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1802 | %------------------------------------------------------------------------ |
---|
1803 | % --- Executes on button press in TestCiv1: prepare the image correlation function |
---|
1804 | % activated by mouse motion |
---|
1805 | function TestCiv1_Callback(hObject, eventdata, handles) |
---|
1806 | %------------------------------------------------------------------------ |
---|
1807 | drawnow |
---|
1808 | if get(handles.TestCiv1,'Value') |
---|
1809 | set(handles.TestCiv1,'BackgroundColor',[1 1 0])% paint TestCiv1 button to yellow to confirm civ launch |
---|
1810 | %Param.Action.RUN=1; |
---|
1811 | |
---|
1812 | hseries=findobj(allchild(0),'Tag','series'); |
---|
1813 | Param=read_GUI(hseries); |
---|
1814 | Param.Action.RUN=1; |
---|
1815 | Param.ActionInput=read_GUI(handles.civ_input); |
---|
1816 | if isfield(Param.ActionInput,'Fix1') |
---|
1817 | Param.ActionInput=rmfield(Param.ActionInput,'Fix1'); |
---|
1818 | end |
---|
1819 | if isfield(Param.ActionInput,'Patch1') |
---|
1820 | Param.ActionInput=rmfield(Param.ActionInput,'Patch1'); |
---|
1821 | end |
---|
1822 | if isfield(Param.ActionInput,'Civ2')%remove options that may be selected beyond Patch1 |
---|
1823 | Param.ActionInput=rmfield(Param.ActionInput,'Civ2'); |
---|
1824 | end |
---|
1825 | if isfield(Param.ActionInput,'Fix2') |
---|
1826 | Param.ActionInput=rmfield(Param.ActionInput,'Fix2'); |
---|
1827 | end |
---|
1828 | if isfield(Param.ActionInput,'Patch2') |
---|
1829 | Param.ActionInput=rmfield(Param.ActionInput,'Patch2'); |
---|
1830 | end |
---|
1831 | if isfield(Param,'OutputSubDir') |
---|
1832 | Param=rmfield(Param,'OutputSubDir'); %remove output file option from civ_series |
---|
1833 | end |
---|
1834 | Param.ActionInput.Civ1.CorrSmooth=0;% launch Civ1 with no data point (to get the image names for A and B) |
---|
1835 | [Data,errormsg]=civ_series(Param);% get the civ1+fix1 results |
---|
1836 | if ~isempty(errormsg), return, end % rmq: error msg displayed in civ_series |
---|
1837 | |
---|
1838 | %% create image data ImageData for display |
---|
1839 | ImageData.ListVarName={'ny','nx','A'}; |
---|
1840 | ImageData.VarDimName= {'ny','nx',{'ny','nx'}}; |
---|
1841 | ImageData.A=imread(Data.Civ1_ImageA); % read the first image |
---|
1842 | if ndims(ImageData.A)==3 %case of color image |
---|
1843 | ImageData.VarDimName= {'ny','nx',{'ny','nx','rgb'}}; |
---|
1844 | end |
---|
1845 | ImageData.ny=[size(ImageData.A,1) 1]; |
---|
1846 | ImageData.nx=[1 size(ImageData.A,2)]; |
---|
1847 | ImageData.CoordUnit='pixel';% used to set equal scaling for x and y in image dispa=ly |
---|
1848 | |
---|
1849 | %% create the figure view_field for image visualization |
---|
1850 | hview_field=view_field(ImageData); %view the image in the GUI view_field |
---|
1851 | set(0,'CurrentFigure',hview_field) |
---|
1852 | hhview_field=guihandles(hview_field); |
---|
1853 | set(hview_field,'CurrentAxes',hhview_field.PlotAxes) |
---|
1854 | ViewData=get(hview_field,'UserData'); |
---|
1855 | ViewData.CivHandle=handles.civ_input;% indicate the handle of the civ GUI in view_field |
---|
1856 | ViewData.PlotAxes.X=Data.Civ1_X'; |
---|
1857 | ViewData.PlotAxes.Y=Data.Civ1_Y'; |
---|
1858 | ViewData.PlotAxes.B=imread(Data.Civ1_ImageB);%store the second image in the UserData of the GUI view_field |
---|
1859 | set(hview_field,'UserData',ViewData)% store the info in the UserData of image view_field |
---|
1860 | |
---|
1861 | %% look for a current figure for image correlation display |
---|
1862 | corrfig=findobj(allchild(0),'tag','corrfig'); |
---|
1863 | if isempty(corrfig) |
---|
1864 | corrfig=figure; |
---|
1865 | set(corrfig,'tag','corrfig') |
---|
1866 | set(corrfig,'name','image correlation') |
---|
1867 | set(corrfig,'DeleteFcn',{@closeview_field})% |
---|
1868 | set(handles.TestCiv1,'BackgroundColor',[1 0 0]) |
---|
1869 | else |
---|
1870 | set(handles.TestCiv1,'BackgroundColor',[1 0 0])% paint button to red |
---|
1871 | corrfig=findobj(allchild(0),'tag','corrfig');% look for a current figure for image correlation display |
---|
1872 | if ~isempty(corrfig) |
---|
1873 | delete(corrfig) |
---|
1874 | end |
---|
1875 | hview_field=findobj(allchild(0),'tag','view_field');% look for view_field |
---|
1876 | if ~isempty(hview_field) |
---|
1877 | delete(hview_field) |
---|
1878 | end |
---|
1879 | end |
---|
1880 | else |
---|
1881 | hview_field=findobj(allchild(0),'Tag','view_field'); %view the image in the GUI view_field |
---|
1882 | if ~isempty(hview_field) |
---|
1883 | delete(hview_field) |
---|
1884 | end |
---|
1885 | end |
---|
1886 | |
---|
1887 | % -------------------------------------------------------------------- |
---|
1888 | % --- Executes on button press in TestPatch1. |
---|
1889 | % -------------------------------------------------------------------- |
---|
1890 | function TestPatch1_Callback(hObject, eventdata, handles) |
---|
1891 | |
---|
1892 | if get(handles.TestPatch1,'Value')% if TestPatch1 is activated |
---|
1893 | set(handles.TestPatch1,'BackgroundColor',[1 1 0])%paint TestPatch1 button in yellow to indicate activation |
---|
1894 | set(handles.Civ1,'BackgroundColor',[1 1 0])% indicate civ1 calculation is performed |
---|
1895 | hseries=findobj(allchild(0),'Tag','series'); |
---|
1896 | Param=read_GUI(hseries); |
---|
1897 | Param.Action.RUN=1; |
---|
1898 | Param.ActionInput=read_GUI(handles.civ_input); |
---|
1899 | if isfield(Param.ActionInput,'Civ2')%remove options that may be selected beyond Patch1 |
---|
1900 | Param.ActionInput=rmfield(Param.ActionInput,'Civ2'); |
---|
1901 | end |
---|
1902 | if isfield(Param.ActionInput,'Fix2') |
---|
1903 | Param.ActionInput=rmfield(Param.ActionInput,'Fix2'); |
---|
1904 | end |
---|
1905 | if isfield(Param.ActionInput,'Patch2') |
---|
1906 | Param.ActionInput=rmfield(Param.ActionInput,'Patch2'); |
---|
1907 | end |
---|
1908 | if isfield(Param,'OutputSubDir') |
---|
1909 | Param=rmfield(Param,'OutputSubDir'); %remove output file option from civ_series |
---|
1910 | end |
---|
1911 | ParamPatch1=Param.ActionInput.Patch1; %store the patch1 parameters |
---|
1912 | Param.ActionInput=rmfield(Param.ActionInput,'Patch1');% does not execute Patch |
---|
1913 | [Data,errormsg]=civ_series(Param);% get the civ1+fix1 results |
---|
1914 | bckcolor=get(handles.civ_input,'Color'); |
---|
1915 | set(handles.Civ1,'BackgroundColor',bckcolor)% indicate civ1 calculation is finished |
---|
1916 | |
---|
1917 | %% prepare Param for iterative Patch processing without input file reading |
---|
1918 | Param.Civ1_X=Data.Civ1_X; |
---|
1919 | Param.Civ1_Y=Data.Civ1_Y; |
---|
1920 | Param.Civ1_U=Data.Civ1_U; |
---|
1921 | Param.Civ1_V=Data.Civ1_V; |
---|
1922 | Param.Civ1_FF=Data.Civ1_FF; |
---|
1923 | Param=rmfield(Param,'InputTable');%desactivate input file reading |
---|
1924 | if isfield(Param.ActionInput,'Civ1') |
---|
1925 | Param.ActionInput=rmfield(Param.ActionInput,'Civ1');%desactivate civ1: remove civ1 input param if relevant |
---|
1926 | end |
---|
1927 | if isfield(Param.ActionInput,'Fix1') |
---|
1928 | Param.ActionInput=rmfield(Param.ActionInput,'Fix1');%desactivate fix1:remove fix1 input param if relevant |
---|
1929 | end |
---|
1930 | SmoothingParam=(ParamPatch1.FieldSmooth/10)*2.^(1:7);%scan the smoothing param from 1/10 to 12.8 current value |
---|
1931 | NbGood=numel(find(Data.Civ1_FF==0)); |
---|
1932 | NbExclude=zeros(1,7);% initialize the set of smoothing parameters |
---|
1933 | DiffVel=zeros(1,7);% initialize the rms difference between patch and civ |
---|
1934 | Param.ActionInput.Patch1=ParamPatch1;% retrieve Patch1 parameters |
---|
1935 | for irho=1:7 |
---|
1936 | Param.ActionInput.Patch1.FieldSmooth=SmoothingParam(irho); |
---|
1937 | [Data,errormsg]= civ_series(Param);%apply the processing fct |
---|
1938 | if ~isempty(errormsg) |
---|
1939 | msgbox_uvmat('ERROR',errormsg) |
---|
1940 | return |
---|
1941 | end |
---|
1942 | ind_good=find(Data.Civ1_FF==0); |
---|
1943 | Civ1_U_Diff=Data.Civ1_U(ind_good)-Data.Civ1_U_smooth(ind_good); |
---|
1944 | Civ1_V_Diff=Data.Civ1_V(ind_good)-Data.Civ1_V_smooth(ind_good); |
---|
1945 | DiffVel(irho)=sqrt(mean(Civ1_U_Diff.*Civ1_U_Diff+Civ1_V_Diff.*Civ1_V_Diff)); |
---|
1946 | NbExclude(irho)=(NbGood-numel(ind_good))/NbGood; |
---|
1947 | end |
---|
1948 | figure(1) |
---|
1949 | hold on |
---|
1950 | semilogx(SmoothingParam,DiffVel,'b',SmoothingParam,NbExclude,'r') |
---|
1951 | grid on |
---|
1952 | legend('rms velocity diff. Patch1-Civ1 (pixels)','proportion of excluded vectors (between 0 to 1)') |
---|
1953 | xlabel('smoothing parameter') |
---|
1954 | ylabel('smoothing effect') |
---|
1955 | set(handles.TestPatch1,'BackgroundColor',[0 1 0]) |
---|
1956 | else |
---|
1957 | corrfig=findobj(allchild(0),'tag','corrfig');% look for a current figure for image correlation display |
---|
1958 | if ~isempty(corrfig) |
---|
1959 | delete(corrfig) |
---|
1960 | end |
---|
1961 | hview_field=findobj(allchild(0),'tag','view_field');% look for view_field |
---|
1962 | if ~isempty(hview_field) |
---|
1963 | delete(hview_field) |
---|
1964 | end |
---|
1965 | end |
---|
1966 | |
---|
1967 | %------------------------------------------------------------------------ |
---|
1968 | % --- Executes on button press in TestCiv2. |
---|
1969 | %------------------------------------------------------------------------ |
---|
1970 | function TestCiv2_Callback(hObject, eventdata, handles) |
---|
1971 | drawnow |
---|
1972 | if get(handles.TestCiv2,'Value') |
---|
1973 | set(handles.TestCiv2,'BackgroundColor',[1 1 0])% paint TestCiv1 button to yellow to confirm civ launch |
---|
1974 | hseries=findobj(allchild(0),'Tag','series'); |
---|
1975 | Param=read_GUI(hseries); |
---|
1976 | Param.Action.RUN=1; |
---|
1977 | Param.ActionInput=read_GUI(handles.civ_input); |
---|
1978 | if isfield(Param,'OutputSubDir') |
---|
1979 | Param=rmfield(Param,'OutputSubDir'); %remove output file option from civ_series |
---|
1980 | end |
---|
1981 | Param.ActionInput.Civ2.CorrSmooth=0;% launch Civ2 with no data point (to get the image names for A and B) |
---|
1982 | set(handles.Civ1,'BackgroundColor',[1 1 0]) |
---|
1983 | set(handles.Fix1,'BackgroundColor',[1 1 0]) |
---|
1984 | set(handles.Patch1,'BackgroundColor',[1 1 0]) |
---|
1985 | [Data,errormsg]=civ_series(Param);% get the civ1+fix1 results |
---|
1986 | |
---|
1987 | %% create image data ImageData for display |
---|
1988 | ImageData.ListVarName={'ny','nx','A'}; |
---|
1989 | ImageData.VarDimName= {'ny','nx',{'ny','nx'}}; |
---|
1990 | ImageData.A=imread(Data.Civ2_ImageA); % read the first image |
---|
1991 | if ndims(ImageData.A)==3 %case of color image |
---|
1992 | ImageData.VarDimName= {'ny','nx',{'ny','nx','rgb'}}; |
---|
1993 | end |
---|
1994 | ImageData.ny=[size(ImageData.A,1) 1]; |
---|
1995 | ImageData.nx=[1 size(ImageData.A,2)]; |
---|
1996 | ImageData.CoordUnit='pixel';% used to set equal scaling for x and y in image dispa=ly |
---|
1997 | |
---|
1998 | %% create the figure view_field for image visualization |
---|
1999 | hview_field=view_field(ImageData); %view the image in the GUI view_field |
---|
2000 | set(0,'CurrentFigure',hview_field) |
---|
2001 | % plot the boundaries of the subdomains used for patch |
---|
2002 | for isub=1:size(Data.Civ1_SubRange,3); |
---|
2003 | pos_x=Data.Civ1_SubRange(1,1,isub); |
---|
2004 | pos_y=Data.Civ1_SubRange(2,1,isub); |
---|
2005 | width=Data.Civ1_SubRange(1,2,isub)-Data.Civ1_SubRange(1,1,isub); |
---|
2006 | height=Data.Civ1_SubRange(2,2,isub)-Data.Civ1_SubRange(2,1,isub); |
---|
2007 | rectangle('Position',[pos_x pos_y width height],'EdgeColor',[0 0 1]) |
---|
2008 | end |
---|
2009 | hhview_field=guihandles(hview_field);% |
---|
2010 | set(hview_field,'CurrentAxes',hhview_field.PlotAxes) |
---|
2011 | ViewData=get(hview_field,'UserData'); % get the currently plotted field (the image A) |
---|
2012 | % store info in the UserData of view-field |
---|
2013 | ViewData.CivHandle=handles.civ_input;% indicate the handle of the civ GUI in view_field |
---|
2014 | ViewData.PlotAxes.B=imread(Data.Civ2_ImageB);%store the second image in the UserData of the GUI view_field |
---|
2015 | ViewData.PlotAxes.X=Data.Civ2_X'; |
---|
2016 | ViewData.PlotAxes.Y=Data.Civ2_Y'; |
---|
2017 | ViewData.PlotAxes.ShiftX=Data.Civ2_U';% shift at each point (from patch1) estimated by the preliminary run of civ2 |
---|
2018 | ViewData.PlotAxes.ShiftY=Data.Civ2_V'; |
---|
2019 | ViewData.PlotAxes.Civ1_SubRange=Data.Civ1_SubRange; |
---|
2020 | ViewData.PlotAxes.Civ1_NbCentres=Data.Civ1_NbCentres; |
---|
2021 | ViewData.PlotAxes.Civ1_Coord_tps=Data.Civ1_Coord_tps; |
---|
2022 | ViewData.PlotAxes.Civ1_U_tps=Data.Civ1_U_tps; |
---|
2023 | ViewData.PlotAxes.Civ1_V_tps=Data.Civ1_V_tps; |
---|
2024 | ViewData.PlotAxes.Civ1_Dt=Data.Civ1_Dt; |
---|
2025 | ViewData.PlotAxes.Civ2_Dt=Data.Civ2_Dt; |
---|
2026 | set(hview_field,'UserData',ViewData)% store the info in the UserData of image view_field |
---|
2027 | bckcolor=get(handles.civ_input,'Color'); |
---|
2028 | set(handles.Civ1,'BackgroundColor',bckcolor)% indicate civ1 calmculation is finished |
---|
2029 | set(handles.Fix1,'BackgroundColor',bckcolor) |
---|
2030 | set(handles.Patch1,'BackgroundColor',bckcolor) |
---|
2031 | drawnow |
---|
2032 | |
---|
2033 | %% look for a current figure for image correlation display |
---|
2034 | corrfig=findobj(allchild(0),'tag','corrfig'); |
---|
2035 | if isempty(corrfig) |
---|
2036 | corrfig=figure; |
---|
2037 | set(corrfig,'tag','corrfig') |
---|
2038 | set(corrfig,'name','image correlation') |
---|
2039 | set(corrfig,'DeleteFcn',{@closeview_field})% |
---|
2040 | set(handles.TestCiv1,'BackgroundColor',[1 0 0]) |
---|
2041 | else |
---|
2042 | set(handles.TestCiv1,'BackgroundColor',[1 0 0])% paint button to red |
---|
2043 | corrfig=findobj(allchild(0),'tag','corrfig');% look for a current figure for image correlation display |
---|
2044 | if ~isempty(corrfig) |
---|
2045 | delete(corrfig) |
---|
2046 | end |
---|
2047 | hview_field=findobj(allchild(0),'tag','view_field');% look for view_field |
---|
2048 | if ~isempty(hview_field) |
---|
2049 | delete(hview_field) |
---|
2050 | end |
---|
2051 | end |
---|
2052 | else |
---|
2053 | hview_field=findobj(allchild(0),'Tag','view_field'); %view the image in the GUI view_field |
---|
2054 | if ~isempty(hview_field) |
---|
2055 | delete(hview_field) |
---|
2056 | end |
---|
2057 | end |
---|
2058 | |
---|
2059 | |
---|
2060 | % --- Executes on button press in TestPatch2. |
---|
2061 | function TestPatch2_Callback(hObject, eventdata, handles) |
---|
2062 | if get(handles.TestPatch2,'Value')% if TestPatch2 is activated |
---|
2063 | set(handles.TestPatch2,'BackgroundColor',[1 1 0])%paint TestPatch2 button in yellow to indicate activation |
---|
2064 | set(handles.Civ1,'BackgroundColor',[1 1 0])% indicate civ1 calculation is activated |
---|
2065 | set(handles.Fix1,'BackgroundColor',[1 1 0])% indicate fix1 calculation is activated |
---|
2066 | set(handles.Patch1,'BackgroundColor',[1 1 0])% indicate Patch1 calculation is activated |
---|
2067 | set(handles.Civ2,'BackgroundColor',[1 1 0])% indicate civ2 calculation is activated |
---|
2068 | set(handles.Fix2,'BackgroundColor',[1 1 0])% indicate fix2 calculation is activated |
---|
2069 | hseries=findobj(allchild(0),'Tag','series'); |
---|
2070 | Param=read_GUI(hseries); |
---|
2071 | Param.Action.RUN=1; |
---|
2072 | Param.ActionInput=read_GUI(handles.civ_input); |
---|
2073 | if isfield(Param,'OutputSubDir') |
---|
2074 | Param=rmfield(Param,'OutputSubDir'); %remove output file option from civ_series |
---|
2075 | end |
---|
2076 | ParamPatch2=Param.ActionInput.Patch2; %store the patch1 parameters |
---|
2077 | Param.ActionInput=rmfield(Param.ActionInput,'Patch2');% does not execute Patch |
---|
2078 | [Data,errormsg]=civ_series(Param);% get the civ1+fix1 results |
---|
2079 | bckcolor=get(handles.civ_input,'Color'); |
---|
2080 | set(handles.Civ1,'BackgroundColor',bckcolor)% indicate civ1 calculation is finished |
---|
2081 | set(handles.Fix1,'BackgroundColor',bckcolor)% indicate fix1 calculation is finished |
---|
2082 | set(handles.Patch1,'BackgroundColor',bckcolor)% indicate Patch1 calculation is finished |
---|
2083 | set(handles.Civ2,'BackgroundColor',bckcolor)% indicate civ2 calculation is finished |
---|
2084 | set(handles.Fix2,'BackgroundColor',bckcolor)% indicate fix2 calculation is finished |
---|
2085 | |
---|
2086 | %% prepare Param for iterative Patch processing without input file reading |
---|
2087 | Param.Civ2_X=Data.Civ2_X; |
---|
2088 | Param.Civ2_Y=Data.Civ2_Y; |
---|
2089 | Param.Civ2_U=Data.Civ2_U; |
---|
2090 | Param.Civ2_V=Data.Civ2_V; |
---|
2091 | Param.Civ2_FF=Data.Civ2_FF; |
---|
2092 | Param=rmfield(Param,'InputTable');%desactivate input file reading |
---|
2093 | if isfield(Param.ActionInput,'Civ1') |
---|
2094 | Param.ActionInput=rmfield(Param.ActionInput,'Civ1');%desactivate civ1: remove civ1 input param if relevant |
---|
2095 | end |
---|
2096 | if isfield(Param.ActionInput,'Fix1') |
---|
2097 | Param.ActionInput=rmfield(Param.ActionInput,'Fix1');%desactivate fix1:remove fix1 input param if relevant |
---|
2098 | end |
---|
2099 | if isfield(Param.ActionInput,'Patch1') |
---|
2100 | Param.ActionInput=rmfield(Param.ActionInput,'Patch1');%desactivate fix1:remove fix1 input param if relevant |
---|
2101 | end |
---|
2102 | if isfield(Param.ActionInput,'Civ2') |
---|
2103 | Param.ActionInput=rmfield(Param.ActionInput,'Civ2');%desactivate civ2: remove civ2 input param if relevant |
---|
2104 | end |
---|
2105 | if isfield(Param.ActionInput,'Fix2') |
---|
2106 | Param.ActionInput=rmfield(Param.ActionInput,'Fix2');%desactivate fix1:remove fix1 input param if relevant |
---|
2107 | end |
---|
2108 | SmoothingParam=(ParamPatch2.FieldSmooth/10)*2.^(1:7);%scan the smoothing param from 1/10 to 12.8 current value |
---|
2109 | NbGood=numel(find(Data.Civ2_FF==0)); |
---|
2110 | NbExclude=zeros(1,7);% initialize the set of smoothing parameters |
---|
2111 | DiffVel=zeros(1,7);% initialize the rms difference between patch and civ |
---|
2112 | Param.ActionInput.Patch2=ParamPatch2;% retrieve Patch2 parameters |
---|
2113 | for irho=1:7 |
---|
2114 | Param.ActionInput.Patch2.FieldSmooth=SmoothingParam(irho); |
---|
2115 | [Data,errormsg]= civ_series(Param);%apply the processing fct |
---|
2116 | if ~isempty(errormsg) |
---|
2117 | msgbox_uvmat('ERROR',errormsg) |
---|
2118 | return |
---|
2119 | end |
---|
2120 | ind_good=find(Data.Civ2_FF==0); |
---|
2121 | Civ2_U_Diff=Data.Civ2_U(ind_good)-Data.Civ2_U_smooth(ind_good); |
---|
2122 | Civ2_V_Diff=Data.Civ2_V(ind_good)-Data.Civ2_V_smooth(ind_good); |
---|
2123 | DiffVel(irho)=sqrt(mean(Civ2_U_Diff.*Civ2_U_Diff+Civ2_V_Diff.*Civ2_V_Diff)); |
---|
2124 | NbExclude(irho)=(NbGood-numel(ind_good))/NbGood; |
---|
2125 | end |
---|
2126 | figure(1) |
---|
2127 | hold on |
---|
2128 | semilogx(SmoothingParam,DiffVel,'b',SmoothingParam,NbExclude,'r') |
---|
2129 | grid on |
---|
2130 | legend('rms velocity diff. Patch2-Civ2 (pixels)','proportion of excluded vectors (between 0 to 1)') |
---|
2131 | xlabel('smoothing parameter') |
---|
2132 | ylabel('smoothing effect') |
---|
2133 | set(handles.TestPatch2,'BackgroundColor',[0 1 0]) |
---|
2134 | else |
---|
2135 | corrfig=findobj(allchild(0),'tag','corrfig');% look for a current figure for image correlation display |
---|
2136 | if ~isempty(corrfig) |
---|
2137 | delete(corrfig) |
---|
2138 | end |
---|
2139 | hview_field=findobj(allchild(0),'tag','view_field');% look for view_field |
---|
2140 | if ~isempty(hview_field) |
---|
2141 | delete(hview_field) |
---|
2142 | end |
---|
2143 | end |
---|
2144 | |
---|
2145 | |
---|
2146 | %'nomtype2pair': creates nomencalture for index pairs knowing the image nomenclature |
---|
2147 | %--------------------------------------------------------------------- |
---|
2148 | function NomTypeNc=nomtype2pair(NomTypeIma,mode) |
---|
2149 | %--------------------------------------------------------------------- |
---|
2150 | % OUTPUT: |
---|
2151 | % NomTypeNc |
---|
2152 | %--------------------------------------------------------------------- |
---|
2153 | % INPUT: |
---|
2154 | % 'NomTypeIma': string defining the kind of nomenclature used for images |
---|
2155 | |
---|
2156 | NomTypeNc=NomTypeIma;%default |
---|
2157 | switch mode |
---|
2158 | case 'pair j1-j2' |
---|
2159 | if ~isempty(regexp(NomTypeIma,'a$')) |
---|
2160 | NomTypeNc=[NomTypeIma 'b']; |
---|
2161 | elseif ~isempty(regexp(NomTypeIma,'A$')) |
---|
2162 | NomTypeNc=[NomTypeIma 'B']; |
---|
2163 | else |
---|
2164 | r=regexp(NomTypeIma,'(?<num1>\d+)_(?<num2>\d+)$','names'); |
---|
2165 | if ~isempty(r) |
---|
2166 | NomTypeNc='_1_1-2'; |
---|
2167 | end |
---|
2168 | end |
---|
2169 | case 'series(Dj)' |
---|
2170 | % r=regexp(NomTypeIma,'(?<num1>\d+)_(?<num2>\d+)$','names'); |
---|
2171 | % if ~isempty(r) |
---|
2172 | NomTypeNc='_1_1-2'; |
---|
2173 | % end |
---|
2174 | case 'series(Di)' |
---|
2175 | r=regexp(NomTypeIma,'(?<num1>\d+)_(?<num2>\d+)$','names'); |
---|
2176 | if ~isempty(r) |
---|
2177 | NomTypeNc='_1-2_1'; |
---|
2178 | else |
---|
2179 | NomTypeNc='_1-2'; |
---|
2180 | end |
---|
2181 | end |
---|
2182 | |
---|
2183 | |
---|
2184 | %------------------------------------------------------------------------ |
---|
2185 | % --- determine the list of index pairs of processing file |
---|
2186 | function [ind1,ind2,mode]=... |
---|
2187 | find_pair_indices(str_civ,i_series,j_series,MinIndex_i,MaxIndex_i,MinIndex_j,MaxIndex_j) |
---|
2188 | %------------------------------------------------------------------------ |
---|
2189 | ind1=''; |
---|
2190 | ind2=''; |
---|
2191 | r=regexp(str_civ,'^\D(?<ind>[i|j])=( -| )(?<num1>\d+)\|(?<num2>\d+)','names'); |
---|
2192 | if ~isempty(r) |
---|
2193 | mode=['D' r.ind]; |
---|
2194 | ind1=stra2num(r.num1); |
---|
2195 | ind2=stra2num(r.num2); |
---|
2196 | else |
---|
2197 | mode='burst'; |
---|
2198 | r=regexp(str_civ,'^j= (?<num1>[a-z])-(?<num2>[a-z])','names'); |
---|
2199 | if ~isempty(r) |
---|
2200 | NomTypeNc='_1ab'; |
---|
2201 | else |
---|
2202 | r=regexp(str_civ,'^j= (?<num1>[A-Z])-(?<num2>[A-Z])','names'); |
---|
2203 | if ~isempty(r) |
---|
2204 | NomTypeNc='_1AB'; |
---|
2205 | else |
---|
2206 | r=regexp(str_civ,'^j= (?<num1>\d+)-(?<num2>\d+)','names'); |
---|
2207 | if ~isempty(r) |
---|
2208 | NomTypeNc='_1_1-2'; |
---|
2209 | end |
---|
2210 | end |
---|
2211 | end |
---|
2212 | if isempty(r) |
---|
2213 | display('wrong pair mode input option') |
---|
2214 | else |
---|
2215 | ind1=stra2num(r.num1); |
---|
2216 | ind2=stra2num(r.num2); |
---|
2217 | end |
---|
2218 | end |
---|
2219 | |
---|
2220 | %------------------------------------------------------------------------ |
---|
2221 | % --- fill stereo_input with the parameters retrieved from an input Civ file |
---|
2222 | %------------------------------------------------------------------------ |
---|
2223 | function fill_civ_input(Data,handles) |
---|
2224 | |
---|
2225 | %% Civ param |
---|
2226 | % lists of parameters to enter |
---|
2227 | ListParamNum={'CorrBoxSize','SearchBoxSize','SearchBoxShift','Dx','Dy','Dz','MinIma','MaxIma'};% list of numerical values (to transform in strings) |
---|
2228 | ListParamValue={'CorrSmooth','CheckGrid','CheckMask','CheckThreshold'}; |
---|
2229 | ListParamString={'Grid','Mask'}; |
---|
2230 | % CorrSmooth ?? |
---|
2231 | option={'Civ1','Civ2'}; |
---|
2232 | for ichoice=1:2 |
---|
2233 | if isfield(Data,[option{ichoice} '_CorrBoxSize']) |
---|
2234 | fill_panel(Data,handles,option{ichoice},ListParamNum,ListParamValue,ListParamString) |
---|
2235 | end |
---|
2236 | end |
---|
2237 | |
---|
2238 | %% Fix param |
---|
2239 | option={'Fix1','Fix2'}; |
---|
2240 | for ichoice=1:2 |
---|
2241 | if isfield(Data,[option{ichoice} '_CheckFmin2']) |
---|
2242 | ListParamNum={'MinVel','MaxVel','MinCorr'};% list of numerical values (to transform in strings) |
---|
2243 | ListParamValue={'CheckFmin2','CheckF3','CheckF4'}; |
---|
2244 | ListParamString={'ref_fix_1'}; |
---|
2245 | fill_panel(Data,handles,option{ichoice},ListParamNum,ListParamValue,ListParamString) |
---|
2246 | end |
---|
2247 | end |
---|
2248 | |
---|
2249 | %% Patch param |
---|
2250 | option={'Patch1','Patch2'}; |
---|
2251 | for ichoice=1:2 |
---|
2252 | if isfield(Data,[option{ichoice} '_FieldSmooth']) |
---|
2253 | ListParamNum={'FieldSmooth','MaxDiff','SubDomainSize'};% list of numerical values (to transform in strings) |
---|
2254 | ListParamValue={}; |
---|
2255 | ListParamString={}; |
---|
2256 | fill_panel(Data,handles,option{ichoice},ListParamNum,ListParamValue,ListParamString) |
---|
2257 | end |
---|
2258 | end |
---|
2259 | %------------------------------------------------------------------------ |
---|
2260 | % --- fill a panel of stereo_input with the parameters retrieved from an input Civ file |
---|
2261 | %------------------------------------------------------------------------ |
---|
2262 | function fill_panel(Data,handles,panel,ListParamNum,ListParamValue,ListParamString) |
---|
2263 | children=get(handles.(panel),'children');%handles of the children of the input GUI with handle 'GUI_handle' |
---|
2264 | handles_panel=[]; |
---|
2265 | for ichild=1:numel(children) |
---|
2266 | if ~isempty(get(children(ichild),'tag')) |
---|
2267 | handles_panel.(get(children(ichild),'tag'))=children(ichild); |
---|
2268 | end |
---|
2269 | end |
---|
2270 | for ilist=1:numel(ListParamNum) |
---|
2271 | ParamName=ListParamNum{ilist}; |
---|
2272 | CivParamName=[panel '_' ParamName]; |
---|
2273 | if isfield(Data,CivParamName) |
---|
2274 | for icoord=1:numel(Data.(CivParamName)) |
---|
2275 | if numel(Data.(CivParamName))>1 |
---|
2276 | Tag=['num_' ParamName '_' num2str(icoord)]; |
---|
2277 | else |
---|
2278 | Tag=['num_' ParamName]; |
---|
2279 | end |
---|
2280 | if isfield(handles_panel,Tag) |
---|
2281 | set(handles_panel.(Tag),'String',num2str(Data.(CivParamName)(icoord))) |
---|
2282 | set(handles_panel.(Tag),'Visible','on') |
---|
2283 | end |
---|
2284 | end |
---|
2285 | end |
---|
2286 | end |
---|
2287 | for ilist=1:numel(ListParamValue) |
---|
2288 | ParamName=ListParamValue{ilist}; |
---|
2289 | CivParamName=[panel '_' ParamName]; |
---|
2290 | if strcmp(ParamName,'CorrSmooth') |
---|
2291 | ParamName=['num_' ParamName]; |
---|
2292 | end |
---|
2293 | if isfield(Data,CivParamName) |
---|
2294 | if isfield(handles_panel,ParamName) |
---|
2295 | set(handles_panel.(ParamName),'Value',Data.(CivParamName)) |
---|
2296 | end |
---|
2297 | end |
---|
2298 | end |
---|
2299 | for ilist=1:numel(ListParamString) |
---|
2300 | ParamName=ListParamString{ilist}; |
---|
2301 | CivParamName=[panel '_' ParamName]; |
---|
2302 | if isfield(Data,CivParamName) |
---|
2303 | if isfield(handles_panel,ParamName) |
---|
2304 | set(handles_panel.(ParamName),'String',Data.(CivParamName)) |
---|
2305 | end |
---|
2306 | end |
---|
2307 | end |
---|
2308 | |
---|
2309 | %------------------------------------------------------------------------ |
---|
2310 | % --- Executes on button press in ImportParam. |
---|
2311 | %------------------------------------------------------------------------ |
---|
2312 | function ImportParam_Callback(hObject, eventdata, handles) |
---|
2313 | hseries=findobj(allchild(0),'Tag','series'); |
---|
2314 | hhseries=guidata(hseries); |
---|
2315 | InputTable=get(hhseries.InputTable,'Data');% read the input file(s) table in the GUI series |
---|
2316 | oldfile=InputTable{1,1}; |
---|
2317 | if isempty(oldfile) |
---|
2318 | % use a file name stored in prefdir |
---|
2319 | dir_perso=prefdir; |
---|
2320 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); |
---|
2321 | if exist(profil_perso,'file') |
---|
2322 | h=load (profil_perso); |
---|
2323 | if isfield(h,'RootPath') && ischar(h.RootPath) |
---|
2324 | oldfile=h.RootPath; |
---|
2325 | end |
---|
2326 | end |
---|
2327 | end |
---|
2328 | filexml=uigetfile_uvmat('pick a xml parameter file for civ',oldfile,'.xml');% get the xml file containing processing parameters |
---|
2329 | %proceed only if a file has been introduced by the browser |
---|
2330 | if ~isempty(filexml) |
---|
2331 | Param=xml2struct(filexml);% read the input xml file as a Matlab structure |
---|
2332 | |
---|
2333 | % Param.Action.RUN=0; %desactivate the input RUN=1 |
---|
2334 | if ~isfield(Param,'InputTable')||~isfield(Param,'IndexRange') |
---|
2335 | msgbox_uvmat('ERROR','invalid config file: open a file in a folder ''/0_XML''') |
---|
2336 | return |
---|
2337 | end |
---|
2338 | check_input=0; |
---|
2339 | if isfield(Param,'ActionInput') |
---|
2340 | if isfield(Param.ActionInput,'Program')&& strcmp(Param.ActionInput.Program,'stereo_civ') |
---|
2341 | fill_GUI(Param.ActionInput,handles.civ_input)% fill the elements of the GUI series with the input parameters |
---|
2342 | set(handles.ConfigSource,'String',filexml) |
---|
2343 | check_input=1; |
---|
2344 | update_CivOptions(handles,0) |
---|
2345 | end |
---|
2346 | end |
---|
2347 | if ~check_input |
---|
2348 | msgbox_uvmat('ERROR','invalid config file (not for civ_series') |
---|
2349 | return |
---|
2350 | end |
---|
2351 | end |
---|
2352 | |
---|
2353 | |
---|
2354 | %------------------------------------------------------------------------ |
---|
2355 | % --- Executes on key press with selection of a uicontrol |
---|
2356 | %------------------------------------------------------------------------ |
---|
2357 | function keyboard_callback(hObject,eventdata,handles) |
---|
2358 | |
---|
2359 | ListExclude={'CheckCiv1','CheckFix1','CheckPatch1','CheckCiv2','CheckFix2','CheckPatch2','ref_i'}; |
---|
2360 | if isempty(find(strcmp(get(gco,'Tag'),ListExclude),1))% if the selected uicontrol is not in the Exclude list |
---|
2361 | set(handles.ConfigSource,'String','NEW')% indicate that the configuration is new |
---|
2362 | set(handles.OK,'BackgroundColor',[1 0 1])% |
---|
2363 | drawnow |
---|
2364 | end |
---|
2365 | |
---|
2366 | |
---|
2367 | |
---|
2368 | function num_FieldSmooth_Callback(hObject, eventdata, handles) |
---|
2369 | % hObject handle to num_FieldSmooth (see GCBO) |
---|
2370 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2371 | % handles structure with handles and user data (see GUIDATA) |
---|
2372 | |
---|
2373 | % Hints: get(hObject,'String') returns contents of num_FieldSmooth as text |
---|
2374 | % str2double(get(hObject,'String')) returns contents of num_FieldSmooth as a double |
---|
2375 | |
---|
2376 | |
---|
2377 | % --- Executes during object creation, after setting all properties. |
---|
2378 | function num_FieldSmooth_CreateFcn(hObject, eventdata, handles) |
---|
2379 | % hObject handle to num_FieldSmooth (see GCBO) |
---|
2380 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2381 | % handles empty - handles not created until after all CreateFcns called |
---|
2382 | |
---|
2383 | % Hint: edit controls usually have a white background on Windows. |
---|
2384 | % See ISPC and COMPUTER. |
---|
2385 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
2386 | set(hObject,'BackgroundColor','white'); |
---|
2387 | end |
---|
2388 | |
---|
2389 | |
---|
2390 | |
---|
2391 | function num_MaxDiff_Callback(hObject, eventdata, handles) |
---|
2392 | % hObject handle to num_MaxDiff (see GCBO) |
---|
2393 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2394 | % handles structure with handles and user data (see GUIDATA) |
---|
2395 | |
---|
2396 | % Hints: get(hObject,'String') returns contents of num_MaxDiff as text |
---|
2397 | % str2double(get(hObject,'String')) returns contents of num_MaxDiff as a double |
---|
2398 | |
---|
2399 | |
---|
2400 | % --- Executes during object creation, after setting all properties. |
---|
2401 | function num_MaxDiff_CreateFcn(hObject, eventdata, handles) |
---|
2402 | % hObject handle to num_MaxDiff (see GCBO) |
---|
2403 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2404 | % handles empty - handles not created until after all CreateFcns called |
---|
2405 | |
---|
2406 | % Hint: edit controls usually have a white background on Windows. |
---|
2407 | % See ISPC and COMPUTER. |
---|
2408 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
2409 | set(hObject,'BackgroundColor','white'); |
---|
2410 | end |
---|
2411 | |
---|
2412 | |
---|
2413 | |
---|
2414 | function num_SubDomainSize_Callback(hObject, eventdata, handles) |
---|
2415 | % hObject handle to num_SubDomainSize (see GCBO) |
---|
2416 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2417 | % handles structure with handles and user data (see GUIDATA) |
---|
2418 | |
---|
2419 | % Hints: get(hObject,'String') returns contents of num_SubDomainSize as text |
---|
2420 | % str2double(get(hObject,'String')) returns contents of num_SubDomainSize as a double |
---|
2421 | |
---|
2422 | |
---|
2423 | % --- Executes during object creation, after setting all properties. |
---|
2424 | function num_SubDomainSize_CreateFcn(hObject, eventdata, handles) |
---|
2425 | % hObject handle to num_SubDomainSize (see GCBO) |
---|
2426 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2427 | % handles empty - handles not created until after all CreateFcns called |
---|
2428 | |
---|
2429 | % Hint: edit controls usually have a white background on Windows. |
---|
2430 | % See ISPC and COMPUTER. |
---|
2431 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
2432 | set(hObject,'BackgroundColor','white'); |
---|
2433 | end |
---|
2434 | |
---|
2435 | |
---|
2436 | |
---|
2437 | function num_Nx_Callback(hObject, eventdata, handles) |
---|
2438 | % hObject handle to num_Nx (see GCBO) |
---|
2439 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2440 | % handles structure with handles and user data (see GUIDATA) |
---|
2441 | |
---|
2442 | % Hints: get(hObject,'String') returns contents of num_Nx as text |
---|
2443 | % str2double(get(hObject,'String')) returns contents of num_Nx as a double |
---|
2444 | |
---|
2445 | |
---|
2446 | % --- Executes during object creation, after setting all properties. |
---|
2447 | function num_Nx_CreateFcn(hObject, eventdata, handles) |
---|
2448 | % hObject handle to num_Nx (see GCBO) |
---|
2449 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2450 | % handles empty - handles not created until after all CreateFcns called |
---|
2451 | |
---|
2452 | % Hint: edit controls usually have a white background on Windows. |
---|
2453 | % See ISPC and COMPUTER. |
---|
2454 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
2455 | set(hObject,'BackgroundColor','white'); |
---|
2456 | end |
---|
2457 | |
---|
2458 | |
---|
2459 | |
---|
2460 | function num_Ny_Callback(hObject, eventdata, handles) |
---|
2461 | % hObject handle to num_Ny (see GCBO) |
---|
2462 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2463 | % handles structure with handles and user data (see GUIDATA) |
---|
2464 | |
---|
2465 | % Hints: get(hObject,'String') returns contents of num_Ny as text |
---|
2466 | % str2double(get(hObject,'String')) returns contents of num_Ny as a double |
---|
2467 | |
---|
2468 | |
---|
2469 | % --- Executes during object creation, after setting all properties. |
---|
2470 | function num_Ny_CreateFcn(hObject, eventdata, handles) |
---|
2471 | % hObject handle to num_Ny (see GCBO) |
---|
2472 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2473 | % handles empty - handles not created until after all CreateFcns called |
---|
2474 | |
---|
2475 | % Hint: edit controls usually have a white background on Windows. |
---|
2476 | % See ISPC and COMPUTER. |
---|
2477 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
2478 | set(hObject,'BackgroundColor','white'); |
---|
2479 | end |
---|
2480 | |
---|
2481 | |
---|
2482 | % --- Executes on button press in TestPatch2. |
---|
2483 | function togglebutton8_Callback(hObject, eventdata, handles) |
---|
2484 | % hObject handle to TestPatch2 (see GCBO) |
---|
2485 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2486 | % handles structure with handles and user data (see GUIDATA) |
---|
2487 | |
---|
2488 | % Hint: get(hObject,'Value') returns toggle state of TestPatch2 |
---|
2489 | |
---|
2490 | |
---|
2491 | % % --- Executes on button press in CheckPatch3. |
---|
2492 | % function CheckPatch3_Callback(hObject, eventdata, handles) |
---|
2493 | % % hObject handle to CheckPatch3 (see GCBO) |
---|
2494 | % % eventdata reserved - to be defined in a future version of MATLAB |
---|
2495 | % % handles structure with handles and user data (see GUIDATA) |
---|
2496 | % |
---|
2497 | % % Hint: get(hObject,'Value') returns toggle state of CheckPatch3 |
---|
2498 | |
---|
2499 | |
---|
2500 | % --- Executes on button press in CheckFmin2. |
---|
2501 | function CheckFmin2_Callback(hObject, eventdata, handles) |
---|
2502 | % hObject handle to CheckFmin2 (see GCBO) |
---|
2503 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2504 | % handles structure with handles and user data (see GUIDATA) |
---|
2505 | |
---|
2506 | % Hint: get(hObject,'Value') returns toggle state of CheckFmin2 |
---|
2507 | |
---|
2508 | |
---|
2509 | % --- Executes on button press in CheckF4. |
---|
2510 | function CheckF4_Callback(hObject, eventdata, handles) |
---|
2511 | % hObject handle to CheckF4 (see GCBO) |
---|
2512 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2513 | % handles structure with handles and user data (see GUIDATA) |
---|
2514 | |
---|
2515 | % Hint: get(hObject,'Value') returns toggle state of CheckF4 |
---|
2516 | |
---|
2517 | |
---|
2518 | % --- Executes on button press in CheckF3. |
---|
2519 | function CheckF3_Callback(hObject, eventdata, handles) |
---|
2520 | % hObject handle to CheckF3 (see GCBO) |
---|
2521 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2522 | % handles structure with handles and user data (see GUIDATA) |
---|
2523 | |
---|
2524 | % Hint: get(hObject,'Value') returns toggle state of CheckF3 |
---|
2525 | |
---|
2526 | |
---|
2527 | % --- Executes on button press in get_ref_fix2. |
---|
2528 | function checkbox56_Callback(hObject, eventdata, handles) |
---|
2529 | % hObject handle to get_ref_fix2 (see GCBO) |
---|
2530 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2531 | % handles structure with handles and user data (see GUIDATA) |
---|
2532 | |
---|
2533 | % Hint: get(hObject,'Value') returns toggle state of get_ref_fix2 |
---|
2534 | |
---|
2535 | |
---|
2536 | |
---|
2537 | function edit123_Callback(hObject, eventdata, handles) |
---|
2538 | % hObject handle to ref_fix2 (see GCBO) |
---|
2539 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2540 | % handles structure with handles and user data (see GUIDATA) |
---|
2541 | |
---|
2542 | % Hints: get(hObject,'String') returns contents of ref_fix2 as text |
---|
2543 | % str2double(get(hObject,'String')) returns contents of ref_fix2 as a double |
---|
2544 | |
---|
2545 | |
---|
2546 | % --- Executes during object creation, after setting all properties. |
---|
2547 | function ref_fix2_CreateFcn(hObject, eventdata, handles) |
---|
2548 | % hObject handle to ref_fix2 (see GCBO) |
---|
2549 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2550 | % handles empty - handles not created until after all CreateFcns called |
---|
2551 | |
---|
2552 | % Hint: edit controls usually have a white background on Windows. |
---|
2553 | % See ISPC and COMPUTER. |
---|
2554 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
2555 | set(hObject,'BackgroundColor','white'); |
---|
2556 | end |
---|
2557 | |
---|
2558 | |
---|
2559 | |
---|
2560 | function num_MaxVel_Callback(hObject, eventdata, handles) |
---|
2561 | % hObject handle to num_MaxVel (see GCBO) |
---|
2562 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2563 | % handles structure with handles and user data (see GUIDATA) |
---|
2564 | |
---|
2565 | % Hints: get(hObject,'String') returns contents of num_MaxVel as text |
---|
2566 | % str2double(get(hObject,'String')) returns contents of num_MaxVel as a double |
---|
2567 | |
---|
2568 | |
---|
2569 | % --- Executes during object creation, after setting all properties. |
---|
2570 | function num_MaxVel_CreateFcn(hObject, eventdata, handles) |
---|
2571 | % hObject handle to num_MaxVel (see GCBO) |
---|
2572 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2573 | % handles empty - handles not created until after all CreateFcns called |
---|
2574 | |
---|
2575 | % Hint: edit controls usually have a white background on Windows. |
---|
2576 | % See ISPC and COMPUTER. |
---|
2577 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
2578 | set(hObject,'BackgroundColor','white'); |
---|
2579 | end |
---|
2580 | |
---|
2581 | |
---|
2582 | |
---|
2583 | function num_MinVel_Callback(hObject, eventdata, handles) |
---|
2584 | % hObject handle to num_MinVel (see GCBO) |
---|
2585 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2586 | % handles structure with handles and user data (see GUIDATA) |
---|
2587 | |
---|
2588 | % Hints: get(hObject,'String') returns contents of num_MinVel as text |
---|
2589 | % str2double(get(hObject,'String')) returns contents of num_MinVel as a double |
---|
2590 | |
---|
2591 | |
---|
2592 | % --- Executes during object creation, after setting all properties. |
---|
2593 | function num_MinVel_CreateFcn(hObject, eventdata, handles) |
---|
2594 | % hObject handle to num_MinVel (see GCBO) |
---|
2595 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2596 | % handles empty - handles not created until after all CreateFcns called |
---|
2597 | |
---|
2598 | % Hint: edit controls usually have a white background on Windows. |
---|
2599 | % See ISPC and COMPUTER. |
---|
2600 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
2601 | set(hObject,'BackgroundColor','white'); |
---|
2602 | end |
---|
2603 | |
---|
2604 | |
---|
2605 | |
---|
2606 | function num_MinCorr_Callback(hObject, eventdata, handles) |
---|
2607 | % hObject handle to num_MinCorr (see GCBO) |
---|
2608 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2609 | % handles structure with handles and user data (see GUIDATA) |
---|
2610 | |
---|
2611 | % Hints: get(hObject,'String') returns contents of num_MinCorr as text |
---|
2612 | % str2double(get(hObject,'String')) returns contents of num_MinCorr as a double |
---|
2613 | |
---|
2614 | |
---|
2615 | % --- Executes during object creation, after setting all properties. |
---|
2616 | function num_MinCorr_CreateFcn(hObject, eventdata, handles) |
---|
2617 | % hObject handle to num_MinCorr (see GCBO) |
---|
2618 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2619 | % handles empty - handles not created until after all CreateFcns called |
---|
2620 | |
---|
2621 | % Hint: edit controls usually have a white background on Windows. |
---|
2622 | % See ISPC and COMPUTER. |
---|
2623 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
2624 | set(hObject,'BackgroundColor','white'); |
---|
2625 | end |
---|
2626 | |
---|
2627 | |
---|
2628 | % --- Executes on selection change in field_ref2. |
---|
2629 | function field_ref2_Callback(hObject, eventdata, handles) |
---|
2630 | % hObject handle to field_ref2 (see GCBO) |
---|
2631 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2632 | % handles structure with handles and user data (see GUIDATA) |
---|
2633 | |
---|
2634 | % Hints: contents = cellstr(get(hObject,'String')) returns field_ref2 contents as cell array |
---|
2635 | % contents{get(hObject,'Value')} returns selected item from field_ref2 |
---|
2636 | |
---|
2637 | |
---|
2638 | % --- Executes during object creation, after setting all properties. |
---|
2639 | function field_ref2_CreateFcn(hObject, eventdata, handles) |
---|
2640 | % hObject handle to field_ref2 (see GCBO) |
---|
2641 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2642 | % handles empty - handles not created until after all CreateFcns called |
---|
2643 | |
---|
2644 | % Hint: popupmenu controls usually have a white background on Windows. |
---|
2645 | % See ISPC and COMPUTER. |
---|
2646 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
2647 | set(hObject,'BackgroundColor','white'); |
---|
2648 | end |
---|
2649 | |
---|
2650 | % |
---|
2651 | % % --- Executes on button press in CheckFix3. |
---|
2652 | % function CheckFix3_Callback(hObject, eventdata, handles) |
---|
2653 | % % hObject handle to CheckFix3 (see GCBO) |
---|
2654 | % % eventdata reserved - to be defined in a future version of MATLAB |
---|
2655 | % % handles structure with handles and user data (see GUIDATA) |
---|
2656 | % |
---|
2657 | % % Hint: get(hObject,'Value') returns toggle state of CheckFix3 |
---|
2658 | % |
---|
2659 | |
---|
2660 | |
---|
2661 | function num_CorrBoxSize_1_Callback(hObject, eventdata, handles) |
---|
2662 | % hObject handle to num_CorrBoxSize_1 (see GCBO) |
---|
2663 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2664 | % handles structure with handles and user data (see GUIDATA) |
---|
2665 | |
---|
2666 | % Hints: get(hObject,'String') returns contents of num_CorrBoxSize_1 as text |
---|
2667 | % str2double(get(hObject,'String')) returns contents of num_CorrBoxSize_1 as a double |
---|
2668 | |
---|
2669 | |
---|
2670 | % --- Executes during object creation, after setting all properties. |
---|
2671 | function num_CorrBoxSize_1_CreateFcn(hObject, eventdata, handles) |
---|
2672 | % hObject handle to num_CorrBoxSize_1 (see GCBO) |
---|
2673 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2674 | % handles empty - handles not created until after all CreateFcns called |
---|
2675 | |
---|
2676 | % Hint: edit controls usually have a white background on Windows. |
---|
2677 | % See ISPC and COMPUTER. |
---|
2678 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
2679 | set(hObject,'BackgroundColor','white'); |
---|
2680 | end |
---|
2681 | |
---|
2682 | |
---|
2683 | |
---|
2684 | function num_CorrBoxSize_2_Callback(hObject, eventdata, handles) |
---|
2685 | % hObject handle to num_CorrBoxSize_2 (see GCBO) |
---|
2686 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2687 | % handles structure with handles and user data (see GUIDATA) |
---|
2688 | |
---|
2689 | % Hints: get(hObject,'String') returns contents of num_CorrBoxSize_2 as text |
---|
2690 | % str2double(get(hObject,'String')) returns contents of num_CorrBoxSize_2 as a double |
---|
2691 | |
---|
2692 | |
---|
2693 | % --- Executes during object creation, after setting all properties. |
---|
2694 | function num_CorrBoxSize_2_CreateFcn(hObject, eventdata, handles) |
---|
2695 | % hObject handle to num_CorrBoxSize_2 (see GCBO) |
---|
2696 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2697 | % handles empty - handles not created until after all CreateFcns called |
---|
2698 | |
---|
2699 | % Hint: edit controls usually have a white background on Windows. |
---|
2700 | % See ISPC and COMPUTER. |
---|
2701 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
2702 | set(hObject,'BackgroundColor','white'); |
---|
2703 | end |
---|
2704 | |
---|
2705 | |
---|
2706 | |
---|
2707 | function edit114_Callback(hObject, eventdata, handles) |
---|
2708 | % hObject handle to num_CorrSmooth (see GCBO) |
---|
2709 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2710 | % handles structure with handles and user data (see GUIDATA) |
---|
2711 | |
---|
2712 | % Hints: get(hObject,'String') returns contents of num_CorrSmooth as text |
---|
2713 | % str2double(get(hObject,'String')) returns contents of num_CorrSmooth as a double |
---|
2714 | |
---|
2715 | |
---|
2716 | % --- Executes during object creation, after setting all properties. |
---|
2717 | function num_CorrSmooth_CreateFcn(hObject, eventdata, handles) |
---|
2718 | % hObject handle to num_CorrSmooth (see GCBO) |
---|
2719 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2720 | % handles empty - handles not created until after all CreateFcns called |
---|
2721 | |
---|
2722 | % Hint: edit controls usually have a white background on Windows. |
---|
2723 | % See ISPC and COMPUTER. |
---|
2724 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
2725 | set(hObject,'BackgroundColor','white'); |
---|
2726 | end |
---|
2727 | |
---|
2728 | |
---|
2729 | % --- Executes on button press in CheckDeformation. |
---|
2730 | function checkbox48_Callback(hObject, eventdata, handles) |
---|
2731 | % hObject handle to CheckDeformation (see GCBO) |
---|
2732 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2733 | % handles structure with handles and user data (see GUIDATA) |
---|
2734 | |
---|
2735 | % Hint: get(hObject,'Value') returns toggle state of CheckDeformation |
---|
2736 | |
---|
2737 | |
---|
2738 | |
---|
2739 | function num_Dx_Callback(hObject, eventdata, handles) |
---|
2740 | % hObject handle to num_Dx (see GCBO) |
---|
2741 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2742 | % handles structure with handles and user data (see GUIDATA) |
---|
2743 | |
---|
2744 | % Hints: get(hObject,'String') returns contents of num_Dx as text |
---|
2745 | % str2double(get(hObject,'String')) returns contents of num_Dx as a double |
---|
2746 | |
---|
2747 | |
---|
2748 | % --- Executes during object creation, after setting all properties. |
---|
2749 | function num_Dx_CreateFcn(hObject, eventdata, handles) |
---|
2750 | % hObject handle to num_Dx (see GCBO) |
---|
2751 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2752 | % handles empty - handles not created until after all CreateFcns called |
---|
2753 | |
---|
2754 | % Hint: edit controls usually have a white background on Windows. |
---|
2755 | % See ISPC and COMPUTER. |
---|
2756 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
2757 | set(hObject,'BackgroundColor','white'); |
---|
2758 | end |
---|
2759 | |
---|
2760 | |
---|
2761 | |
---|
2762 | function num_Dy_Callback(hObject, eventdata, handles) |
---|
2763 | % hObject handle to num_Dy (see GCBO) |
---|
2764 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2765 | % handles structure with handles and user data (see GUIDATA) |
---|
2766 | |
---|
2767 | % Hints: get(hObject,'String') returns contents of num_Dy as text |
---|
2768 | % str2double(get(hObject,'String')) returns contents of num_Dy as a double |
---|
2769 | |
---|
2770 | |
---|
2771 | % --- Executes during object creation, after setting all properties. |
---|
2772 | function num_Dy_CreateFcn(hObject, eventdata, handles) |
---|
2773 | % hObject handle to num_Dy (see GCBO) |
---|
2774 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2775 | % handles empty - handles not created until after all CreateFcns called |
---|
2776 | |
---|
2777 | % Hint: edit controls usually have a white background on Windows. |
---|
2778 | % See ISPC and COMPUTER. |
---|
2779 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
2780 | set(hObject,'BackgroundColor','white'); |
---|
2781 | end |
---|
2782 | |
---|
2783 | |
---|
2784 | % --- Executes on button press in CheckGrid. |
---|
2785 | function checkbox49_Callback(hObject, eventdata, handles) |
---|
2786 | % hObject handle to CheckGrid (see GCBO) |
---|
2787 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2788 | % handles structure with handles and user data (see GUIDATA) |
---|
2789 | |
---|
2790 | % Hint: get(hObject,'Value') returns toggle state of CheckGrid |
---|
2791 | |
---|
2792 | |
---|
2793 | |
---|
2794 | function Grid_Callback(hObject, eventdata, handles) |
---|
2795 | % hObject handle to Grid (see GCBO) |
---|
2796 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2797 | % handles structure with handles and user data (see GUIDATA) |
---|
2798 | |
---|
2799 | % Hints: get(hObject,'String') returns contents of Grid as text |
---|
2800 | % str2double(get(hObject,'String')) returns contents of Grid as a double |
---|
2801 | |
---|
2802 | |
---|
2803 | % --- Executes during object creation, after setting all properties. |
---|
2804 | function Grid_CreateFcn(hObject, eventdata, handles) |
---|
2805 | % hObject handle to Grid (see GCBO) |
---|
2806 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2807 | % handles empty - handles not created until after all CreateFcns called |
---|
2808 | |
---|
2809 | % Hint: edit controls usually have a white background on Windows. |
---|
2810 | % See ISPC and COMPUTER. |
---|
2811 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
2812 | set(hObject,'BackgroundColor','white'); |
---|
2813 | end |
---|
2814 | |
---|
2815 | |
---|
2816 | % --- Executes on button press in CheckMask. |
---|
2817 | function checkbox50_Callback(hObject, eventdata, handles) |
---|
2818 | % hObject handle to CheckMask (see GCBO) |
---|
2819 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2820 | % handles structure with handles and user data (see GUIDATA) |
---|
2821 | |
---|
2822 | % Hint: get(hObject,'Value') returns toggle state of CheckMask |
---|
2823 | |
---|
2824 | |
---|
2825 | |
---|
2826 | function Mask_Callback(hObject, eventdata, handles) |
---|
2827 | % hObject handle to Mask (see GCBO) |
---|
2828 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2829 | % handles structure with handles and user data (see GUIDATA) |
---|
2830 | |
---|
2831 | % Hints: get(hObject,'String') returns contents of Mask as text |
---|
2832 | % str2double(get(hObject,'String')) returns contents of Mask as a double |
---|
2833 | |
---|
2834 | |
---|
2835 | % --- Executes during object creation, after setting all properties. |
---|
2836 | function Mask_CreateFcn(hObject, eventdata, handles) |
---|
2837 | % hObject handle to Mask (see GCBO) |
---|
2838 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2839 | % handles empty - handles not created until after all CreateFcns called |
---|
2840 | |
---|
2841 | % Hint: edit controls usually have a white background on Windows. |
---|
2842 | % See ISPC and COMPUTER. |
---|
2843 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
2844 | set(hObject,'BackgroundColor','white'); |
---|
2845 | end |
---|
2846 | |
---|
2847 | |
---|
2848 | % --- Executes on button press in CheckThreshold. |
---|
2849 | function checkbox51_Callback(hObject, eventdata, handles) |
---|
2850 | % hObject handle to CheckThreshold (see GCBO) |
---|
2851 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2852 | % handles structure with handles and user data (see GUIDATA) |
---|
2853 | |
---|
2854 | % Hint: get(hObject,'Value') returns toggle state of CheckThreshold |
---|
2855 | |
---|
2856 | |
---|
2857 | |
---|
2858 | function num_MinIma_Callback(hObject, eventdata, handles) |
---|
2859 | % hObject handle to num_MinIma (see GCBO) |
---|
2860 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2861 | % handles structure with handles and user data (see GUIDATA) |
---|
2862 | |
---|
2863 | % Hints: get(hObject,'String') returns contents of num_MinIma as text |
---|
2864 | % str2double(get(hObject,'String')) returns contents of num_MinIma as a double |
---|
2865 | |
---|
2866 | |
---|
2867 | % --- Executes during object creation, after setting all properties. |
---|
2868 | function num_MinIma_CreateFcn(hObject, eventdata, handles) |
---|
2869 | % hObject handle to num_MinIma (see GCBO) |
---|
2870 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2871 | % handles empty - handles not created until after all CreateFcns called |
---|
2872 | |
---|
2873 | % Hint: edit controls usually have a white background on Windows. |
---|
2874 | % See ISPC and COMPUTER. |
---|
2875 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
2876 | set(hObject,'BackgroundColor','white'); |
---|
2877 | end |
---|
2878 | |
---|
2879 | |
---|
2880 | |
---|
2881 | function num_MaxIma_Callback(hObject, eventdata, handles) |
---|
2882 | % hObject handle to num_MaxIma (see GCBO) |
---|
2883 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2884 | % handles structure with handles and user data (see GUIDATA) |
---|
2885 | |
---|
2886 | % Hints: get(hObject,'String') returns contents of num_MaxIma as text |
---|
2887 | % str2double(get(hObject,'String')) returns contents of num_MaxIma as a double |
---|
2888 | |
---|
2889 | |
---|
2890 | % --- Executes during object creation, after setting all properties. |
---|
2891 | function num_MaxIma_CreateFcn(hObject, eventdata, handles) |
---|
2892 | % hObject handle to num_MaxIma (see GCBO) |
---|
2893 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2894 | % handles empty - handles not created until after all CreateFcns called |
---|
2895 | |
---|
2896 | % Hint: edit controls usually have a white background on Windows. |
---|
2897 | % See ISPC and COMPUTER. |
---|
2898 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
2899 | set(hObject,'BackgroundColor','white'); |
---|
2900 | end |
---|
2901 | |
---|
2902 | |
---|
2903 | % --- Executes on button press in TestCiv3. |
---|
2904 | function TestCiv3_Callback(hObject, eventdata, handles) |
---|
2905 | % hObject handle to TestCiv3 (see GCBO) |
---|
2906 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2907 | % handles structure with handles and user data (see GUIDATA) |
---|
2908 | |
---|
2909 | % Hint: get(hObject,'Value') returns toggle state of TestCiv3 |
---|
2910 | |
---|
2911 | |
---|
2912 | |
---|
2913 | function num_SearchBoxSize_1_Callback(hObject, eventdata, handles) |
---|
2914 | % hObject handle to num_SearchBoxSize_1 (see GCBO) |
---|
2915 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2916 | % handles structure with handles and user data (see GUIDATA) |
---|
2917 | |
---|
2918 | % Hints: get(hObject,'String') returns contents of num_SearchBoxSize_1 as text |
---|
2919 | % str2double(get(hObject,'String')) returns contents of num_SearchBoxSize_1 as a double |
---|
2920 | |
---|
2921 | |
---|
2922 | % --- Executes during object creation, after setting all properties. |
---|
2923 | function num_SearchBoxSize_1_CreateFcn(hObject, eventdata, handles) |
---|
2924 | % hObject handle to num_SearchBoxSize_1 (see GCBO) |
---|
2925 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2926 | % handles empty - handles not created until after all CreateFcns called |
---|
2927 | |
---|
2928 | % Hint: edit controls usually have a white background on Windows. |
---|
2929 | % See ISPC and COMPUTER. |
---|
2930 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
2931 | set(hObject,'BackgroundColor','white'); |
---|
2932 | end |
---|
2933 | |
---|
2934 | |
---|
2935 | |
---|
2936 | function num_SearchBoxSize_2_Callback(hObject, eventdata, handles) |
---|
2937 | % hObject handle to num_SearchBoxSize_2 (see GCBO) |
---|
2938 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2939 | % handles structure with handles and user data (see GUIDATA) |
---|
2940 | |
---|
2941 | % Hints: get(hObject,'String') returns contents of num_SearchBoxSize_2 as text |
---|
2942 | % str2double(get(hObject,'String')) returns contents of num_SearchBoxSize_2 as a double |
---|
2943 | |
---|
2944 | |
---|
2945 | % --- Executes during object creation, after setting all properties. |
---|
2946 | function num_SearchBoxSize_2_CreateFcn(hObject, eventdata, handles) |
---|
2947 | % hObject handle to num_SearchBoxSize_2 (see GCBO) |
---|
2948 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2949 | % handles empty - handles not created until after all CreateFcns called |
---|
2950 | |
---|
2951 | % Hint: edit controls usually have a white background on Windows. |
---|
2952 | % See ISPC and COMPUTER. |
---|
2953 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
2954 | set(hObject,'BackgroundColor','white'); |
---|
2955 | end |
---|
2956 | |
---|
2957 | |
---|
2958 | % --- Executes during object deletion, before destroying properties. |
---|
2959 | function num_MinCorr_DeleteFcn(hObject, eventdata, handles) |
---|
2960 | % hObject handle to num_MinCorr (see GCBO) |
---|
2961 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2962 | % handles structure with handles and user data (see GUIDATA) |
---|
2963 | |
---|
2964 | |
---|
2965 | % --- Executes on button press in CheckLSM. |
---|
2966 | function CheckLSM_Callback(hObject, eventdata, handles) |
---|
2967 | % hObject handle to CheckLSM (see GCBO) |
---|
2968 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2969 | % handles structure with handles and user data (see GUIDATA) |
---|
2970 | % if get(hObject,'Value')==1 |
---|
2971 | % set(handles.Patch3,'Visible','on') |
---|
2972 | % else |
---|
2973 | % set(handles.Patch3,'Visible','off') |
---|
2974 | |
---|
2975 | % Hint: get(hObject,'Value') returns toggle state of CheckLSM |
---|