Changeset 1191 for trunk/src


Ignore:
Timestamp:
Feb 6, 2026, 5:13:05 PM (2 weeks ago)
Author:
sommeria
Message:

bugs repaired

Location:
trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/find_imadoc.m

    r1156 r1191  
    22% take into account the old conventions
    33%-----------------------------------------------------------------------
    4 % function XmlFileName=find_imadoc(RootPath,SubDir)
     4% function {[XmlFileName,Rank]=find_imadoc(RootPath,SubDir)
    55%
    66% OUTPUT:
    7 % XmlFileName: name of the xml file, ='' if none is found
     7% XmlFileName: name of the xml file, if the SubDir has suffixes marked with
     8%        '.', take the first one going backward, ='' isf no xml file is found
     9% Rank: = nbre of suffixes in SubDir
    810%
    911% INPUT:
     
    2931%=======================================================================
    3032
    31 function XmlFileName=find_imadoc(RootPath,SubDir)
     33function [XmlFileName,Rank]=find_imadoc(RootPath,SubDir)
    3234XmlFileName=fullfile(RootPath,[SubDir '.xml']);
     35Rank=0;
    3336if ~exist(XmlFileName,'file')
    3437    dotchar=regexp(SubDir,'\.');%detect the dots in the folder name
     
    3841            XmlFileName=fullfile(RootPath,[SubDir '.xml']);
    3942            if exist(XmlFileName,'file')
    40                 break
     43                Rank=idot;
     44                break % take the root name after removing all the dot suffixes
    4145            end
    4246        end
  • trunk/src/get_file_info.m

    r1181 r1191  
    153153        XmlFile=fullfile(RootPath,[SubDir '.xml']);
    154154        CheckWriteImaDoc=true;
    155         if exist(XmlFile,'file')
    156             [XmlData,~,errormsg]=xml2struct(XmlFile);
    157             if ~isempty(errormsg)
    158                 disp(errormsg)
    159                 FileInfo.FileType='error';
    160                 return
    161             elseif isfield(XmlData,'FileSeries')
    162                 CheckWriteImaDoc=false;
    163             end
    164         end
    165         if CheckWriteImaDoc
    166             DirContent=dir(Path);
    167             NbFiles=0;
    168             FileSeries.Convention='telopsIR';
    169             for ilist=1:numel(DirContent)
    170                 FName=DirContent(ilist).name;
    171                 if ~isempty(regexp(FName,'.hcc$', 'once'))
    172                     NbFiles=NbFiles+1;
    173                     FileSeries.FileName{NbFiles,1}=FName;
    174                 end
    175             end
    176             FileSeries.NbFramePerFile=FileInfo.NumberOfFrames;
    177             [checkupdate,xmlfile,errormsg]=update_imadoc(RootPath,SubDir,'FileSeries',FileSeries);
    178         end
     155%         if exist(XmlFile,'file')
     156%             [XmlData,~,errormsg]=xml2struct(XmlFile);
     157%             if ~isempty(errormsg)
     158%                 disp(errormsg)
     159%                 FileInfo.FileType='error';
     160%                 return
     161%             elseif isfield(XmlData,'FileSeries')
     162%                 CheckWriteImaDoc=false;
     163%             end
     164%         end
     165%         if CheckWriteImaDoc
     166%             DirContent=dir(Path);
     167%             NbFiles=0;
     168%             FileSeries.Convention='telopsIR';
     169%             for ilist=1:numel(DirContent)
     170%                 FName=DirContent(ilist).name;
     171%                 if ~isempty(regexp(FName,'.hcc$', 'once'))
     172%                     NbFiles=NbFiles+1;
     173%                     FileSeries.FileName{NbFiles,1}=FName;
     174%                 end
     175%             end
     176%             FileSeries.NbFramePerFile=FileInfo.NumberOfFrames;
     177%             [checkupdate,xmlfile,errormsg]=update_imadoc(RootPath,SubDir,'FileSeries',FileSeries);
     178%         end
    179179
    180180    otherwise
  • trunk/src/series.m

    r1189 r1191  
    608608        RootFile='';
    609609    else
    610         XmlFileName=find_imadoc(InputTable{iview,1},InputTable{iview,2});
    611         if ~isempty(XmlFileName)
     610        [XmlFileName,Rank]=find_imadoc(InputTable{iview,1},InputTable{iview,2});
     611        if ~isempty(XmlFileName) && Rank==0
    612612            XmlData=read_imadoc(XmlFileName);
    613613            if ~isempty(XmlData.FileSeries)
     
    745745[FilePath,RootFile,FileExt]=fileparts(InputFile);
    746746[RootPath,SubDir]=fileparts(FilePath);
    747 XmlFileName=find_imadoc(RootPath,SubDir);
     747[XmlFileName,Rank]=find_imadoc(RootPath,SubDir);
    748748Param.Relabel=false;%no file relabeling by default
    749749XmlData=[];
    750750if ~isempty(XmlFileName)
    751751    XmlData=read_imadoc(XmlFileName);
    752     if isfield(XmlData,'FileSeries')
     752    if isfield(XmlData,'FileSeries') && Rank==0
    753753        set(handles.Relabel,'Visible','on')
    754754        answer=msgbox_uvmat('INPUT_Y-N','relabel the frame  indices according to the xml info?');
     
    823823    SeriesData.j1_series(iview+1:end)=[];
    824824    SeriesData.j2_series(iview+1:end)=[];
    825     SeriesData.FileType(iview+1:end)=[];
     825    %SeriesData.FileType(iview+1:end)=[];
    826826    SeriesData.FileInfo(iview+1:end)=[];
    827827    SeriesData.Time(iview+1:end)=[];
     
    12631263if CheckPair% if pairs need to be display for line iview
    12641264    [ModeMenu,ModeValue]=update_mode(i1_series,i2_series,j2_series);
    1265     Menu=update_listpair(i1_series,i2_series,j1_series,j2_series,ModeMenu{ModeValue},Time,TimeUnit,ref_i,ref_j,TimeName,InputTable(iview,:),FileInfo);
     1265    Menu=update_listpair(i1_series,i2_series,j1_series,j2_series,ModeMenu{ModeValue},Time,TimeUnit,ref_i,ref_j,TimeName,InputTable(iview,:),Param.FileInfo);
    12661266    PairString{iview,1}=Menu{1};
    12671267else
  • trunk/src/uvmat.m

    r1189 r1191  
    19581958end
    19591959[XmlData,errormsg]=imadoc2struct(XmlFile);
    1960 if isempty(XmlData) || isempty(XmlData.Time)
    1961     msgbox_uvmat('ERROR',['the timing needs to be documented in the file ' XmlFile])
    1962     return
    1963 end
     1960% if isempty(XmlData) || isempty(XmlData.Time)
     1961%     msgbox_uvmat('ERROR',['the timing needs to be documented in the file ' XmlFile])
     1962%     return
     1963% end
    19641964FileInfo=get_file_info(FileName);
    19651965switch FileInfo.FileType
     
    22892289FieldType=FileInfo.FieldType;
    22902290
    2291 %% case of isolated input files without series
     2291%% case of isolated input files without field indexing, direct display
    22922292if strcmp(FileInfo.FileIndexing,'off')
    22932293    switch FieldType
     
    23162316end
    23172317
    2318 %% define the relevant handles for the first field series (input_line=1) or the second file series (input_line=2)
     2318%% define the relevant handles on the uvmat GUI for the first field series (input_line=1) or the second file series (input_line=2)
    23192319if ~exist('input_line','var')
    23202320    input_line=1;
     
    37343734    end
    37353735end
    3736 %% case of special file series (PCO)
     3736%% case of file relabeling (PCO, Telops...)
    37373737if isfield(UvData,'XmlData') && isfield(UvData.XmlData{1},'FileSeries')
    37383738    [RootName,~,Ext]=fileparts(FileName);
  • trunk/src/xml2struct.m

    r1183 r1191  
    3939catch ME
    4040    errormsg=ME.message;
    41     if ~isempty(regexp(ME.message,'Undefined function','once'))||~isempty(regexp(ME.message,'Missing','once'))
     41    if ~isempty(regexp(ME.message,'Undefined function'))||~isempty(regexp(ME.message,'Missing'))
    4242        errormsg=[errormsg ': package xmltree not correctly installed, reload it from www.artefact.tk/software/matlab/xml'];
    4343    end
     
    5252    end
    5353end
    54 if nargin>1 % additional input vartiable(s) beyond filename, select specified subtrees
     54if nargin>1
    5555    for isub=1:nargin-1
    5656        uid_sub=find(t,['/' RootTag '/' varargin{isub}]);
     
    5858            s.(varargin{isub})=[];
    5959        else
    60             tsub=branch(t,uid_sub);
    61             if ~isempty(get(tsub,1,'contents'))
    62                 ss=convert(tsub);
    63                 s.(varargin{isub})=convert_string(ss);
    64             end
     60        tsub=branch(t,uid_sub);
     61        if ~isempty(get(tsub,1,'contents'))
     62        ss=convert(tsub);
     63        s.(varargin{isub})=convert_string(ss);
     64        end
    6565        end
    6666    end
    6767else
    6868    try
    69         ss=convert(t);%transform the xmltree object into a Matlab structure.
    70         s=convert_string(ss);% explore the sub-structures if needed
     69    ss=convert(t);%transform the xmltree object into a Matlab structure.
     70    s=convert_string(ss);
    7171    catch ME
    7272        errormsg=ME.message;
     
    8585        end
    8686    case 'char'
    87         % try to convert to number if the char does not correspond to a function (otherwise str2num calls this function as it uses 'eval')
    88         if exist(ss,'builtin')||exist(ss,'file')% ss corresponds to the name of a builtin Matlab function or a file
    89             out=ss; %reproduce the input string
    90         else
    91             out=str2num(ss);% convert to number or vector (str2num applied to a fct name executes this fct by 'eval', thus this possibility had to be ruled out above
    92             if isempty(out)
     87            out=str2double(strsplit(ss));% convert to number or vector (str2num applied to a fct name executes this fct by 'eval', thus this possibility had to be ruled out above
     88            if isnan(out)
    9389                sep_ind=regexp(ss,'\s&\s');% check for separator ' & ' which indicates column separation in tables
    9490                if ~isempty(sep_ind)
     
    10298                end
    10399            end
    104          end
    105100    case 'cell'
    106         out={};%default
     101        out=cell(numel(ss),1);%default
    107102        check_numeric=zeros(size(ss));
    108103        for ilist=1:numel(ss)
    109             if ~strcmp(ss{ilist},'image') && ~isempty(str2num(ss{ilist}))
    110                 out{ilist,1}=str2num(ss{ilist});
     104            if  ~isnan(str2double(strsplit(ss{ilist})))
     105                out{ilist,1}=str2double(strsplit(ss{ilist}));
    111106                check_numeric(ilist)=1;
    112107            else
     
    129124end
    130125
     126
    131127   
Note: See TracChangeset for help on using the changeset viewer.