Changeset 615
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series.m
r612 r615 696 696 InputTable=get(handles.InputTable,'Data'); 697 697 FileBase=fullfile(InputTable{iview,1},InputTable{iview,3}); 698 time=[];%default698 Time=[];%default 699 699 TimeSource=''; 700 700 % case of movies 701 if strcmp(InputTable{iview,4},'*') 702 if ~isempty(VideoObject) 703 imainfo=get(VideoObject); 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 708 ColorType='truecolor'; 709 elseif ~isempty(imformats(regexprep(InputTable{iview,5},'^.',''))) || isequal(InputTable{iview,5},'.vol')%&& isequal(NomType,'*')% multi-frame image 710 if ~isempty(InputTable{iview,2}) 711 imainfo=imfinfo(fullfile(InputTable{iview,1},InputTable{iview,2},[InputTable{iview,3} InputTable{iview,5}])); 712 else 713 imainfo=imfinfo([FileBase InputTable{iview,5}]); 714 end 715 ColorType=imainfo.ColorType;%='truecolor' for color images 716 if length(imainfo) >1 %case of image with multiple frames 717 nbfield=length(imainfo); 718 nbfield_j=1; 719 end 720 end 721 end 701 % 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 722 726 723 727 %% read image documentation file if found … … 732 736 end 733 737 if isfield(XmlData,'Time') 734 time=XmlData.Time;738 Time=XmlData.Time; 735 739 TimeSource='xml'; 736 740 end … … 752 756 753 757 %% update time table 754 if ~isempty( time)758 if ~isempty(Time) 755 759 TimeTable=get(handles.TimeTable,'Data'); 756 760 first_i=str2num(get(handles.num_first_i,'String')); … … 764 768 MaxIndex_i=MaxIndexTable{iview,1}; 765 769 MaxIndex_j=MaxIndexTable{iview,2}; 766 % if isempty(MinIndex_j)% only i index 767 % TimeTable{iview,1}=time(MinIndex_i+1,2); 768 % TimeTable{iview,2}=time(first_i+1,2); 769 % TimeTable{iview,3}=time(last_i+1,2); 770 % TimeTable{iview,4}=time(MaxIndex_i+1,2); 771 if ~isempty(time) 772 TimeTable{iview,1}=time(MinIndex_i+1,MinIndex_j+1); 773 if size(time)>=[first_i+1 first_j+1] 774 TimeTable{iview,2}=time(first_i+1,first_j+1); 775 end 776 if size(time)>=[last_i+1 last_j+1] 777 TimeTable{iview,3}=time(last_i+1,last_j+1); 778 end 779 if size(time)>=[MaxIndex_i+1 MaxIndex_j+1]; 780 TimeTable{iview,4}=time(MaxIndex_i+1,MaxIndex_j+1); 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] 773 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); 781 780 end 782 781 end … … 805 804 set(handles.ListView,'String',ListView); 806 805 set(handles.ListView,'Value',iview) 807 update_mode(handles,i1_series,i2_series,j1_series,j2_series, time)806 update_mode(handles,i1_series,i2_series,j1_series,j2_series,Time) 808 807 809 808 %% update the series info in 'UserData' … … 815 814 SeriesData.FileType{iview}=FileType; 816 815 SeriesData.FileInfo{iview}=FileInfo; 817 SeriesData.Time{iview}= time;816 SeriesData.Time{iview}=Time; 818 817 if ~isempty(TimeSource) 819 818 SeriesData.TimeSource=TimeSource; … … 1013 1012 TimeTable{iview,2}=[]; 1014 1013 TimeTable{iview,3}=[]; 1015 if size(SeriesData.Time{iview},1)>=i2(2) &&size(SeriesData.Time{iview},1)>=j2(2)1014 if size(SeriesData.Time{iview},1)>=i2(2)+1&&size(SeriesData.Time{iview},2)>=j2(2)+1 1016 1015 if isempty(ref_j) 1017 1016 time_first=(SeriesData.Time{iview}(i1(1)+1)+SeriesData.Time{iview}(i2(1)+1))/2; -
trunk/src/uigetfile_uvmat.m
r613 r615 17 17 option='browser'; 18 18 end 19 if exist(InputName,'dir') 20 InputDir=InputName; 21 InputFileName=''; 22 elseif exist(InputName,'file') 23 [InputDir,InputFileName,Ext]=fileparts(InputName); 24 if isempty(InputFileName)% if InputName is already the root 25 InputFileName=InputDir; 26 if ~isempty(strcmp (computer, {'PCWIN','PCWIN64'}))%case of Windows systems 27 InputDir=[InputDir '\'];% append '\' for a correct action of dir 28 InputFileName=[InputFileName '\']; 29 end 30 end 31 if isdir(InputName) 32 InputFileName=['+/' InputFileName Ext]; 33 end 34 else 35 InputDir=pwd;%look in the current work directory if the input file does not exist 36 InputFileName=''; 19 InputDir=pwd;%look in the current work directory if the input file does not exist 20 InputFileName='';%default 21 if ischar(InputName) 22 if exist(InputName,'dir') 23 InputDir=InputName; 24 InputFileName=''; 25 elseif exist(InputName,'file') 26 [InputDir,InputFileName,Ext]=fileparts(InputName); 27 if isempty(InputFileName)% if InputName is already the root 28 InputFileName=InputDir; 29 if ~isempty(strcmp (computer, {'PCWIN','PCWIN64'}))%case of Windows systems 30 InputDir=[InputDir '\'];% append '\' for a correct action of dir 31 InputFileName=[InputFileName '\']; 32 end 33 end 34 if isdir(InputName) 35 InputFileName=['+/' InputFileName Ext]; 36 end 37 end 37 38 end 38 39 hfig=findobj(allchild(0),'tag',option); … … 48 49 uicontrol('Style','text','Units','normalized', 'Position', [0.05 0.97 0.5 0.03],'BackgroundColor',BackgroundColor,... 49 50 'String','path:','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','left'); 50 uicontrol('Style','edit','Units','normalized', 'Position', [0.05 0.89 0.9 0.08],'tag','titlebox','Max',2,'BackgroundColor',[1 1 1],'Callback',@ refresh_GUI,...51 uicontrol('Style','edit','Units','normalized', 'Position', [0.05 0.89 0.9 0.08],'tag','titlebox','Max',2,'BackgroundColor',[1 1 1],'Callback',@titlebox_Callback,... 51 52 'String',InputDir,'FontUnits','points','FontSize',12,'FontWeight','bold'); 52 53 uicontrol('Style','pushbutton','Tag','backward','Units','normalized','Position',[0.05 0.75 0.1 0.07],... … … 86 87 end 87 88 88 89 %------------------------------------------------------------------------ 90 % --- launched by refreshing the display figure 91 function titlebox_Callback(hObject,event) 92 refresh_GUI(hObject) 93 %------------------------------------------------------------------------ 89 94 90 95 %------------------------------------------------------------------------ … … 194 199 function list_Callback(option,hObject,event) 195 200 %------------------------------------------------------------------------ 201 set(hObject,'BackgroundColor',[1 1 0])% paint list in yellow to indicate action 202 drawnow 196 203 list=get(hObject,'String'); 197 204 index=get(hObject,'Value'); … … 255 262 end 256 263 end 264 set(hObject,'BackgroundColor',[0.7 0.7 0.7])% paint list in grey to indicate action end 257 265 258 266 %------------------------------------------------------------------------- -
trunk/src/uvmat.m
r611 r615 850 850 TimeUnit='';%default 851 851 Time=[]; 852 % testima=0; %test for image input853 852 imainfo=[]; 854 853 ColorType='falsecolor'; %default 855 % hhh=[];856 854 UvData.MovieObject{index}=VideoObject; 857 855 if ~isempty(VideoObject) 858 856 imainfo=get(VideoObject); 859 % testima=1;860 857 TimeUnit='s'; 861 858 if isempty(j1_series); %frame index along i 862 Time=(0:1/imainfo.FrameRate:(imainfo.NumberOfFrames)/imainfo.FrameRate)'; 859 Time=zeros(imainfo.NumberOfFrames+1,2); 860 Time(:,2)=(0:1/imainfo.FrameRate:(imainfo.NumberOfFrames)/imainfo.FrameRate)'; 863 861 else 864 Time= ones(size(i1_series,1),1)*(0:1/imainfo.FrameRate:(imainfo.NumberOfFrames)/imainfo.FrameRate);862 Time=[0;ones(size(i1_series,3)-1,1)]*(0:1/imainfo.FrameRate:(imainfo.NumberOfFrames)/imainfo.FrameRate); 865 863 end 866 864 set(handles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FrameRate) 'ms']);%display the elementary time interval in millisec … … 2030 2028 2031 2029 %% initialisation 2032 abstime=[];2033 abstime_1=[];2034 dt=[];2035 2030 if ~exist('Field','var') 2036 2031 Field={}; … … 2350 2345 2351 2346 %% display time 2352 testimedoc=0; 2347 abstime=[];%default inputs 2348 abstime_1=[]; 2349 dt=[]; 2353 2350 TimeUnit=''; 2354 if isfield(Field{1},'Time') 2355 abstime=Field{1}.Time;%time read from the netcdf input file 2356 end 2357 if numel(Field)==2 && isfield(Field{2},'Time') 2358 abstime_1=Field{2}.Time;%time read from the netcdf input file 2359 end 2360 if isfield(Field{1},'Dt') 2361 dt=Field{1}.Dt;%dt read from the netcdf input file 2362 if isfield(Field{1},'TimeUnit') 2363 TimeUnit=Field{1}.TimeUnit; 2364 end 2365 elseif numel(Field)==2 && isfield(Field{2},'Dt')%dt obtained from the second field if not defined in the first 2366 dt=Field{2}.Dt;%dt read from the netcdf input file 2367 if isfield(Field{2},'TimeUnit') 2368 TimeUnit=Field{2}.TimeUnit; 2369 end 2370 end 2371 % time from xml file overset previous result 2351 % time from xml file or video movie 2372 2352 if isfield(UvData,'XmlData') && isfield(UvData.XmlData{1},'Time') 2373 2353 if isempty(num_i2)||isnan(num_i2) … … 2381 2361 end 2382 2362 siz=size(UvData.XmlData{1}.Time); 2383 if ~isempty(num_i1)&& ~isempty(num_i2) && num_i1>=0 &&siz(1)>=max(num_i1 ,num_i2) && siz(2)>=max(num_j1,num_j2)2363 if ~isempty(num_i1)&& ~isempty(num_i2) && num_i1>=0 &&siz(1)>=max(num_i1+1,num_i2+1) && siz(2)>=max(num_j1+1,num_j2+1) 2384 2364 abstime=(UvData.XmlData{1}.Time(num_i1+1,num_j1+1)+UvData.XmlData{1}.Time(num_i2+1,num_j2+1))/2;%overset the time read from files 2385 2365 dt=(UvData.XmlData{1}.Time(num_i2+1,num_j2+1)-UvData.XmlData{1}.Time(num_i1+1,num_j1+1)); … … 2400 2380 end 2401 2381 siz=size(UvData.XmlData{2}.Time); 2402 if ~isempty(i1_1) && siz(1)>=max(i1_1,i2_1) && siz(2)>=max(j1_1,j2_1) 2403 abstime_1=(UvData.XmlData{2}.Time(i1_1,j1_1)+UvData.XmlData{2}.Time(i2_1,j2_1))/2;%overset the time read from files 2404 Field{2}.Dt=(UvData.XmlData{2}.Time(i2_1,j2_1)-UvData.XmlData{2}.Time(i1_1,j1_1)); 2405 end 2406 end 2407 end 2408 if ~isequal(numel(abstime),1) 2409 abstime=[]; 2410 end 2411 if ~isequal(numel(abstime_1),1) 2412 abstime_1=[]; 2413 end 2382 if ~isempty(i1_1) && siz(1)>=max(i1_1+1,i2_1+1) && siz(2)>=max(j1_1+1,j2_1+1) 2383 abstime_1=(UvData.XmlData{2}.Time(i1_1+1,j1_1+1)+UvData.XmlData{2}.Time(i2_1+1,j2_1+1))/2;%overset the time read from files 2384 Field{2}.Dt=(UvData.XmlData{2}.Time(i2_1+1,j2_1+1)-UvData.XmlData{2}.Time(i1_1+1,j1_1+1)); 2385 end 2386 end 2387 end 2388 % if isfield(Field{1},'Time') 2389 % abstime=Field{1}.Time;%time read from the netcdf input file 2390 % end 2391 % if numel(Field)==2 && isfield(Field{2},'Time') 2392 % abstime_1=Field{2}.Time;%time read from the netcdf input file 2393 % end 2394 2395 % look for timing in the input file if not defined in a xml file or movie 2396 if isempty(abstime) 2397 if isfield(Field{1},'Dt') 2398 dt=Field{1}.Dt;%dt read from the netcdf input file 2399 if isfield(Field{1},'TimeUnit') 2400 TimeUnit=Field{1}.TimeUnit; 2401 end 2402 elseif numel(Field)==2 && isfield(Field{2},'Dt')%dt obtained from the second field if not defined in the first 2403 dt=Field{2}.Dt;%dt read from the netcdf input file 2404 if isfield(Field{2},'TimeUnit') 2405 TimeUnit=Field{2}.TimeUnit; 2406 end 2407 end 2408 end 2409 % if ~isequal(numel(abstime),1) 2410 % abstime=[]; 2411 % end 2412 % if ~isequal(numel(abstime_1),1) 2413 % abstime_1=[]; 2414 % end 2414 2415 set(handles.abs_time,'String',num2str(abstime,5)) 2415 2416 set(handles.abs_time_1,'String',num2str(abstime_1,5))
Note: See TracChangeset
for help on using the changeset viewer.