- Timestamp:
- Feb 6, 2026, 5:13:05 PM (2 weeks ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
-
find_imadoc.m (modified) (3 diffs)
-
get_file_info.m (modified) (1 diff)
-
series.m (modified) (4 diffs)
-
uvmat.m (modified) (4 diffs)
-
xml2struct.m (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/find_imadoc.m
r1156 r1191 2 2 % take into account the old conventions 3 3 %----------------------------------------------------------------------- 4 % function XmlFileName=find_imadoc(RootPath,SubDir)4 % function {[XmlFileName,Rank]=find_imadoc(RootPath,SubDir) 5 5 % 6 6 % 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 8 10 % 9 11 % INPUT: … … 29 31 %======================================================================= 30 32 31 function XmlFileName=find_imadoc(RootPath,SubDir)33 function [XmlFileName,Rank]=find_imadoc(RootPath,SubDir) 32 34 XmlFileName=fullfile(RootPath,[SubDir '.xml']); 35 Rank=0; 33 36 if ~exist(XmlFileName,'file') 34 37 dotchar=regexp(SubDir,'\.');%detect the dots in the folder name … … 38 41 XmlFileName=fullfile(RootPath,[SubDir '.xml']); 39 42 if exist(XmlFileName,'file') 40 break 43 Rank=idot; 44 break % take the root name after removing all the dot suffixes 41 45 end 42 46 end -
trunk/src/get_file_info.m
r1181 r1191 153 153 XmlFile=fullfile(RootPath,[SubDir '.xml']); 154 154 CheckWriteImaDoc=true; 155 if exist(XmlFile,'file')156 [XmlData,~,errormsg]=xml2struct(XmlFile);157 if ~isempty(errormsg)158 disp(errormsg)159 FileInfo.FileType='error';160 return161 elseif isfield(XmlData,'FileSeries')162 CheckWriteImaDoc=false;163 end164 end165 if CheckWriteImaDoc166 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 end175 end176 FileSeries.NbFramePerFile=FileInfo.NumberOfFrames;177 [checkupdate,xmlfile,errormsg]=update_imadoc(RootPath,SubDir,'FileSeries',FileSeries);178 end155 % 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 179 179 180 180 otherwise -
trunk/src/series.m
r1189 r1191 608 608 RootFile=''; 609 609 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 612 612 XmlData=read_imadoc(XmlFileName); 613 613 if ~isempty(XmlData.FileSeries) … … 745 745 [FilePath,RootFile,FileExt]=fileparts(InputFile); 746 746 [RootPath,SubDir]=fileparts(FilePath); 747 XmlFileName=find_imadoc(RootPath,SubDir);747 [XmlFileName,Rank]=find_imadoc(RootPath,SubDir); 748 748 Param.Relabel=false;%no file relabeling by default 749 749 XmlData=[]; 750 750 if ~isempty(XmlFileName) 751 751 XmlData=read_imadoc(XmlFileName); 752 if isfield(XmlData,'FileSeries') 752 if isfield(XmlData,'FileSeries') && Rank==0 753 753 set(handles.Relabel,'Visible','on') 754 754 answer=msgbox_uvmat('INPUT_Y-N','relabel the frame indices according to the xml info?'); … … 823 823 SeriesData.j1_series(iview+1:end)=[]; 824 824 SeriesData.j2_series(iview+1:end)=[]; 825 SeriesData.FileType(iview+1:end)=[];825 %SeriesData.FileType(iview+1:end)=[]; 826 826 SeriesData.FileInfo(iview+1:end)=[]; 827 827 SeriesData.Time(iview+1:end)=[]; … … 1263 1263 if CheckPair% if pairs need to be display for line iview 1264 1264 [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); 1266 1266 PairString{iview,1}=Menu{1}; 1267 1267 else -
trunk/src/uvmat.m
r1189 r1191 1958 1958 end 1959 1959 [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 return1963 end1960 % if isempty(XmlData) || isempty(XmlData.Time) 1961 % msgbox_uvmat('ERROR',['the timing needs to be documented in the file ' XmlFile]) 1962 % return 1963 % end 1964 1964 FileInfo=get_file_info(FileName); 1965 1965 switch FileInfo.FileType … … 2289 2289 FieldType=FileInfo.FieldType; 2290 2290 2291 %% case of isolated input files without series2291 %% case of isolated input files without field indexing, direct display 2292 2292 if strcmp(FileInfo.FileIndexing,'off') 2293 2293 switch FieldType … … 2316 2316 end 2317 2317 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) 2319 2319 if ~exist('input_line','var') 2320 2320 input_line=1; … … 3734 3734 end 3735 3735 end 3736 %% case of special file series (PCO)3736 %% case of file relabeling (PCO, Telops...) 3737 3737 if isfield(UvData,'XmlData') && isfield(UvData.XmlData{1},'FileSeries') 3738 3738 [RootName,~,Ext]=fileparts(FileName); -
trunk/src/xml2struct.m
r1183 r1191 39 39 catch ME 40 40 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')) 42 42 errormsg=[errormsg ': package xmltree not correctly installed, reload it from www.artefact.tk/software/matlab/xml']; 43 43 end … … 52 52 end 53 53 end 54 if nargin>1 % additional input vartiable(s) beyond filename, select specified subtrees54 if nargin>1 55 55 for isub=1:nargin-1 56 56 uid_sub=find(t,['/' RootTag '/' varargin{isub}]); … … 58 58 s.(varargin{isub})=[]; 59 59 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 end60 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 65 65 end 66 66 end 67 67 else 68 68 try 69 ss=convert(t);%transform the xmltree object into a Matlab structure.70 s=convert_string(ss);% explore the sub-structures if needed69 ss=convert(t);%transform the xmltree object into a Matlab structure. 70 s=convert_string(ss); 71 71 catch ME 72 72 errormsg=ME.message; … … 85 85 end 86 86 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) 93 89 sep_ind=regexp(ss,'\s&\s');% check for separator ' & ' which indicates column separation in tables 94 90 if ~isempty(sep_ind) … … 102 98 end 103 99 end 104 end105 100 case 'cell' 106 out= {};%default101 out=cell(numel(ss),1);%default 107 102 check_numeric=zeros(size(ss)); 108 103 for ilist=1:numel(ss) 109 if ~strcmp(ss{ilist},'image') && ~isempty(str2num(ss{ilist}))110 out{ilist,1}=str2 num(ss{ilist});104 if ~isnan(str2double(strsplit(ss{ilist}))) 105 out{ilist,1}=str2double(strsplit(ss{ilist})); 111 106 check_numeric(ilist)=1; 112 107 else … … 129 124 end 130 125 126 131 127
Note: See TracChangeset
for help on using the changeset viewer.
