- Timestamp:
- May 9, 2012, 2:20:26 AM (13 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r414 r415 23 23 %TODO: search range 24 24 25 % Last Modified by GUIDE v2.5 10-Mar-2012 22:32:1025 % Last Modified by GUIDE v2.5 08-May-2012 22:14:39 26 26 % Begin initialization code - DO NOT EDIT 27 27 gui_Singleton = 1; … … 496 496 TimeUnit=XmlData.TimeUnit; 497 497 end 498 pxcmx_search=1; 499 pxcmy_search=1; 498 pxcm_search=1; 500 499 if isfield(XmlData,'GeometryCalib') 501 500 tsai=XmlData.GeometryCalib; 502 if isfield(tsai,'f') && isfield(tsai,'Tz') && isfield(tsai,'dpx') && isfield(tsai,'dpy')&& isfield(tsai,'R') 503 rot2D=tsai.R(1:2,[1,2]); 504 pxcmx_search=tsai.f * sqrt(det(rot2D))/(tsai.Tz*tsai.dpx); 505 pxcmy_search=tsai.f * sqrt(det(rot2D))/(tsai.Tz*tsai.dpy); 501 if isfield(tsai,'fx_fy') 502 pxcm_search=max(tsai.fx_fy(1),tsai.fx_fy(2));%pixels:cm estimated for the search range 506 503 end 507 504 if isfield(tsai,'CoordUnit') … … 569 566 set(handles.nb_field2,'String',num2str(MaxIndex_j)); 570 567 set(handles.CoordUnit,'String',CoordUnit) 571 set(handles.SearchRange,'UserData', [pxcmx_search pxcmy_search]);568 set(handles.SearchRange,'UserData', pxcm_search); 572 569 set(handles.ImaExt,'String',ImaExt) 573 570 set(handles.NomType,'String',NomTypeIma) … … 3197 3194 set(gcf,'Pointer','arrow') 3198 3195 3199 %------------------------------------------------------------------- 3200 % --- 3201 function closeview_field(gcbo,eventdata) 3202 hview_field=findobj(allchild(0),'tag','view_field');% look for view_field 3203 if ~isempty(hview_field) 3204 delete(hview_field) 3205 end 3196 3206 3197 3207 3208 %------------------------------------------------------------------------ 3209 % call 'view_field.fig' to display the field selected in the list of 'status' 3210 function open_view_field(hObject, eventdata) 3211 %------------------------------------------------------------------------ 3212 list=get(hObject,'String'); 3213 index=get(hObject,'Value'); 3214 rootroot=get(hObject,'UserData'); 3215 filename=list{index}; 3216 ind_dot=strfind(filename,'...'); 3217 filename=filename(1:ind_dot-1); 3218 filename=fullfile(rootroot,filename); 3219 delete(get(hObject,'parent'))%delete the display figure to stop the check process 3220 if exist(filename,'file')%visualise the vel field if it exists 3221 uvmat(filename) 3222 set(gcbo,'Value',1) 3223 end 3198 % %------------------------------------------------------------------------ 3199 % % call 'view_field.fig' to display the field selected in the list of 'status' 3200 % function open_view_field(hObject, eventdata) 3201 % %------------------------------------------------------------------------ 3202 % list=get(hObject,'String'); 3203 % index=get(hObject,'Value'); 3204 % rootroot=get(hObject,'UserData'); 3205 % filename=list{index}; 3206 % ind_dot=strfind(filename,'...'); 3207 % filename=filename(1:ind_dot-1); 3208 % filename=fullfile(rootroot,filename); 3209 % delete(get(hObject,'parent'))%delete the display figure to stop the check process 3210 % if exist(filename,'file')%visualise the vel field if it exists 3211 % uvmat(filename) 3212 % set(gcbo,'Value',1) 3213 % end 3224 3214 3225 3215 %------------------------------------------------------------------------ … … 3264 3254 %------------------------------------------------------------------------ 3265 3255 %determine pair numbers 3266 if strcmp(get(handles. umin,'Visible'),'off')3256 if strcmp(get(handles.num_UMin,'Visible'),'off') 3267 3257 set(handles.u_title,'Visible','on') 3268 3258 set(handles.v_title,'Visible','on') 3269 set(handles. umin,'Visible','on')3270 set(handles. umax,'Visible','on')3271 set(handles. vmin,'Visible','on')3272 set(handles. vmax,'Visible','on')3259 set(handles.num_UMin,'Visible','on') 3260 set(handles.num_UMax,'Visible','on') 3261 set(handles.num_VMin,'Visible','on') 3262 set(handles.num_VMax,'Visible','on') 3273 3263 set(handles.CoordUnit,'Visible','on') 3274 3264 set(handles.TimeUnit,'Visible','on') … … 3284 3274 % --- determine the search range num_Searchx,num_Searchy and shift 3285 3275 function get_search_range(hObject, eventdata, handles) 3286 umin=str2double(get(handles.umin,'String')); 3287 umax=str2double(get(handles.umax,'String')); 3288 vmin=str2double(get(handles.umin,'String')); 3289 vmax=str2double(get(handles.vmax,'String')); 3276 %------------------------------------------------------------------------ 3277 param_civ1=read_GUI(handles.Civ1); 3278 umin=param_civ1.UMin; 3279 umax=param_civ1.UMax; 3280 vmin=param_civ1.VMin; 3281 vmax=param_civ1.VMax; 3290 3282 %switch min_title and max_title in case of error 3291 3283 if umax<=umin … … 3293 3285 umin=umax; 3294 3286 umax=umin_old; 3295 set(handles. umin,'String', num2str(umin))3296 set(handles. umax,'String', num2str(umax))3287 set(handles.num_UMin,'String', num2str(umin)) 3288 set(handles.num_UMax,'String', num2str(umax)) 3297 3289 end 3298 3290 if vmax<=vmin … … 3300 3292 vmin=vmax; 3301 3293 vmax=vmin_old; 3302 set(handles. vmin,'String', num2str(vmin))3303 set(handles. vmax,'String', num2str(vmax))3294 set(handles.num_VMin,'String', num2str(vmin)) 3295 set(handles.num_VMax,'String', num2str(vmax)) 3304 3296 end 3305 if ~(is nan(umin)||isnan(umax)||isnan(vmin)||isnan(vmax))3297 if ~(isempty(umin)||isempty(umax)||isempty(vmin)||isempty(vmax)) 3306 3298 list_pair=get(handles.ListPairCiv1,'String');%get the menu of image pairs 3307 3299 index=get(handles.ListPairCiv1,'Value'); 3308 displ_num=get(handles.ListPairCiv1,'UserData');3300 pair_string=list_pair{index}; 3309 3301 time=get(handles.ImaDoc,'UserData'); %get the set of times 3310 pxcm_xy=get(handles.SearchRange,'UserData'); 3311 pxcmx=pxcm_xy(1); 3312 pxcmy=pxcm_xy(2); 3302 pxcm=get(handles.SearchRange,'UserData'); 3313 3303 mode_list=get(handles.ListPairMode,'String'); 3314 3304 mode_value=get(handles.ListPairMode,'Value'); 3315 mode=mode_list{mode_value}; 3305 mode=mode_list{mode_value}; 3316 3306 if isequal (mode, 'series(Di)' ) 3317 3307 ref_i=str2double(get(handles.ref_i,'String')); … … 3326 3316 num_a=ref_j-floor(index/2);% first image numbers 3327 3317 num_b=ref_j+ceil(index/2); 3328 elseif isequal(mode,'pair j1-j2') %case of bursts (png_old or png_2D) 3318 elseif isequal(mode,'pair j1-j2') %case of bursts (png_old or png_2D) 3329 3319 ref_i=str2double(get(handles.ref_i,'String')); 3330 3320 num1=ref_i; 3331 3321 num2=ref_i; 3332 num_a=displ_num(1,index); 3333 num_b=displ_num(2,index); 3334 end 3335 dt=time(num2,num_b)-time(num1,num_a); 3322 r=regexp(pair_string,'(?<mode>(Di=)|(Dj=)) -*(?<num1>\d+)\|(?<num2>\d+)','names'); 3323 if isempty(r) 3324 r=regexp(pair_string,'(?<num1>\d+)(?<mode>-)(?<num2>\d+)','names'); 3325 end 3326 num_a=str2num(r.num1); 3327 num_b=str2num(r.num2); 3328 end 3329 dt=time(num2+1,num_b+1)-time(num1+1,num_a+1); 3336 3330 ibx=str2double(get(handles.num_Bx,'String')); 3337 3331 iby=str2double(get(handles.num_By,'String')); 3338 umin=dt*pxcm x*umin;3339 umax=dt*pxcm x*umax;3340 vmin=dt*pxcm y*vmin;3341 vmax=dt*pxcm y*vmax;3332 umin=dt*pxcm*umin; 3333 umax=dt*pxcm*umax; 3334 vmin=dt*pxcm*vmin; 3335 vmax=dt*pxcm*vmax; 3342 3336 shiftx=round((umin+umax)/2); 3343 3337 shifty=round((vmin+vmax)/2); 3344 isx=(umax+2-shiftx)*2+ ibx;3338 isx=(umax+2-shiftx)*2+param_civ1.Bx; 3345 3339 isx=2*ceil(isx/2)+1; 3346 isy=(vmax+2-shifty)*2+ iby;3340 isy=(vmax+2-shifty)*2+param_civ1.Bx; 3347 3341 isy=2*ceil(isy/2)+1; 3348 3342 set(handles.num_Shiftx,'String',num2str(shiftx)); … … 4002 3996 end 4003 3997 3998 %------------------------------------------------------------------------ 3999 %----function introduced for the correlation window figure, activated by deleting this window 4000 function closeview_field(gcbo,eventdata) 4001 %------------------------------------------------------------------------ 4002 hview_field=findobj(allchild(0),'tag','view_field');% look for view_field 4003 if ~isempty(hview_field) 4004 delete(hview_field) 4005 end 4004 4006 4005 4007 %------------------------------------------------------------------------ … … 4461 4463 set(handles.num_Rho,'String','1') 4462 4464 set(handles.BATCH,'Enable','on') 4465 set(handles.CheckThreshold,'Visible','off') 4466 set(handles.CheckDeformation,'Value',1) 4467 set(handles.CheckDecimal,'Value',1) 4463 4468 case 'Matlab' 4464 4469 set(handles.num_MaxDiff,'Visible','on') … … 4471 4476 set(handles.num_Rho,'Value',1) 4472 4477 set(handles.num_Rho,'String',{'1';'2'}) 4478 set(handles.CheckThreshold,'Visible','on') 4479 set(handles.CheckDeformation,'Value',0)% desactivate (work in progress) 4480 set(handles.CheckDecimal,'Value',0)% desactivate (work in progress) 4473 4481 end 4474 4482 -
trunk/src/plot_field.m
r411 r415 808 808 caxis([abscontmin abscontmax]) 809 809 colormap(map); 810 if isfield(PlotParam.Coordinates,'CheckFixEqual') && isequal(PlotParam.Coordinates.CheckFixEqual,1) 811 set(haxes,'DataAspectRatioMode','manual') 812 set(haxes,'DataAspectRatio',[1 1 1]) 813 end 810 814 end 811 815 -
trunk/src/read_civxdata.m
r404 r415 130 130 if isfield(Field,'absolut_time_T0') 131 131 Field.Time=double(Field.absolut_time_T0); 132 Field. dt=double(Field.dt);132 Field.Dt=double(Field.dt); 133 133 else 134 134 errormsg='the input file is not civx'; 135 135 Field.CivStage=0; 136 Field. dt=0;136 Field.Dt=0; 137 137 end 138 138 elseif test_civ2 139 139 Field.Time=double(Field.absolut_time_T0_2); 140 Field. dt=double(Field.dt2);140 Field.Dt=double(Field.dt2); 141 141 else 142 142 errormsg='the input file is not civx'; 143 143 Field.CivStage=0; 144 Field. dt=0;144 Field.Dt=0; 145 145 end 146 146 … … 172 172 for ilist=1:length(List) 173 173 switch(List{ilist}) 174 case {'patch2','fix2','civ2','patch','fix','dt 2','absolut_time_T0','absolut_time_T0_2','nb_coord','nb_dim','pixcmx','pixcmy'}174 case {'patch2','fix2','civ2','patch','fix','dt','dt2','absolut_time_T0','absolut_time_T0_2','nb_coord','nb_dim','pixcmx','pixcmy'} 175 175 ind_remove=[ind_remove ilist]; 176 176 Field=rmfield(Field,List{ilist}); … … 178 178 end 179 179 List(ind_remove)=[]; 180 Field.ListGlobalAttribute=[{'NbCoord'},{'NbDim'} List {'Time',' TimeUnit','CivStage','CoordUnit'}];180 Field.ListGlobalAttribute=[{'NbCoord'},{'NbDim'} List {'Time','Dt','TimeUnit','CivStage','CoordUnit'}]; 181 181 Field.CoordUnit='pixel'; 182 182 -
trunk/src/uvmat.m
r413 r415 2045 2045 set(handles.num_Npy,'String',num2str(ParamOut.Npy)); 2046 2046 end 2047 if isfield(ParamOut,'TimeIndex') 2047 if isfield(ParamOut,'TimeIndex')% case of time obtained from get_field 2048 2048 set(handles.i1,'String',num2str(ParamOut.TimeIndex)) 2049 2049 end 2050 2050 if isfield(ParamOut,'TimeValue') 2051 Field{1}.Time=ParamOut.TimeValue; 2051 Field{1}.Time=ParamOut.TimeValue;% case of time obtained from get_field 2052 2052 end 2053 2053 end … … 2218 2218 end 2219 2219 2220 2221 2222 %% display time 2223 testimedoc=0; 2224 TimeUnit=''; 2225 if isfield(Field{1},'Time') 2226 abstime=Field{1}.Time;%time read from the netcdf input file 2227 end 2228 if numel(Field)==2 && isfield(Field{2},'Time') 2229 abstime_1=Field{2}.Time;%time read from the netcdf input file 2230 end 2231 if isfield(Field{1},'Dt') 2232 dt=Field{1}.Dt;%dt read from the netcdf input file 2233 if isfield(Field{1},'TimeUnit') 2234 TimeUnit=Field{1}.TimeUnit; 2235 end 2236 elseif numel(Field)==2 && isfield(Field{2},'Dt')%dt obtained from the second field if not defined in the first 2237 dt=Field{2}.Dt;%dt read from the netcdf input file 2238 if isfield(Field{2},'TimeUnit') 2239 TimeUnit=Field{2}.TimeUnit; 2240 end 2241 end 2242 % time from xml file overset previous result 2243 if isfield(UvData,'XmlData') && isfield(UvData.XmlData{1},'Time') 2244 if isempty(num_i2)||isnan(num_i2) 2245 num_i2=num_i1; 2246 end 2247 if isempty(num_j1)||isnan(num_j1) 2248 num_j1=1; 2249 end 2250 if isempty(num_j2)||isnan(num_j2) 2251 num_j2=num_j1; 2252 end 2253 siz=size(UvData.XmlData{1}.Time); 2254 if siz(1)>=max(num_i1,num_i2) && siz(2)>=max(num_j1,num_j2) 2255 abstime=(UvData.XmlData{1}.Time(num_i1,num_j1)+UvData.XmlData{1}.Time(num_i2,num_j2))/2;%overset the time read from files 2256 dt=(UvData.XmlData{1}.Time(num_i2,num_j2)-UvData.XmlData{1}.Time(num_i1,num_j1)); 2257 Field{1}.Dt=dt; 2258 if isfield(UvData.XmlData{1},'TimeUnit') 2259 TimeUnit=UvData.XmlData{1}.TimeUnit; 2260 end 2261 end 2262 if numel(UvData.XmlData)==2 2263 [tild,tild,tild,num_i1,num_i2,num_j1,num_j2]=fileparts_uvmat(['xx' get(handles.FileIndex_1,'String') get(handles.FileExt_1,'String')]); 2264 if isempty(num_i2) 2265 num_i2=num_i1; 2266 end 2267 if isempty(num_j1) 2268 num_j1=1; 2269 end 2270 if isempty(num_j2) 2271 num_j2=num_j1; 2272 end 2273 siz=size(UvData.XmlData{2}.Time); 2274 if ~isempty(num_i1) && siz(1)>=max(num_i1,num_i2) && siz(2)>=max(num_j1,num_j2) 2275 abstime_1=(UvData.XmlData{2}.Time(num_i1,num_j1)+UvData.XmlData{2}.Time(num_i2,num_j2))/2;%overset the time read from files 2276 Field{2}.Dt=(UvData.XmlData{2}.Time(num_i2,num_j2)-UvData.XmlData{2}.Time(num_i1,num_j1)); 2277 end 2278 end 2279 end 2280 if ~isequal(numel(abstime),1) 2281 abstime=[]; 2282 end 2283 if ~isequal(numel(abstime_1),1) 2284 abstime_1=[]; 2285 end 2286 set(handles.abs_time,'String',num2str(abstime,4)) 2287 set(handles.abs_time_1,'String',num2str(abstime_1,4)) 2288 % if testimedoc && isfield(UvData,'dt') 2289 % dt=UvData.dt; 2290 % end 2291 if isempty(dt)||isequal(dt,0) 2292 set(handles.Dt_txt,'String','') 2293 else 2294 if isempty(TimeUnit) 2295 set(handles.Dt_txt,'String',['Dt=' num2str(1000*dt,3) ' 10^(-3)'] ) 2296 else 2297 set(handles.Dt_txt,'String',['Dt=' num2str(1000*dt,3) ' m' TimeUnit] ) 2298 end 2299 end 2300 2301 2220 2302 %% store the current open names, fields and vel types in uvmat interface 2221 2303 UvData.filename_1=filename_1; … … 2642 2724 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2643 2725 2644 %% display time 2645 testimedoc=0; 2646 TimeUnit=''; 2647 if isfield(UvData.Field,'Time') 2648 abstime=UvData.Field.Time;%time read from the netcdf input file 2649 end 2650 if isfield(UvData,'Field_1') && isfield(UvData.Field_1,'Time') 2651 abstime_1=UvData.Field_1.Time;%time read from the netcdf input file 2652 end 2653 if isfield(UvData.Field,'dt') 2654 dt=UvData.Field.dt;%dt read from the netcdf input file 2655 if isfield(UvData.Field,'TimeUnit') 2656 TimeUnit=UvData.Field.TimeUnit; 2657 end 2658 elseif isfield(UvData,'Field_1') && isfield(UvData.Field_1,'dt')%dt obtained from the second field if not defined in the first 2659 dt=UvData.Field_1.dt;%dt read from the netcdf input file 2660 if isfield(UvData.Field_1,'TimeUnit') 2661 TimeUnit=UvData.Field_1.TimeUnit; 2662 end 2663 end 2664 % time from xml file overset previous result 2665 if isfield(UvData,'XmlData') && isfield(UvData.XmlData{1},'Time') 2666 if isempty(num_i2)||isnan(num_i2) 2667 num_i2=num_i1; 2668 end 2669 if isempty(num_j1)||isnan(num_j1) 2670 num_j1=1; 2671 end 2672 if isempty(num_j2)||isnan(num_j2) 2673 num_j2=num_j1; 2674 end 2675 siz=size(UvData.XmlData{1}.Time); 2676 if siz(1)>=max(num_i1,num_i2) && siz(2)>=max(num_j1,num_j2) 2677 abstime=(UvData.XmlData{1}.Time(num_i1,num_j1)+UvData.XmlData{1}.Time(num_i2,num_j2))/2;%overset the time read from files 2678 dt=(UvData.XmlData{1}.Time(num_i2,num_j2)-UvData.XmlData{1}.Time(num_i1,num_j1)); 2679 testimedoc=1; 2680 if isfield(UvData.XmlData{1},'TimeUnit') 2681 TimeUnit=UvData.XmlData{1}.TimeUnit; 2682 end 2683 end 2684 if numel(UvData.XmlData)==2 2685 [tild,tild,tild,num_i1,num_i2,num_j1,num_j2]=fileparts_uvmat(['xx' get(handles.FileIndex_1,'String') get(handles.FileExt_1,'String')]); 2686 % [P,F,str1,str2,str_a,str_b,E]=name2display(['xx' get(handles.FileIndex_1,'String') get(handles.FileExt_1,'String')]); 2687 if isempty(num_i2) 2688 num_i2=num_i1; 2689 end 2690 if isempty(num_j1) 2691 num_j1=1; 2692 end 2693 if isempty(num_j2) 2694 num_j2=num_j1; 2695 end 2696 siz=size(UvData.XmlData{2}.Time); 2697 if ~isempty(num_i1) && siz(1)>=max(num_i1,num_i2) && siz(2)>=max(num_j1,num_j2) 2698 abstime_1=(UvData.XmlData{2}.Time(num_i1,num_j1)+UvData.XmlData{2}.Time(num_i2,num_j2))/2;%overset the time read from files 2699 end 2700 end 2701 end 2702 2703 if ~isequal(numel(abstime),1) 2704 abstime=[]; 2705 end 2706 if ~isequal(numel(abstime_1),1) 2707 abstime_1=[]; 2708 end 2709 set(handles.abs_time,'String',num2str(abstime,4)) 2710 set(handles.abs_time_1,'String',num2str(abstime_1,4)) 2711 if testimedoc && isfield(UvData,'dt') 2712 dt=UvData.dt; 2713 end 2714 if isempty(dt)||isequal(dt,0) 2715 set(handles.Dt_txt,'String','') 2716 else 2717 if isempty(TimeUnit) 2718 set(handles.Dt_txt,'String',['Dt=' num2str(1000*dt,3) ' 10^(-3)'] ) 2719 else 2720 set(handles.Dt_txt,'String',['Dt=' num2str(1000*dt,3) ' m' TimeUnit] ) 2721 end 2722 end 2726 2723 2727 2724 2728
Note: See TracChangeset
for help on using the changeset viewer.