Changeset 620
- Timestamp:
- Apr 25, 2013, 10:25:20 PM (12 years ago)
- Location:
- trunk/src
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/read_multimadoc.m
r617 r620 1 %'read_multimadoc': read a set of Imadoc files and compare their timing of different file series1 %'read_multimadoc': read a set of Imadoc files for different file series and compare their timing 2 2 %------------------------------------------------------------------------ 3 % [XmlData,NbSlice_calib,time, errormsg]=read_multimadoc(RootPath,SubDir,RootFile,FileExt,i1_series,i2_series,j1_series,j2_series)3 % [XmlData,NbSlice_calib,time,warnmsg]=read_multimadoc(RootPath,SubDir,RootFile,FileExt,i1_series,i2_series,j1_series,j2_series) 4 4 % 5 5 % OUTPUT: 6 % XmlData : cell array of structure representing the contents of the xml files6 % XmlData(iview): cell array of structures representing the contents of the xml files, iview =index of the input file series 7 7 % NbSlice_calib: nbre of slices detected in the geometric calibration data 8 % mtrix of times9 % errormsg: error message, ='' if readingOK8 % Time(iview,i,j): matrix of times, iview =index of the series, i,j=file indices within the series 9 % warnmsg: warning message, ='' if OK 10 10 % 11 11 % INPUT: 12 12 % RootPath,SubDir,RootFile,FileExt: cell arrays characterizing the input file series 13 % i1_series,i2_series,j1_series,j2_series: cell arrays of file index 14 % arrays, as given by the fct uvmat/get_file_series 13 % i1_series,i2_series,j1_series,j2_series: cell arrays of file index arrays, as given by the fct uvmat/get_file_series 15 14 % 16 function [XmlData,NbSlice_calib, time,errormsg]=read_multimadoc(RootPath,SubDir,RootFile,FileExt,i1_series,i2_series,j1_series,j2_series)17 errormsg='';15 function [XmlData,NbSlice_calib,Time,warnmsg]=read_multimadoc(RootPath,SubDir,RootFile,FileExt,i1_series,i2_series,j1_series,j2_series) 16 warnmsg=''; 18 17 if ischar(RootPath) 19 18 RootPath={RootPath};SubDir={SubDir};RootFile={RootFile};FileExt={FileExt}; … … 26 25 XmlFileName=find_imadoc(RootPath{iview},SubDir{iview},RootFile{iview},FileExt{iview}); 27 26 if ~isempty(XmlFileName) 28 [XmlData{iview},errormsg]=imadoc2struct(XmlFileName);% read the ImaDoc xml file 29 if ~isempty(errormsg) 30 return 31 end 27 [XmlData{iview},warnmsg]=imadoc2struct(XmlFileName);% read the ImaDoc xml file 32 28 end 33 29 if isfield(XmlData{iview},'Time') … … 37 33 NbSlice_calib{iview}=size(XmlData{iview}.GeometryCalib.SliceCoord,1);%nbre of slices for Zindex in phys transform 38 34 if ~isequal(NbSlice_calib{iview},NbSlice_calib{1}) 39 msgbox_uvmat('WARNING','inconsistent number of Z indices for the two field series');35 warnmsg='inconsistent number of Z indices in field series'; 40 36 end 41 37 end … … 44 40 %% check coincidence in time for several input file series 45 41 if isempty(timecell) 46 time=[];42 Time=[]; 47 43 else 48 time=get_time(timecell{1},i1_series{1},i2_series{1},j1_series{1},j2_series{1});44 Time=get_time(timecell{1},i1_series{1},i2_series{1},j1_series{1},j2_series{1}); 49 45 end 50 46 if nbview>1 51 time=shiftdim(time,-1); % add a singleton dimension for nbview47 Time=shiftdim(Time,-1); % add a singleton dimension for nbview 52 48 for icell=2:nbview 53 49 if isequal(size(timecell{icell}),size(timecell{1})) 54 50 time_line=get_time(timecell{icell},i1_series{icell},i2_series{icell},j1_series{icell},j2_series{icell}); 55 time=cat(1,time,shiftdim(time_line,-1));51 Time=cat(1,Time,shiftdim(time_line,-1)); 56 52 else 57 53 msgbox_uvmat('WARNING','inconsistent time array dimensions in ImaDoc fields, the time for the first series is used') 58 time=cat(1,time,time(icell-1,:,:));54 Time=cat(1,Time,Time(1,:,:));% copy times of the first line 59 55 break 60 56 end -
trunk/src/series.m
r615 r620 67 67 68 68 %% initial settings 69 % position and size of the GUI at opening 69 70 set(0,'Unit','points') 70 ScreenSize=get(0,'ScreenSize');%size of the current screen 71 ScreenSize=get(0,'ScreenSize');%size of the current screen, in points (1/72 inch) 71 72 Width=900;% prefered width of the GUI in points (1/72 inch) 72 Height=624; 73 Height=624;% prefered height of the GUI in points (1/72 inch) 73 74 %adjust to screen size (reduced by a min margin) 74 75 RescaleFactor=min((ScreenSize(3)-80)/Width,(ScreenSize(4)-80)/Height); … … 82 83 LowY=round(ScreenSize(4)/2-Height/2); % put at the middle height on the screen 83 84 set(hObject,'Units','points') 84 set(hObject,'Position',[LeftX LowY Width Height]) 85 set(hObject,'Position',[LeftX LowY Width Height])% position and size of the GUI at opening 86 87 % settings of table MinIndex_j 88 set(handles.MinIndex_i,'ColumnFormat',{'numeric'}) 89 set(handles.MinIndex_i,'ColumnEditable',false) 90 set(handles.MinIndex_i,'ColumnName',{'i min'}) 91 92 % settings of table MinIndex_j 93 set(handles.MinIndex_j,'ColumnFormat',{'numeric'}) 94 set(handles.MinIndex_j,'ColumnEditable',false) 95 set(handles.MinIndex_j,'ColumnName',{'j min'}) 96 97 % settings of table MaxIndex_i 98 set(handles.MaxIndex_i,'ColumnFormat',{'numeric'}) 99 set(handles.MaxIndex_i,'ColumnEditable',false) 100 set(handles.MaxIndex_i,'ColumnName',{'i max'}) 101 102 % settings of table MaxIndex_j 103 set(handles.MaxIndex_j,'ColumnFormat',{'numeric'}) 104 set(handles.MaxIndex_j,'ColumnEditable',false) 105 set(handles.MaxIndex_j,'ColumnName',{'j max'}) 106 107 % settings of table PairString 85 108 set(handles.PairString,'ColumnName',{'pairs'}) 86 109 set(handles.PairString,'ColumnEditable',false) 87 110 set(handles.PairString,'ColumnFormat',{'char'}) 88 111 set(handles.PairString,'Data',{''}) 112 89 113 series_ResizeFcn(hObject, eventdata, handles)%resize table according to series GUI size 90 114 set(hObject,'WindowButtonDownFcn',{'mouse_down'})%allows mouse action with right button (zoom for uicontrol display) 115 91 116 % check default input data 92 117 if ~exist('Param','var') … … 237 262 set(handles.InputTable,'Data',InputTable) 238 263 if isfield(Param,'FileName_1') 239 display_file_name(handles,Param.FileName _1,0)240 display_file_name(handles,Param.FileName ,1)264 display_file_name(handles,Param.FileName,'one')%refresh the input table 265 display_file_name(handles,Param.FileName_1,1) 241 266 else 242 display_file_name(handles,Param.FileName, 0)267 display_file_name(handles,Param.FileName,'one')%refresh the input table 243 268 end 244 269 end … … 289 314 end 290 315 end 291 fileinput=uigetfile_uvmat(' file browser',oldfile);316 fileinput=uigetfile_uvmat('pick a file to refresh the input table',oldfile); 292 317 if ~isempty(fileinput) 293 display_file_name(handles,fileinput,0) 294 end 295 % 296 % [FileName, PathName] = uigetfile( ... 297 % {'*.xml;*.xls;*.png;*.tif;*.avi;*.AVI;*.nc', ' (*.xml,*.xls, *.png,*.tif, *.avi,*.nc)'; 298 % '*.xml', '.xml files '; ... 299 % '*.xls', '.xls files '; ... 300 % '*.png','.png image files'; ... 301 % '*.tif','.tif image files'; ... 302 % '*.avi;*.AVI','.avi movie files'; ... 303 % '*.nc','.netcdf files'; ... 304 % '*.*', 'All Files (*.*)'}, ... 305 % 'Pick a file',oldfile); 306 % fileinput=[PathName FileName];%complete file name 307 % [path,name,ext]=fileparts(fileinput); 308 % if isequal(ext,'.xml') 309 % [Param,Heading]=xml2struct(fileinput); 310 % if ~strcmp(Heading,'Series') 311 % msg_box_uvmat('ERROR','xml file heading is not <Series>') 312 % else 313 % fill_GUI(Param,handles.series);%fill the GUI with the parameters retrieved from the xml file 314 % if isfield(Param,'CheckObject')&& Param.CheckObject 315 % set_object(Param.ProjObject) 316 % end 317 % set(handles.REFRESH,'UserData',1:size(Param.InputTable,1)) 318 % REFRESH_Callback([],[], handles) 319 % return 320 % end 321 % elseif isequal(ext,'.xls') 322 % msg_box_uvmat('ERROR','input file type not implemented')%A Faire: ouvrir le fichier pour naviguer 323 % else 324 % display_file_name(handles,fileinput,0) 325 % end 318 display_file_name(handles,fileinput,'one') 319 end 320 326 321 327 322 % -------------------------------------------------------------------- 328 323 function MenuFile_1_Callback(hObject, eventdata, handles) 329 324 fileinput=get(handles.MenuFile_1,'Label'); 330 display_file_name(handles,fileinput, 0)325 display_file_name(handles,fileinput,'one') 331 326 332 327 % -------------------------------------------------------------------- 333 328 function MenuFile_2_Callback(hObject, eventdata, handles) 334 329 fileinput=get(handles.MenuFile_2,'Label'); 335 display_file_name(handles,fileinput, 0)330 display_file_name(handles,fileinput,'one') 336 331 337 332 % -------------------------------------------------------------------- 338 333 function MenuFile_3_Callback(hObject, eventdata, handles) 339 334 fileinput=get(handles.MenuFile_3,'Label'); 340 display_file_name( handles,fileinput, 0)335 display_file_name( handles,fileinput,'one') 341 336 342 337 % -------------------------------------------------------------------- 343 338 function MenuFile_4_Callback(hObject, eventdata, handles) 344 339 fileinput=get(handles.MenuFile_4,'Label'); 345 display_file_name(handles,fileinput, 0)340 display_file_name(handles,fileinput,'one') 346 341 347 342 % -------------------------------------------------------------------- 348 343 function MenuFile_5_Callback(hObject, eventdata, handles) 349 344 fileinput=get(handles.MenuFile_5,'Label'); 350 display_file_name(handles,fileinput, 0)345 display_file_name(handles,fileinput,'one') 351 346 352 347 % -------------------------------------------------------------------- … … 449 444 %------------------------------------------------------------------------ 450 445 InputTable=get(handles.InputTable,'Data'); 451 view_set=get(handles.REFRESH,'UserData'); 446 view_set=get(handles.REFRESH,'UserData');% list of lines to refresh 452 447 set(handles.REFRESH,'BackgroundColor',[1 1 0])% set REFRESH button to yellow color (indicate activation) 453 448 drawnow … … 462 457 end 463 458 if isempty(i1_series) 464 [FileName, PathName] = uigetfile( ... 465 {'*.xml;*.xls;*.png;*.tif;*.avi;*.AVI;*.nc', ' (*.xml,*.xls, *.png,*.tif, *.avi,*.nc)'; 466 '*.xml', '.xml files '; ... 467 '*.xls', '.xls files '; ... 468 '*.png','.png image files'; ... 469 '*.tif','.tif image files'; ... 470 '*.avi;*.AVI','.avi movie files'; ... 471 '*.nc','.netcdf files'; ... 472 '*.*', 'All Files (*.*)'}, ... 473 ['unvalid entry at line ' num2str(iview) ', pick a new input file'],RootPath); 474 fileinput=[PathName FileName];%complete file name 475 if isempty(fileinput) %abandon if the operation has been cancelled: no input from browser 459 fileinput=uigetfile_uvmat(['wrong input at line ' num2str(iview) ':pick a new input file'],RootPath); 460 if isempty(fileinput) 476 461 set(handles.REFRESH,'BackgroundColor',[1 0 0])% set REFRESH back to red color 477 return ;478 e nd479 [path,name,ext]=fileparts(fileinput);480 display_file_name(handles,fileinput,iview)462 return 463 else 464 display_file_name(handles,fileinput,iview) 465 end 481 466 else 482 467 update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,FileInfo,MovieObject,iview) 483 468 end 484 469 end … … 496 481 % fileinput: input file name, including path 497 482 % iview: line index in the input table 483 % or 'one': refresh the list 484 % 'append': add a new line to the list 498 485 499 486 %% get the input root name, indices, file extension and nomenclature NomType … … 527 514 %% fill the list of file series 528 515 InputTable=get(handles.InputTable,'Data'); 516 SeriesData=get(handles.series,'UserData'); 529 517 if strcmp(iview,'append') % display the input data as a new line in the table 530 iview=size(InputTable,1);531 532 533 elseif iview==0 % or re-initialisethe list of input file series534 iview=1; 518 iview=size(InputTable,1);% the next line in InputTable becomes the current line 519 InputTable(iview+1,:)={'','','','',''}; 520 InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}]; 521 elseif strcmp(iview,'one') % refresh the list of input file series 522 iview=1; %the first line in InputTable becomes the current line 535 523 InputTable=[{'','','','',''};{'','','','',''}]; 536 InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}]; 537 set(handles.TimeTable,'Data',[{[]},{[]},{[]},{[]}]) 538 set(handles.MinIndex,'Data',[{[]},{[]}]) 539 set(handles.MaxIndex,'Data',[{[]},{[]}]) 524 InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}]; 525 set(handles.TimeTable,'Data',[{[]},{[]},{[]},{[]}]) 526 set(handles.MinIndex_i,'Data',[{[]}]) 527 set(handles.MaxIndex_i,'Data',[{[]}]) 528 set(handles.MinIndex_j,'Data',[{[]}]) 529 set(handles.MaxIndex_j,'Data',[{[]}]) 540 530 set(handles.ListView,'Value',1) 541 531 set(handles.ListView,'String',{'1'}) 542 end 543 nbview=size(InputTable,1); 532 set(handles.PairString,'Data',{''}) 533 SeriesData.i1_series={}; 534 SeriesData.i2_series={}; 535 SeriesData.j1_series={}; 536 SeriesData.j2_series={}; 537 SeriesData.FileType={}; 538 SeriesData.FileInfo={}; 539 SeriesData.Time={}; 540 end 541 nbview=size(InputTable,1)-1;% rmq: the last line is set blank to allow manual addition of a line 544 542 set(handles.ListView,'String',mat2cell((1:nbview)',ones(nbview,1))) 545 543 set(handles.ListView,'Value',iview) … … 585 583 end 586 584 % save the opened file to initiate future opening 587 SeriesData=get(handles.series,'UserData'); 588 SeriesData.RefFile{iview}=fileinput; 585 SeriesData.RefFile{iview}=fileinput;% reference opening file for line iview 586 SeriesData.Ref_i1=i1; 587 SeriesData.Ref_i2=i2; 588 SeriesData.Ref_j1=j1; 589 SeriesData.Ref_j2=j2; 589 590 set(handles.series,'UserData',SeriesData) 590 591 … … 599 600 function update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,FileInfo,VideoObject,iview) 600 601 %------------------------------------------------------------------------ 601 %% update the output dir602 602 InputTable=get(handles.InputTable,'Data'); 603 SubDir=sort(InputTable(1:end-1,2)); %set of subdirectories sorted in alphabetical order 604 SubDirOut=SubDir{1}; 605 if numel(SubDir)>1 606 for ilist=2:numel(SubDir) 607 SubDirOut=[SubDirOut '-' SubDir{ilist}]; 608 end 609 end 610 set(handles.OutputSubDir,'String',SubDirOut) 611 612 %% display the min and max indices for the file series 603 604 %% display the min and max indices for the whole file series 613 605 if size(i1_series,2)==2 && min(min(i1_series(:,1,:)))==0 614 606 MinIndex_j=1;% index j set to 1 by default … … 633 625 end 634 626 end 635 MinIndex=get(handles.MinIndex,'Data');%retrieve the min indices in the table MinIndex636 MaxIndex=get(handles.MaxIndex,'Data');%retrieve the max indices in the table MaxIndex637 627 if isequal(MinIndex_i,-1) 638 628 MinIndex_i=0; … … 641 631 MinIndex_j=0; 642 632 end 643 MinIndex{iview,1}=MinIndex_i; 644 MinIndex{iview,2}=MinIndex_j; 645 MaxIndex{iview,1}=MaxIndex_i; 646 MaxIndex{iview,2}=MaxIndex_j; 647 648 set(handles.MinIndex,'Data',MinIndex)%display the min indices in the table MinIndex 649 set(handles.MaxIndex,'Data',MaxIndex)%display the max indices in the table MaxIndex 650 651 %% adjust the first and last indices, only if requested by the bounds 633 MinIndex_i_cell=get(handles.MinIndex_i,'Data');%retrieve the min indices in the table MinIndex 634 MinIndex_j_cell=get(handles.MinIndex_j,'Data');%retrieve the min indices in the table MinIndex 635 MaxIndex_i_cell=get(handles.MaxIndex_i,'Data');%retrieve the min indices in the table MinIndex 636 MaxIndex_j_cell=get(handles.MaxIndex_j,'Data');%retrieve the min indices in the table MinIndex 637 MinIndex_i_cell{iview,1}=MinIndex_i; 638 MinIndex_j_cell{iview,1}=MinIndex_j; 639 MaxIndex_i_cell{iview,1}=MaxIndex_i; 640 MaxIndex_j_cell{iview,1}=MaxIndex_j; 641 set(handles.MinIndex_i,'Data',MinIndex_i_cell)%display the min indices in the table MinIndex 642 set(handles.MinIndex_j,'Data',MinIndex_j_cell)%display the max indices in the table MaxIndex 643 set(handles.MaxIndex_i,'Data',MaxIndex_i_cell)%display the min indices in the table MinIndex 644 set(handles.MaxIndex_j,'Data',MaxIndex_j_cell)%display the max indices in the table MaxIndex 645 646 %% adjust the first and last indices for the selected series, only if requested by the bounds 652 647 % i index, compare input to min index i 653 648 first_i=str2num(get(handles.num_first_i,'String'));%retrieve previous first i … … 693 688 set(handles.num_last_j,'String',num2str(last_j)); 694 689 695 %% read timing and total frame number from the current file (movie files) may be overrid by xml file 690 %% number of slices set by default 691 NbSlice=1;%default 692 % read value set by the first series for the append mode (iwiew >1) 693 if iview>1 && strcmp(get(handles.num_NbSlice,'Visible'),'on') 694 NbSlice=str2num(get(handles.num_NbSlice,'String')); 695 end 696 697 %% default time unit 698 TimeUnit=''; 699 % read value set by the first series for the append mode (iwiew >1) 700 if iview>1 701 TimeUnit=get(handles.TimeUnit,'String'); 702 end 703 TimeSource=''; 704 Time=[];%default 705 706 %% read image documentation file if found 707 XmlData=[]; 708 check_calib=0; 709 XmlFileName=find_imadoc(InputTable{iview,1},InputTable{iview,2},InputTable{iview,3},InputTable{iview,5}); 710 if ~isempty(XmlFileName) 711 [XmlData,errormsg]=imadoc2struct(XmlFileName); 712 if ~isempty(errormsg) 713 msgbox_uvmat('WARNING',['error in reading ' XmlFileName ': ' errormsg]); 714 end 715 % read time if available 716 if isfield(XmlData,'Time') 717 Time=XmlData.Time; 718 TimeSource='xml'; 719 end 720 if isfield(XmlData,'Camera') 721 if isfield(XmlData.Camera,'NbSlice')&& ~isempty(XmlData.Camera.NbSlice) 722 if iview>1 && ~isempty(NbSlice) && ~strcmp(NbSlice,XmlData.Camera.NbSlice) 723 msgbox_uvmat('WARNING','inconsistent number of slices with the first field series'); 724 end 725 NbSlice=XmlData.Camera.NbSlice;% Nbre of slices from camera 726 end 727 if isfield(XmlData.Camera,'TimeUnit')&& ~isempty(XmlData.Camera.TimeUnit) 728 if iview>1 && ~isempty(TimeUnit) && ~strcmp(TimeUnit,XmlData.Camera.TimeUnit) 729 msgbox_uvmat('WARNING','inconsistent time unit with the first field series'); 730 end 731 TimeUnit=XmlData.Camera.TimeUnit; 732 end 733 end 734 % number of slices 735 if isfield(XmlData,'GeometryCalib') 736 check_calib=1; 737 if isfield(XmlData.GeometryCalib,'SliceCoord') 738 siz=size(XmlData.GeometryCalib.SliceCoord); 739 if siz(1)>1 740 if iview>1 && ~isempty(NbSlice) && ~strcmp(NbSlice,siz(1)) 741 msgbox_uvmat('WARNING','inconsistent number of Z indices with the first field series'); 742 end 743 NbSlice=siz(1); 744 end 745 end 746 end 747 set(handles.num_NbSlice,'String',num2str(NbSlice)) 748 end 749 750 %% read timing and total frame number from the current file (movie files) if not already set by the xml file (prioritary) 696 751 InputTable=get(handles.InputTable,'Data'); 697 FileBase=fullfile(InputTable{iview,1},InputTable{iview,3}); 698 Time=[];%default 699 TimeSource=''; 752 % FileBase=fullfile(InputTable{iview,1},InputTable{iview,3}); 753 700 754 % case of movies 701 755 % if strcmp(InputTable{iview,4},'*') 702 if ~isempty(VideoObject) 703 imainfo=get(VideoObject); 704 if isempty(j1_series); %frame index along i 705 Time=zeros(imainfo.NumberOfFrames+1,2); 706 Time(:,2)=(0:1/imainfo.FrameRate:(imainfo.NumberOfFrames)/imainfo.FrameRate)'; 707 else 708 Time=[0;ones(size(i1_series,3)-1,1)]*(0:1/imainfo.FrameRate:(imainfo.NumberOfFrames)/imainfo.FrameRate); 709 end 710 TimeSource='video'; 711 % set(han:dles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FrameRate) 'ms']);%display the elementary time interval in millisec 712 ColorType='truecolor'; 713 elseif ~isempty(imformats(regexprep(InputTable{iview,5},'^.',''))) || isequal(InputTable{iview,5},'.vol')%&& isequal(NomType,'*')% multi-frame image 714 if ~isempty(InputTable{iview,2}) 715 imainfo=imfinfo(fullfile(InputTable{iview,1},InputTable{iview,2},[InputTable{iview,3} InputTable{iview,5}])); 716 else 717 imainfo=imfinfo([FileBase InputTable{iview,5}]); 718 end 719 ColorType=imainfo.ColorType;%='truecolor' for color images 720 if length(imainfo) >1 %case of image with multiple frames 721 nbfield=length(imainfo); 722 nbfield_j=1; 723 end 724 end 725 % end 726 727 %% read image documentation file if found 728 XmlData=[]; 729 NbSlice_calib={}; 730 XmlFileName=find_imadoc(InputTable{iview,1},InputTable{iview,2},InputTable{iview,3},InputTable{iview,5}); 731 TimeUnit=''; 732 if ~isempty(XmlFileName) 733 [XmlData,warntext]=imadoc2struct(XmlFileName); 734 if isfield(XmlData,'Heading') && isfield(XmlData.Heading,'ImageName') && ischar(XmlData.Heading.ImageName) 735 [PP,FF,ext_ima_read]=fileparts(XmlData.Heading.ImageName); 736 end 737 if isfield(XmlData,'Time') 738 Time=XmlData.Time; 739 TimeSource='xml'; 740 end 741 if isfield(XmlData,'Camera') 742 if isfield(XmlData.Camera,'NbSlice')&& ~isempty(XmlData.Camera.NbSlice) 743 NbSlice_calib{iview}=XmlData.Camera.NbSlice;% Nbre of slices for Zindex in phys transform 744 if ~isequal(NbSlice_calib{iview},NbSlice_calib{1}) 745 msgbox_uvmat('WARNING','inconsistent number of Z indices for the two field series'); 746 end 747 end 748 if isfield(XmlData.Camera,'TimeUnit')&& ~isempty(XmlData.Camera.TimeUnit) 749 TimeUnit=XmlData.Camera.TimeUnit; 750 end 751 end 752 if ~isempty(warntext) 753 msgbox_uvmat('WARNING',warntext) 754 end 756 if isempty(Time) 757 if ~isempty(VideoObject) 758 imainfo=get(VideoObject); 759 if isempty(j1_series); %frame index along i 760 Time=zeros(imainfo.NumberOfFrames+1,2); 761 Time(:,2)=(0:1/imainfo.FrameRate:(imainfo.NumberOfFrames)/imainfo.FrameRate)'; 762 else 763 Time=[0;ones(size(i1_series,3)-1,1)]*(0:1/imainfo.FrameRate:(imainfo.NumberOfFrames)/imainfo.FrameRate); 764 end 765 TimeSource='video'; 766 % set(han:dles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FrameRate) 'ms']);%display the elementary time interval in millisec 767 % ColorType='truecolor'; 768 % elseif ~isempty(imformats(regexprep(InputTable{iview,5},'^.',''))) || isequal(InputTable{iview,5},'.vol')%&& isequal(NomType,'*')% multi-frame image 769 % if ~isempty(InputTable{iview,2}) 770 % imainfo=imfinfo(fullfile(InputTable{iview,1},InputTable{iview,2},[InputTable{iview,3} InputTable{iview,5}])); 771 % else 772 % imainfo=imfinfo([FileBase InputTable{iview,5}]); 773 % end 774 % % ColorType=imainfo.ColorType;%='truecolor' for color images 775 % % if length(imainfo) >1 %case of image with multiple frames 776 % % nbfield=length(imainfo); 777 % % nbfield_j=1; 778 % % end 779 end 755 780 end 756 781 … … 758 783 if ~isempty(Time) 759 784 TimeTable=get(handles.TimeTable,'Data'); 760 first_i=str2num(get(handles.num_first_i,'String')); 761 last_i=str2num(get(handles.num_last_i,'String')); 762 first_j=str2num(get(handles.num_first_j,'String')); 763 last_j=str2num(get(handles.num_last_j,'String')); 764 MinIndexTable=get(handles.MinIndex,'Data'); 765 MinIndex_i=MinIndexTable{iview,1}; 766 MinIndex_j=MinIndexTable{iview,2}; 767 MaxIndexTable=get(handles.MaxIndex,'Data'); 768 MaxIndex_i=MaxIndexTable{iview,1}; 769 MaxIndex_j=MaxIndexTable{iview,2}; 770 if ~isempty(Time) 771 TimeTable{iview,1}=Time(MinIndex_i+1,MinIndex_j+1); 772 if size(Time)>=[first_i+1 first_j+1] 785 % first_i=str2num(get(handles.num_first_i,'String')); 786 % last_i=str2num(get(handles.num_last_i,'String')); 787 % first_j=str2num(get(handles.num_first_j,'String')); 788 % last_j=str2num(get(handles.num_last_j,'String')); 789 % MinIndex_i=get(handles.MinIndex_i,'Data'); 790 % MinIndex_j=get(handles.MinIndex_j,'Data'); 791 % MaxIndex_i=get(handles.MaxIndex_i,'Data'); 792 % MaxIndex_j=get(handles.MaxIndex_j,'Data'); 793 TimeTable{iview,1}=Time(MinIndex_i+1,MinIndex_j+1); 794 if size(Time)>=[first_i+1 first_j+1] 773 795 TimeTable{iview,2}=Time(first_i+1,first_j+1); 774 end 775 if size(Time)>=[last_i+1 last_j+1] 776 TimeTable{iview,3}=Time(last_i+1,last_j+1); 777 end 778 if size(Time)>=[MaxIndex_i+1 MaxIndex_j+1]; 779 TimeTable{iview,4}=Time(MaxIndex_i+1,MaxIndex_j+1); 780 end 796 end 797 if size(Time)>=[last_i+1 last_j+1] 798 TimeTable{iview,3}=Time(last_i+1,last_j+1); 799 end 800 if size(Time)>=[MaxIndex_i+1 MaxIndex_j+1]; 801 TimeTable{iview,4}=Time(MaxIndex_i+1,MaxIndex_j+1); 781 802 end 782 803 set(handles.TimeTable,'Data',TimeTable) 783 804 end 784 785 %% number of slices786 NbSlice=1;%default787 check_calib=0;788 if isfield(XmlData,'GeometryCalib')789 check_calib=1;790 if isfield(XmlData.GeometryCalib,'SliceCoord')791 siz=size(XmlData.GeometryCalib.SliceCoord);792 if siz(1)>1793 NbSlice=siz(1);794 end795 end796 end797 set(handles.num_NbSlice,'String',num2str(NbSlice))798 805 799 %% update pair menus800 set(handles.Pairs,'Visible','on')801 set(handles.PairString,'Visible','on')802 ListView=get(handles.ListView,'String');803 ListView{iview}=num2str(iview);804 set(handles.ListView,'String',ListView);805 set(handles.ListView,'Value',iview)806 update_mode(handles,i1_series,i2_series,j1_series,j2_series,Time)807 806 808 807 %% update the series info in 'UserData' … … 818 817 SeriesData.TimeSource=TimeSource; 819 818 end 820 if ~isempty(TimeUnit)821 SeriesData.TimeUnit=TimeUnit;822 end819 % if ~isempty(TimeUnit) 820 % SeriesData.TimeUnit=TimeUnit; 821 % end 823 822 if check_calib 824 SeriesData.GeometryCalib{iview}=XmlData.GeometryCalib;823 SeriesData.GeometryCalib{iview}=XmlData.GeometryCalib; 825 824 end 826 825 set(handles.series,'UserData',SeriesData) 827 826 827 %% update pair menus 828 ListView=get(handles.ListView,'String'); 829 ListView{iview}=num2str(iview); 830 set(handles.ListView,'String',ListView); 831 set(handles.ListView,'Value',iview) 832 update_mode(handles,i1_series,i2_series,j1_series,j2_series,Time) 833 828 834 %% enable j index visibilitycellfun(@isempty,regexp(PairString,'^j')) 829 % state='off';830 835 check_jindex=~cellfun(@isempty,SeriesData.j1_series); %look for non empty j indices 831 836 if isempty(find(check_jindex)) … … 833 838 else 834 839 PairString=get(handles.PairString,'Data'); 835 if isempty(find(cellfun(@isempty,regexp(PairString,'^j'))))% if all pair string begins by j (burst) 840 % ~cellfun(@isempty,regexp(PairString,'^j'): gives 1 when the pair string begins by 'j' (burst case) 841 % cellfun(@isempty,PairString): gives 1 when the pair string is empty 842 if isempty(find(~cellfun(@isempty,regexp(PairString,'^j'))&cellfun(@isempty,PairString)))% if all pair string begins by j (burst) or empty 836 843 enable_j(handles,'off') % no j index needed 837 844 else … … 1172 1179 end 1173 1180 end 1174 % if check_burst1175 % enable_i(handles,'On')1176 % enable_j(handles,'Off') %do not display j index scanning in burst mode (j is fixed by the burst choice)1177 % else1178 % enable_i(handles,'On')1179 % if isempty(j1_series)1180 % enable_j(handles,'Off')1181 % else1182 % enable_j(handles,'On')1183 % end1184 % end1185 1181 fill_ListPair(handles,i1_series,i2_series,j1_series,j2_series,time) 1186 1182 ListPairs_Callback([],[],handles) 1187 1183 1188 1184 %-------------------------------------------------------------- 1189 % determine the menu for civ1pairstring depending on existing netcdf files1185 % determine the menu for pairstring depending on existing netcdf files 1190 1186 % with the reference indices num_ref_i and num_ref_j 1191 1187 %---------------------------------------------------------------- … … 1306 1302 set(handles.num_last_i,'Visible',state) 1307 1303 set(handles.num_incr_i,'Visible',state) 1308 % set(handles.num_MaxIndex_i,'Visible',state)1309 1304 set(handles.num_ref_i,'Visible',state) 1310 1305 set(handles.ref_i_text,'Visible',state) … … 1318 1313 set(handles.num_ref_j,'Visible',state) 1319 1314 set(handles.ref_j_text,'Visible',state) 1320 % if strcmp(state,'off') 1321 % set(handles.MinIndex,'ColumnName',{'imax'}) 1322 % set(handles.MinIndex,'ColumnEditable',logical(0)) 1323 % else 1324 % set(handles.MinIndex,'ColumnName',{'imax','jmax'}) 1325 % end 1315 set(handles.MinIndex_j,'Visible',state) 1316 set(handles.MaxIndex_j,'Visible',state) 1326 1317 1327 1318 … … 1715 1706 SubDirOutNew=SubDirOut; 1716 1707 SeriesData=get(handles.series,'UserData'); 1717 if size(Series.InputTable,1)>1 && isfield(SeriesData,'AllowInputSort') && SeriesData.AllowInputSort1718 [tild,iview]=sort(Series.InputTable(:,2)); %subdirectories sorted in alphabetical order1719 Series.InputTable=Series.InputTable(iview,:);1720 end1708 % if size(Series.InputTable,1)>1 && isfield(SeriesData,'AllowInputSort') && SeriesData.AllowInputSort 1709 % [tild,iview]=sort(Series.InputTable(:,2)); %subdirectories sorted in alphabetical order 1710 % Series.InputTable=Series.InputTable(iview,:); 1711 % end 1721 1712 detect=exist(fullfile(Series.InputTable{1,1},SubDirOutNew),'dir');% test if the dir already exist 1722 1713 check_create=1; %need to create the result directory by default … … 1759 1750 end 1760 1751 Series.IndexRange=rmfield(Series.IndexRange,'TimeTable'); 1761 % Series.IndexRange=rmfield(Series.IndexRange,'MinIndex ');1762 % Series.IndexRange=rmfield(Series.IndexRange,'MaxIndex ');1752 % Series.IndexRange=rmfield(Series.IndexRange,'MinIndex_j'); 1753 % Series.IndexRange=rmfield(Series.IndexRange,'MaxIndex_i'); 1763 1754 empty_line=false(size(Series.InputTable,1),1); 1764 1755 for iline=1:size(Series.InputTable,1) … … 1787 1778 ActionList=get(handles.ActionName,'String');% list menu fields 1788 1779 ActionIndex=get(handles.ActionName,'Value'); 1789 if ~isequal(ActionIndex,1) 1780 if ~isequal(ActionIndex,1)% if we are not just opening series 1790 1781 InputTable=get(handles.InputTable,'Data'); 1791 1782 if isempty(InputTable{1,4}) … … 1918 1909 1919 1910 %% Check whether alphabetical sorting of input Subdir is alowed by the Action fct (for multiples series entries) 1920 SeriesData.AllowInputSort=0;%default 1921 if isfield(ParamOut,'AllowInputSort')&&isequal(ParamOut.AllowInputSort,'on') 1922 SeriesData.AllowInputSort=1; 1911 if isfield(ParamOut,'AllowInputSort')&&isequal(ParamOut.AllowInputSort,'on')&& size(Series.InputTable,1)>1 1912 [tild,iview]=sort(InputTable(:,2)); %subdirectories sorted in alphabetical order 1913 set(handles.InputTable,'Data',InputTable(iview,:)); 1914 MinIndex_i=get(handles.MinIndex_i,'Data'); 1915 MinIndex_j=get(handles.MinIndex_j,'Data'); 1916 MaxIndex_i=get(handles.MaxIndex_i,'Data'); 1917 MaxIndex_j=get(handles.MaxIndex_j,'Data'); 1918 set(handles.MinIndex_i,'Data',MinIndex_i(iview,:)); 1919 set(handles.MinIndex_j,'Data',MinIndex_j(iview,:)); 1920 set(handles.MaxIndex_i,'Data',MaxIndex_i(iview,:)); 1921 set(handles.MaxIndex_j,'Data',MaxIndex_j(iview,:)); 1922 TimeTable=get(handles.TimeTable,'Data'); 1923 set(handles.TimeTable,'Data',TimeTable(iview,:)); 1924 PairString=get(handles.PairString,'Data'); 1925 set(handles.PairString,'Data',PairString(iview,:)); 1923 1926 end 1924 1927 1925 1928 %% Impose the whole input file index range if requested 1926 1929 if isfield(ParamOut,'WholeIndexRange')&&isequal(ParamOut.WholeIndexRange,'on') 1927 MinIndex=get(handles.MinIndex,'Data'); 1928 MaxIndex=get(handles.MaxIndex,'Data'); 1929 if ~isempty(MinIndex) 1930 set(handles.num_first_i,'String',num2str(MinIndex{1})) 1931 set(handles.num_last_i,'String',num2str(MaxIndex{1})) 1932 set(handles.num_incr_i,'String','1') 1933 if size(MinIndex,2)>=2 1934 set(handles.num_first_j,'String',num2str(MinIndex{1,2})) 1935 set(handles.num_last_j,'String',num2str(MaxIndex{1,2})) 1936 set(handles.num_incr_j,'String','1') 1937 end 1938 end 1939 else 1940 % check index ranges 1941 first_i=1;last_i=1;first_j=1;last_j=1; 1942 if isfield(Series.IndexRange,'first_i') 1943 first_i=Series.IndexRange.first_i; 1944 incr_i=Series.IndexRange.incr_i; 1945 last_i=Series.IndexRange.last_i; 1946 end 1947 if isfield(Series.IndexRange,'first_j') 1948 first_j=Series.IndexRange.first_j; 1949 incr_j=Series.IndexRange.incr_j; 1950 last_j=Series.IndexRange.last_j; 1951 end 1952 if last_i < first_i || last_j < first_j , msgbox_uvmat('ERROR','last field number must be larger than the first one'),... 1953 set(handles.RUN, 'Enable','On'), set(handles.RUN,'BackgroundColor',[1 0 0]),return,end; 1930 MinIndex_i=get(handles.MinIndex_i,'Data'); 1931 MinIndex_j=get(handles.MinIndex_j,'Data'); 1932 MaxIndex_i=get(handles.MaxIndex_i,'Data'); 1933 MaxIndex_j=get(handles.MaxIndex_j,'Data'); 1934 set(handles.num_first_i,'String',num2str(MinIndex_i{1}))% set first as the min index (for the first line) 1935 set(handles.num_last_i,'String',num2str(MaxIndex_i{1}))% set last as the max index (for the first line) 1936 set(handles.num_incr_i,'String','1') 1937 set(handles.num_first_j,'String',num2str(MinIndex_j{1}))% set first as the min index (for the first line) 1938 set(handles.num_last_j,'String',num2str(MaxIndex_j{1}))% set last as the max index (for the first line) 1939 set(handles.num_incr_j,'String','1') 1940 else % check index ranges 1941 first_i=1;last_i=1;first_j=1;last_j=1; 1942 if isfield(Series.IndexRange,'first_i') 1943 first_i=Series.IndexRange.first_i; 1944 % incr_i=Series.IndexRange.incr_i; 1945 last_i=Series.IndexRange.last_i; 1946 end 1947 if isfield(Series.IndexRange,'first_j') 1948 first_j=Series.IndexRange.first_j; 1949 % incr_j=Series.IndexRange.incr_j; 1950 last_j=Series.IndexRange.last_j; 1951 end 1952 if last_i < first_i || last_j < first_j , msgbox_uvmat('ERROR','last field number must be larger than the first one'),... 1953 set(handles.RUN, 'Enable','On'), set(handles.RUN,'BackgroundColor',[1 0 0]),return,end; 1954 1954 end 1955 1955 … … 2047 2047 set(handles.OutputDirExt,'String',ParamOut.OutputDirExt) 2048 2048 OutputDirVisible='on'; 2049 SubDir=InputTable(1:end-1,2); %set of subdirectories sorted in alphabetical order 2050 SubDirOut=SubDir{1}; 2051 if numel(SubDir)>1 2052 for ilist=2:numel(SubDir) 2053 SubDirOut=[SubDirOut '-' SubDir{ilist}]; 2054 end 2055 end 2056 set(handles.OutputSubDir,'String',SubDirOut) 2049 2057 end 2050 2058 set(handles.OutputDirExt,'Visible',OutputDirVisible) … … 2055 2063 set(handles.RunMode_title,'Visible',OutputDirVisible) 2056 2064 set(handles.ActionExt_title,'Visible',OutputDirVisible) 2065 2057 2066 2058 2067 %% Expected nbre of output files … … 2389 2398 commandwindow; %brings the Matlab command window to the front 2390 2399 2391 2392 2400 % -------------------------------------------------------------------- 2393 2401 function MenuImportConfig_Callback(hObject, eventdata, handles) … … 2410 2418 function Coord_x_Callback(hObject, eventdata, handles) 2411 2419 2412 2413 2420 % --- Executes on selection change in Coord_y. 2414 2421 function Coord_y_Callback(hObject, eventdata, handles) 2415 2422 2416 2417 2423 % -------------------------------------------------------------------- 2418 2424 % --- Executes when series is resized. 2419 2425 function series_ResizeFcn(hObject, eventdata, handles) 2426 % -------------------------------------------------------------------- 2420 2427 %% input table 2421 2428 set(handles.InputTable,'Unit','pixel') … … 2426 2433 set(handles.InputTable,'ColumnWidth',ColumnWidth) 2427 2434 2428 %% MinIndex and MaxIndex 2429 set(handles.MinIndex,'Unit','pixel') 2430 Pos=get(handles.MinIndex,'Position'); 2431 set(handles.MinIndex,'Unit','normalized') 2432 ColumnWidth=get(handles.MinIndex,'ColumnWidth'); 2433 if numel(ColumnWidth)==2 2434 ColumnWidth=num2cell(floor([0.5 0.5]*(Pos(3)-20))); 2435 else 2436 ColumnWidth={Pos(3)-5}; 2437 end 2438 set(handles.MinIndex,'ColumnWidth',ColumnWidth) 2439 set(handles.MaxIndex,'ColumnWidth',ColumnWidth) 2435 %% MinIndex_j and MaxIndex_i 2436 unit=get(handles.MinIndex_i,'Unit'); 2437 set(handles.MinIndex_i,'Unit','pixel') 2438 Pos=get(handles.MinIndex_i,'Position'); 2439 set(handles.MinIndex_i,'Unit',unit) 2440 set(handles.MinIndex_i,'ColumnWidth',{Pos(3)-18}) 2441 set(handles.MaxIndex_i,'ColumnWidth',{Pos(3)-18}) 2442 set(handles.MinIndex_j,'ColumnWidth',{Pos(3)-18}) 2443 set(handles.MaxIndex_j,'ColumnWidth',{Pos(3)-18}) 2440 2444 2441 2445 %% TimeTable … … 2443 2447 Pos=get(handles.TimeTable,'Position'); 2444 2448 set(handles.TimeTable,'Unit','normalized') 2445 ColumnWidth=get(handles.TimeTable,'ColumnWidth');2449 % ColumnWidth=get(handles.TimeTable,'ColumnWidth'); 2446 2450 ColumnWidth=num2cell(floor([0.25 0.25 0.25 0.25]*(Pos(3)-20))); 2447 2451 set(handles.TimeTable,'ColumnWidth',ColumnWidth) -
trunk/src/uigetfile_uvmat.m
r617 r620 82 82 if ~strcmp(option,'status_display') 83 83 uiwait(hfig) 84 if ishandle(hfig) 84 85 htitlebox=findobj(hfig,'Tag','titlebox'); 85 86 fileinput=get(htitlebox,'String');% retrieve the input file selection 86 87 delete(hfig) 88 end 87 89 end 88 90 -
trunk/src/uvmat.m
r615 r620 5307 5307 5308 5308 5309 5309 % --- Executes on button press in CheckZoomFig. 5310 function CheckZoomFig_Callback(hObject, eventdata, handles) 5311 % hObject handle to CheckZoomFig (see GCBO) 5312 % eventdata reserved - to be defined in a future version of MATLAB 5313 % handles structure with handles and user data (see GUIDATA) 5314 5315 % Hint: get(hObject,'Value') returns toggle state of CheckZoomFig
Note: See TracChangeset
for help on using the changeset viewer.