Changeset 526 for trunk/src/series.m
- Timestamp:
- Aug 20, 2012, 12:32:31 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series.m
r525 r526 68 68 drawnow 69 69 set(hObject,'Units','pixels') 70 set(handles.PairString,'ColumnName',{'pairs'}) 70 71 set(handles.PairString,'ColumnEditable',logical(0)) 71 72 set(handles.PairString,'ColumnFormat',{'char'}) 72 set(handles.PairString,'ColumnWidth',{60})73 73 set(handles.PairString,'Data',{''}) 74 series_ResizeFcn(hObject, eventdata, handles)%resize table according to series GUI size 74 75 set(hObject,'WindowButtonDownFcn',{'mouse_down'})%allows mouse action with right button (zoom for uicontrol display) 75 76 dir_perso=prefdir; … … 92 93 93 94 %% file name and browser initialisation 94 if isfield(param,' menu_coord_str')95 set(handles.TransformName,'String',param. menu_coord_str)96 end 97 if isfield(param,' menu_coord_val')98 set(handles.TransformName,'Value',param. menu_coord_val);95 if isfield(param,'transform_str') 96 set(handles.TransformName,'String',param.transform_str) 97 end 98 if isfield(param,'transform_val') 99 set(handles.TransformName,'Value',param.transform_val); 99 100 else 100 101 set(handles.TransformName,'Value',1);%default … … 121 122 set(handles.FieldName,'String',param.list_fields);% list menu fields 122 123 set(handles.FieldName,'Value',param.index_fields);% selected string index 123 % FieldCell{1}=param.list_fields{param.index_fields}; 124 end 125 if isfield(param,'Coord_x_str')&& isfield(param,'Coord_x_val') 126 set(handles.Coord_x,'String',param.Coord_x_str);% list menu fields 127 set(handles.Coord_x,'Value',param.Coord_x_val);% selected string index 128 end 129 if isfield(param,'Coord_y_str')&& isfield(param,'Coord_y_val') 130 set(handles.Coord_y,'String',param.Coord_y_str);% list menu fields 131 set(handles.Coord_y,'Value',param.Coord_y_val);% selected string index 124 132 end 125 133 … … 585 593 586 594 %% display the min and max indices for the file series 595 if size(i1_series,2)==1 596 MinIndex_j=1; 597 MaxIndex_j=1; 598 MinIndex_i=min(find(i1_series)); 599 MaxIndex_i=max(find(i1_series)); 600 else 587 601 pair_max=squeeze(max(i1_series,[],1)); %max on pair index 588 602 j_max=max(pair_max,[],1); … … 590 604 MaxIndex_i=max(find(j_max))-1;% max ref index i 591 605 MinIndex_i=min(find(j_max))-1;% min ref index i 606 diff_i_max=diff(j_max); 607 if isequal (diff_i_max,diff_i_max(1)*ones(size(diff_i_max))) 608 set(handles.num_incr_i,'String',num2str(diff_i_max(1))) 609 end 592 610 i_max=max(pair_max,[],2); 593 611 MaxIndex_j=max(find(i_max))-1;% max ref index i 594 612 MinIndex_j=min(find(i_max))-1;% min ref index i 613 diff_j_max=diff(i_max); 614 if isequal (diff_j_max,diff_j_max(1)*ones(size(diff_j_max))) 615 set(handles.num_incr_j,'String',num2str(diff_j_max(1))) 616 end 617 end 595 618 MinIndex=get(handles.MinIndex,'Data');%retrieve the min indices in the table MinIndex 596 619 MaxIndex=get(handles.MaxIndex,'Data');%retrieve the max indices in the table MaxIndex … … 611 634 elseif first_i < MinIndex_i 612 635 first_i=MinIndex_i; 636 elseif first_i >MaxIndex_i 637 first_i=MinIndex_i; 613 638 end 614 639 first_j=str2num(get(handles.num_first_j,'String')); … … 617 642 elseif first_j<MinIndex_j 618 643 first_j=MinIndex_j; 644 elseif first_j >MaxIndex_j 645 first_j=MinIndex_j; 619 646 end 620 647 last_i=str2num(get(handles.num_last_i,'String')); … … 623 650 elseif last_i > MaxIndex_i 624 651 last_i=MaxIndex_i; 652 elseif last_i<first_i 653 last_i=first_i; 625 654 end 626 655 last_j=str2num(get(handles.num_first_j,'String')); … … 629 658 elseif last_j>MaxIndex_j 630 659 last_j=MaxIndex_j; 660 elseif last_i<first_i 661 last_i=first_i; 631 662 end 632 663 set(handles.num_first_i,'String',num2str(first_i)); … … 635 666 set(handles.num_last_j,'String',num2str(last_j)); 636 667 637 %% read timing and total frame number from the current file (movie files) !!may be overrid by xml file668 %% read timing and total frame number from the current file (movie files) may be overrid by xml file 638 669 InputTable=get(handles.InputTable,'Data'); 639 670 FileBase=fullfile(InputTable{iview,1},InputTable{iview,3}); … … 644 675 imainfo=get(VideoObject); 645 676 time=(0:1/imainfo.FrameRate:(imainfo.NumberOfFrames-1)/imainfo.FrameRate)'; 646 set(handles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FrameRate) 'ms']);%display the elementary time interval in millisec677 % set(handles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FrameRate) 'ms']);%display the elementary time interval in millisec 647 678 ColorType='truecolor'; 648 679 elseif ~isempty(imformats(regexprep(InputTable{iview,5},'^.',''))) || isequal(InputTable{iview,5},'.vol')%&& isequal(NomType,'*')% multi-frame image … … 771 802 for iview=1:nbview 772 803 pair_max{iview}=squeeze(max(SeriesData.i1_series{iview},[],1)); %max on pair index 773 if strcmp(get(handles.num_first_j,'Visible'),'off')804 if (strcmp(get(handles.num_first_j,'Visible'),'off')&& size(pair_max{iview},2)~=1) 774 805 pair_max{iview}=squeeze(max(pair_max{iview},[],1)); % consider only the i index 775 806 end … … 831 862 set(handles.Coord_y,'String',{'Y'}); 832 863 case 'netcdf' 833 set(handles_Fields,'Value',1) 834 set(handles_Fields,'String',{'get_field...'}) 864 set(handles.FieldName,'Value',1) 865 set(handles.FieldName,'String',{'get_field...'}) 866 if isempty(i2_series) 867 i2=[]; 868 else 869 i2=i2_series(1,ref_j+1,ref_i+1); 870 end 871 if isempty(j1_series) 872 j1=[];j2=[]; 873 else 874 j1=j1_series(1,ref_j+1,ref_i+1); 875 if isempty(j2_series) 876 j2=[]; 877 else 878 j2=j2_series(1,ref_j+1,ref_i+1); 879 end 880 end 881 FileName=fullfile_uvmat(InputTable{iview,1},InputTable{iview,2},InputTable{iview,3},InputTable{iview,5},InputTable{iview,4},i1_series(1,ref_j+1,ref_i+1),i2,j1,j2); 835 882 hget_field=get_field(FileName); 836 883 hhget_field=guidata(hget_field); 837 884 get_field('RUN_Callback',hhget_field.RUN,[],hhget_field); 838 885 otherwise 839 set(handles _Fields,'Value',1) % set menu to 'image'840 set(handles _Fields,'String',{'image'})886 set(handles.FieldName,'Value',1) % set menu to 'image' 887 set(handles.FieldName,'String',{'image'}) 841 888 set(handles.Coord_x,'Value',1); 842 889 set(handles.Coord_x,'String',{'AX'}); … … 844 891 set(handles.Coord_y,'String',{'AY'}); 845 892 end 846 % %% set default options in menu 'Fields'%% TODO: check VelType847 % if ~testima848 % testcivx=0;849 % if isfield(UvData,'FieldsString') && isequal(UvData.FieldsString,{'get_field...'})% field menu defined as input (from get_field)850 % set(handles_Fields,'Value',1)851 % set(handles_Fields,'String',{'get_field...'})852 % UvData=rmfield(UvData,'FieldsString');853 % else854 % Data=nc2struct(FileName,'ListGlobalAttribute','Conventions','absolut_time_T0','civ');855 % if strcmp(Data.Conventions,'uvmat/civdata') ||( ~isempty(Data.absolut_time_T0)&& ~isequal(Data.civ,0))%if the new input is Civx856 % FieldList=calc_field;857 % set(handles_Fields,'String',[{'image'};FieldList;{'get_field...'}]);%standard menu for civx data858 % set(handles_Fields,'Value',2) % set menu to 'velocity'859 % col_vec=FieldList;860 % col_vec(1)=[];%remove 'velocity' option for vector color (must be a scalar)861 % testcivx=1;862 % end863 % if ~testcivx864 % set(handles_Fields,'Value',1) % set menu to 'get_field...865 % set(handles_Fields,'String',{'get_field...'})866 % col_vec={'get_field...'};867 % end868 % set(handles.ColorScalar,'String',col_vec)869 % end870 % end871 % set(handles.uvmat,'UserData',UvData)872 %873 % %% set index navigation options and refresh plots874 % scan_option='i';%default875 % state_j='off'; %default876 % if index==2877 % if get(handles.scan_j,'Value')878 % scan_option='j'; %keep the scan option for the second fiel series879 % end880 % if strcmp(get(handles.j1,'Visible'),'on')881 % state_j='on';882 % end883 % end884 % if ~isempty(j1_series)885 % state_j='on';886 % if isequal(nbfield,1) &&index==1887 % scan_option='j'; %scan j index by default if nbfield=1888 % end889 % end890 % if isequal(scan_option,'i')891 % set(handles.scan_i,'Value',1)892 % scan_i_Callback([],[], handles);893 % else894 % set(handles.scan_j,'Value',1)895 % scan_j_Callback([],[], handles);896 % end897 % set(handles.scan_j,'Visible',state_j)898 % set(handles.j1,'Visible',state_j)899 % set(handles.j2,'Visible',state_j)900 % set(handles.last_j,'Visible',state_j);901 % set(handles.frame_j,'Visible',state_j);902 % set(handles.j_text,'Visible',state_j);903 % if ~isempty(i2_series)||~isempty(j2_series)904 % set(handles.CheckFixPair,'Visible','on')905 % elseif index==1906 % set(handles.CheckFixPair,'Visible','off')907 % end908 %909 %910 % mode_Callback(hObject, eventdata, handles)911 %912 % set(handles.REFRESH,'BackgroundColor',[0.7 0.7 0.7])913 % InputTable=get(handles.InputTable,'Data');914 % check_lines=get(handles.REFRESH,'UserData');915 %916 % %% check the indices and FileTypes for each series (limited to the new ones to save time)917 % for ind_list=1:length(check_lines)918 % if check_lines(ind_list)919 % InputLine=InputTable(ind_list,:);920 % detect_idem=strcmp('"',InputLine);% look for '" (repeat of previous data)921 % detect_idem=detect_idem(detect_idem>0);922 % if ~isempty (detect_idem)923 % InputLine(detect_idem)=InputTable(ind_list-1,detect_idem);924 % set(handles.InputTable,'Data',InputTable)925 % end926 % fileinput=fullfile_uvmat(InputLine{1},InputLine{2},InputLine{3},InputLine{5},InputLine{4},1,2,1,2);927 % %fileinput=name_generator(fullfile(InputLine{1},InputLine{3}),1,1,InputLine{5},InputLine{4},1,2,2,InputLine{2})928 % %update file series defined by the selected line929 % [InputTable{ind_list,3},InputTable{(ind_list),4},errormsg]=update_indices(handles,fileinput,ind_list);930 % if ~isempty(errormsg)931 % msgbox_uvmat('ERROR',errormsg)932 % return933 % end934 % end935 % end936 % set(handles.InputTable,'Data',InputTable)937 % SeriesData=get(handles.series,'UserData');938 %939 % state_j='off';940 % state_Pairs='off';941 % state_InputFields='off';942 % val=get(handles.ListView,'Value');943 % ListViewString={''};944 % if ~isempty(SeriesData)945 % % ListViewString={};946 % for iview=1:size(InputTable,1)947 % if ~isempty(SeriesData.j1_series{iview})948 % state_j='on';949 % end950 % if ~isempty(SeriesData.i2_series{iview})||~isempty(SeriesData.j2_series{iview})951 % state_Pairs='on';952 % ListViewString{iview}=num2str(iview);953 % if check_lines(iview)954 % val=iview;%select the last pair if it is a new entry955 % end956 % end957 % if strcmp(SeriesData.FileType{iview},'civx')||strcmp(SeriesData.FileType{iview},'civdata')958 % state_InputFields='on';959 % end960 % end961 % end962 % set(handles.ListView,'Value',val)963 % set(handles.ListView,'String',ListViewString)964 % if strcmp(state_Pairs,'on')965 % ListView_Callback(hObject,eventdata,handles)966 % end967 % set(handles.PairString,'Visible',state_Pairs)968 % enable_j(handles,state_j)969 893 970 894 %------------------------------------------------------------------------ … … 1059 983 % end 1060 984 for iview=1:numel(SeriesData.i1_series) 1061 index_min(iview)=min(find(SeriesData.i1_series{iview}(1,2:end,2:end)>0)); 1062 index_max(iview)=max(find(SeriesData.i1_series{iview}(1,2:end,2:end)>0)); 985 pair_max{iview}=squeeze(max(SeriesData.i1_series{iview},[],1)); %max on pair index 986 if (strcmp(get(handles.num_first_j,'Visible'),'off')&& size(pair_max{iview},2)~=1) 987 pair_max{iview}=squeeze(max(pair_max{iview},[],1)); % consider only the i index 988 end 989 pair_max{iview}=reshape(pair_max{iview},1,[]); 990 index_min(iview)=find(pair_max{iview}>0, 1 ); 991 index_max(iview)=find(pair_max{iview}>0, 1, 'last' ); 1063 992 end 1064 993 [index_min,iview_min]=min(index_min); 1065 994 [index_max,iview_max]=min(index_max); 1066 index_first=(ref_i(1)-1)*(size(SeriesData.i1_series{iview_min},2)-1)+ref_j(1); 1067 index_last=(ref_i(2)-1)*(size(SeriesData.i1_series{iview_max},2)-1)+ref_j(2); 995 if size(SeriesData.i1_series{iview_min},2)==1% movie 996 index_first=ref_i(1); 997 index_last=ref_i(2); 998 else 999 %index_first=(ref_i(1)-1)*(size(SeriesData.i1_series{iview_min},2)-1)+ref_j(1); 1000 %index_last=(ref_i(2)-1)*(size(SeriesData.i1_series{iview_max},2)-1)+ref_j(2); 1001 index_first=(ref_i(1))*(size(SeriesData.i1_series{iview_min},2))+ref_j(1)+1; 1002 index_last=(ref_i(2))*(size(SeriesData.i1_series{iview_max},2))+ref_j(2)+1; 1003 end 1068 1004 range=index_max-index_min+1; 1069 1005 coeff_min=(index_first-index_min)/range; … … 1334 1270 function enable_j(handles,state) 1335 1271 set(handles.j_txt,'Visible',state) 1336 % set(handles.num_MinIndex_j,'Visible',state)1337 1272 set(handles.num_first_j,'Visible',state) 1338 1273 set(handles.num_last_j,'Visible',state) 1339 1274 set(handles.num_incr_j,'Visible',state) 1340 % set(handles.num_MaxIndex_j,'Visible',state)1341 1275 set(handles.num_ref_j,'Visible',state) 1342 1276 set(handles.ref_j_text,'Visible',state) 1277 % if strcmp(state,'off') 1278 % set(handles.MinIndex,'ColumnName',{'imax'}) 1279 % set(handles.MinIndex,'ColumnEditable',logical(0)) 1280 % else 1281 % set(handles.MinIndex,'ColumnName',{'imax','jmax'}) 1282 % end 1343 1283 1344 1284 … … 2067 2007 function RunMode_Callback(hObject, eventdata, handles) 2068 2008 2069 2070 % --- Executes on selection change in popupmenu14. 2071 function popupmenu14_Callback(hObject, eventdata, handles) 2072 % hObject handle to popupmenu14 (see GCBO) 2073 % eventdata reserved - to be defined in a future version of MATLAB 2074 % handles structure with handles and user data (see GUIDATA) 2075 2076 % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu14 contents as cell array 2077 % contents{get(hObject,'Value')} returns selected item from popupmenu14 2078 2079 2080 % --- Executes during object creation, after setting all properties. 2081 function popupmenu14_CreateFcn(hObject, eventdata, handles) 2082 % hObject handle to popupmenu14 (see GCBO) 2083 % eventdata reserved - to be defined in a future version of MATLAB 2084 % handles empty - handles not created until after all CreateFcns called 2085 2086 % Hint: popupmenu controls usually have a white background on Windows. 2087 % See ISPC and COMPUTER. 2088 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 2089 set(hObject,'BackgroundColor','white'); 2090 end 2009 % --- Executes on selection change in Coord_x. 2010 function Coord_x_Callback(hObject, eventdata, handles) 2011 2012 2013 % --- Executes on selection change in Coord_y. 2014 function Coord_y_Callback(hObject, eventdata, handles) 2015 2016 2017 2018 % --- Executes when series is resized. 2019 function series_ResizeFcn(hObject, eventdata, handles) 2020 %% input table 2021 set(handles.InputTable,'Unit','pixel') 2022 Pos=get(handles.InputTable,'Position'); 2023 set(handles.InputTable,'Unit','normalized') 2024 ColumnWidth=round([0.5 0.14 0.14 0.14 0.08]*(Pos(3)-52)); 2025 ColumnWidth=num2cell(ColumnWidth); 2026 set(handles.InputTable,'ColumnWidth',ColumnWidth) 2027 2028 %% MinIndex and MaxIndex 2029 set(handles.MinIndex,'Unit','pixel') 2030 Pos=get(handles.MinIndex,'Position'); 2031 set(handles.MinIndex,'Unit','normalized') 2032 ColumnWidth=get(handles.MinIndex,'ColumnWidth'); 2033 if numel(ColumnWidth)==2 2034 ColumnWidth=num2cell(floor([0.5 0.5]*(Pos(3)-20))); 2035 else 2036 ColumnWidth={Pos(3)-5}; 2037 end 2038 set(handles.MinIndex,'ColumnWidth',ColumnWidth) 2039 set(handles.MaxIndex,'ColumnWidth',ColumnWidth) 2040 2041 %% TimeTable 2042 set(handles.TimeTable,'Unit','pixel') 2043 Pos=get(handles.TimeTable,'Position'); 2044 set(handles.TimeTable,'Unit','normalized') 2045 ColumnWidth=get(handles.TimeTable,'ColumnWidth'); 2046 ColumnWidth=num2cell(floor([0.25 0.25 0.25 0.25]*(Pos(3)-20))); 2047 set(handles.TimeTable,'ColumnWidth',ColumnWidth) 2048 2049 2050 %% PairString 2051 set(handles.PairString,'Unit','pixel') 2052 Pos=get(handles.PairString,'Position'); 2053 set(handles.PairString,'Unit','normalized') 2054 set(handles.PairString,'ColumnWidth',{Pos(3)-5})
Note: See TracChangeset
for help on using the changeset viewer.