Changeset 1040 for trunk/src/uvmat.m
- Timestamp:
- May 4, 2018, 10:57:13 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/uvmat.m
r1033 r1040 3167 3167 %% read the second field 3168 3168 if isempty(UvData.MovieObject) 3169 [Field_b,ParamOut,errormsg] = read_field(imaname_1,UvData.File Type{index},[],num_frame);3170 else 3171 [Field_b,ParamOut,errormsg] = read_field(imaname_1,UvData.File Type{1},UvData.MovieObject{1},num_frame);3169 [Field_b,ParamOut,errormsg] = read_field(imaname_1,UvData.FileInfo{index}.FileType,[],num_frame); 3170 else 3171 [Field_b,ParamOut,errormsg] = read_field(imaname_1,UvData.FileInfo{1}.FileType,UvData.MovieObject{1},num_frame); 3172 3172 end 3173 3173 if ~isempty(errormsg) … … 3304 3304 %% test for need of tps 3305 3305 check_proj_tps=0; 3306 if (strcmp(UvData.File Type{1},'civdata')||strcmp(UvData.FileType{1},'civx'))3306 if (strcmp(UvData.FileInfo{1}.FileType,'civdata')||strcmp(UvData.FileInfo{1}.FileType,'civx')) 3307 3307 for iobj=1:numel(UvData.ProjObject) 3308 3308 if isfield(UvData.ProjObject{iobj},'ProjMode')&& strcmp(UvData.ProjObject{iobj}.ProjMode,'interp_tps') … … 3318 3318 FieldName='';%default 3319 3319 VelType='';%default 3320 switch UvData.FileType{1} 3320 if strcmp(UvData.FileInfo{1}.FieldType,'image') 3321 FieldName='image'; 3322 frame_index=1;%default 3323 if UvData.FileInfo{1}.NumberOfFrames>1 3324 if strcmp(NomType,'*') 3325 if num_i1>UvData.FileInfo{1}.NumberOfFrames 3326 errormsg='specified frame index exceeds file content'; 3327 return 3328 else 3329 frame_index=num_i1;%frame index from a single movies or multimage 3330 end 3331 else 3332 if num_j1>UvData.FileInfo{1}.NumberOfFrames 3333 errormsg='specified frame index exceeds file content'; 3334 return 3335 else 3336 frame_index=num_j1;% frame index from a set of indexed movies 3337 end 3338 end 3339 end 3340 if isfield(UvData,'MovieObject') 3341 ParamIn=UvData.MovieObject{1}; 3342 end 3343 end 3344 switch UvData.FileInfo{1}.FileType 3321 3345 case {'civx','civdata','netcdf','pivdata_fluidimage'}; 3322 3346 list_fields=get(handles.FieldName,'String');% list menu fields … … 3338 3362 end 3339 3363 end 3340 case {'video','mmreader','rdvision','cine_phantom'}3341 FieldName='image';3342 ParamIn=UvData.MovieObject{1}; % movie object3343 if strcmp(NomType,'*')3344 frame_index=num_i1;%frame index from a single movies or multimage3345 else3346 frame_index=num_j1;% frame index from a set of indexed movies3347 end3348 if isempty(frame_index)3349 frame_index=1;3350 end3351 case 'multimage'3352 FieldName='image';3353 if ~strcmp(NomType,'*')3354 MaxIndex_j_cell=get(handles.MaxIndex_j,'String');3355 if num_j1>str2num(MaxIndex_j_cell{1})3356 errormsg='specified frame index exceeds file content';3357 return3358 else3359 frame_index=num_j1;%frame index for movies or multimage3360 end3361 else3362 MaxIndex_i_cell=get(handles.MaxIndex_i,'String');3363 if num_i1>str2num(MaxIndex_i_cell{1})3364 errormsg='specified frame index exceeds file content';3365 return3366 else3367 frame_index=num_i1;3368 end3369 end3370 3364 case 'vol' %TODO: update 3371 3365 if isfield(UvData.XmlData,'Npy') && isfield(UvData.XmlData,'Npx') … … 3376 3370 return 3377 3371 end 3378 case {'image','image_DaVis'}3379 FieldName='image';3380 frame_index=num_j1;%frame index for image pairs3381 3372 end 3382 3373 if isstruct (ParamIn) … … 3399 3390 end 3400 3391 3401 [Field{1},ParamOut,errormsg] = read_field(FileName,UvData.File Type{1},ParamIn,frame_index);3392 [Field{1},ParamOut,errormsg] = read_field(FileName,UvData.FileInfo{1}.FileType,ParamIn,frame_index); 3402 3393 if ~isempty(errormsg) 3403 3394 errormsg=['uvmat / refresh_field / read_field( ' FileName ') / ' errormsg]; … … 3411 3402 3412 3403 %% choose and read a second field FileName_1 if defined 3413 VelType_1=[];%default3414 FieldName_1=[];3415 ParamIn_1=[];3416 3404 ParamOut_1=[]; 3417 frame_index_1=1; 3418 if ~isempty(FileName_1) 3419 if ~exist(FileName_1,'file') 3420 errormsg=['second file ' FileName_1 ' does not exist']; 3421 return 3422 end 3423 switch UvData.FileType{2} 3424 case {'civx','civdata','netcdf'}; 3405 if numel(UvData.FileInfo)>1 3406 VelType_1=[];%default 3407 FieldName_1=[]; 3408 ParamIn_1=[]; 3409 3410 frame_index_1=1; 3411 if ~isempty(FileName_1) 3412 if ~exist(FileName_1,'file') 3413 errormsg=['second file ' FileName_1 ' does not exist']; 3414 return 3415 end 3416 end 3417 if isequal(get(handles.NomType_1,'Visible'),'on') 3418 NomType_1=get(handles.NomType_1,'String'); 3419 else 3420 NomType_1=get(handles.NomType,'String'); 3421 end 3422 if strcmp(UvData.FileInfo{2}.FieldType,'image') 3423 FieldName_1='image'; 3424 frame_index_1=1;%default 3425 if UvData.FileInfo{2}.NumberOfFrames>1 3426 if strcmp(NomType_1,'*') 3427 if num_i1>UvData.FileInfo{2}.NumberOfFrames 3428 errormsg='specified frame index exceeds file content'; 3429 return 3430 else 3431 frame_index_1=num_i1;%frame index from a single movies or multimage 3432 end 3433 else 3434 if num_j1>UvData.FileInfo{2}.NumberOfFrames 3435 errormsg='specified frame index exceeds file content'; 3436 return 3437 else 3438 frame_index_1=num_j1;% frame index from a set of indexed movies 3439 end 3440 end 3441 end 3442 if isfield(UvData,'MovieObject') 3443 ParamIn_1=UvData.MovieObject{2}; 3444 end 3445 end 3446 switch UvData.FileInfo{2}.FileType 3447 case {'civx','civdata','netcdf','pivdata_fluidimage'}; 3425 3448 list_fields=get(handles.FieldName_1,'String');% list menu fields 3426 if ischar(list_fields),list_fields={list_fields};end3427 3449 FieldName_1= list_fields{get(handles.FieldName_1,'Value')}; % selected field 3428 3450 if ~strcmp(FieldName_1,'get_field...') 3429 3451 if get(handles.FixVelType,'Value') 3430 3452 VelTypeList=get(handles.VelType_1,'String'); 3431 VelType_1=VelTypeList{get(handles.VelType_1,'Value')}; % read the velocity type.3453 VelType_1=VelTypeList{get(handles.VelType_1,'Value')}; 3432 3454 end 3433 3455 end 3434 if isempty(FieldName_1) 3435 FieldName_1=FieldName;% if blank reproduce the field name of the first field 3436 end 3437 if ~isempty(regexp(FieldName_1,'^vel', 'once'))&& strcmp(get(handles.ColorCode,'Visible'),'on') 3456 % case of input vector field, get the scalar used for vector color 3457 if ~isempty(regexp(FieldName_1,'^vec(')) 3438 3458 list_code=get(handles.ColorCode,'String');% list menu fields 3439 3459 index_code=get(handles.ColorCode,'Value');% selected string index … … 3441 3461 list_code=get(handles.ColorScalar,'String');% list menu fields 3442 3462 index_code=get(handles.ColorScalar,'Value');% selected string index 3443 ParamIn_1.ColorVar= list_code{index_code}; % selected field for vector color display3463 ParamIn_1.ColorVar= list_code{index_code}; % selected field 3444 3464 end 3445 end3446 case {'video','mmreader','cine_phantom'}3447 ParamIn_1=UvData.MovieObject{2};3448 if ~strcmp(NomType_1,'*')3449 frame_index_1=j1_1;%frame index for movies or multimage3450 else3451 frame_index_1=i1_1;3452 end3453 case 'multimage'3454 if strcmp(NomType_1,'*')%frame index for movies or multimage3455 frame_index_1=i1_1;3456 else3457 frame_index_1=j1_1;3458 3465 end 3459 3466 case 'vol' %TODO: update … … 3466 3473 end 3467 3474 end 3468 if isequal(get(handles.NomType_1,'Visible'),'on') 3469 NomType_1=get(handles.NomType_1,'String'); 3470 else 3471 NomType_1=get(handles.NomType,'String'); 3472 end 3475 % switch UvData.FileType{2} 3476 % case {'civx','civdata','netcdf'}; 3477 % list_fields=get(handles.FieldName_1,'String');% list menu fields 3478 % if ischar(list_fields),list_fields={list_fields};end 3479 % FieldName_1= list_fields{get(handles.FieldName_1,'Value')}; % selected field 3480 % if ~strcmp(FieldName_1,'get_field...') 3481 % if get(handles.FixVelType,'Value') 3482 % VelTypeList=get(handles.VelType_1,'String'); 3483 % VelType_1=VelTypeList{get(handles.VelType_1,'Value')};% read the velocity type. 3484 % end 3485 % end 3486 % if isempty(FieldName_1) 3487 % FieldName_1=FieldName;% if blank reproduce the field name of the first field 3488 % end 3489 % if ~isempty(regexp(FieldName_1,'^vel', 'once'))&& strcmp(get(handles.ColorCode,'Visible'),'on') 3490 % list_code=get(handles.ColorCode,'String');% list menu fields 3491 % index_code=get(handles.ColorCode,'Value');% selected string index 3492 % if ~strcmp(list_code{index_code},'black') && ~strcmp(list_code{index_code},'white') 3493 % list_code=get(handles.ColorScalar,'String');% list menu fields 3494 % index_code=get(handles.ColorScalar,'Value');% selected string index 3495 % ParamIn_1.ColorVar= list_code{index_code}; % selected field for vector color display 3496 % end 3497 % end 3498 % case {'video','mmreader','cine_phantom'} 3499 % ParamIn_1=UvData.MovieObject{2}; 3500 % if ~strcmp(NomType_1,'*') 3501 % frame_index_1=j1_1;%frame index for movies or multimage 3502 % else 3503 % frame_index_1=i1_1; 3504 % end 3505 % case 'multimage' 3506 % if strcmp(NomType_1,'*')%frame index for movies or multimage 3507 % frame_index_1=i1_1; 3508 % else 3509 % frame_index_1=j1_1; 3510 % end 3511 % case 'vol' %TODO: update 3512 % if isfield(UvData.XmlData,'Npy') && isfield(UvData.XmlData,'Npx') 3513 % ParamIn_1.Npy=UvData.XmlData.Npy; 3514 % ParamIn_1.Npx=UvData.XmlData.Npx; 3515 % else 3516 % errormsg='Npx and Npy need to be defined in the xml file for volume images .vol'; 3517 % return 3518 % end 3519 % end 3520 3473 3521 test_keepdata_1=0;% test for keeping the previous stored data if the input files are unchanged 3474 % if ~isequal(NomType_1,'*')&& isfield(UvData,'FileName_1')3475 % test_keepdata_1= strcmp(FileName_1,UvData.FileName_1) ;3476 % end3477 3522 if test_keepdata_1 3478 3523 Field{2}=UvData.Field_1;% keep the stored field … … 3480 3525 else 3481 3526 if isempty(ParamIn_1) || isstruct(ParamIn_1) 3482 ParamIn_1.FieldName=FieldName_1;3483 ParamIn_1.VelType=VelType_1;3484 ParamIn_1.Coord_x=get(handles.Coord_x,'String');3485 ParamIn_1.Coord_y=get(handles.Coord_y,'String');3527 ParamIn_1.FieldName=FieldName_1; 3528 ParamIn_1.VelType=VelType_1; 3529 ParamIn_1.Coord_x=get(handles.Coord_x,'String'); 3530 ParamIn_1.Coord_y=get(handles.Coord_y,'String'); 3486 3531 end 3487 3532 [Field{2},ParamOut_1,errormsg] = read_field(FileName_1,UvData.FileType{2},ParamIn_1,frame_index_1); … … 3510 3555 %% update the display menu for the first velocity type (first menuline) 3511 3556 test_veltype=0; 3512 if (strcmp(UvData.File Type{1},'civx')||strcmp(UvData.FileType{1},'civdata')||strcmp(UvData.FileType{1},'pivdata_fluidimage'))...3557 if (strcmp(UvData.FileInfo{1}.FileType,'civx')||strcmp(UvData.FileInfo{1}.FileType,'civdata')||strcmp(UvData.FileInfo{1}.FileType,'pivdata_fluidimage'))... 3513 3558 && ~strcmp(FieldName,'get_field...') 3514 3559 test_veltype=1; … … 3516 3561 set(handles.VelType_1,'Visible','on') 3517 3562 set(handles.FixVelType,'Visible','on') 3518 menu=set_veltype_display(ParamOut.CivStage,UvData.File Type{1});3563 menu=set_veltype_display(ParamOut.CivStage,UvData.FileInfo{1}.FileType); 3519 3564 index_menu=strcmp(ParamOut.VelType,menu);%look for VelType in the menu 3520 3565 index_val=find(index_menu,1); … … 3536 3581 if isempty(FileName_1) 3537 3582 elseif ~test_keepdata_1 3538 if (strcmp(UvData.FileType{2},'civx')||strcmp(UvData.FileType{2},'civdata')||strcmp(UvData.File Type{1},'pivdata_fluidimage'))...3583 if (strcmp(UvData.FileType{2},'civx')||strcmp(UvData.FileType{2},'civdata')||strcmp(UvData.FileInfo{1}.FileType,'pivdata_fluidimage'))... 3539 3584 && ~strcmp(FieldName_1,'get_field...') 3540 3585 test_veltype_1=1; … … 4514 4559 set(handles.ColorScalar,'Value',1) 4515 4560 set(handles.ColorScalar,'String',VecColorList); 4516 UvData.File Type{1}='netcdf';4561 UvData.FileInfo{1}.FileType='netcdf'; 4517 4562 set(handles.uvmat,'UserData',UvData) 4518 4563 REFRESH_Callback(hObject, eventdata, handles) … … 4711 4756 set(handles.FileExt_1,'String',get(handles.FileExt,'String')) 4712 4757 4713 UvData.FileType{2}=UvData.File Type{1};4758 UvData.FileType{2}=UvData.FileInfo{1}.FileType; 4714 4759 UvData.XmlData{2}= UvData.XmlData{1}; 4715 4760 transform=get(handles.TransformPath,'UserData'); … … 4812 4857 else% we introduce the same file (with a different field) for the second series 4813 4858 FileName_1=FileName;% we compare two fields in the same file 4814 UvData.FileType{2}=UvData.File Type{1};4859 UvData.FileType{2}=UvData.FileInfo{1}.FileType; 4815 4860 UvData.XmlData{2}= UvData.XmlData{1}; 4816 4861 set(handles.SubField,'Value',1)
Note: See TracChangeset
for help on using the changeset viewer.