Changeset 609
- Timestamp:
- Apr 9, 2013, 8:20:00 PM (12 years ago)
- Location:
- trunk/src
- Files:
-
- 1 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/find_file_series.m
r599 r609 5 5 % OUTPUT: 6 6 % RootFile: root file detected in fileinput, possibly modified for movies (indexing is then done on image view, not file) 7 % i1_series( ref_i+1, ref_j+1,pair),i2_series,j1_series,j2_series: set of indices (i1,i2,j1,j2) sorted by ref index ref_i, ref_j, and pairindex in case of multiple pairs with the same ref7 % i1_series(pair,ref_j+1, ref_i+1),i2_series,j1_series,j2_series: set of indices (i1,i2,j1,j2) sorted by ref index ref_i, ref_j, and pairindex in case of multiple pairs with the same ref 8 8 % (ref_i+1 is used to deal with the image index zero sometimes used) 9 9 % NomType: nomenclature type corrected after checking the first file (problem of 0 before the number string) … … 244 244 if isfield(FileInfo,'NumberOfFrames') && FileInfo.NumberOfFrames >1 245 245 if isempty(i1_series) 246 i1_series=(1:FileInfo.NumberOfFrames)'; 246 i1_series=zeros(FileInfo.NumberOfFrames+1,2);% first column =0 247 i1_series(:,2)=(0:FileInfo.NumberOfFrames)'; % second column=frame index -1 247 248 i1_input=1; 248 249 NomType='*'; 249 250 else 250 i1_series=i1_series(:,2)*ones( 1,FileInfo.NumberOfFrames);251 i1_series=i1_series(:,2)*ones(0,FileInfo.NumberOfFrames); 251 252 i1_series=[i1_series(:,1) i1_series]; 252 253 j1_series=ones(size(i1_series,1),1)*(0:FileInfo.NumberOfFrames); -
trunk/src/plot_field.m
r582 r609 282 282 VarName=FieldData.ListVarName{VarIndex(ivar)}; 283 283 VarValue=FieldData.(VarName); 284 if is column(VarValue)284 if isvector(VarValue') 285 285 VarValue=VarValue';% put the different values on a line 286 286 end -
trunk/src/read_multimadoc.m
r537 r609 4 4 % 5 5 % OUTPUT: 6 % 6 % XmlData: cell array of structure representing the contents of the xml files 7 % NbSlice_calib: nbre of slices detected in the geometric calibration data 8 % mtrix of times 9 % errormsg: error message, ='' if reading OK 7 10 % 8 11 % INPUT: 9 % 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 15 % 10 16 function [XmlData,NbSlice_calib,time,errormsg]=read_multimadoc(RootPath,SubDir,RootFile,FileExt,i1_series,i2_series,j1_series,j2_series) 11 17 errormsg=''; -
trunk/src/series.m
r606 r609 67 67 68 68 %% initial settings 69 drawnow 70 set(hObject,'Units','pixels') 69 set(0,'Unit','points') 70 ScreenSize=get(0,'ScreenSize');%size of the current screen 71 Width=750;% prefered width of the GUI in points (1/72 inch) 72 Height=520; 73 %adjust to screen size (reduced by a min margin) 74 RescaleFactor=min((ScreenSize(3)-80)/Width,(ScreenSize(4)-80)/Height); 75 if RescaleFactor>1 76 %RescaleFactor=RescaleFactor/2+1/2; %reduce the rescale factor to provide an increased margin for a big screen 77 RescaleFactor=min(RescaleFactor,1); 78 end 79 Width=Width*RescaleFactor; 80 Height=Height*RescaleFactor; 81 LeftX=80*RescaleFactor;%position of the left fig side, in pixels (put to the left side, with some margin) 82 LowY=round(ScreenSize(4)/2-Height/2); % put at the middle height on the screen 83 set(hObject,'Units','points') 84 set(hObject,'Position',[LeftX LowY Width Height]) 71 85 set(handles.PairString,'ColumnName',{'pairs'}) 72 86 set(handles.PairString,'ColumnEditable',false) … … 78 92 if ~exist('Param','var') 79 93 Param=[]; %default 80 end 81 82 %% default list offunctions in the mebu ActionName94 end 95 96 %% list of builtin functions in the mebu ActionName 83 97 ActionList={'check_data_files';'aver_stat';'time_series';'merge_proj'};% WARNING: fits with nb_builtin_ACTION=4 in ActionName_callback 98 NbBuiltinAction=numel(ActionList); 84 99 [path_series,name,ext]=fileparts(which('series'));% path to the GUI series 85 100 path_series_fct=fullfile(path_series,'series');%path of the functions in subdirectroy 'series' 86 %path_bin=fullfile(path_series,'bin');%path of the binary functions (compiled) 87 ActionPathList=regexprep(ActionList,'^.+$',path_series_fct);% set path=path_series to each function in the list ('^.+$'=any non empty nbre of char form beginning to end of char string) 88 ActionPathList=[ActionPathList ActionPathList];% set path to .sh commands for compiled functions 89 ActionExtList={'.m';'.sh'};% default choice of extensions (Matlab fct .m or compiled version .sh) 101 ActionExtList={'.m';'.sh'};% default choice of extensions (Matlab fct .m or compiled version .sh 102 ActionPathList=cell(NbBuiltinAction,numel(ActionExtList));%initiate the cell matrix of Action fct paths 103 ActionPathList(:)={path_series_fct}; %set the default path to series fcts to all list members 90 104 RunModeList={'local';'background'};% default choice of extensions (Matlab fct .m or compiled version .sh) 91 105 [s,w]=system('oarstat');% look for cluster system 'oar' … … 99 113 set(handles.RunMode,'String',RunModeList) 100 114 101 %% default list offunctions in the mebu TransformName115 %% list of builtin transform functions in the mebu TransformName 102 116 TransformList={'';'sub_field';'phys';'phys_polar'};% WARNING: must fit with the corresponding menu in uvmat and nb_builtin_transform=4 in TransformName_callback 117 NbBuiltinTransform=numel(TransformList); 103 118 path_transform_fct=fullfile(path_series,'transform_field'); 104 TransformPathList=regexprep(TransformList,'^.+$',path_transform_fct);% set path=path_transform_fct to each function in the list ('^.+$'=any non empty nbre of char form beginning to end of char string) 105 106 %% load the personal file uvmat_perso.mat 119 TransformPathList=cell(NbBuiltinTransform,1);%initiate the cell matrix of Action fct paths 120 TransformPathList(:)={path_transform_fct}; %set the default path to series fcts to all list members 121 122 %% get the user defined functions stored in the personal file uvmat_perso.mat 107 123 dir_perso=prefdir; 108 124 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); … … 131 147 132 148 %% selection of the input Action fct 133 ActionCheckExist= false(size(ActionList));134 for ilist= 1:numel(ActionList)149 ActionCheckExist=true(size(ActionList));%initiate the check of the path to the listed action fct 150 for ilist=NbBuiltinAction+1:numel(ActionList)%check the validity of the path of the user defined Action fct 135 151 ActionCheckExist(ilist)=exist(fullfile(ActionPathList{ilist},[ActionList{ilist} '.m']),'file'); 136 152 end 137 ActionPathList=ActionPathList(ActionCheckExist,:); 153 ActionPathList=ActionPathList(ActionCheckExist,:);% suppress the menu options which are not valid anymore 138 154 ActionList=ActionList(ActionCheckExist); 139 155 set(handles.ActionName,'String',[ActionList;{'more...'}]) … … 152 168 153 169 %% selection of the input transform fct 154 TransformCheckExist=false(size(TransformList)); 155 TransformCheckExist(1)=1;%the first option is blank: no transform, always allowed 156 for ilist=2:numel(TransformList) 170 TransformCheckExist=true(size(TransformList)); 171 for ilist=NbBuiltinTransform+1:numel(TransformList) 157 172 TransformCheckExist(ilist)=exist(fullfile(TransformPathList{ilist},[TransformList{ilist} '.m']),'file'); 158 173 end … … 260 275 %get the previous input file in the Input Table 261 276 oldfile=''; %default 262 InputTable=get(handles.InputTable,'Data'); 263 if isequal(InputTable(:,1),[{''};{''};{''};{''}])%open the personal file for empty previous input 277 SeriesData=get(handles.series,'UserData'); 278 if isfield(SeriesData,'RefFile') 279 oldfile=SeriesData.RefFile{1}; 280 end 281 if ~exist(oldfile,'file') 264 282 dir_perso=prefdir; 265 283 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); … … 270 288 end 271 289 end 272 else% select the previous file as the first line of the input table 273 oldfile=fullfile(InputTable{1,1},InputTable{1,2},InputTable{1,3}); 274 end 275 hfig=uigetfile_uvmat('file browser',fileparts(fileparts(oldfile))); 276 uiwait(hfig); 277 if ishandle(hfig) % stop if browser closed without selection 278 fileinput=get(hfig,'UserData');% retrieve the input file selection 279 delete(hfig) 280 display_file_name(handles,fileinput,0) 290 end 291 fileinput=uigetfile_uvmat('file browser',oldfile); 292 if ~isempty(fileinput) 293 display_file_name(handles,fileinput,0) 281 294 end 282 295 % … … 481 494 % INPUT: 482 495 % handles: handles of elements in the GUI 483 % fi elinput: input file name, including path484 % append =0 (refresh the Input table with the new file), ='append' append a new line in thetable496 % fileinput: input file name, including path 497 % iview: line index in the input table 485 498 486 499 %% get the input root name, indices, file extension and nomenclature NomType … … 542 555 ref_i=floor((i1+i2)/2);% reference image number corresponding to the file 543 556 set(handles.num_ref_i,'String',num2str(ref_i)); 544 set(handles.num_ref_i,'UserData',[i1 i2]) 557 % set(handles.num_ref_i,'UserData',[i1 i2])%store the indices for future opening 545 558 if isempty(j1) 546 559 j1=1; … … 551 564 ref_j=floor((j1+j2)/2);% reference image number corresponding to the file 552 565 set(handles.num_ref_j,'String',num2str(ref_j)); 553 set(handles.num_ref_j,'UserData',[j1 j2]) 566 % set(handles.num_ref_j,'UserData',[j1 j2]);%store the indices for future opening 554 567 555 568 %% update the list of recent files in the menubar and save it for future opening … … 571 584 save (profil_perso,'MenuFile','-V6'); %store the file names for future opening of uvmat 572 585 end 586 % save the opened file to initiate future opening 587 SeriesData=get(handles.series,'UserData'); 588 SeriesData.RefFile{iview}=fileinput; 589 set(handles.series,'UserData',SeriesData) 573 590 574 591 set(handles.InputTable,'BackgroundColor',[1 1 1]) … … 595 612 %% display the min and max indices for the file series 596 613 if size(i1_series,2)==2 && min(min(i1_series(:,1,:)))==0 597 MinIndex_j=1; 614 MinIndex_j=1;% index j set to 1 by default 598 615 MaxIndex_j=1; 599 616 MinIndex_i=find(i1_series(:,2,:), 1 )-1; … … 602 619 pair_max=squeeze(max(i1_series,[],1)); %max on pair index 603 620 j_max=max(pair_max,[],1); 604 %i_sum=sum(sum(i1_series,2),1);%sum of i1_series on the last index605 621 MaxIndex_i=find(j_max, 1, 'last' )-1;% max ref index i 606 622 MinIndex_i=find(j_max, 1 )-1;% min ref index i 607 623 diff_i_max=diff(j_max); 608 if isequal (diff_i_max,diff_i_max(1)*ones(size(diff_i_max)))609 set(handles.num_incr_i,'String',num2str(diff_i_max(1))) 624 if ~isempty(diff_i_max) && isequal (diff_i_max,diff_i_max(1)*ones(size(diff_i_max))) 625 set(handles.num_incr_i,'String',num2str(diff_i_max(1)))% detect an increment to dispaly by default 610 626 end 611 627 i_max=max(pair_max,[],2); … … 633 649 set(handles.MaxIndex,'Data',MaxIndex)%display the max indices in the table MaxIndex 634 650 635 %% adjust the first and last indices if requested by the bounds636 first_i=str2num(get(handles.num_first_i,'String')); 637 ref_i=str2num(get(handles.num_ref_i,'String')); 638 ref_ j=str2num(get(handles.num_ref_j,'String'));651 %% adjust the first and last indices, only if requested by the bounds 652 % i index, compare input to min index i 653 first_i=str2num(get(handles.num_first_i,'String'));%retrieve previous first i 654 ref_i=str2num(get(handles.num_ref_i,'String'));%index i given by the input field 639 655 if isempty(first_i) 640 first_i=ref_i; 656 first_i=ref_i;% first_i updated by the input value 641 657 elseif first_i < MinIndex_i 642 first_i=MinIndex_i; 658 first_i=MinIndex_i; % first_i set to the min i index (restricted by oter input lines) 643 659 elseif first_i >MaxIndex_i 644 first_i=MinIndex_i; 645 end 660 first_i=MaxIndex_i;% first_i set to the max i index (restricted by oter input lines) 661 end 662 % j index, compare input to min index j 646 663 first_j=str2num(get(handles.num_first_j,'String')); 664 ref_j=str2num(get(handles.num_ref_j,'String'));%index j given by the input field 647 665 if isempty(first_j) 648 first_j=ref_j; 666 first_j=ref_j;% first_j updated by the input value 649 667 elseif first_j<MinIndex_j 650 first_j=MinIndex_j; 668 first_j=MinIndex_j; % first_j set to the min j index (restricted by oter input lines) 651 669 elseif first_j >MaxIndex_j 652 first_j=MinIndex_j; 653 end 670 first_j=MaxIndex_j; % first_j set to the max j index (restricted by oter input lines) 671 end 672 % i index, compare input to max index i 654 673 last_i=str2num(get(handles.num_last_i,'String')); 655 674 if isempty(last_i) … … 660 679 last_i=first_i; 661 680 end 662 last_j=str2num(get(handles.num_first_j,'String')); 681 % j index, compare input to max index j 682 last_j=str2num(get(handles.num_last_j,'String')); 663 683 if isempty(last_j) 664 684 last_j=ref_j; 665 685 elseif last_j>MaxIndex_j 666 686 last_j=MaxIndex_j; 667 elseif last_ i<first_i668 last_ i=first_i;687 elseif last_j<first_j 688 last_j=first_j; 669 689 end 670 690 set(handles.num_first_i,'String',num2str(first_i)); … … 677 697 FileBase=fullfile(InputTable{iview,1},InputTable{iview,3}); 678 698 time=[];%default 699 TimeSource=''; 679 700 % case of movies 680 701 if strcmp(InputTable{iview,4},'*') 681 702 if ~isempty(VideoObject) 682 703 imainfo=get(VideoObject); 683 time=(0:1/imainfo.FrameRate:(imainfo.NumberOfFrames-1)/imainfo.FrameRate)'; 684 % set(handles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FrameRate) 'ms']);%display the elementary time interval in millisec 704 time=zeros(imainfo.NumberOfFrames+1,2); 705 time(:,2)=(0:1/imainfo.FrameRate:(imainfo.NumberOfFrames)/imainfo.FrameRate)'; 706 TimeSource='video'; 707 % set(han:dles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FrameRate) 'ms']);%display the elementary time interval in millisec 685 708 ColorType='truecolor'; 686 709 elseif ~isempty(imformats(regexprep(InputTable{iview,5},'^.',''))) || isequal(InputTable{iview,5},'.vol')%&& isequal(NomType,'*')% multi-frame image … … 698 721 end 699 722 700 %% read image documentation file if found %%%%%%%%%%%%%%%%%%%%%%%%%%%723 %% read image documentation file if found 701 724 XmlData=[]; 702 725 NbSlice_calib={}; … … 710 733 if isfield(XmlData,'Time') 711 734 time=XmlData.Time; 735 TimeSource='xml'; 712 736 end 713 737 if isfield(XmlData,'Camera') … … 742 766 if isempty(MinIndex_j)% only i index 743 767 if MinIndex_i>0 744 TimeTable{iview,1}=time(MinIndex_i );745 end 746 TimeTable{iview,2}=time(first_i );747 TimeTable{iview,3}=time(last_i );748 TimeTable{iview,4}=time(MaxIndex_i );768 TimeTable{iview,1}=time(MinIndex_i+1); 769 end 770 TimeTable{iview,2}=time(first_i+1); 771 TimeTable{iview,3}=time(last_i+1); 772 TimeTable{iview,4}=time(MaxIndex_i+1); 749 773 elseif ~isempty(time) 750 774 if MinIndex_i>0 751 775 TimeTable{iview,1}=time(MinIndex_i,MinIndex_j); 752 776 end 753 if size(time)>=[last_i last_j]754 TimeTable{iview,2}=time(first_i ,first_j);755 TimeTable{iview,3}=time(last_i ,last_j);756 end 757 if size(time)>=[MaxIndex_i MaxIndex_j];758 TimeTable{iview,4}=time(MaxIndex_i ,MaxIndex_j);777 if size(time)>=[last_i+1 last_j+1] 778 TimeTable{iview,2}=time(first_i+1,first_j+1); 779 TimeTable{iview,3}=time(last_i+1,last_j+1); 780 end 781 if size(time)>=[MaxIndex_i+1 MaxIndex_j+1]; 782 TimeTable{iview,4}=time(MaxIndex_i+1,MaxIndex_j+1); 759 783 end 760 784 end … … 787 811 %% update the series info in 'UserData' 788 812 SeriesData=get(handles.series,'UserData'); 789 SeriesData.Ref_i{iview}=get(handles.num_ref_i,'UserData');790 SeriesData.Ref_j{iview}=get(handles.num_ref_j,'UserData');791 813 SeriesData.i1_series{iview}=i1_series; 792 814 SeriesData.i2_series{iview}=i2_series; … … 796 818 SeriesData.FileInfo{iview}=FileInfo; 797 819 SeriesData.Time{iview}=time; 820 if ~isempty(TimeSource) 821 SeriesData.TimeSource=TimeSource; 822 end 798 823 if ~isempty(TimeUnit) 799 824 SeriesData.TimeUnit=TimeUnit; … … 992 1017 if size(SeriesData.Time{iview},1)>=i2(2)&&size(SeriesData.Time{iview},1)>=j2(2) 993 1018 if isempty(ref_j) 994 time_first=(SeriesData.Time{iview}(i1(1) )+SeriesData.Time{iview}(i2(1)))/2;995 time_last=(SeriesData.Time{iview}(i1(2) )+SeriesData.Time{iview}(i2(2)))/2;1019 time_first=(SeriesData.Time{iview}(i1(1)+1)+SeriesData.Time{iview}(i2(1)+1))/2; 1020 time_last=(SeriesData.Time{iview}(i1(2)+1)+SeriesData.Time{iview}(i2(2))+1)/2; 996 1021 else 997 time_first=(SeriesData.Time{iview}(i1(1) ,j1(1))+SeriesData.Time{iview}(i2(1),j2(1)))/2;998 time_last=(SeriesData.Time{iview}(i1(2) ,j1(2))+SeriesData.Time{iview}(i2(2),j2(2)))/2;1022 time_first=(SeriesData.Time{iview}(i1(1)+1,j1(1)+1)+SeriesData.Time{iview}(i2(1)+1,j2(1)+1))/2; 1023 time_last=(SeriesData.Time{iview}(i1(2)+1,j1(2)+1)+SeriesData.Time{iview}(i2(2)+1,j2(2)+1))/2; 999 1024 end 1000 1025 TimeTable{iview,2}=time_first; %TODO: take into account pairs … … 1429 1454 1430 1455 %% read index ranges 1431 first_i=1; 1432 last_i=1; 1433 incr_i=1; 1434 first_j=1; 1435 last_j=1; 1436 incr_j=1; 1437 if isfield(Series.IndexRange,'first_i') 1438 first_i=Series.IndexRange.first_i; 1439 incr_i=Series.IndexRange.incr_i; 1440 last_i=Series.IndexRange.last_i; 1441 end 1442 if isfield(Series.IndexRange,'first_j') 1443 first_j=Series.IndexRange.first_j; 1444 last_j=Series.IndexRange.last_j; 1445 incr_j=Series.IndexRange.incr_j; 1446 end 1447 if last_i < first_i || last_j < first_j , msgbox_uvmat('ERROR','last field number must be larger than the first one'),... 1448 set(handles.RUN, 'Enable','On'), set(handles.RUN,'BackgroundColor',[1 0 0]),return 1456 [first_i,incr_i,last_i,first_j,incr_j,last_j,errormsg]=get_index_range(Series.IndexRange); 1457 if ~isempty(errormsg) 1458 msgbox_uvmat('ERROR',['series/Run_Callback/get_index_range' errormsg]) 1459 set(handles.RUN, 'Enable','On'), 1460 set(handles.RUN,'BackgroundColor',[1 0 0]) 1461 return 1449 1462 else 1450 1463 BlockLength=ceil(numel(first_i:incr_i:last_i)/NbProcess); … … 1457 1470 switch StatusData.OutputFileMode 1458 1471 case 'NbInput' 1459 StatusData.NbOutputFile=numel(first_i ,incr_i:last_i)*numel(first_j,incr_j:last_j);1472 StatusData.NbOutputFile=numel(first_i:incr_i:last_i)*numel(first_j:incr_j:last_j); 1460 1473 case 'NbInput_i' 1461 StatusData.NbOutputFile=numel(first_i ,incr_i:last_i);1474 StatusData.NbOutputFile=numel(first_i:incr_i:last_i); 1462 1475 case 'NbSlice' 1463 1476 StatusData.NbOutputFile=str2num(get(handles.num_NbSlice,'String')); … … 1479 1492 Series.IndexRange.last_i=min(first_i+(iprocess)*BlockLength*incr_i-1,last_i); 1480 1493 else 1481 Series.IndexRange.first_i= first_i+i process-1;1494 Series.IndexRange.first_i= first_i+incr_i*(iprocess-1); 1482 1495 Series.IndexRange.incr_i=incr_i*Series.IndexRange.NbSlice; 1483 1496 end -
trunk/src/series/aver_stat.m
r605 r609 73 73 OutputDir=[Param.OutputSubDir Param.OutputDirExt]; 74 74 75 %% root input file(s) and type75 %% root input file(s) name, type and index series 76 76 RootPath=Param.InputTable(:,1); 77 77 RootFile=Param.InputTable(:,3); … … 88 88 % i1_series(iview,fileindex) expresses the same indices as a 1D array in file indices 89 89 %%%%%%%%%%%% 90 % NbSlice=1;%default91 % if isfield(Param.IndexRange,'NbSlice')&&~isempty(Param.IndexRange.NbSlice)92 % NbSlice=Param.IndexRange.NbSlice;93 % end94 90 nbview=numel(i1_series);%number of input file series (lines in InputTable) 95 91 nbfield_j=size(i1_series{1},1); %nb of fields for the j index (bursts or volume slices) 96 92 nbfield_i=size(i1_series{1},2); %nb of fields for the i index 97 93 nbfield=nbfield_j*nbfield_i; %total number of fields 98 %nbfield_i=floor(nbfield/NbSlice);%total number of indexes in a slice (adjusted to an integer number of slices) 99 %nbfield=nbfield_i*NbSlice; %total number of fields after adjustement 100 101 % determine the file type on each line from the first input file94 [first_i,tild,last_i,first_j,tild,last_j,errormsg]=get_index_range(Param.IndexRange); 95 if ~isempty(errormsg),display(errormsg),return,end 96 97 %% determine the file type on each line from the first input file 102 98 ImageTypeOptions={'image','multimage','mmreader','video'}; 103 99 NcTypeOptions={'netcdf','civx','civdata'}; … … 150 146 return 151 147 end 152 NomTypeOut='_1-2_1';% output file index will indicate the first and last ref index in the series153 148 %NomTypeOut='_1-2_1';% output file index will indicate the first and last ref index in the series 149 NomTypeOut=nomtype2pair(NomType{1});% determine the index nomenclature type for the output file 154 150 155 151 %% Set field names and velocity types … … 272 268 %%%%%%%%%%%% END MAIN RUNNING OPERATIONS %%%%%%%%%%%% 273 269 else 274 disp lay(errormsg)270 disp(errormsg) 275 271 end 276 272 end … … 303 299 end 304 300 305 % writting the result file306 OutputFile=fullfile_uvmat(RootPath{1},OutputDir,RootFile{1},FileExtOut,NomTypeOut, i1_series{1}(1),i1_series{1}(end),j1_series{1}(1),j1_series{1}(end));301 %% writing the result file 302 OutputFile=fullfile_uvmat(RootPath{1},OutputDir,RootFile{1},FileExtOut,NomTypeOut,first_i,last_i,first_j,last_j); 307 303 if CheckImage{1} %case of images 308 304 if isequal(FileInfo{1}.BitDepth,16)||(numel(FileInfo)==2 &&isequal(FileInfo{2}.BitDepth,16)) … … 313 309 imwrite(DataOut.A,OutputFile,'BitDepth',8); % case of 16 bit images 314 310 end 315 disp lay([OutputFile ' written']);311 disp([OutputFile ' written']); 316 312 else %case of netcdf input file , determine global attributes 317 313 errormsg=struct2nc(OutputFile,DataOut); %save result file 318 314 if isempty(errormsg) 319 display([OutputFile ' written']); 320 else 321 msgbox_uvmat('ERROR',['error in writting result file: ' errormsg]) 322 display(errormsg) 315 disp([OutputFile ' written']); 316 else 317 disp(['error in writting result file: ' errormsg]) 323 318 end 324 319 end % end averaging loop -
trunk/src/series/civ_input.m
r604 r609 89 89 FileType=SeriesData.FileType{1}; 90 90 FileInfo=SeriesData.FileInfo{1}; 91 Ref_i=SeriesData.Ref_i{1}; 92 Ref_j=SeriesData.Ref_j{1}; 93 FileInput=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomTypeInput,Ref_i(1),Ref_i(2),Ref_j(1),Ref_j(2)); 91 FileInput=SeriesData.RefFile{1}; 94 92 95 93 %% case of netcdf file as input, get the processing stage and look for corresponding images … … 226 224 time=SeriesData.Time{1}; 227 225 %transform .Time to a column vector if it is a line vector thenomenclature uses a single index: correct possible bug in xml 228 if isequal(MaxIndex_i,1) && ~isequal(MaxIndex_j,1)% .Time is a line vector 229 if numel(nom_type_read)>=2 && isempty(regexp(nom_type_read(2:end),'\D','once')) 230 time=time'; 231 MaxIndex_i=MaxIndex_j; 232 MaxIndex_j=1; 233 end 234 end 235 end 236 if isfield(SeriesData,'TimeUnit') 237 TimeUnit=SeriesData.TimeUnit; 238 end 226 % if isequal(MaxIndex_i,1) && ~isequal(MaxIndex_j,1)% .Time is a line vector 227 % if numel(nom_type_read)>=2 && isempty(regexp(nom_type_read(2:end),'\D','once')) 228 % time=time'; 229 % MaxIndex_i=MaxIndex_j; 230 % MaxIndex_j=1; 231 % end 232 % end 233 end 234 if isfield(Param.IndexRange,'TimeUnit')&&~isempty(Param.IndexRange.TimeUnit) 235 TimeUnit=Param.IndexRange.TimeUnit; 236 end 237 if isfield(SeriesData,'TimeSource') 238 set(handles.ImaDoc,'String',SeriesData.TimeSource) 239 end 239 240 if isfield(SeriesData,'GeometryCalib') 240 241 tsai=SeriesData.GeometryCalib; … … 247 248 end 248 249 % timing set by video input 249 if isempty(time) && (strcmp(FileType,'video') || strcmp(FileType,'mmreader'))250 set(handles.ListPairMode,'Value',1);251 dt=1/get(MovieObject,'FrameRate');%time interval between successive frames252 if strcmp(NomTypeIma,'*')253 set(handles.ListPairMode,'String',{'series(Di)'})254 time=(dt*(0:MaxIndex_i-1))';%list of image times255 else256 set(handles.ListPairMode,'String',[{'series(Dj)'};{'series(Di)'}])257 time=ones(MaxIndex_i,1)*(dt*(0:MaxIndex_j-1));%list of image times258 enable_j(handles,'on')259 end260 TimeUnit='s';261 set(handles.ImaDoc,'BackgroundColor',[1 1 1])% set display box back to whiter262 end250 % if isempty(time) && (strcmp(FileType,'video') || strcmp(FileType,'mmreader')) 251 % set(handles.ListPairMode,'Value',1); 252 % dt=1/get(MovieObject,'FrameRate');%time interval between successive frames 253 % if strcmp(NomTypeIma,'*') 254 % set(handles.ListPairMode,'String',{'series(Di)'}) 255 % time=(dt*(0:MaxIndex_i-1))';%list of image times 256 % else 257 % set(handles.ListPairMode,'String',[{'series(Dj)'};{'series(Di)'}]) 258 % time=ones(MaxIndex_i,1)*(dt*(0:MaxIndex_j-1));%list of image times 259 % enable_j(handles,'on') 260 % end 261 % TimeUnit='s'; 262 % set(handles.ImaDoc,'BackgroundColor',[1 1 1])% set display box back to whiter 263 % end 263 264 264 265 %% timing display … … 274 275 else 275 276 set(handles.ImaDoc,'String',''); %xml file not used for timing 276 % time=(i1_series(:,1)+0:size(i1_series,3)-1);% time=index i277 % time=time'*ones(1,size(i1_series,2),1); %makes a time matrix with the same time for all j indices278 277 TimeUnit='frame'; 279 278 time=ones(MaxIndex_j-MinIndex_j+1,1)*(MinIndex_i:MaxIndex_i); 280 279 time=time+0.001*(MinIndex_j:MaxIndex_j)'*ones(1,MaxIndex_i-MinIndex_i+1); 281 280 end 282 time=[zeros(size(time,1),1) time]; %insert a vertical line of zeros (to deal with zero file indices)283 time=[zeros(1,size(time,2)); time]; %insert a horizontal line of zeros281 % time=[zeros(size(time,1),1) time]; %insert a vertical line of zeros (to deal with zero file indices) 282 % time=[zeros(1,size(time,2)); time]; %insert a horizontal line of zeros 284 283 CivInputData.Time=time; 285 284 CivInputData.NomTypeIma=NomTypeIma; 286 285 set(handles.civ_input,'UserData',CivInputData) 287 %set(handles.ImaDoc,'UserData',time); %store the matrix of times288 286 set(handles.dt_unit,'String',['dt in m' TimeUnit]);%display dt in unit 10-3 of the time (e.g ms) 289 287 set(handles.TimeUnit,'String',TimeUnit); … … 292 290 set(handles.CoordUnit,'String',CoordUnit) 293 291 set(handles.SearchRange,'UserData', pxcm_search); 294 295 % set(handles.ImaExt,'String',ImaExt)296 % set(handles.NomType,'String',NomTypeIma)297 292 298 293 %% set the reference indices from the input file indices … … 865 860 mode=mode_list{mode_value}; 866 861 end 867 displ_num=[];%default862 % displ_num=[];%default 868 863 ref_i=str2double(get(handles.ref_i,'String')); 869 864 % last_i=str2num(get(handles.last_i,'String')); … … 873 868 time=CivInputData.Time; 874 869 siztime=size(CivInputData.Time); 875 nbfield=siztime( 2)-1;876 nbfield2=siztime( 1)-1;870 nbfield=siztime(1)-1; 871 nbfield2=siztime(2)-1; 877 872 indchosen=1; %%first pair selected by default 878 873 %displ_num used to define the indices of the civ_input pairs … … 916 911 enable_j(handles, 'on') 917 912 elseif isequal(mode,'series(Di)') %| isequal(mode,'st_series(Di)') 918 index=1:200;919 displ_num(1:2,index)=zeros(2,200);920 displ_num(3,index)=-floor(index/2);921 displ_num(4,index)=ceil(index/2);913 % index=1:200; 914 % displ_num(1:2,index)=zeros(2,200); 915 % displ_num(3,index)=-floor(index/2); 916 % displ_num(4,index)=ceil(index/2); 922 917 enable_i(handles, 'on') 923 918 if nbfield2 > 1 … … 942 937 end 943 938 end 944 set(handles.ListPairCiv1,'UserData',displ_num);939 %set(handles.ListPairCiv1,'UserData',displ_num); 945 940 errormsg=find_netcpair_civ( handles,1); 946 941 if ~isempty(errormsg) … … 978 973 set(handles.ListPairCiv2,'Value',index_pair); 979 974 end 975 976 %update first_i and last_i according to the chosen image pairs 977 % mode_list=get(handles.ListPairMode,'String'); 978 % mode_value=get(handles.ListPairMode,'Value'); 979 % mode=mode_list{mode_value}; 980 % if isequal(mode,'series(Di)') 981 % first_i=str2double(get(handles.first_i,'String')); 982 % last_i=str2double(get(handles.last_i,'String')); 983 % incr_i=str2double(get(handles.incr_i,'String')); 984 % num_i=first_i:incr_i:last_i; 985 % lastfield=str2double(get(handles.nb_field,'String')); 986 % if ~isnan(lastfield) 987 % test_find=(num_i-floor(index_pair/2)*ones(size(num_i))>0)& ... 988 % (num_i+ceil(index_pair/2)*ones(size(num_i))<=lastfield); 989 % num_i=num_i(test_find); 990 % end 991 % set(handles.first_i,'String',num2str(num_i(1))); 992 % set(handles.last_i,'String',num2str(num_i(end))); 993 % elseif isequal(mode,'series(Dj)') 994 % first_j=str2double(get(handles.first_j,'String')); 995 % last_j=str2double(get(handles.last_j,'String')); 996 % incr_j=str2double(get(handles.incr_j,'String')); 997 % num_j=first_j:incr_j:last_j; 998 % lastfield2=str2double(get(handles.nb_field2,'String')); 999 % if ~isnan(lastfield2) 1000 % test_find=(num_j-floor(index_pair/2)*ones(size(num_j))>0)& ... 1001 % (num_j+ceil(index_pair/2)*ones(size(num_j))<=lastfield2); 1002 % num_j=num_j(test_find); 1003 % end 1004 % set(handles.first_j,'String',num2str(num_j(1))); 1005 % set(handles.last_j,'String',num2str(num_j(end))); 1006 % end 1007 1008 %------------------------------------------------------------------------ 1009 % --- Executes on selection change in ListPairCiv2. 1010 function ListPairCiv2_Callback(hObject, eventdata, handles) 1011 %------------------------------------------------------------------------ 1012 index_pair=get(handles.ListPairCiv2,'Value');%get the selected position index in the menu 980 1013 981 1014 %update first_i and last_i according to the chosen image pairs … … 1012 1045 1013 1046 %------------------------------------------------------------------------ 1014 % --- Executes on selection change in ListPairCiv2.1015 function ListPairCiv2_Callback(hObject, eventdata, handles)1016 %------------------------------------------------------------------------1017 index_pair=get(handles.ListPairCiv2,'Value');%get the selected position index in the menu1018 1019 %update first_i and last_i according to the chosen image pairs1020 mode_list=get(handles.ListPairMode,'String');1021 mode_value=get(handles.ListPairMode,'Value');1022 mode=mode_list{mode_value};1023 if isequal(mode,'series(Di)')1024 first_i=str2double(get(handles.first_i,'String'));1025 last_i=str2double(get(handles.last_i,'String'));1026 incr_i=str2double(get(handles.incr_i,'String'));1027 num_i=first_i:incr_i:last_i;1028 lastfield=str2double(get(handles.nb_field,'String'));1029 if ~isnan(lastfield)1030 test_find=(num_i-floor(index_pair/2)*ones(size(num_i))>0)& ...1031 (num_i+ceil(index_pair/2)*ones(size(num_i))<=lastfield);1032 num_i=num_i(test_find);1033 end1034 set(handles.first_i,'String',num2str(num_i(1)));1035 set(handles.last_i,'String',num2str(num_i(end)));1036 elseif isequal(mode,'series(Dj)')1037 first_j=str2double(get(handles.first_j,'String'));1038 last_j=str2double(get(handles.last_j,'String'));1039 incr_j=str2double(get(handles.incr_j,'String'));1040 num_j=first_j:incr_j:last_j;1041 lastfield2=str2double(get(handles.nb_field2,'String'));1042 if ~isnan(lastfield2)1043 test_find=(num_j-floor(index_pair/2)*ones(size(num_j))>0)& ...1044 (num_j+ceil(index_pair/2)*ones(size(num_j))<=lastfield2);1045 num_j=num_j(test_find);1046 end1047 set(handles.first_j,'String',num2str(num_j(1)));1048 set(handles.last_j,'String',num2str(num_j(end)));1049 end1050 1051 %------------------------------------------------------------------------1052 1047 function ref_i_Callback(hObject, eventdata, handles) 1053 1048 %------------------------------------------------------------------------ … … 1114 1109 %% reads .nc subdirectoy and image numbers from the interface 1115 1110 SubDirImages=get(handles.Civ1_ImageA,'String'); 1111 %TODO: determine 1116 1112 subdir_civ1=[SubDirImages get(handles.Civ1_ImageB,'String')];%subdirectory subdir_civ1 for the netcdf data 1117 1113 subdir_civ2=[SubDirImages get(handles.Civ2_ImageA,'String')];%subdirectory subdir_civ2 for the netcdf data … … 1126 1122 ref_j=1; 1127 1123 end 1128 time=get(handles.ImaDoc,'UserData');%get the set of times 1124 CivInputData=get(handles.civ_input,'UserData'); 1129 1125 TimeUnit=get(handles.TimeUnit,'String'); 1126 time=CivInputData.Time; 1130 1127 checkframe=strcmp(TimeUnit,'frame'); 1131 displ_num=get(handles.ListPairCiv1,'UserData');1128 %displ_num=get(handles.ListPairCiv1,'UserData'); 1132 1129 1133 1130 %% eliminate the first pairs inconsistent with the position 1134 if isempty(displ_num)1135 nbpair=0;1136 else1137 nbpair=length(displ_num(1,:));%nbre of displayed pairs1138 if isequal(mode,'series(Di)') %| isequal(mode,'st_series(Di)')1139 nbpair=min(2*ref_i-1,nbpair);%limit the number of pairs with positive first index1140 elseif isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)')1141 nbpair=min(2*ref_j-1,nbpair);%limit the number of pairs with positive first index1142 end1143 end1144 nbpair=min(200,nbpair);%limit the number of displayed pairs to 2001131 % if isempty(displ_num) 1132 % nbpair=0; 1133 % else 1134 % nbpair=length(displ_num(1,:));%nbre of displayed pairs 1135 % if isequal(mode,'series(Di)') %| isequal(mode,'st_series(Di)') 1136 % nbpair=min(2*ref_i-1,nbpair);%limit the number of pairs with positive first index 1137 % elseif isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)') 1138 % nbpair=min(2*ref_j-1,nbpair);%limit the number of pairs with positive first index 1139 % end 1140 % end 1141 % nbpair=min(200,nbpair);%limit the number of displayed pairs to 200 1145 1142 1146 1143 %% case with no Civ1 operation, netcdf files need to exist for reading 1147 1144 displ_pair={''}; 1145 nbpair=200;%default 1148 1146 select=ones(size(1:nbpair));%flag for displayed pairs =1 for display 1149 1147 testpair=0; 1150 1148 RootPath=get(handles.RootPath,'String'); 1151 1149 RootFile=get(handles.Civ2_ImageB,'String'); 1150 nbpair=200; %default 1152 1151 if index==1 % case civ1 1153 1152 if ~get(handles.CheckCiv1,'Value') % … … 1227 1226 % in mode 'pair j1-j2', j1 and j2 are the file indices, else the indices 1228 1227 % are relative to the reference indices ref_i and ref_j respectively. 1228 testpair=0; %TODO: check 1229 1229 if isequal(mode,'series(Di)') 1230 1230 if testpair -
trunk/src/series/civ_series.m
r606 r609 58 58 if ~exist(filecell{1,1},'file') 59 59 msgbox_uvmat('WARNING','the first input file does not exist') 60 else 61 FileType=get_file_type(filecell{1,1}); 62 if isempty(find(strcmp(FileType,{'civdata','image','multimage','mmreader','video'})));% =1 for images 63 msgbox_uvmat('ERROR',['bad input file type for ' mfilename ': an image or civdata file is needed']) 64 end 60 65 end 61 66 return … … 85 90 MinIndex=cell2mat(Param.IndexRange.MinIndex); 86 91 [filecell,i_series,tild,j_series]=get_file_series(Param); 92 [FileType_A,FileInfo,MovieObject_A]=get_file_type(filecell{1,1}); 93 if strcmp(FileType_A,'civdata')% a civdata file has been introduced as input. 94 [FileType_A,FileInfo,MovieObject_A]=get_file_type(filecell{2,1}); 95 end 87 96 [i1_series_Civ1,i2_series_Civ1,j1_series_Civ1,j2_series_Civ1,check_bounds,NomTypeNc]=... 88 97 find_pair_indices(PairCiv1,i_series{1},j_series{1},MinIndex,MaxIndex); … … 118 127 119 128 NbField=numel(i1_series_Civ1); 120 [FileType_A,FileInfo,MovieObject_A]=get_file_type(filecell{1,1}); 129 121 130 FileType_B=FileType_A; 122 131 MovieObject_B=MovieObject_A; … … 143 152 144 153 %% get timing from the ImaDoc file or input video 145 [XmlData,NbSlice_calib,time,errormsg]=read_multimadoc(RootPath,SubDir,RootFile,FileExt,i1_series,i2_series,j1_series,j2_series); 154 XmlFileName=find_imadoc(RootPath,SubDir,RootFile,FileExt); 155 time=[]; 156 if ~isempty(XmlFileName) 157 XmlData=imadoc2struct(XmlFileName); 158 if isfield(XmlData,'Time') 159 time=XmlData.Time; 160 TimeSource='xml'; 161 end 162 if isfield(XmlData,'Camera') 163 if isfield(XmlData.Camera,'NbSlice')&& ~isempty(XmlData.Camera.NbSlice) 164 NbSlice_calib{iview}=XmlData.Camera.NbSlice;% Nbre of slices for Zindex in phys transform 165 if ~isequal(NbSlice_calib{iview},NbSlice_calib{1}) 166 msgbox_uvmat('WARNING','inconsistent number of Z indices for the two field series'); 167 end 168 end 169 if isfield(XmlData.Camera,'TimeUnit')&& ~isempty(XmlData.Camera.TimeUnit) 170 TimeUnit=XmlData.Camera.TimeUnit; 171 end 172 end 173 end 174 if strcmp(InputTable{iview,4},'*') 175 if ~isempty(VideoObject) 176 imainfo=get(VideoObject); 177 time=zeros(imainfo.NumberOfFrames+1,2); 178 time(:,2)=(0:1/imainfo.FrameRate:(imainfo.NumberOfFrames)/imainfo.FrameRate)'; 179 TimeSource='video'; 180 % set(han:dles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FrameRate) 'ms']);%display the elementary time interval in millisec 181 ColorType='truecolor'; 182 elseif ~isempty(imformats(regexprep(InputTable{iview,5},'^.',''))) || isequal(InputTable{iview,5},'.vol')%&& isequal(NomType,'*')% multi-frame image 183 if ~isempty(InputTable{iview,2}) 184 imainfo=imfinfo(fullfile(InputTable{iview,1},InputTable{iview,2},[InputTable{iview,3} InputTable{iview,5}])); 185 else 186 imainfo=imfinfo([FileBase InputTable{iview,5}]); 187 end 188 ColorType=imainfo.ColorType;%='truecolor' for color images 189 if length(imainfo) >1 %case of image with multiple frames 190 nbfield=length(imainfo); 191 nbfield_j=1; 192 end 193 end 194 end 195 146 196 %TODO: get time_A and time_B 147 % case of movies TODO TODO TODO 197 148 198 if isempty(time) && (strcmp(FileType,'video') || strcmp(FileType,'mmreader')) 149 199 set(handles.ListPairMode,'Value',1); … … 161 211 end 162 212 TimeUnit='s'; 213 end 163 214 %%%%% MAIN LOOP %%%%%% 164 215 -
trunk/src/series/time_series.m
r606 r609 75 75 OutputDir=[Param.OutputSubDir Param.OutputDirExt]; 76 76 77 %% root input file(s) and type77 %% root input file(s) name, type and index series 78 78 RootPath=Param.InputTable(:,1); 79 79 RootFile=Param.InputTable(:,3); … … 90 90 % i1_series(iview,fileindex) expresses the same indices as a 1D array in file indices 91 91 %%%%%%%%%%%% 92 % NbSlice=1;%default93 % if isfield(Param.IndexRange,'NbSlice')&&~isempty(Param.IndexRange.NbSlice)94 % NbSlice=Param.IndexRange.NbSlice;95 % end96 92 nbview=numel(i1_series);%number of input file series (lines in InputTable) 97 93 nbfield_j=size(j1_series{1},1); %nb of fields for the j index (bursts or volume slices) 98 94 nbfield_i=size(i1_series{1},2); %nb of fields for the i index 99 95 nbfield=nbfield_j*nbfield_i; %total number of fields 100 101 %determine the file type on each line from the first input file 96 [first_i,tild,last_i,first_j,tild,last_j,errormsg]=get_index_range(Param.IndexRange); 97 if ~isempty(errormsg),display(errormsg),return,end 98 99 %% determine the file type on each line from the first input file 102 100 ImageTypeOptions={'image','multimage','mmreader','video'}; 103 101 NcTypeOptions={'netcdf','civx','civdata'}; … … 151 149 return 152 150 end 153 NomTypeOut= '_1-2_1';% output file index will indicate the first and last ref index in the series151 NomTypeOut=nomtype2pair(NomType{1});% determine the index nomenclature type for the output file 154 152 155 153 %% Set field names and velocity types … … 414 412 end 415 413 416 % name of result file417 OutputFile=fullfile_uvmat(RootPath{1},OutputDir,RootFile{1},FileExtOut,NomTypeOut, i1_series{1}(1),i1_series{1}(end),j1_series{1}(1),j1_series{1}(end));414 %% name of result file 415 OutputFile=fullfile_uvmat(RootPath{1},OutputDir,RootFile{1},FileExtOut,NomTypeOut,first_i,last_i,first_j,last_j); 418 416 errormsg=struct2nc(OutputFile,DataOut); %save result file 419 417 if isempty(errormsg) … … 422 420 displ_uvmat('ERROR',['error in Series/struct2nc: ' errormsg],checkrun) 423 421 end 424 425 422 426 423 %% plot the time series (the last one in case of multislices) -
trunk/src/uigetfile_uvmat.m
r606 r609 4 4 % 5 5 % OUTPUT: 6 % hfig: handles of the browser fig, the selected file name is obtained as File=get(hfig,'UserData')6 % fileinput: detected file name, including path 7 7 % 8 8 % INPUT: 9 % option: ='file browser': usual browser, 'seriesstatus': display advancement of a series calculation9 % title: = displayed title, 'status': display advancement of a series calculation 10 10 % InputDir: directory to browse at first display 11 11 12 13 function hfig=uigetfile_uvmat(option,InputDir) 14 if ~exist(InputDir,'dir') 15 InputDir=pwd; 16 end 17 hfig=findobj(allchild(0),'name',option); 12 function fileinput=uigetfile_uvmat(title,InputName) 13 fileinput=''; %default file selection 14 if strcmp(title,'status') 15 option='status'; 16 else 17 option='browser'; 18 end 19 if exist(InputName,'file')||exist(InputName,'dir') 20 [InputDir,InputFileName,Ext]=fileparts(InputName); 21 InputFileName=[InputFileName Ext]; 22 if isdir(InputName) 23 InputFileName=['+/' InputFileName]; 24 end 25 else 26 InputDir=pwd;%look in the current work directory if the input file does not exist 27 InputFileName=''; 28 end 29 hfig=findobj(allchild(0),'tag',option); 18 30 if isempty(hfig) 31 set(0,'Unit','points') 19 32 ScreenSize=get(0,'ScreenSize');% get the size of the screen, to put the fig on the upper right 20 hfig=figure('name',option,'tag',option,'MenuBar','none','NumberTitle','off','Position',[ScreenSize(3)-600 ScreenSize(4)-640 560 600],'DeleteFcn',@stop_status,'UserData',InputDir); 21 uicontrol('Style','listbox','Units','normalized', 'Position',[0.05 0.09 0.9 0.71], 'Callback', @(src,event)view_file(option,src,event),'tag','list','FontSize',12); 22 uicontrol('Style','edit','Units','normalized', 'Position', [0.05 0.87 0.9 0.1],'tag','titlebox','Max',2,'String',InputDir,'FontSize',12,'FontWeight','bold'); 23 uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.7 0.01 0.2 0.07],'String','Close','FontWeight','bold','FontUnits','points','FontSize',12,'Callback',@stop_status); 24 uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.1 0.01 0.2 0.07],'String','Refresh','FontWeight','bold','FontUnits','points','FontSize',12,'Callback',@refresh_GUI); 33 Width=350;% fig width in points (1/72 inch) 34 Height=min(0.8*ScreenSize(4),500); 35 Left=ScreenSize(3)- Width-40; %right edge close to the right, with margin=40 36 Bottom=ScreenSize(4)-Height-40; %put fig at top right 37 hfig=figure('name',option,'tag',option,'MenuBar','none','NumberTitle','off','Unit','points','Position',[Left,Bottom,Width,Height],'UserData',InputDir); 38 uicontrol('Style','listbox','Units','normalized', 'Position',[0.05 0.09 0.9 0.71], 'Callback', @(src,event)view_file(option,src,event),'tag','list',... 39 'FontUnits','points','FontSize',12); 40 uicontrol('Style','edit','Units','normalized', 'Position', [0.05 0.87 0.9 0.1],'tag','titlebox','Max',2,... 41 'String',InputDir,'FontUnits','points','FontSize',12,'FontWeight','bold'); 42 uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.7 0.01 0.2 0.07],'Callback',@(src,event)close(option,src,event),... 43 'String','Close','FontWeight','bold','FontUnits','points','FontSize',12); 44 uicontrol('Style','pushbutton','Tag','refresh','Units','normalized','Position', [0.1 0.01 0.2 0.07],'Callback',@refresh_GUI,... 45 'String','Refresh','FontWeight','bold','FontUnits','points','FontSize',12); 25 46 %set(hrefresh,'UserData',StatusData) 26 if strcmp(option,'series status') %put a run advancement display 47 if strcmp(option,'status') %put a run advancement display 48 set(hfig,'DeleteFcn',@stop_status) 27 49 uicontrol('Style','frame','Units','normalized', 'Position',[0.05 0.81 0.01 0.05],'BackgroundColor',[1 0 0],'tag','waitbar'); 28 50 uicontrol('Style','frame','Units','normalized', 'Position', [0.05 0.81 0.9 0.05]); 29 else %put a title 30 uicontrol('Style','text','Units','normalized', 'Position', [0.05 0.81 0.9 0.03],'String','select an input file:',... 31 'FontSize',14,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','left'); 32 uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.4 0.01 0.2 0.07],'String','Home','FontWeight','bold','FontUnits','points','FontSize',12,'Callback',@home_dir); 51 else %put a title and additional pushbuttons 52 uicontrol('Style','text','Units','normalized', 'Position', [0.15 0.81 0.8 0.03],... 53 'String',title,'FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','left'); 54 uicontrol('Style','pushbutton','Tag','backward','Units','normalized','Position',[0.05 0.8 0.1 0.07],... 55 'String','<--','FontWeight','bold','FontUnits','points','FontSize',12,'Callback',@backward); 56 uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.4 0.01 0.2 0.07],... 57 'String','Home','FontWeight','bold','FontUnits','points','FontSize',12,'Callback',@home_dir); 33 58 end 34 59 drawnow 35 60 end 36 refresh_GUI(hfig) 37 38 %------------------------------------------------------------------------ 39 % --- launched by selecting a file on the list 61 refresh_GUI(findobj(hfig,'Tag','refresh'),InputFileName) 62 if ~strcmp(option,'status') 63 uiwait(hfig) 64 end 65 fileinput=get(hfig,'UserData');% retrieve the input file selection 66 delete(hfig) 67 68 %------------------------------------------------------------------------ 69 % --- launched by selecting an item on the file list 40 70 function view_file(option,hObject,event) 41 71 %------------------------------------------------------------------------ 42 72 list=get(hObject,'String'); 43 73 index=get(hObject,'Value'); 44 hfig=get(hObject,'parent'); 45 DirName=get( get(hObject,'parent'),'UserData');46 SelectName=regexprep(list{index},'^ /','');% remove the/ used to mark dir47 if strcmp(SelectName,'..') 74 hfig=get(hObject,'parent');%handle of the fig 75 DirName=get(hfig,'UserData'); 76 SelectName=regexprep(list{index},'^\+/','');% remove the +/ used to mark dir 77 if strcmp(SelectName,'..')% the upward dir option has been selected 48 78 FullSelectName=fileparts(DirName); 49 79 else 50 %ind_dot=regexp(SelectName,'\.\.\.');51 % if ~isempty(ind_dot)52 % SelectName=SelectName(1:ind_dot-1);53 % end54 FullSelectName=fullfile(DirName,SelectName);80 %ind_dot=regexp(SelectName,'\.\.\.'); 81 % if ~isempty(ind_dot) 82 % SelectName=SelectName(1:ind_dot-1); 83 % end 84 FullSelectName=fullfile(DirName,SelectName); 55 85 end 56 86 if exist(FullSelectName,'dir')% a directory has been selected … … 65 95 % FullSelectName=fileparts(fileparts(FullSelectName)); 66 96 % end 97 hbackward=findobj(hfig,'Tag','backward'); 98 set(hbackward,'UserData',DirName); %store the current dir for future backward action 67 99 ListFiles=list_files(FullSelectName); 68 100 set(hObject,'Value',1) … … 82 114 %uvmat(FullSelectName); 83 115 switch option 84 case ' filebrowser'116 case 'browser' 85 117 hfig=get(hObject,'parent'); 86 118 set(hfig,'UserData',FullSelectName); 87 119 uiresume(hfig) 88 case 's eries status'120 case 'status' 89 121 uvmat(FullSelectName); 90 122 end 91 end92 set(gcbo,'Value',1)123 set(gcbo,'Value',1) 124 end 93 125 end 94 126 … … 96 128 % --- launched by selecting home 97 129 function home_dir(hObject,event) 130 %------------------------------------------------------------------------ 98 131 DirName=pwd; 99 100 132 ListFiles=list_files(DirName);% list the directory content 101 133 hfig=get(hObject,'parent'); … … 108 140 109 141 %------------------------------------------------------------------------ 142 % --- launched by pressing the backward (<--) button 143 function backward(hObject,event) 144 %------------------------------------------------------------------------ 145 PrevDir=get(hObject,'UserData'); 146 if ~isempty(PrevDir) 147 hfig=get(hObject,'parent'); 148 set(hfig,'UserData',PrevDir) 149 htitlebox=findobj(hfig,'tag','titlebox'); % display the new dir name 150 set(htitlebox,'String',PrevDir) 151 refresh_GUI(findobj(hfig,'Tag','refresh')) 152 end 153 154 %------------------------------------------------------------------------ 155 156 %------------------------------------------------------------------------ 110 157 % --- launched by refreshing the display figure 111 function refresh_GUI(hfig,event) 112 %------------------------------------------------------------------------ 158 function refresh_GUI(hObject,InputFileName) 159 %------------------------------------------------------------------------ 160 if ~exist('InputFileName','var') 161 InputFileName=''; 162 end 163 hfig=get(hObject,'parent'); 113 164 DirName=get(hfig,'UserData'); 114 165 ListFiles=list_files(DirName);% list the directory content 115 166 hlist=findobj(hfig,'tag','list');% find the list object 116 167 set(hlist,'String',ListFiles) 168 Value=[]; 169 if ~isempty(InputFileName) 170 Value=find(strcmp(InputFileName,ListFiles)); 171 end 172 if isempty(Value) 173 Value=1; 174 end 175 set(hlist,'Value',Value) 117 176 return 118 177 … … 188 247 ListFiles=ListCells(1,:);%list of file names 189 248 check_dir=cell2mat(ListCells(4,:));% check directories 190 ListFiles(check_dir)=regexprep(ListFiles(check_dir),'^.+',' /$0');% put '/' in front of dir name display249 ListFiles(check_dir)=regexprep(ListFiles(check_dir),'^.+','+/$0');% put '+/' in front of dir name display 191 250 [tild,index_sort]=sort(check_dir,2,'descend');% sort 192 251 ListFiles=ListFiles(index_sort);% list of names sorted by alaphabetical order and dir and file 193 cell_remove=regexp(ListFiles,'^(-|\.| /\.)');% remove strings beginning by '/.',';' or '-'194 check_ remove=cellfun('isempty',cell_remove);195 ListFiles=[{' /..'} ListFiles(check_remove)];252 cell_remove=regexp(ListFiles,'^(-|\.|\+/\.)');% detect strings beginning by '-' ,'.' or '+/.'(dir beginning by . ) 253 check_keep=cellfun('isempty', cell_remove); 254 ListFiles=[{'+/..'} ListFiles(check_keep)]; 196 255 197 256 %------------------------------------------------------------------------- 198 % launched by deleting the status figure 199 function stop_status(hObject, eventdata)257 % launched by deleting the status figure (only used in mode series status') 258 function close(option,hObject, eventdata) 200 259 %------------------------------------------------------------------------- 201 hciv=findobj(allchild(0),'tag','series'); 202 hhciv=guidata(hciv); 203 set(hhciv.status,'value',0) %reset the status uicontrol in the GUI civ 204 set(hhciv.status,'BackgroundColor',[0 1 0]) 260 if strcmp(option,'status') 261 hseries=findobj(allchild(0),'tag','series'); 262 hstatus=findobj(hfig,'Tag','status'); 263 set(hhciv.status,'value',0) %reset the status uicontrol in the GUI civ 264 set(hhciv.status,'BackgroundColor',[0 1 0]) 265 end 205 266 delete(gcbf) 206 267 -
trunk/src/uvmat.m
r606 r609 32 32 % .OpenParam: structure containing parameters defined when uvmat is opened 33 33 % .PosColorbar: position (1x4 vector)of the colorbar (relative to the fig uvmat) 34 % .PosSetObject: position of set_object35 34 % .PosGeometryCalib: size of set_object 36 35 % .NbBuiltin: nbre of functions always displayed in TransformName menu … … 175 174 path_uvmat=fileparts(which('uvmat')); 176 175 177 %% set the position of colorbar and ancillary GUIs: 178 set(hObject,'Units','Normalized') 179 movegui(hObject,'center') 176 %% set the position of the GUI, colorbar and ancillary GUIs: 177 set(hObject,'Units','pixels')% 178 set(0,'Units','pixels'); 179 ScreenSize=get(0,'ScreenSize');%size of the current screen 180 Width=1050; 181 Height=700; 182 %adjust to screen size (reduced by a min margin) 183 RescaleFactor=min((ScreenSize(3)-80)/Width,(ScreenSize(4)-80)/Height); 184 if RescaleFactor>1 185 RescaleFactor=RescaleFactor/2+1/2; %reduce the rescale factor to provide an increased margin for a big screen 186 end 187 Width=Width*RescaleFactor; 188 Height=Height*RescaleFactor; 189 LeftX=80*RescaleFactor;%position of the left fig side, in pixels (put to the left side, with some margin) 190 LowY=round(ScreenSize(4)/2-Height/2); % put at the middle height on the screen 191 set(hObject,'Position',[LeftX LowY Width Height]) 192 193 %set(hObject,'Units','Normalized') 194 180 195 %UvData.OpenParam.PosColorbar=[0.8450 0.0900 0.0190 0.3600]; 181 196 UvData.OpenParam.PosColorbar=[0.805 0.022 0.019 0.445]; 182 UvData.OpenParam.PosSetObject=[-0.05 -0.03 0.3 0.7]; %position for set_object197 %UvData.OpenParam.PosSetObject=[-0.05 -0.03 0.3 0.7]; %position for set_object 183 198 UvData.OpenParam.PosGeometryCalib=[0.95 -0.03 0.28 1 ];%position for geometry_calib (TO IMPROVE) 184 199 % UvData.OpenParam.CalSize=[0.28 1]; … … 197 212 198 213 %% initialisation 199 % set(handles.ListObject,'Value',1)% default: empty projection objectproj_field200 % set(handles.ListObject,'String',{''})201 % set(handles.ListObject_1,'Value',1)% default: empty projection objectproj_field202 % set(handles.ListObject_1,'String',{''})203 214 set(handles.FieldName,'Value',1) 204 215 set(handles.FieldName,'string',{''}) … … 337 348 function MenuBrowse_Callback(hObject, eventdata, handles) 338 349 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 339 oldfile= fullfile(RootPath,SubDir);350 oldfile=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]; 340 351 if isempty(oldfile) %loads the previously stored file name and set it as default in the file_input box 341 352 oldfile=get(handles.RootPath,'UserData'); 342 353 end 343 hfig=uigetfile_uvmat('file browser',fileparts(oldfile)); 344 uiwait(hfig); 345 if ishandle(hfig) % stop if browser closed without selection 346 fileinput=get(hfig,'UserData');% retrieve the input file selection 347 delete(hfig) 348 % display the selected field and related information 354 fileinput=uigetfile_uvmat('select an input file:',oldfile); 355 if ~isempty(fileinput) 349 356 display_file_name(handles,fileinput) 350 357 end 351 352 %353 %354 %355 % [FileName, PathName] = uigetfile({'*.*','All Files(*.*)'},'Pick a file',oldfile);356 % if ~ischar(FileName),return,end %abandon if the browser is cancelled357 % fileinput=[PathName FileName];%complete file name358 358 359 359 %% display the selected field and related information … … 435 435 %------------------------------------------------------------------------ 436 436 RootPath=get(handles.RootPath,'String'); 437 [FileName, PathName] = uigetfile({'*.*','All Files(*.*)'},'Pick a file',RootPath); 438 if ~ischar(FileName),return,end %abandon if the browser is cancelled 439 fileinput_1=[PathName FileName];%complete file name 440 441 % refresh the current displayed field 442 set(handles.SubField,'Value',1) 443 display_file_name(handles,fileinput_1,2) 444 445 %update list of recent files in the menubar 446 MenuFile_1=fileinput_1; 447 MenuFile_2=get(handles.MenuFile_1,'Label'); 448 MenuFile_3=get(handles.MenuFile_2,'Label'); 449 MenuFile_4=get(handles.MenuFile_3,'Label'); 450 MenuFile_5=get(handles.MenuFile_4,'Label'); 451 set(handles.MenuFile_1,'Label',MenuFile_1) 452 set(handles.MenuFile_2,'Label',MenuFile_2) 453 set(handles.MenuFile_3,'Label',MenuFile_3) 454 set(handles.MenuFile_4,'Label',MenuFile_4) 455 set(handles.MenuFile_5,'Label',MenuFile_5) 456 set(handles.MenuFile_1_1,'Label',MenuFile_1) 457 set(handles.MenuFile_2_1,'Label',MenuFile_2) 458 set(handles.MenuFile_3_1,'Label',MenuFile_3) 459 set(handles.MenuFile_4_1,'Label',MenuFile_4) 460 set(handles.MenuFile_5_1,'Label',MenuFile_5) 461 % dir_perso=prefdir; 462 % profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 463 % if exist(profil_perso,'file') 464 % save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5','-append'); %store the file names for future opening of uvmat 465 % else 466 % txt=ver('MATLAB'); 467 % Release=txt.Release; 468 % relnumb=str2double(Release(3:4)); 469 % if relnumb >= 14 470 % save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5','-V6'); %store the file names for future opening of uvmat 471 % else 472 % save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5'); %store the file names for future opening of uvmat 473 % end 474 % end 437 SubDir=get(handles.SubDir,'String'); 438 fileinput_1=uigetfile_uvmat('select a second input file:',fullfile(RootPath,SubDir)); 439 if ~isempty(fileinput_1) 440 % [FileName, PathName] = uigetfile({'*.*','All Files(*.*)'},'Pick a file',RootPath); 441 % if ~ischar(FileName),return,end %abandon if the browser is cancelled 442 % fileinput_1=[PathName FileName];%complete file name 443 444 % refresh the current displayed field 445 set(handles.SubField,'Value',1) 446 display_file_name(handles,fileinput_1,2) 447 448 %update list of recent files in the menubar 449 MenuFile_1=fileinput_1; 450 MenuFile_2=get(handles.MenuFile_1,'Label'); 451 MenuFile_3=get(handles.MenuFile_2,'Label'); 452 MenuFile_4=get(handles.MenuFile_3,'Label'); 453 MenuFile_5=get(handles.MenuFile_4,'Label'); 454 set(handles.MenuFile_1,'Label',MenuFile_1) 455 set(handles.MenuFile_2,'Label',MenuFile_2) 456 set(handles.MenuFile_3,'Label',MenuFile_3) 457 set(handles.MenuFile_4,'Label',MenuFile_4) 458 set(handles.MenuFile_5,'Label',MenuFile_5) 459 set(handles.MenuFile_1_1,'Label',MenuFile_1) 460 set(handles.MenuFile_2_1,'Label',MenuFile_2) 461 set(handles.MenuFile_3_1,'Label',MenuFile_3) 462 set(handles.MenuFile_4_1,'Label',MenuFile_4) 463 set(handles.MenuFile_5_1,'Label',MenuFile_5) 464 end 475 465 476 466 % -------------------------------------------------------------------- … … 2003 1993 num_j1=stra2num(get(handles.j1,'String')); 2004 1994 num_j2=stra2num(get(handles.j2,'String')); 2005 [tild,tild,tild,i1_1,i2_1,j1_1,j2_1]=fileparts_uvmat(FileIndex_1); 1995 [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_1 1996 if isempty(j1_1)% case of movies, the index is not given by file index 1997 j1_1=num_j1; 1998 end 2006 1999 2007 2000 errormsg=refresh_field(handles,filename,filename_1,num_i1,num_i2,num_j1,num_j2,i1_1,i2_1,j1_1,j2_1); … … 2204 2197 end 2205 2198 case 'multimage' 2206 if ~strcmp(NomType_1,'*')2207 frame_index_1= j1_1;%frame index for movies or multimage2199 if strcmp(NomType_1,'*')%frame index for movies or multimage 2200 frame_index_1=i1_1; 2208 2201 else 2209 frame_index_1= i1_1;2202 frame_index_1=j1_1; 2210 2203 end 2211 2204 case 'vol' %TODO: update … … 3509 3502 [hset_object,UvData.sethandles]=set_object(data,PlotHandles);% call the set_object interface with action on haxes, 3510 3503 % associate the set_object interface handle to the plotting axes 3511 set(hset_object,'Position',get(handles.uvmat,'Position')+UvData.OpenParam.PosSetObject)3504 %set(hset_object,'Position',get(handles.uvmat,'Position')+UvData.OpenParam.PosSetObject) 3512 3505 UvData.MouseAction='create_object'; 3513 3506 else … … 4402 4395 [PlotType,PlotParam]=plot_field(ProjData,hhview_field.PlotAxes,read_GUI(hview_field));%read plotting parameters on the GUI view_field); 4403 4396 errormsg=fill_GUI(PlotParam,hview_field); 4404 4405 if ~isfield(PlotParamOut,list{1})4406 4407 4408 4397 for list={'Scalar','Vectors'} 4398 if ~isfield(PlotParam,list{1}) 4399 set(hhview_field.(list{1}),'Visible','off') 4400 end 4401 end 4409 4402 %write_plot_param(hhview_field,PlotParam); %update the display of plotting parameters for the current object 4410 4403 haxes=findobj(hview_field,'tag','axes3');
Note: See TracChangeset
for help on using the changeset viewer.