Changeset 611 for trunk/src


Ignore:
Timestamp:
Apr 18, 2013, 9:02:03 AM (12 years ago)
Author:
sommeria
Message:

problem of time display repaired

Location:
trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r599 r611  
    335335    set(handles.ListPairCiv2,'String',{''})
    336336    Param=xml2struct(fileinput);  %read parameters from the xml input file
    337     fill_GUI(Param,handles);%fill the GUI with the parameters retrieved from the xml file
     337    fill_GUI(Param,handles.civ);%fill the GUI with the parameters retrieved from the xml file
    338338    return
    339339end
     
    534534    MaxIndex_i=min(size(time,1),MaxIndex_i);%possibly adjust the max index according to time data
    535535    MaxIndex_j=min(size(time,2),MaxIndex_j);
    536     time=[zeros(size(time,1),1) time]; %insert a vertical line of zeros (to deal with zero file indices)
    537     time=[zeros(1,size(time,2)); time]; %insert a horizontal line of zeros
     536%     time=[zeros(size(time,1),1) time]; %insert a vertical line of zeros (to deal with zero file indices)
     537%     time=[zeros(1,size(time,2)); time]; %insert a horizontal line of zeros
    538538else
    539539    set(handles.ImaDoc,'String',''); %xml file not used for timing
  • trunk/src/imadoc2struct.m

    r591 r611  
    66% s: structure representing ImaDoc
    77%   s.Heading: information about the data hierarchical structure
    8 %   s.Time: matrix of times
     8%   s.Time: matrix of times, note that s.Time(i+1,j+1) is the time for file indices i and j (in order to deal with index 0)
    99%   s.TimeUnit
    1010%  s.GeometryCalib: substructure containing the parameters for geometric calibration
     
    101101        end
    102102    end
     103    s.Time=[zeros(size(s.Time,1),1) s.Time]; %insert a vertical line of zeros (to deal with zero file indices)
     104    s.Time=[zeros(1,size(s.Time,2)); s.Time]; %insert a horizontal line of zeros
    103105end
    104106
  • trunk/src/series.m

    r610 r611  
    764764    MaxIndex_i=MaxIndexTable{iview,1};
    765765    MaxIndex_j=MaxIndexTable{iview,2};
    766     if isempty(MinIndex_j)% only i index
    767         if MinIndex_i>0
    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);
    773     elseif ~isempty(time)
    774         if MinIndex_i>0
    775             TimeTable{iview,1}=time(MinIndex_i,MinIndex_j);
     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);
    776775        end
    777776        if size(time)>=[last_i+1 last_j+1]
    778             TimeTable{iview,2}=time(first_i+1,first_j+1);
    779777            TimeTable{iview,3}=time(last_i+1,last_j+1);
    780778        end
     
    866864% y=(0.5:nbview-0.5)*Position(4)/nbview;
    867865range_y=max(1,floor(Position(4)/nbview));
    868 CData=zeros(nbview*range_y,Position(3));
     866CData=zeros(nbview*range_y,floor(Position(3)));
    869867for iview=1:nbview
    870868    ind_y=1+(iview-1)*range_y:iview*range_y;
  • trunk/src/uigetfile_uvmat.m

    r610 r611  
    4545    Bottom=ScreenSize(4)-Height-40; %put fig at top right
    4646    hfig=figure('name',option,'tag',option,'MenuBar','none','NumberTitle','off','Unit','points','Position',[Left,Bottom,Width,Height],'UserData',InputDir);
    47     uicontrol('Style','listbox','Units','normalized', 'Position',[0.05 0.09 0.9 0.71], 'Callback', @(src,event)view_file(option,src,event),'tag','list',...
     47    BackgroundColor=get(hfig,'Color');
     48    uicontrol('Style','text','Units','normalized', 'Position', [0.05 0.97 0.5 0.03],'BackgroundColor',BackgroundColor,...
     49            '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],...
     51        'String',InputDir,'FontUnits','points','FontSize',12,'FontWeight','bold');
     52%     uicontrol('Style','text','Units','normalized', 'Position', [0.05 0.85 0.5 0.03],'BackgroundColor',BackgroundColor,...
     53%             'String','first modified:','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','right');
     54%     uicontrol('Style','text','Units','normalized', 'Position', [0.05 0.82 0.5 0.03],'BackgroundColor',BackgroundColor,...
     55%             'String','last modified:','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','right');
     56    uicontrol('Style','listbox','Units','normalized', 'Position',[0.05 0.08 0.9 0.66], 'Callback', @(src,event)view_file(option,src,event),'tag','list',...
    4857        'FontUnits','points','FontSize',12);
    49     uicontrol('Style','edit','Units','normalized', 'Position', [0.05 0.87 0.9 0.1],'tag','titlebox','Max',2,...
    50         'String',InputDir,'FontUnits','points','FontSize',12,'FontWeight','bold');
    51     uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.7 0.01 0.2 0.07],'Callback',@(src,event)close(option,src,event),...
     58    uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.7 0.005 0.2 0.07],'Callback',@(src,event)close(option,src,event),...
    5259        'String','Close','FontWeight','bold','FontUnits','points','FontSize',12);
    53     uicontrol('Style','pushbutton','Tag','refresh','Units','normalized','Position', [0.1 0.01 0.2 0.07],'Callback',@refresh_GUI,...
     60    uicontrol('Style','pushbutton','Tag','refresh','Units','normalized','Position', [0.1 0.005 0.2 0.07],'Callback',@refresh_GUI,...
    5461        'String','Refresh','FontWeight','bold','FontUnits','points','FontSize',12);
    5562    %set(hrefresh,'UserData',StatusData)
     
    5966        uicontrol('Style','frame','Units','normalized', 'Position', [0.05 0.81 0.9 0.05]);
    6067    else  %put a title and additional pushbuttons
    61         uicontrol('Style','text','Units','normalized', 'Position', [0.15 0.81 0.8 0.03],...
     68        uicontrol('Style','text','Units','normalized', 'Position', [0.15 0.75 0.8 0.03],'BackgroundColor',BackgroundColor,...
    6269            'String',title,'FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','left');
    63         uicontrol('Style','pushbutton','Tag','backward','Units','normalized','Position',[0.05 0.8 0.1 0.07],...
     70        uicontrol('Style','pushbutton','Tag','backward','Units','normalized','Position',[0.05 0.75 0.1 0.07],...
    6471            'String','<--','FontWeight','bold','FontUnits','points','FontSize',12,'Callback',@backward);
    65         uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.4 0.01 0.2 0.07],...
     72        uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.4 0.005 0.2 0.07],...
    6673            'String','Home','FontWeight','bold','FontUnits','points','FontSize',12,'Callback',@home_dir);
    6774    end
     
    7178if ~strcmp(option,'status_display') 
    7279    uiwait(hfig)
    73     fileinput=get(hfig,'UserData');% retrieve the input file selection
     80    htitlebox=findobj(hfig,'Tag','titlebox');
     81    fileinput=get(htitlebox,'String');% retrieve the input file selection
    7482    delete(hfig)
    7583end
     
    8593end
    8694hfig=get(hObject,'parent');
    87 DirName=get(hfig,'UserData');
     95htitlebox=findobj(hfig,'tag','titlebox');
     96DirName=get(htitlebox,'String');
    8897ListFiles=list_files(DirName);% list the directory content
    8998hlist=findobj(hfig,'tag','list');% find the list object
     
    109118   
    110119   
    111     htitlebox=findobj(hfig,'tag','titlebox');
     120
    112121    hlist=findobj(hfig,'tag','list');
    113     OutputDir=get(hfig,'UserData');
     122   % OutputDir=get(hfig,'UserData');
    114123   
    115124    testrecent=0;
     
    168177index=get(hObject,'Value');
    169178hfig=get(hObject,'parent');%handle of the fig
    170 DirName=get(hfig,'UserData');
     179htitlebox=findobj(hfig,'tag','titlebox');  % display the new dir name 
     180DirName=get(htitlebox,'String');
    171181SelectName=regexprep(list{index},'^\+/','');% remove the +/ used to mark dir
    172182if strcmp(SelectName,'..')% the upward dir option has been selected
     
    195205    set(hObject,'Value',1)
    196206    set(hObject,'String',ListFiles)
    197     set(hfig,'UserData',FullSelectName)% record the new dir name
    198     htitlebox=findobj(hfig,'tag','titlebox');  % display the new dir name 
    199     set(htitlebox,'String',FullSelectName)
     207    set(htitlebox,'String',FullSelectName)% record the new dir name
    200208elseif exist(FullSelectName,'file')%visualise the field if it exists
    201209    FileType=get_file_type(FullSelectName);
     
    210218        switch option
    211219            case 'browser'
    212         hfig=get(hObject,'parent');
    213         set(hfig,'UserData',FullSelectName);
     220        set(htitlebox,'String',FullSelectName);
    214221        uiresume(hfig)
    215222            case 'status_display'
    216223           uvmat(FullSelectName);
    217224        end
    218         set(gcbo,'Value',1)
    219225    end
    220226end
     
    222228%-------------------------------------------------------------------------   
    223229% list the content of a directory
    224 function ListFiles=list_files(DirName)
     230function [ListFiles,ListDates]=list_files(DirName)
    225231%-------------------------------------------------------------------------
    226232ListStruct=dir(DirName);% get structure of the current directory
    227 if numel(ListStruct)<1
     233if numel(ListStruct)<1  % case of empty dir
    228234    ListFiles={};
     235    ListDates={};
    229236    return
    230237end
    231 if strcmp(ListStruct(1).name,'.')
    232     ListStruct(1)=[];%removes the first line ='.'
    233 end
     238% if strcmp(ListStruct(1).name,'.')
     239%     ListStruct(1)=[];%removes the first line ='.'
     240% end
    234241ListCells=struct2cell(ListStruct);% transform dir struct to a cell arrray
    235242ListFiles=ListCells(1,:);%list of file names
    236 check_dir=cell2mat(ListCells(4,:));% check directories
     243check_dir=cell2mat(ListCells(4,:));% =1 for directories, =0 for files
     244ListDates=cell2mat(ListCells(5,:));%list of numerical dates
    237245ListFiles(check_dir)=regexprep(ListFiles(check_dir),'^.+','+/$0');% put '+/' in front of dir name display
    238 [tild,index_sort]=sort(check_dir,2,'descend');% sort
     246ListDates(check_dir)=0; % we set the dir dates to 0
     247[tild,index_sort]=sort(check_dir,2,'descend');% put the dir first in the list
    239248ListFiles=ListFiles(index_sort);% list of names sorted by alaphabetical order and dir and file
     249ListDates=ListDates(index_sort);% sort the corresponding dates
    240250cell_remove=regexp(ListFiles,'^(-|\.|\+/\.)');% detect strings beginning by '-' ,'.' or '+/.'(dir beginning by . )
    241251check_keep=cellfun('isempty', cell_remove);               
    242252ListFiles=[{'+/..'} ListFiles(check_keep)];
     253ListDates=[0 ListDates(check_keep)];
    243254
    244255%------------------------------------------------------------------------   
     
    249260ListFiles=list_files(DirName);% list the directory content
    250261hfig=get(hObject,'parent');
    251     set(hfig,'UserData',DirName)% record the new dir name
    252     htitlebox=findobj(hfig,'tag','titlebox');  % display the new dir name 
    253     set(htitlebox,'String',DirName)
    254     hlist=findobj(hfig,'tag','list');% find the list object
     262htitlebox=findobj(hfig,'Tag','titlebox');
     263set(htitlebox,'String',DirName)% record the new dir name
     264hlist=findobj(hfig,'tag','list');% find the list object
    255265set(hlist,'String',ListFiles)
    256266%------------------------------------------------------------------------
     
    263273if ~isempty(PrevDir)
    264274hfig=get(hObject,'parent');
    265 set(hfig,'UserData',PrevDir)
    266275htitlebox=findobj(hfig,'tag','titlebox');  % display the new dir name
    267276set(htitlebox,'String',PrevDir)
  • trunk/src/uvmat.m

    r609 r611  
    353353end
    354354fileinput=uigetfile_uvmat('select an input file:',oldfile);
     355
     356%% display the selected field and related information
    355357if ~isempty(fileinput)
    356358    display_file_name(handles,fileinput)
    357359end
    358 
    359 %% display the selected field and related information
    360 % display_file_name( handles,fileinput)
    361360
    362361% -----------------------------------------------------------------------
     
    895894warntext='';%default warning message
    896895NbSlice=1;%default
     896ImaDoc_str='';
    897897set(handles.RootPath,'BackgroundColor',[1 1 1])
    898898if ~isempty(XmlFileName)
    899899    set(handles.view_xml,'Visible','on')
    900     set(handles.view_xml,'BackgroundColor',[1 1 0])
     900    set(handles.view_xml,'BackgroundColor',[1 1 0])% paint  to yellow color to indicate reading of the xml file
    901901    set(handles.view_xml,'String','view .xml')
    902902    drawnow
     
    905905        msgbox_uvmat('WARNING',warntext)
    906906    end
    907     if isempty(XmlDataRead)
    908         set(handles.view_xml,'Visible','off')
    909     else
    910         set(handles.view_xml,'String',['view ' DocExt])   
     907    if ~isempty(XmlDataRead)
     908        ImaDoc_str=['view ' DocExt];   
    911909        XmlData=XmlDataRead;
    912910        if isfield(XmlData,'TimeUnit')
     
    915913            end
    916914        end
    917         set(handles.view_xml,'BackgroundColor',[1 1 1])
     915        set(handles.view_xml,'BackgroundColor',[1 1 1])% paint black to white
    918916        drawnow
    919917        if isfield(XmlData, 'GeometryCalib') && ~isempty(XmlData.GeometryCalib)
     
    936934if ~(isfield(XmlData,'Time')&& ~isempty(XmlData.Time))
    937935    XmlData.Time=Time; %time set by video
     936end
     937if isempty(ImaDoc_str)
     938    set(handles.view_xml,'Visible','off')
     939else
     940    set(handles.view_xml,'String',ImaDoc_str)
    938941end
    939942
     
    23782381    end
    23792382    siz=size(UvData.XmlData{1}.Time);
    2380     if ~isempty(num_i1)&& ~isempty(num_i2) && num_i1>0 &&siz(1)>=max(num_i1,num_i2) && siz(2)>=max(num_j1,num_j2)
    2381         abstime=(UvData.XmlData{1}.Time(num_i1,num_j1)+UvData.XmlData{1}.Time(num_i2,num_j2))/2;%overset the time read from files
    2382         dt=(UvData.XmlData{1}.Time(num_i2,num_j2)-UvData.XmlData{1}.Time(num_i1,num_j1));
     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)
     2384        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        dt=(UvData.XmlData{1}.Time(num_i2+1,num_j2+1)-UvData.XmlData{1}.Time(num_i1+1,num_j1+1));
    23832386        Field{1}.Dt=dt;
    23842387        if isfield(UvData.XmlData{1},'TimeUnit')
     
    53015304    end
    53025305end
     5306
     5307
     5308
Note: See TracChangeset for help on using the changeset viewer.