Changeset 1095 for trunk/src/uvmat.m
- Timestamp:
- Mar 31, 2021, 3:32:03 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/uvmat.m
r1094 r1095 2198 2198 editxml(fileinput); 2199 2199 return 2200 case 'mat'% matlab data file2201 global Data_uvmat2202 Data_uvmat.Field=load(fileinput);2203 evalin('base','global Data_uvmat')%make CurData global in the workspace2204 disp('Data_uvmat.Field=')2205 evalin('base','Data_uvmat.Field') %display CurData in the workspace2206 commandwindow; %brings the Matlab command window to the front2207 return2200 % case 'mat'% matlab data file 2201 % % global Data_uvmat 2202 % Data_uvmat.Field=load(fileinput); 2203 % evalin('base','global Data_uvmat')%make CurData global in the workspace 2204 % disp('Data_uvmat.Field=') 2205 % evalin('base','Data_uvmat.Field') %display CurData in the workspace 2206 % commandwindow; %brings the Matlab command window to the front 2207 % return 2208 2208 otherwise 2209 2209 set(handles_RootPath,'String',RootPath); … … 2278 2278 2279 2279 %enable other menus 2280 % set(handles.MenuOpenCampaign,'Enable','on')2281 2280 set(handles.MenuExport,'Enable','on') 2282 2281 set(handles.MenuExportFigure,'Enable','on') … … 2355 2354 if isfield(FileInfo,'FrameRate')% frame rate given in the file (case of video data) 2356 2355 TimeUnit='s'; 2357 if isempty(j1_series) ;%frame index along i2356 if isempty(j1_series) %frame index along i 2358 2357 XmlData.Time=zeros(FileInfo.NumberOfFrames+1,2); 2359 2358 XmlData.Time(:,2)=(0:1/FileInfo.FrameRate:(FileInfo.NumberOfFrames)/FileInfo.FrameRate)'; … … 2552 2551 set(handles.Coord_x,'String','X'); 2553 2552 set(handles.Coord_y,'String','Y'); 2554 case 'netcdf'2553 case {'netcdf','mat'} 2555 2554 set(handles_Fields,'Value',1) 2556 2555 set(handles_Fields,'String',{'get_field...'}) … … 3019 3018 pause(1.02-get(handles.speed,'Value'))% wait for next image 3020 3019 end 3021 if isfield(UvData,'aviobj') && ~isempty( UvData.aviobj) ,3020 if isfield(UvData,'aviobj') && ~isempty( UvData.aviobj) 3022 3021 UvData.aviobj=close(UvData.aviobj); 3023 3022 set(handles.uvmat,'UserData',UvData); … … 3063 3062 set(handles.MovieBackward,'BusyAction','Cancel') 3064 3063 set(handles.MenuExportMovie,'BusyAction','Cancel') 3065 %set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command buttonback to red3066 3064 set(handles.Movie,'BackgroundColor',[1 0 0])%paint the command buttonback to red 3067 3065 set(handles.MovieBackward,'BackgroundColor',[1 0 0])%paint the command buttonback to red … … 3073 3071 errormsg='';%default 3074 3072 %% check for movie pair status 3075 movie_status=get(handles.movie_pair,'Value');3076 if movie_status3077 STOP_Callback(hObject, eventdata, handles)%interrupt movie pair if active3078 end3073 % movie_status=get(handles.movie_pair,'Value'); 3074 % if movie_status 3075 % STOP_Callback(hObject, eventdata, handles)%interrupt movie pair if active 3076 % end 3079 3077 3080 3078 %% read the current input file name(s) and field indices … … 3090 3088 j1=str2num(get(handles.j1,'String'));%case of indexed movie 3091 3089 end 3092 if movie_status% we read the second index from the edit box3093 i2=str2num(get(handles.i2,'String'));%read the field indices (for movie, it is not given by the file name)3094 if strcmp(get(handles.j2,'Visible'),'on')3095 j2=str2num(get(handles.j2,'String'));%3096 end3097 end3090 % if movie_status% we read the second index from the edit box 3091 % i2=str2num(get(handles.i2,'String'));%read the field indices (for movie, it is not given by the file name) 3092 % if strcmp(get(handles.j2,'Visible'),'on') 3093 % j2=str2num(get(handles.j2,'String'));% 3094 % end 3095 % end 3098 3096 sub_value= get(handles.SubField,'Value'); 3099 3097 if sub_value % a second input file has been entered … … 3113 3111 set(handles.CheckFixPair,'Value',0) 3114 3112 end 3115 CheckFixPair=get(handles.CheckFixPair,'Value')||(isempty(i2)&& isempty(j2));3113 CheckFixPair=get(handles.CheckFixPair,'Value')||(isempty(i2)&& isempty(j2)); 3116 3114 3117 3115 % the pair i1-i2 or j1-j2 is imposed (check box CheckFixPair selected) … … 3132 3130 end 3133 3131 end 3134 3135 % the pair i1-i2 or j1-j2 is free (check box CheckFixPair not selected): the list of existing indices recorded in UvData is used3132 3133 % the pair i1-i2 or j1-j2 is free (check box CheckFixPair not selected): the list of existing indices recorded in UvData is used 3136 3134 else 3137 3135 UvData=get(handles.uvmat,'UserData'); … … 3154 3152 end 3155 3153 else % free increment 3156 % runaction=get(gcbo,'tag');3157 3154 if strcmp(increment,'+')% if runplus or movie is activated 3158 3155 step=1; … … 3203 3200 j2=UvData.j2_series{1}(ref_indices(end)); 3204 3201 end 3205 3202 3206 3203 % case of a second file series 3207 3204 if sub_value … … 3300 3297 end 3301 3298 if strcmp(NomType,'level') 3302 indices=num2str(i1);3299 indices=num2str(i1); 3303 3300 else 3304 indices=fullfile_uvmat('','','','',NomType,i1,i2,j1,j2);3301 indices=fullfile_uvmat('','','','',NomType,i1,i2,j1,j2); 3305 3302 end 3306 3303 set(handles.FileIndex,'String',indices); … … 3309 3306 set(handles.FileIndex_1,'String',indices_1); 3310 3307 end 3311 if isequal(movie_status,1) 3312 set(handles.movie_pair,'Value',1) 3313 movie_pair_Callback(hObject, eventdata, handles); %reactivate moviepair if it was activated 3314 else 3315 if isempty(i2), set(handles.i2,'String',''); end % suppress the second index display if not used 3316 if isempty(j2), set(handles.j2,'String',''); end 3317 end 3308 if isempty(i2), set(handles.i2,'String',''); end % suppress the second index display if not used 3309 if isempty(j2), set(handles.j2,'String',''); end 3318 3310 end 3319 3311 … … 3352 3344 msgbox_uvmat('ERROR',errormsg); 3353 3345 end 3354 3355 % set(hima,'CData',Field_b.A); %TODO: generalise to other kinds of fields3356 3346 pause(1.02-get(handles.speed,'Value'));% wait for next image 3357 3347 errormsg=runpm(hObject,eventdata,handles,-increment); 3358 3359 % set(hima,'CData',Field_a.A); 3348 if ~isempty(errormsg) 3349 msgbox_uvmat('ERROR',errormsg); 3350 end 3360 3351 pause(1.02-get(handles.speed,'Value'));% wait for next image 3352 get(handles.speed,'Value')~=0 && isequal(get(handles.movie_pair,'BusyAction'),'queue') 3361 3353 end 3362 3354 set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red … … 3364 3356 set(handles.Dt_txt,'String','') 3365 3357 3366 3367 3368 3369 3358 set(handles.runplus,'BackgroundColor',[1 0 0])%paint the command button back in red 3370 3359 3371 %3372 % set(handles.runmin,'BackgroundColor',[1 1 0])%paint the command button in yellow3373 % drawnow3374 % increment=-str2double(get(handles.num_IndexIncrement,'String')); %get the field increment d3375 % if isnan(increment)% case of free increment: move to previous available field index3376 % increment='-';3377 % end3378 % errormsg=runpm(hObject,eventdata,handles,increment);3379 % if ~isempty(errormsg)3380 % msgbox_uvmat('ERROR',errormsg);3381 % end3382 % set(handles.runmin,'BackgroundColor',[1 0 0])%paint the command button back in red3383 %3384 % %% check the input file indexing:3385 % [RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles);3386 % NomType=get(handles.NomType,'String');3387 % if ~isempty(find(regexp(NomType,'-')))3388 % msgbox_uvmat('ERROR','The movie pair requires file series with a single index on the first input line')3389 % return3390 % end3391 % filename=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt];% build the input file name (first line)3392 %3393 % set(handles.movie_pair,'BusyAction','queue')%3394 % set(handles.CheckFixPair,'Value',1)% impose fixed pair (needed for function runpm)3395 % set(handles.REFRESH,'BackgroundColor',[1 1 0])%paint the command button in yellow to indicate its activity3396 % set(handles.movie_pair,'BackgroundColor',[1 1 0])%paint the command button in yellow to indicate its activity3397 % drawnow3398 %3399 % num_i1=str2num(get(handles.i1,'String'));3400 % num_j1=stra2num(get(handles.j1,'String'));3401 % num_i2=str2num(get(handles.i2,'String'));3402 % num_j2=stra2num(get(handles.j2,'String'));3403 %3404 % %% determine the name 'imaname_1' of the second file in the pair3405 % imaname_1='';3406 % if isempty(num_j2)% no second j index indicated3407 % if isempty(num_i2)3408 % if strcmp(get(handles.j2,'Visible'),'on') %if the j box is visible3409 % imaname_1=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,num_i1,[],num_j1+1);3410 % end3411 % if exist(imaname_1,'file')3412 % num_j2=num_j1+1;% look by default for the next j index as the second file3413 % set(handles.j2,'String',num2stra(num_j2,NomType));3414 % else3415 % imaname_1=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,num_i1+1,[],num_j1);3416 % if exist(imaname_1,'file')3417 % num_i2=num_i1+1;3418 % set(handles.i2,'String',num2str(num_i2));3419 % else3420 % msgbox_uvmat('ERROR', 'a second image index i2 or j2 is needed to show the pair as a movie')3421 % set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red3422 % set(handles.movie_pair,'Value',0)3423 % return3424 % end3425 % end3426 % else3427 % num_j2=num_j1;%repeat the index i1 by default3428 % end3429 % end3430 % if isempty(num_i2)3431 % num_i2=num_i1;%repeat the index i1 by default3432 % end3433 % if isempty(num_j1)3434 % num_j1=1;3435 % end3436 % if isempty(num_j2)3437 % num_j2=num_j1;%repeat the index i1 by default3438 % end3439 % imaname_1=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,num_i2,[],num_j2);3440 % if strcmp(NomType,'*')3441 % num_frame=num_i2;3442 % else3443 % num_frame=num_j2;3444 % end3445 % if ~exist(imaname_1,'file')3446 % msgbox_uvmat('ERROR',['second input open (-) ' imaname_1 ' not found']);3447 % set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red3448 % set(handles.movie_pair,'Value',0)3449 % return3450 % end3451 %3452 % %% display the first field in the pair (including possibly a background field from second line input filename_1)3453 % filename_1='';%default3454 % FileIndex_1='';3455 % if get(handles.SubField,'Value')3456 % [RootPath_1,SubDir_1,RootFile_1,FileIndex_1,FileExt_1]=read_file_boxes_1(handles);3457 % filename_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndex_1 FileExt_1];3458 % end3459 % [tild,tild,tild,i1_1,i2_1,j1_1,j2_1]=fileparts_uvmat(FileIndex_1);% get the indices of the second series from the string FileIndex_13460 % if isempty(j1_1)% case of movies, the index is not given by file index3461 % j1_1=num_j1;3462 % end3463 %3464 % errormsg=refresh_field(handles,filename,filename_1,num_i1,num_i2,num_j1,num_j2,i1_1,i2_1,j1_1,j2_1);3465 %3466 % if isempty(errormsg)3467 % set(handles.REFRESH,'BackgroundColor',[1 0 0])% set button color to red, update successfull3468 % else3469 % msgbox_uvmat('ERROR',errormsg);3470 % set(handles.REFRESH,'BackgroundColor',[1 0 1])% keep button color magenta, input not succesfull3471 % end3472 % UvData=get(handles.uvmat,'UserData');3473 % Field_a=UvData.Field;% movie on the field defined by the second input line3474 %3475 % %% display time interval for the image pair3476 % if isfield(UvData,'XmlData')&&isfield(UvData.XmlData{1},'Time')...3477 % && size(UvData.XmlData{1}.Time,1)>=num_i2+1 && size(UvData.XmlData{1}.Time,2)>=num_j2+13478 % dt=(UvData.XmlData{1}.Time(num_i2+1,num_j2+1)-UvData.XmlData{1}.Time(num_i1+1,num_j1+1));3479 % if isfield(UvData,'TimeUnit')3480 % set(handles.Dt_txt,'String',['Dt=' num2str(1000*dt,3) ' m' UvData.TimeUnit] )3481 % else3482 % set(handles.Dt_txt,'String',['Dt=' num2str(1000*dt,3) ' 10^(-3)'] )3483 % end3484 % else3485 % set(handles.Dt_txt,'String','')3486 % end3487 %3488 % %% read the second field3489 % if isempty(UvData.MovieObject)3490 % [Field_b,ParamOut,errormsg] = read_field(imaname_1,UvData.FileInfo{index}.FileType,[],num_frame);3491 % else3492 % [Field_b,ParamOut,errormsg] = read_field(imaname_1,UvData.FileInfo{1}.FileType,UvData.MovieObject{1},num_frame);3493 % end3494 % if ~isempty(errormsg)3495 % msgbox_uvmat('ERROR',['Error in reading second image: ' errormsg])3496 % return3497 % end3498 %3499 % %% apply phys or other transform on the two input fields3500 % transform=get(handles.TransformPath,'UserData');3501 % if ~isempty(transform)3502 % if isfield(UvData,'XmlData') && ~isempty(UvData.XmlData) %use geometry calib recorded from the ImaDoc xml file as first priority3503 % if nargin(transform)>=23504 % Field_b=transform(Field_b,UvData.XmlData{1});3505 % else3506 % Field_b=transform(Field_b);3507 % end3508 % end3509 % end3510 %3511 % %% make movie until movie speed is set to 0 or STOP is activated3512 % hima=findobj(handles.PlotAxes,'Tag','ima');% %handles.PlotAxes =main plotting window (A GENERALISER)3513 % set(handles.STOP,'Visible','on')3514 % set(handles.speed,'Visible','on')3515 % set(handles.speed_txt,'Visible','on')3516 % while get(handles.speed,'Value')~=0 && isequal(get(handles.movie_pair,'BusyAction'),'queue') % enable STOP command3517 % % read and plot the series of images in non erase mode3518 % set(hima,'CData',Field_b.A); %TODO: generalise to other kinds of fields3519 % pause(1.02-get(handles.speed,'Value'));% wait for next image3520 % set(hima,'CData',Field_a.A);3521 % pause(1.02-get(handles.speed,'Value'));% wait for next image3522 % end3523 % set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red3524 % set(handles.movie_pair,'Value',0)3525 % set(handles.Dt_txt,'String','')3526 3360 3527 3361 %------------------------------------------------------------------------ … … 3660 3494 end 3661 3495 switch UvData.FileInfo{1}.FieldType 3662 case {'civdata','netcdf' }3496 case {'civdata','netcdf','mat'} 3663 3497 list_fields=get(handles.FieldName,'String');% list menu fields 3664 3498 FieldName= list_fields{get(handles.FieldName,'Value')}; % selected field 3665 if ~strcmp(FieldName,'get_field...') 3499 if strcmp(FieldName,'get_field...') 3500 FieldName_Callback(hObject, eventdata, handles) 3501 return 3502 else 3666 3503 if get(handles.FixVelType,'Value') 3667 3504 VelTypeList=get(handles.VelType,'String'); … … 3697 3534 end 3698 3535 ParamIn.Coord_z=get(handles.Coord_z,'String'); 3699 %ParamIn.CheckCoordIndex=strcmp(get(handles.SwitchCoordIndex,'String'),'dim');3700 3536 TimeName=get(handles.TimeName,'String'); 3701 3537 r=regexp(TimeName,'^(?<type>(dim:)|(var:))','names');%look for 'var:' or 'dim:' at the beginning of time name … … 3768 3604 end 3769 3605 switch UvData.FileInfo{2}.FileType 3770 case {'civx','civdata','netcdf','pivdata_fluidimage' }3606 case {'civx','civdata','netcdf','pivdata_fluidimage','mat'} 3771 3607 list_fields=get(handles.FieldName_1,'String');% list menu fields 3772 3608 FieldName_1= list_fields{get(handles.FieldName_1,'Value')}; % selected field … … 4170 4006 break 4171 4007 end 4172 if UvData.Field.NbDim==34008 if isfield(UvData.Field,'NbDim') && UvData.Field.NbDim==3 4173 4009 UvData.ProjObject{iobj}.NbDim=3;%test for 3D objects 4174 4010 if ~isfield(UvData.ProjObject{iobj},'RangeZ') … … 5356 5192 prev_path=fullfile(fileparts(which('uvmat')),'transform_field'); 5357 5193 end 5358 if strcmp(transform_name,'more...') ;5194 if strcmp(transform_name,'more...') 5359 5195 transform_fct_chosen=uigetfile_uvmat('Pick the transform function',prev_path,'.m'); 5360 5196 if ~isempty(transform_fct_chosen) … … 5444 5280 %% delete drawn objects if the output CooordUnit is different from the previous one 5445 5281 if ~strcmp(CoordUnit,CoordUnitPrev) 5446 % for iobj=1:numel(UvData.ProjObject)5447 % delete_object(iobj)5448 % end5449 5282 set(handles.CheckFixLimits,'Value',0) 5450 5283 hother=findobj('Tag','proj_object');%find all the proj objects … … 5834 5667 AxeData=[]; 5835 5668 if isfield(UvData,'PlotAxes') 5836 AxeData=UvData.PlotAxes;% retrieve the current plotted data5669 AxeData=UvData.PlotAxes;% retrieve the current plotted data 5837 5670 end 5838 5671 PlotParam=read_GUI(handles.uvmat);
Note: See TracChangeset
for help on using the changeset viewer.