Changeset 615


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

a few bugs repaired

Location:
trunk/src
Files:
3 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;
  • trunk/src/uigetfile_uvmat.m

    r613 r615  
    1717    option='browser';
    1818end
    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='';
     19InputDir=pwd;%look in the current work directory if the input file does not exist
     20InputFileName='';%default
     21if 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
    3738end
    3839hfig=findobj(allchild(0),'tag',option);
     
    4849    uicontrol('Style','text','Units','normalized', 'Position', [0.05 0.97 0.5 0.03],'BackgroundColor',BackgroundColor,...
    4950            '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,...
    5152        'String',InputDir,'FontUnits','points','FontSize',12,'FontWeight','bold');
    5253    uicontrol('Style','pushbutton','Tag','backward','Units','normalized','Position',[0.05 0.75 0.1 0.07],...
     
    8687end
    8788
    88 
     89%------------------------------------------------------------------------   
     90% --- launched by refreshing the display figure
     91function titlebox_Callback(hObject,event)
     92refresh_GUI(hObject)
     93%------------------------------------------------------------------------
    8994
    9095%------------------------------------------------------------------------   
     
    194199function list_Callback(option,hObject,event)
    195200%------------------------------------------------------------------------
     201    set(hObject,'BackgroundColor',[1 1 0])% paint list in yellow to indicate action
     202    drawnow
    196203list=get(hObject,'String');
    197204index=get(hObject,'Value');
     
    255262    end
    256263end
     264set(hObject,'BackgroundColor',[0.7 0.7 0.7])% paint list in grey to indicate action end
    257265
    258266%-------------------------------------------------------------------------   
  • trunk/src/uvmat.m

    r611 r615  
    850850TimeUnit='';%default
    851851Time=[];
    852 % testima=0; %test for image input
    853852imainfo=[];
    854853ColorType='falsecolor'; %default
    855 % hhh=[];
    856854UvData.MovieObject{index}=VideoObject;
    857855if ~isempty(VideoObject)
    858856    imainfo=get(VideoObject);
    859 %     testima=1;
    860857    TimeUnit='s';
    861858    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)';
    863861    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);
    865863    end
    866864    set(handles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FrameRate) 'ms']);%display the elementary time interval in millisec
     
    20302028
    20312029%% initialisation
    2032 abstime=[];
    2033 abstime_1=[];
    2034 dt=[];
    20352030if ~exist('Field','var')
    20362031    Field={};
     
    23502345
    23512346%% display time
    2352 testimedoc=0;
     2347abstime=[];%default inputs
     2348abstime_1=[];
     2349dt=[];
    23532350TimeUnit='';
    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
    23722352if isfield(UvData,'XmlData') && isfield(UvData.XmlData{1},'Time')
    23732353    if isempty(num_i2)||isnan(num_i2)
     
    23812361    end
    23822362    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)
    23842364        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
    23852365        dt=(UvData.XmlData{1}.Time(num_i2+1,num_j2+1)-UvData.XmlData{1}.Time(num_i1+1,num_j1+1));
     
    24002380        end
    24012381        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
     2387end
     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
     2396if isempty(abstime)
     2397if 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
     2402elseif 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
     2407end
     2408end
     2409% if ~isequal(numel(abstime),1)
     2410%     abstime=[];
     2411% end
     2412% if ~isequal(numel(abstime_1),1)
     2413%       abstime_1=[];
     2414% end 
    24142415set(handles.abs_time,'String',num2str(abstime,5))
    24152416set(handles.abs_time_1,'String',num2str(abstime_1,5))
Note: See TracChangeset for help on using the changeset viewer.