Changeset 334 for trunk/src/uvmat.m
- Timestamp:
- Dec 14, 2011, 1:33:18 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/uvmat.m
r332 r334 468 468 function display_file_name(hObject, eventdata, handles,fileinput) 469 469 %------------------------------------------------------------------------ 470 %% analyse the input file 470 471 if ~exist(fileinput,'file') 471 472 msgbox_uvmat('ERROR',['input file ' fileinput ' does not exist']) 472 473 return 473 474 end 474 [RootPath,RootFile,i1,i2,str_a,str_b,ext,NomType,SubDir]=name2display(fileinput);%extract information from the file name 475 ext_test=''; %default 476 if ~isempty(ext) % if a file extension is detected 477 form=imformats(ext(2:end));%test valid Matlab image formats 478 if ~isempty(form) 479 ext_test='.image'; 480 imainfo=imfinfo(fileinput); 481 if length(imainfo) >1 %case of image with multiple frames 482 i1='1'; % set the frame counter to 1 by default 483 i2=''; 484 str_a=''; 485 str_b=''; 486 NomType='*'; %indicate a set of indexed frames within a single file 487 [RootPath,RootFile]=fileparts(fileinput); %include the indices in the root file 488 end 489 elseif isequal(lower(ext),'.avi')%case of avi movie file 490 ext_test='.image'; 491 i1='1'; % set the frame counter to 1 by default 492 i2=''; 493 str_a=''; 494 str_b=''; 495 NomType='*'; %indicate a set of indexed frames within a single file 496 [RootPath,RootFile]=fileparts(fileinput); %include the indices in the root file 497 else 498 ext_test=lower(ext); 499 end 500 end 501 switch ext_test 502 case {'.civ','.log','.cmx','.cmx2','.txt','.bat'} %display text file 475 % detect root name, nomenclature and indices in the input file name: 476 [RootPath,SubDir,RootFile,i1,i2,j1,j2,FileExt]=fileparts_uvmat(fileinput); 477 % detect the file type, get the movie object if relevant, and look for the corresponding file series: 478 [i1_series,i2_series,j1_series,j2_series,NomType,FileType,MovieObject]=find_file_series(fileinput); 479 480 % open the file or fill the GUI uvmat according to the detected file type 481 switch FileType 482 case '' 483 msgbox_uvmat('ERROR','invalid input file type') 484 case 'txt' 503 485 edit(fileinput) 504 case ' .fig' %display matlab figure486 case 'figure' %display matlab figure 505 487 hfig=open(fileinput); 506 488 set(hfig,'WindowButtonMotionFcn','mouse_motion')%set mouse action functio 507 489 set(hfig,'WindowButtonUpFcn','mouse_up')%set mouse click action function 508 490 set(hfig,'WindowButtonUpFcn','mouse_down')%set mouse click action function 509 case {' .xml','.xls'} % edit xml or Excel files491 case {'xml','xls'} % edit xml or Excel files 510 492 editxml(fileinput); 511 case {'.avi','.image','.vol','.nc','.cdf'}493 otherwise 512 494 set(handles.RootPath,'String',RootPath); 513 495 if isequal(SubDir,'') … … 520 502 set(handles.RootFile,'String',['/' RootFile]); %display the separator 521 503 indices=fileinput(length(rootname)+1:end); 522 indices(end-length( ext)+1:end)=[]; %remove extension504 indices(end-length(FileExt)+1:end)=[]; %remove extension 523 505 set(handles.FileIndex,'String',indices); 524 506 % set(handles.FileIndex,'UserData',NomType); 525 set(handles.NomType,'String',NomType);526 set(handles.FileExt,'String', ext);507 set(handles.NomType,'String',NomType); 508 set(handles.FileExt,'String',FileExt); 527 509 % fill file index counters 528 set(handles.i1,'String', i1);529 set(handles.i2,'String', i2);530 set(handles.j1,'String', str_a);531 set(handles.j2,'String', str_b);510 set(handles.i1,'String',num2str(i1)); 511 set(handles.i2,'String',num2str(i2)); 512 set(handles.j1,'String',num2str(j1)); 513 set(handles.j2,'String',num2str(j2)); 532 514 533 515 % synchronise indices of the second input file if it exists … … 536 518 NomType_1=get(handles.NomType_1,'String'); 537 519 % NomType_1=get(handles.FileIndex_1,'UserData'); 538 FileName_1=name_generator(FileBase_1, str2double(i1),str2double(i2),FileExt_1,NomType_1,1,stra2num(str_a),stra2num(str_b),SubDir_1);520 FileName_1=name_generator(FileBase_1,i1,i2,FileExt_1,NomType_1,1,j1,j2,SubDir_1); 539 521 if exist(FileName_1,'file') 540 FileIndex_1=name_generator('', str2double(i1),str2double(i2),'',NomType_1,1,stra2num(str_a),stra2num(str_b),'');522 FileIndex_1=name_generator('',i1,i2,'',NomType_1,1,j1,j2,''); 541 523 set(handles.FileIndex_1,'String',FileIndex_1) 542 524 else … … 561 543 set(handles.ListObject,'Visible','on') 562 544 set(handles.frame_object,'Visible','on') 563 %%%%%% initiate input file: 564 update_rootinfo(hObject,eventdata,handles); 565 otherwise 566 msgbox_uvmat('ERROR',['invalid input file extension' ext]) 545 546 % initiate input file series and refresh the current field view: 547 update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,MovieObject); 567 548 end 568 549 … … 571 552 function RootPath_Callback(hObject,eventdata,handles) 572 553 %------------------------------------------------------------------------ 573 update_rootinfo(hObject,eventdata,handles); 554 % read the current input file name: 555 fileinput=read_file_boxes(handles); 556 % detect the file type, get the movie object if relevant, and look for the corresponding file series: 557 [i1_series,i2_series,j1_series,j2_series,~,FileType,MovieObject]=find_file_series(fileinput); 558 % initiate the input file series and refresh the current field view: 559 update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,MovieObject); 574 560 575 561 %------------------------------------------------------------------------ … … 579 565 %refresh the menu of input fields 580 566 Fields_Callback(hObject, eventdata, handles); 581 % refresh the current field 567 % refresh the current field view 582 568 run0_Callback(hObject, eventdata, handles); 583 569 … … 586 572 function RootFile_Callback(hObject, eventdata, handles) 587 573 %------------------------------------------------------------------------ 588 update_rootinfo(hObject,eventdata,handles)574 RootPath_Callback(hObject,eventdata,handles) 589 575 590 576 %------------------------------------------------------------------------ … … 592 578 function FileIndex_Callback(hObject, eventdata, handles) 593 579 %------------------------------------------------------------------------ 594 FileIndices=get(handles.FileIndex,'String'); 595 if isempty(str2num(FileIndices)) 596 [pp,ff,str1,str2,str_a,str_b]=name2display(FileIndices); 597 else 598 str1=FileIndices; 599 str2=''; 600 str_a=''; 601 str_b=''; 602 end 603 set(handles.i1,'String',str1); 604 set(handles.i2,'String',str2); 605 set(handles.j1,'String',str_a); 606 set(handles.j2,'String',str_b); 580 [~,~,~,i1,i2,j1,j2]=fileparts_uvmat(get(handles.FileIndex,'String')); 581 set(handles.i1,'String',num2str(i1)); 582 set(handles.i2,'String',num2str(i2)); 583 set(handles.j1,'String',num2str(j1)); 584 set(handles.j2,'String',num2str(j2)); 585 586 % refresh the current field view 607 587 run0_Callback(hObject, eventdata, handles) 608 588 … … 610 590 % --- Update information about a new field series (indices to scan, timing, 611 591 % calibration from an xml file, then refresh current plots 612 function update_rootinfo(h Object,eventdata,handles)592 function update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,MovieObject) 613 593 %------------------------------------------------------------------------ 614 594 set(handles.RootPath,'BackgroundColor',[1 1 0]) … … 618 598 UvData.NewSeries=1; %flag for run0: begin a new series 619 599 UvData.TestInputFile=1; 600 UvData.FileType=FileType; 620 601 set(handles.fix_pair,'Value',1) % activate by default the comp_input '-'input window 621 602 set(handles.FixVelType,'Value',0); %desactivate fixed veltype 622 603 [FileName,RootPath,FileBase,FileIndices,FileExt,SubDir]=read_file_boxes(handles); 604 623 605 if ~exist(FileName,'file') 624 606 msgbox_uvmat('ERROR',['input file ' FileName ' not found']); … … 626 608 end 627 609 nbfield=[];%default 628 nb urst=[];%default610 nbfield_j=[];%default 629 611 630 612 % read timing and total frame number from the current file (movie files) !! may be overrid by xml file … … 640 622 imainfo=aviinfo([FileBase FileIndices FileExt]); 641 623 nbfield=imainfo.NumFrames; 642 nb urst=1;624 nbfield_j=1; 643 625 set(handles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FramesPerSecond) 'ms']);%display the elementary time interval in millisec 644 626 XmlData.Time=(0:1/imainfo.FramesPerSecond:(imainfo.NumFrames-1)/imainfo.FramesPerSecond)'; … … 657 639 if length(imainfo) >1 %case of image with multiple frames 658 640 nbfield=length(imainfo); 659 nb urst=1;641 nbfield_j=1; 660 642 end 661 643 end … … 748 730 end 749 731 750 % store last index in handles.lat_i and .last_j 732 %% store last index in handles.lat_i and .last_j 733 nbfield=max(i2_series); 734 if isempty(nbfield) 735 nbfield=max(i1_series); 736 end 737 nbfield_j=max(j2_series); 738 if isempty(nbfield_j) 739 nbfield_j=max(j1_series); 740 end 751 741 if ~isempty(XmlData.Time) 752 742 nbfield=size(XmlData.Time,1); 753 nb urst=size(XmlData.Time,2);743 nbfield_j=size(XmlData.Time,2); 754 744 %transform .Time to a column vector if it is a line vector the nomenclature uses a single index 755 if isequal(nbfield,1) && ~isequal(nb urst,1)% .Time is a line vector745 if isequal(nbfield,1) && ~isequal(nbfield_j,1)% .Time is a line vector 756 746 NomType=get(handles.NomType,'String'); 757 747 % NomType=get(handles.FileIndex,'UserData'); 758 748 if numel(NomType)>=2 &&(strcmp(NomType,'_i')||strcmp(NomType(1:2),'%0')||strcmp(NomType(1:2),'_%')) 759 749 XmlData.Time=(XmlData.Time)'; 760 nbfield=nb urst;761 nb urst=1;750 nbfield=nbfield_j; 751 nbfield_j=1; 762 752 end 763 753 end … … 771 761 set(handles.last_i,'String',last_i_cell) 772 762 last_j_cell=get(handles.last_j,'String'); 773 if isempty(nb urst)763 if isempty(nbfield_j) 774 764 last_j_cell{1}=''; 775 765 else 776 last_j_cell{1}=num2str(nb urst);766 last_j_cell{1}=num2str(nbfield_j); 777 767 end 778 768 set(handles.last_j,'String',last_j_cell); … … 812 802 set(handles.nb_slice,'String',num2str(NbSlice)) 813 803 end 814 slices_Callback( hObject, eventdata, handles)804 slices_Callback([],[], handles) 815 805 end 816 806 end … … 824 814 UvData.XmlData=XmlData; 825 815 UvData.NewSeries=1; 826 816 UvData.MovieObject=MovieObject; 827 817 828 818 %display warning message … … 862 852 set(handles.RootPath,'BackgroundColor',[1 1 1]) 863 853 drawnow 864 set_scan_options(h Object, eventdata, handles)854 set_scan_options(handles) 865 855 866 856 %% update list of recent files in the menubar … … 886 876 %--- Set index navigation options for new series input and refresh plot 887 877 %------------------------------------------------------------------------ 888 function set_scan_options(h Object, eventdata, handles)878 function set_scan_options(handles) 889 879 890 880 % set the corresponding index navigation options … … 918 908 if isequal(scan_option,'i') 919 909 set(handles.scan_i,'Value',1) 920 scan_i_Callback( hObject, eventdata, handles);910 scan_i_Callback([],[], handles); 921 911 else 922 912 set(handles.scan_j,'Value',1) 923 scan_j_Callback( hObject, eventdata, handles);913 scan_j_Callback([],[], handles); 924 914 end 925 915 set(handles.scan_j,'Visible',state_j) … … 936 926 937 927 %% view the field 938 run0_Callback( hObject, eventdata, handles); %view field928 run0_Callback([],[], handles); %view field 939 929 mask_test=get(handles.CheckMask,'value'); 940 930 if mask_test … … 943 933 delete(MaskData.maskhandle) %delete old mask 944 934 end 945 CheckMask_Callback( hObject, eventdata,handles)935 CheckMask_Callback([],[],handles) 946 936 end 947 937 … … 1051 1041 1052 1042 %[path,name,ext]=fileparts(fileinput_1); 1053 [RootPath_1,RootFile_1,field_count,str2,str_a,str_b,FileExt_1,NomType_1,SubDir_1]=name2display(fileinput_1); 1054 nbfield_1=1; %default 1055 ext_test=FileExt_1;%default 1056 form=imformats(FileExt_1(2:end)); 1057 if ~isempty(form) % if the extension corresponds to an image format recognized by Matlab 1058 imainfo=imfinfo(fileinput_1); 1059 nbfield_1=length(imainfo); 1060 ext_test='.image'; 1061 elseif isequal(lower(FileExt_1),'.avi') 1062 info=aviinfo(fileinput_1); 1063 nbfield_1=info.NumFrames; 1064 ext_test='.image'; 1065 end 1066 1067 %open directly fig or text files 1068 switch ext_test 1069 case {'.civ','.log','.cmx','.cmx2','.txt'} %display text file 1043 [RootPath_1,SubDir_1,RootFile_1,i1,i2,j1,j2,FileExt_1]=fileparts_uvmat(fileinput_1); 1044 [i1_series,i2_series,j1_series,j2_series,NomType,FileType,MovieObject]=find_file_series(fileinput_1); 1045 % [RootPath_1,RootFile_1,field_count,str2,str_a,str_b,FileExt_1,NomType_1,SubDir_1]=name2display(fileinput_1); 1046 switch FileType 1047 case '' 1048 msgbox_uvmat('ERROR','invalid input file type') 1049 case 'txt' 1070 1050 edit(fileinput) 1071 return 1072 case '.fig' %display matlab figure 1051 case 'figure' %display matlab figure 1073 1052 hfig=open(fileinput); 1074 1053 set(hfig,'WindowButtonMotionFcn','mouse_motion')%set mouse action functio 1075 1054 set(hfig,'WindowButtonUpFcn','mouse_up')%set mouse click action function 1076 1055 set(hfig,'WindowButtonUpFcn','mouse_down')%set mouse click action function 1077 return 1078 case {'.xml','.xls'} % edit xml or Excel files 1079 heditxml=editxml(fileinput); 1080 return 1081 case {'.image','.nc','.cdf'} 1082 % set(handles.FileIndex,'UserData',NomType_1); 1056 case {'xml','xls'} % edit xml or Excel files 1057 editxml(fileinput); 1058 % case {'.avi','.image','.vol','.nc','.cdf'} 1083 1059 otherwise 1084 msgbox_uvmat(['invalid input file extension ' FileExt_1 ' for uvmat'],'ERROR') 1085 return 1086 end 1060 set(handles.RootPath,'String',RootPath); 1061 if isequal(SubDir,'') 1062 rootname=fullfile(RootPath,RootFile); 1063 else 1064 rootname=fullfile(RootPath,SubDir,RootFile); 1065 SubDir=['/' SubDir]; %display the separator 1066 end 1067 set(handles.SubDir,'String',SubDir); 1068 set(handles.RootFile,'String',['/' RootFile]); %display the separator 1069 indices=fileinput(length(rootname)+1:end); 1070 indices(end-length(FileExt)+1:end)=[]; %remove extension 1071 set(handles.FileIndex,'String',indices); 1072 % set(handles.FileIndex,'UserData',NomType); 1073 set(handles.NomType,'String',NomType); 1074 set(handles.FileExt,'String',FileExt); 1075 % fill file index counters 1076 set(handles.i1,'String',num2str(i1)); 1077 set(handles.i2,'String',num2str(i2)); 1078 set(handles.j1,'String',num2str(j1)); 1079 set(handles.j2,'String',num2str(j2)); 1080 1081 % synchronise indices of the second input file if it exists 1082 if get(handles.SubField,'Value')==1% if the subfield button is activated, update the field numbers 1083 [ff,rr,FileBase_1,ii,FileExt_1,SubDir_1]=read_file_boxes_1(handles); 1084 NomType_1=get(handles.NomType_1,'String'); 1085 % NomType_1=get(handles.FileIndex_1,'UserData'); 1086 FileName_1=name_generator(FileBase_1,i1,i2,FileExt_1,NomType_1,1,j1,j2,SubDir_1); 1087 if exist(FileName_1,'file') 1088 FileIndex_1=name_generator('',i1,i2,'',NomType_1,1,j1,j2,''); 1089 set(handles.FileIndex_1,'String',FileIndex_1) 1090 else 1091 set(handles.SubField,'Value',0) 1092 SubField_Callback(hObject, eventdata, handles) 1093 end 1094 end 1095 end 1096 % 1097 % 1098 % nbfield_1=1; %default 1099 % ext_test=FileExt_1;%default 1100 % form=imformats(FileExt_1(2:end)); 1101 % if ~isempty(form) % if the extension corresponds to an image format recognized by Matlab 1102 % imainfo=imfinfo(fileinput_1); 1103 % nbfield_1=length(imainfo); 1104 % ext_test='.image'; 1105 % elseif isequal(lower(FileExt_1),'.avi') 1106 % info=aviinfo(fileinput_1); 1107 % nbfield_1=info.NumFrames; 1108 % ext_test='.image'; 1109 % end 1110 % 1111 % %open directly fig or text files 1112 % switch ext_test 1113 % case {'.civ','.log','.cmx','.cmx2','.txt'} %display text file 1114 % edit(fileinput) 1115 % return 1116 % case '.fig' %display matlab figure 1117 % hfig=open(fileinput); 1118 % set(hfig,'WindowButtonMotionFcn','mouse_motion')%set mouse action functio 1119 % set(hfig,'WindowButtonUpFcn','mouse_up')%set mouse click action function 1120 % set(hfig,'WindowButtonUpFcn','mouse_down')%set mouse click action function 1121 % return 1122 % case {'.xml','.xls'} % edit xml or Excel files 1123 % heditxml=editxml(fileinput); 1124 % return 1125 % case {'.image','.nc','.cdf'} 1126 % % set(handles.FileIndex,'UserData',NomType_1); 1127 % otherwise 1128 % msgbox_uvmat(['invalid input file extension ' FileExt_1 ' for uvmat'],'ERROR') 1129 % return 1130 % end 1087 1131 1088 1132 % test for image series in a single file and synchronise file indices of the two series … … 1186 1230 set(handles.FixVelType,'Value',0); %desactivate fixed veltype 1187 1231 nbfield_1=[];%default 1188 nb urst_1=[];%default1232 nbfield_j_1=[];%default 1189 1233 XmlData.Time=[]; 1190 1234 XmlData.GeometryCalib=[];%default … … 1199 1243 imainfo=aviinfo([FileBase FileIndices FileExt]); 1200 1244 nbfield_1=imainfo.NumFrames; 1201 nb urst_1=1;1245 nbfield_j_1=1; 1202 1246 set(handles.Dt_txt,'String',['Dt=' num2str(1000/info.FramesPerSecond) 'ms']);%display the elementary time interval in millisec 1203 1247 time=(0:1/imainfo.FramesPerSecond:(imainfo.NumFrames-1)/imainfo.FramesPerSecond)'; … … 1214 1258 if length(imainfo) >1 %case of image with multiple frames 1215 1259 nbfield_1=length(imainfo); 1216 nb urst_1=1;1260 nbfield_j_1=1; 1217 1261 end 1218 1262 end … … 1281 1325 if ~isempty(XmlData.Time) 1282 1326 nbfield_1=size(XmlData.Time,1); 1283 nb urst_1=size(XmlData.Time,2);1327 nbfield_j_1=size(XmlData.Time,2); 1284 1328 end 1285 1329 last_i_cell=get(handles.last_i,'String'); … … 1291 1335 set(handles.last_i,'String',last_i_cell) 1292 1336 last_j_cell=get(handles.last_j,'String'); 1293 if isempty(nb urst_1)1337 if isempty(nbfield_j_1) 1294 1338 last_j_cell{2}=''; 1295 1339 else 1296 last_j_cell{2}=num2str(nb urst_1);1340 last_j_cell{2}=num2str(nbfield_j_1); 1297 1341 end 1298 1342 set(handles.last_j,'String',last_j_cell); … … 1332 1376 drawnow 1333 1377 1334 set_scan_options(h Object, eventdata, handles)1378 set_scan_options(handles) 1335 1379 1336 1380 %------------------------------------------------------------------------ … … 1386 1430 set(handles.FileIndex,'BackgroundColor',[0.7 0.7 0.7]) 1387 1431 if get(handles.SubField,'Value')==1 1388 NomType_1=get(handles. FileIndex_1,'String');1389 FileExt_1=get(handles.FileExt_1,'String');1390 [P,F,str1,str2,str_a,str_b,Ext,NomType_1]=name2display(['xx' NomType_1 FileExt_1]);1432 NomType_1=get(handles.NomType_1,'String'); 1433 % FileExt_1=get(handles.FileExt_1,'String'); 1434 % [P,F,str1,str2,str_a,str_b,Ext,NomType_1]=name2display(['xx' NomType_1 FileExt_1]); 1391 1435 indices=name_generator('',num1,num_a,'',NomType_1,1,num2,num_b,''); 1392 1436 set(handles.FileIndex_1,'String',indices) … … 1478 1522 for ilist=1:length(maskfiles) 1479 1523 maskname=maskfiles(ilist).name;% take the first mask file in the list 1480 [rr,ff,x1,x2,xa,xb,xext,Mask_NomType{ilist}]=name2display(maskname); 1481 [Path2,Name,ext]=fileparts(maskname); 1524 [~,~,~,~,~,~,~,MaskExt,Mask_NomType{ilist}]=fileparts_uvmat(maskname); 1525 % [rr,ff,x1,x2,xa,xb,xext,Mask_NomType{ilist}]=name2display(maskname); 1526 [~,Name]=fileparts(maskname); 1482 1527 Namedouble=double(Name); 1483 1528 val=(48>Namedouble)|(Namedouble>57);% select the non-numerical characters … … 1528 1573 errormsg='no file browsed'; 1529 1574 end 1530 [RootDir,RootFile,x1,x2,xa,xb,xext,Mask.NomType]=name2display(maskname); 1575 [RootDir,~,RootFile,~,~,~,~,~,Mask.NomType]=fileparts_uvmat(maskname); 1576 % [RootDir,RootFile,x1,x2,xa,xb,xext,Mask.NomType]=name2display(maskname); 1531 1577 Mask.Base=fullfile(RootDir,RootFile); 1532 1578 Mask.NbSlice=1; … … 1796 1842 if sub_value % a second input file has been entered 1797 1843 [FileName_1,RootPath_1,filebase_1,FileIndices_1,FileExt_1,SubDir_1]=read_file_boxes_1(handles); 1798 [pp,ff,i1_1_str,i2_1_str,j1_1_str,j2_1_str]=name2display(FileIndices_1); 1799 i1_1=stra2num(i1_1_str);%current set of indices for the second field (may be set different than the main indices) 1800 i2_1=stra2num(i2_1_str); 1801 j1_1=stra2num(j1_1_str); 1802 j2_1=stra2num(j2_1_str); 1844 [~,~,~,i1_1,i2_1,j1_1,j2_1]=fileparts_uvmat(FileIndices_1); 1845 % [pp,ff,i1_1_str,i2_1_str,j1_1_str,j2_1_str]=name2display(FileIndices_1); 1846 % i1_1=stra2num(i1_1_str);%current set of indices for the second field (may be set different than the main indices) 1847 % i2_1=stra2num(i2_1_str); 1848 % j1_1=stra2num(j1_1_str); 1849 % j2_1=stra2num(j2_1_str); 1803 1850 NomType_1=get(handles.NomType_1,'String'); 1804 1851 % NomType_1=get(handles.FileIndex_1,'UserData'); … … 2090 2137 VelType=[];%default 2091 2138 Ext=get(handles.FileExt,'String'); 2092 if strcmp(Ext,'.nc')||strcmp(Ext,'.cdf') 2093 FileType='netcdf'; 2094 list_fields=get(handles.Fields,'String');% list menu fields 2095 index_fields=get(handles.Fields,'Value');% selected string index 2096 FieldName= list_fields{index_fields}; % selected field 2097 if ~strcmp(FieldName,'get_field...') 2098 TestVelType=get(handles.FixVelType,'Value'); 2099 if TestVelType 2100 VelType=setfield(handles);% read the velocity type. 2101 end 2102 end 2103 if strcmp(FieldName,'velocity') 2104 list_code=get(handles.ListColorCode,'String');% list menu fields 2105 index_code=get(handles.ListColorCode,'Value');% selected string index 2106 if ~strcmp(list_code{index_code},'black') && ~strcmp(list_code{index_code},'white') 2107 list_code=get(handles.ListColorScalar,'String');% list menu fields 2108 index_code=get(handles.ListColorScalar,'Value');% selected string index 2109 ParamIn.ColorVar= list_code{index_code}; % selected field 2139 FileType=UvData.FileType; 2140 switch FileType 2141 % if strcmp(Ext,'.nc')||strcmp(Ext,'.cdf') 2142 case {'civx','civdata','netcdf'}; 2143 list_fields=get(handles.Fields,'String');% list menu fields 2144 index_fields=get(handles.Fields,'Value');% selected string index 2145 FieldName= list_fields{index_fields}; % selected field 2146 if ~strcmp(FieldName,'get_field...') 2147 TestVelType=get(handles.FixVelType,'Value'); 2148 if TestVelType 2149 VelType=setfield(handles);% read the velocity type. 2150 end 2110 2151 end 2111 end 2112 elseif isfield(UvData,'MovieObject') 2113 ObjectName=UvData.MovieObject; 2114 FileType='movie'; 2115 elseif isequal(lower(Ext),'.avi') 2116 FileType='avi'; 2117 elseif isequal(lower(Ext),'.vol') 2118 FileType='vol'; 2119 if isfield(UvData.XmlData,'Npy') && isfield(UvData.XmlData,'Npx') 2120 ParamIn.Npy=UvData.XmlData.Npy; 2121 ParamIn.Npx=UvData.XmlData.Npx; 2122 else 2123 errormsg='Npx and Npy need to be defined in the xml file for volume images .vol'; 2124 return 2125 end 2126 else 2127 form=imformats(Ext(2:end)); 2128 if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab 2129 if isequal(NomType,'*'); 2130 FileType='multimage'; 2131 else 2132 FileType='image'; 2133 end 2134 end 2152 if strcmp(FieldName,'velocity') 2153 list_code=get(handles.ListColorCode,'String');% list menu fields 2154 index_code=get(handles.ListColorCode,'Value');% selected string index 2155 if ~strcmp(list_code{index_code},'black') && ~strcmp(list_code{index_code},'white') 2156 list_code=get(handles.ListColorScalar,'String');% list menu fields 2157 index_code=get(handles.ListColorScalar,'Value');% selected string index 2158 ParamIn.ColorVar= list_code{index_code}; % selected field 2159 end 2160 end 2161 case 'video' 2162 ObjectName=UvData.MovieObject; 2163 2164 case 'vol' %TODO: update 2165 if isfield(UvData.XmlData,'Npy') && isfield(UvData.XmlData,'Npx') 2166 ParamIn.Npy=UvData.XmlData.Npy; 2167 ParamIn.Npx=UvData.XmlData.Npx; 2168 else 2169 errormsg='Npx and Npy need to be defined in the xml file for volume images .vol'; 2170 return 2171 end 2135 2172 end 2136 2173 ParamIn.FieldName=FieldName; … … 2578 2615 %PlotParam{1}=read_plot_param(handles);%read plotting parameters on the uvmat interfac 2579 2616 PlotParam{1}=read_GUI(handles.uvmat); 2617 PlotParam{1}.Coordinates 2580 2618 if ~isfield(PlotParam{1},'Vectors') 2581 2619 PlotParam{1}.Vectors.MaxVec=1; … … 2784 2822 end 2785 2823 if isfield(UvData,'XmlData_1') && isfield(UvData.XmlData_1,'Time') 2786 [ P,F,str1,str2,str_a,str_b,E]=name2display(['xx' get(handles.FileIndex_1,'String') get(handles.FileExt_1,'String')]);2787 num_i2=str2double(str2);2788 if is nan(num_i2)2824 [~,~,~,num_i1,num_i2,num_j1,num_j2]=fileparts_uvmat(['xx' get(handles.FileIndex_1,'String') get(handles.FileExt_1,'String')]); 2825 % [P,F,str1,str2,str_a,str_b,E]=name2display(['xx' get(handles.FileIndex_1,'String') get(handles.FileExt_1,'String')]); 2826 if isempty(num_i2) 2789 2827 num_i2=num_i1; 2790 2828 end 2791 num_j1=str2double(str_a); 2792 if isnan(num_j1) 2829 if isempty(num_j1) 2793 2830 num_j1=1; 2794 2831 end 2795 num_j2=str2double(str_b); 2796 if isnan(num_j2) 2832 if isempty(num_j2) 2797 2833 num_j2=num_j1; 2798 2834 end 2799 num_i1=str2double(str1);2800 2835 siz=size(UvData.XmlData_1.Time); 2801 2836 if siz(1)>=max(num_i1,num_i2) && siz(2)>=max(num_j1,num_j2) … … 3146 3181 %read the rootfile input display 3147 3182 [FileName,RootPath,FileBase,FileIndices,FileExt]=read_file_boxes(handles); 3148 [P,F,str1,str2,str_a,str_b,E,NomType]=name2display(['xxx' get(handles.FileIndex,'String') FileExt]); 3183 [~,~,~,i1,i2,j1,j2,~,NomType]=fileparts_uvmat(['xxx' get(handles.FileIndex,'String') FileExt]); 3184 % [P,F,str1,str2,str_a,str_b,E,NomType]=name2display(['xxx' get(handles.FileIndex,'String') FileExt]); 3149 3185 NomTypeNew=NomType;%default 3150 3186 if isequal(field,'image') … … 3156 3192 NomTypeNew='_1'; 3157 3193 end 3158 imagename=name_generator(FileBase, str2double(str1),str2double(str_a),'.png',NomTypeNew,1,str2double(str2),str2double(str_b),'');3194 imagename=name_generator(FileBase,i1,j1,'.png',NomTypeNew,1,i2,j2,''); 3159 3195 if ~exist(imagename,'file') 3160 3196 [FileName,PathName] = uigetfile( ... … … 3186 3222 end 3187 3223 end 3188 indices=name_generator('', str2double(str1),str2double(str_a),'',NomTypeNew,1,str2double(str2),str2double(str_b),'');3224 indices=name_generator('',i1,j1,'',NomTypeNew,1,i2,j2,''); 3189 3225 set(handles.FileIndex,'String',indices) 3190 3226 set(handles.NomType,'String',NomTypeNew) … … 3226 3262 %read the rootfile input display 3227 3263 [FileName,RootPath,FileBase,FileIndices,FileExt_1]=read_file_boxes_1(handles); 3228 [P,F,str1,str2,str_a,str_b,E,NomType_1]=name2display(['xxx' get(handles.FileIndex,'String') FileExt_1]); 3264 [~,~,~,i1,i2,j1,j2,~,NomType_1]=fileparts_uvmat(['xxx' get(handles.FileIndex,'String') FileExt_1]); 3265 % [P,F,str1,str2,str_a,str_b,E,NomType_1]=name2display(['xxx' get(handles.FileIndex,'String') FileExt_1]); 3229 3266 if isempty(NomType_1)|| strcmp(NomType_1,'') 3230 3267 [FileName,RootPath,FileBase,FileIndices,FileExt_1]=read_file_boxes(handles); 3231 [P,F,str1,str2,str_a,str_b,E,NomType_1]=name2display(['xxx' get(handles.FileIndex,'String') FileExt_1]); 3268 [~,~,~,i1,i2,j1,j2,~,NomType_1]=fileparts_uvmat(['xxx' get(handles.FileIndex,'String') FileExt_1]); 3269 % [P,F,str1,str2,str_a,str_b,E,NomType_1]=name2display(['xxx' get(handles.FileIndex,'String') FileExt_1]); 3232 3270 end 3233 3271 NomTypeNew=NomType_1;%default … … 3280 3318 end 3281 3319 end 3282 imagename=name_generator(FileBase, str2double(str1),str2double(str_a),'.png',NomTypeNew,1,str2double(str2),str2double(str_b),'');3320 imagename=name_generator(FileBase,i1,j1,'.png',NomTypeNew,1,i2,j2,''); 3283 3321 if ~exist(imagename,'file') 3284 3322 [FileName,PathName] = uigetfile( ...
Note: See TracChangeset
for help on using the changeset viewer.