Changeset 615 for trunk/src/series.m


Ignore:
Timestamp:
Apr 23, 2013, 4:22:08 PM (8 years ago)
Author:
sommeria
Message:

a few bugs repaired

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series.m

    r612 r615  
    696696InputTable=get(handles.InputTable,'Data');
    697697FileBase=fullfile(InputTable{iview,1},InputTable{iview,3});
    698 time=[];%default
     698Time=[];%default
    699699TimeSource='';
    700700% 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},'*')
     702if ~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';
     713elseif ~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
     724end
     725% end
    722726
    723727%%  read image documentation file  if found
     
    732736        end
    733737        if isfield(XmlData,'Time')
    734             time=XmlData.Time;
     738            Time=XmlData.Time;
    735739            TimeSource='xml';
    736740        end
     
    752756
    753757%% update time table
    754 if ~isempty(time)
     758if ~isempty(Time)
    755759    TimeTable=get(handles.TimeTable,'Data');
    756760    first_i=str2num(get(handles.num_first_i,'String'));
     
    764768    MaxIndex_i=MaxIndexTable{iview,1};
    765769    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);
    781780        end
    782781    end
     
    805804set(handles.ListView,'String',ListView);
    806805set(handles.ListView,'Value',iview)
    807 update_mode(handles,i1_series,i2_series,j1_series,j2_series,time)
     806update_mode(handles,i1_series,i2_series,j1_series,j2_series,Time)
    808807
    809808%% update the series info in 'UserData'
     
    815814SeriesData.FileType{iview}=FileType;
    816815SeriesData.FileInfo{iview}=FileInfo;
    817 SeriesData.Time{iview}=time;
     816SeriesData.Time{iview}=Time;
    818817if ~isempty(TimeSource)
    819818    SeriesData.TimeSource=TimeSource;
     
    10131012    TimeTable{iview,2}=[];
    10141013    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
    10161015        if isempty(ref_j)
    10171016            time_first=(SeriesData.Time{iview}(i1(1)+1)+SeriesData.Time{iview}(i2(1)+1))/2;
Note: See TracChangeset for help on using the changeset viewer.