Changeset 962 for trunk/src/uvmat.m


Ignore:
Timestamp:
Jun 28, 2016, 1:05:08 PM (5 years ago)
Author:
sommeria
Message:

level introduced

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r961 r962  
    442442
    443443%------------------------------------------------------------------------
    444 % --- Executes on the menu Open/Browse...
     444% --- Executes on the menu Open/Browse...fill_GUI
    445445% search the files, recognize their type according to their name and fill the rootfile input windows
    446446function MenuBrowse_Callback(hObject, eventdata, handles)
     
    452452fileinput=uigetfile_uvmat('pick an input file',oldfile);
    453453hh=dir(fileinput);
    454 if numel(hh)>1
     454if numel(hh)>1fill_GUI
    455455    msgbox_uvmat('ERROR','invalid input, probably a broken link');
    456456else
     
    465465
    466466% -----------------------------------------------------------------------
    467 % --- Open again the file whose name has been recorded in MenuFile_1
     467% --- Open again the file whose name has been recorded in MenuFile
    468468function MenuFile_Callback(hObject, eventdata, handles)
    469469%------------------------------------------------------------------------
     
    16951695j1=str2num(get(handles.j1,'String'));
    16961696j2=str2num(get(handles.j2,'String'));
     1697NomType=get(hObject,'String');
     1698if strcmp(NomType,'level')
     1699    FileIndex=str2num(get(handles.i1,'String'));
     1700else
    16971701FileIndex=fullfile_uvmat('','','','',get(handles.NomType,'String'),i1,i2,j1,j2);
     1702end
    16981703set(handles.FileIndex,'String',FileIndex)
    16991704% refresh the current settings and refresh the field view
     
    17081713j1=str2num(get(handles.j1,'String'));
    17091714j2=str2num(get(handles.j2,'String'));
     1715NomType=get(hObject,'String');
     1716if strcmp(NomType,'level')
     1717    FileIndex=str2num(get(handles.i1,'String'));
     1718else
    17101719FileIndex=fullfile_uvmat('','','','',get(handles.NomType_1,'String'),i1,i2,j1,j2);
     1720end
    17111721set(handles.FileIndex_1,'String',FileIndex)
    17121722% inputfilerefresh the current settings and inputfilerefresh the field view
     
    18581868    otherwise
    18591869        set(handles_RootPath,'String',RootPath);
    1860         rootname=fullfile(RootPath,SubDir,RootFile);
    18611870        set(handles_SubDir,'String',['/' SubDir]);
    18621871        set(handles_RootFile,'String',['/' RootFile]); %display the separator
    1863         indices=fileinput(length(rootname)+1:end);
    1864         indices(end-length(FileExt)+1:end)=[]; %remove extension
    1865         set(handles_FileIndex,'String',indices);
     1872        if strcmp(NomType,'level')
     1873            rootname=fullfile(RootPath,SubDir,'level');
     1874            rr=regexp(fileinput,['^' rootname '(?<j>\d+)/' RootFile '(?<i>\d+)' FileExt '$'],'names');
     1875            if ~isempty(rr)
     1876                set(handles_FileIndex,'String',rr.i);
     1877            end
     1878        else
     1879            rootname=fullfile(RootPath,SubDir,RootFile);
     1880            indices=fileinput(length(rootname)+1:end);
     1881            indices(end-length(FileExt)+1:end)=[]; %remove extension
     1882            set(handles_FileIndex,'String',indices);
     1883        end
    18661884        set(handles_NomType,'String',NomType);
    18671885        set(handles_FileExt,'String',FileExt);
     
    20452063        if isfield(XmlDataRead,'TimeUnit')&& ~isempty(XmlDataRead.TimeUnit)
    20462064            TimeUnit=XmlDataRead.TimeUnit;
    2047         end   
     2065        end
    20482066        if isfield(XmlDataRead,'Time')&& ~isempty(XmlDataRead.Time)
    20492067            XmlData.Time=XmlDataRead.Time;
    2050              if XmlDataRead.Time(1,:)==XmlDataRead.Time(2,:)% case starting with index 1
    2051             sizDti=size(XmlDataRead.Time,1)-1;%size of the time vector explicitly defined in the xml file
    2052             ind_start=1;
    2053         else
    2054             sizDti=size(XmlDataRead.Time,1);% case starting with index 0
    2055             ind_start=0;
    2056         end
     2068            if XmlDataRead.Time(1,:)==XmlDataRead.Time(2,:)% case starting with index 1
     2069                sizDti=size(XmlDataRead.Time,1)-1;%size of the time vector explicitly defined in the xml file
     2070                ind_start=1;
     2071            else
     2072                sizDti=size(XmlDataRead.Time,1);% case starting with index 0
     2073                ind_start=0;
     2074            end
    20572075            % complement the input if the whole time series is not defined
    2058 %             if size(i1_series,3)>size(XmlDataRead.Time,1)-ind_start %only the first time interval is defined, extrapolate to the whole series           
    2059 %                 Dti_total=XmlDataRead.Time(end)-XmlDataRead.Time(1);%total time interval covered by the time vector
    2060 %                 missing_indices=sizDti+1+ind_start:size(i1_series,3)+1;% remaining set of frame indices for which time needs to be found
    2061 %                 repeat_nbre=1+floor((missing_indices-sizDti-ind_start)/(sizDti-1));% number of repetitions of Dti
    2062 %                 time_indices=1+mod(missing_indices-sizDti-1,sizDti-1);
    2063 %                 for j=1:size(XmlDataRead.Time,2)
    2064 %                     XmlData.Time(missing_indices,j)=XmlDataRead.Time(time_indices,j)+repeat_nbre'*Dti_total;
    2065 %                 end
    2066 %                 % update the xml file with NbDti
    2067 %                 t=xmltree(XmlFileName);
    2068 %                 uid_NbDti=find(t,'ImaDoc/Camera/BurstTiming/NbDti')
    2069 %                 if isempty(uid_NbDti)
    2070 %                     uid_BurstTiming=find(t,'ImaDoc/Camera/BurstTiming')
    2071 %                     [t,uid_NbDti]=add(t,uid_BurstTiming,'element','NbDti');
    2072 %                 end
    2073 %                 [t,uid_NbDti]=add(t,uid_NbDti,'chardata',num2str(repeat_nbre(end)-1));
    2074 %                 save(t,XmlFileName)
    2075 %             end
     2076            %             if size(i1_series,3)>size(XmlDataRead.Time,1)-ind_start %only the first time interval is defined, extrapolate to the whole series
     2077            %                 Dti_total=XmlDataRead.Time(end)-XmlDataRead.Time(1);%total time interval covered by the time vector
     2078            %                 missing_indices=sizDti+1+ind_start:size(i1_series,3)+1;% remaining set of frame indices for which time needs to be found
     2079            %                 repeat_nbre=1+floor((missing_indices-sizDti-ind_start)/(sizDti-1));% number of repetitions of Dti
     2080            %                 time_indices=1+mod(missing_indices-sizDti-1,sizDti-1);
     2081            %                 for j=1:size(XmlDataRead.Time,2)
     2082            %                     XmlData.Time(missing_indices,j)=XmlDataRead.Time(time_indices,j)+repeat_nbre'*Dti_total;
     2083            %                 end
     2084            %                 % update the xml file with NbDti
     2085            %                 t=xmltree(XmlFileName);
     2086            %                 uid_NbDti=find(t,'ImaDoc/Camera/BurstTiming/NbDti')
     2087            %                 if isempty(uid_NbDti)
     2088            %                     uid_BurstTiming=find(t,'ImaDoc/Camera/BurstTiming')
     2089            %                     [t,uid_NbDti]=add(t,uid_BurstTiming,'element','NbDti');
     2090            %                 end
     2091            %                 [t,uid_NbDti]=add(t,uid_NbDti,'chardata',num2str(repeat_nbre(end)-1));
     2092            %                 save(t,XmlFileName)
     2093            %             end
    20762094        end
    20772095        set(handles.view_xml,'BackgroundColor',[1 1 1])% paint back to white
     
    23542372   
    23552373NomType=get(handles.NomType,'String');
    2356 indices=get(handles.FileIndex,'String');
     2374
    23572375if strcmp(NomType,'level')
    23582376    indices=get(handles.i1,'String');
    23592377else
     2378    indices=get(handles.FileIndex,'String');
    23602379    [tild,tild,tild,i1,i2,j1,j2]=fileparts_uvmat(indices);% the indices for the second series taken from FileIndex
    23612380    switch index_rank
Note: See TracChangeset for help on using the changeset viewer.