- Timestamp:
- Jan 30, 2013, 10:15:30 PM (12 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/geometry_calib.m
r544 r565 1367 1367 %------------------------------------------------------------------------ 1368 1368 Heading=[];%default 1369 [s,errormsg]=imadoc2struct(fileinput,' GeometryCalib');1369 [s,errormsg]=imadoc2struct(fileinput,'Heading','GeometryCalib'); 1370 1370 if ~isempty(errormsg) 1371 1371 msgbox_uvmat('ERROR',errormsg) … … 1405 1405 set(handles.Psi,'String',num2str(GeometryCalib.omc(3),4)) 1406 1406 end 1407 calib=reshape(GeometryCalib. PointCoord,[],1);1407 calib=reshape(GeometryCalib.SourceCalib.PointCoord,[],1); 1408 1408 for ilist=1:numel(calib) 1409 1409 CoordCell{ilist}=num2str(calib(ilist)); -
trunk/src/imadoc2struct.m
r561 r565 17 17 function [s,errormsg]=imadoc2struct(ImaDoc,varargin) 18 18 %% default input and output 19 errormsg=[];%default 20 s.Heading=[];%default 21 s.Time=[]; %default 22 s.TimeUnit=[]; %default 23 s.GeometryCalib=[]; 19 errormsg='';%default 20 s=[]; 21 % s.Heading=[];%default 22 % s.Time=[]; %default 23 % s.TimeUnit=[]; %default 24 % s.GeometryCalib=[]; 24 25 % tsai=[];%default 25 26 … … 33 34 34 35 %% case of xml files 35 if nargin >1 36 [s,Heading]=xml2struct(ImaDoc,varargin);% convert the xml file in a structure s, keeping only the subtree defined in input 37 else 36 if nargin ==1 38 37 [s,Heading]=xml2struct(ImaDoc);% convert the whole xml file in a structure s 38 elseif nargin ==2 39 [s,Heading]=xml2struct(ImaDoc,varargin{1});% convert the xml file in a structure s, keeping only the subtree defined in input 40 else %TODO: deal with more than two subtrees? 41 [s,Heading]=xml2struct(ImaDoc,varargin{1},varargin{2});% convert the xml file in a structure s, keeping only the subtree defined in input 39 42 end 40 43 if ~strcmp(Heading,'ImaDoc') … … 43 46 end 44 47 %% reading timing 45 Timing=s.Camera.BurstTiming; 46 if ~iscell(Timing) 47 Timing={Timing}; 48 end 49 s.Time=[]; 50 for k=1:length(Timing) 51 Frequency=1; 52 if isfield(Timing{k},'Frequency') 53 Frequency=Timing{k}.FrameFrequency; 48 if isfield(s,'Camera') 49 Timing=s.Camera.BurstTiming; 50 if ~iscell(Timing) 51 Timing={Timing}; 54 52 end 55 Dtj=[]; 56 if isfield(Timing{k},'Dtj') 57 Dtj=Timing{k}.Dtj/Frequency;%Dtj converted from frame unit to TimeUnit (e.g. 's'); 53 s.Time=[]; 54 for k=1:length(Timing) 55 Frequency=1; 56 if isfield(Timing{k},'Frequency') 57 Frequency=Timing{k}.FrameFrequency; 58 end 59 Dtj=[]; 60 if isfield(Timing{k},'Dtj') 61 Dtj=Timing{k}.Dtj/Frequency;%Dtj converted from frame unit to TimeUnit (e.g. 's'); 62 end 63 NbDtj=1; 64 if isfield(Timing{k},'NbDtj')&&~isempty(Timing{k}.NbDtj) 65 NbDtj=Timing{k}.NbDtj; 66 end 67 Dti=[]; 68 if isfield(Timing{k},'Dti') 69 Dti=Timing{k}.Dti/Frequency;%Dti converted from frame unit to TimeUnit (e.g. 's'); 70 end 71 NbDti=1; 72 if isfield(Timing{k},'NbDti')&&~isempty(Timing{k}.NbDti) 73 NbDti=Timing{k}.NbDti; 74 end 75 Time_val=Timing{k}.Time;%time in TimeUnit 76 if ~isempty(Dti) 77 Dti=reshape(Dti'*ones(1,NbDti),NbDti*numel(Dti),1); %concatene Dti vector NbDti times 78 Time_val=[Time_val;Time_val(end)+cumsum(Dti)];%append the times defined by the intervals Dti 79 end 80 if ~isempty(Dtj) 81 Dtj=reshape(Dtj'*ones(1,NbDtj),1,NbDtj*numel(Dtj)); %concatene Dtj vector NbDtj times 82 Dtj=[0 Dtj]; 83 Time_val=Time_val*ones(1,numel(Dtj))+ones(numel(Time_val),1)*cumsum(Dtj);% produce a time matrix with Dtj 84 end 85 % reading Dtk 86 Dtk=[];%default 87 NbDtk=1;%default 88 if isfield(Timing,'Dtk') 89 Dtk=Timing{k}.Dtk; 90 end 91 if isfield(Timing,'NbDtk')&&~isempty(Timing{k}.NbDtk) 92 NbDtk=Timing{k}.NbDtk; 93 end 94 if isempty(Dtk) 95 s.Time=[s.Time;Time_val]; 96 else 97 for kblock=1:NbDtk+1 98 Time_val_k=Time_val+(kblock-1)*Dtk; 99 s.Time=[s.Time;Time_val_k]; 100 end 101 end 58 102 end 59 NbDtj=1; 60 if isfield(Timing{k},'NbDtj')&&~isempty(Timing{k}.NbDtj) 61 NbDtj=Timing{k}.NbDtj; 62 end 63 Dti=[]; 64 if isfield(Timing{k},'Dti') 65 Dti=Timing{k}.Dti/Frequency;%Dti converted from frame unit to TimeUnit (e.g. 's'); 66 end 67 NbDti=1; 68 if isfield(Timing{k},'NbDti')&&~isempty(Timing{k}.NbDti) 69 NbDti=Timing{k}.NbDti; 70 end 71 Time_val=Timing{k}.Time;%time in TimeUnit 72 if ~isempty(Dti) 73 Dti=reshape(Dti'*ones(1,NbDti),NbDti*numel(Dti),1); %concatene Dti vector NbDti times 74 Time_val=[Time_val;Time_val(end)+cumsum(Dti)];%append the times defined by the intervals Dti 75 end 76 if ~isempty(Dtj) 77 Dtj=reshape(Dtj'*ones(1,NbDtj),1,NbDtj*numel(Dtj)); %concatene Dtj vector NbDtj times 78 Dtj=[0 Dtj]; 79 Time_val=Time_val*ones(1,numel(Dtj))+ones(numel(Time_val),1)*cumsum(Dtj);% produce a time matrix with Dtj 80 end 81 % reading Dtk 82 Dtk=[];%default 83 NbDtk=1;%default 84 if isfield(Timing,'Dtk') 85 Dtk=Timing{k}.Dtk; 86 end 87 if isfield(Timing,'NbDtk')&&~isempty(Timing{k}.NbDtk) 88 NbDtk=Timing{k}.NbDtk; 89 end 90 if isempty(Dtk) 91 s.Time=[s.Time;Time_val]; 92 else 93 for kblock=1:NbDtk+1 94 Time_val_k=Time_val+(kblock-1)*Dtk; 95 s.Time=[s.Time;Time_val_k]; 96 end 97 end 98 end 99 103 end 100 104 101 105 % try -
trunk/src/series/aver_stat.m
r526 r565 303 303 end 304 304 else % time from ImaDoc prevails if it exists 305 j1=1;%default 306 if ~isempty(j1_series{1}) 307 j1=j1_series{1}; 308 end 309 DataOut.Time=time(1,i1_series{1}(1),j1filexml); 310 DataOut.Time_end=time(end,i1_series{end}(end),j1_series{end}(end)); 305 % j1=1;%default 306 % if ~isempty(j1_series{1}) 307 % j1=j1_series{1}; 308 % end 309 %DataOut.Time=time(1,i1_series{1}(1),j1); 310 %DataOut.Time_end=time(end,i1_series{end}(end),j1_series{end}(end)); 311 DataOut.Time=time(1); 312 DataOut.Time_end=time(end); 311 313 end 312 314 -
trunk/src/struct2xml.m
r493 r565 31 31 if isstruct(fieldnames_sub{ilist_sub}) 32 32 t=struct2xml(fieldnames_sub{ilist_sub},t,uid); 33 save(t)33 % save(t) 34 34 else 35 eval(['val_sub=val.' fieldnames_sub{ilist_sub} ';'])35 val_sub=val.(fieldnames_sub{ilist_sub}); 36 36 t=add_element(t,uid,fieldnames_sub{ilist_sub},val_sub); 37 37 end -
trunk/src/xml2struct.m
r560 r565 12 12 function [s,Heading]=xml2struct(filename,varargin) 13 13 t=xmltree(filename); 14 Heading=get(t,1,'name'); 14 iline=0; 15 Heading=''; 16 while isempty(Heading) 17 iline=iline+1; 18 if strcmp(get(t,iline,'type'),'element') 19 Heading=get(t,iline,'name'); 20 end 21 end 15 22 if nargin>1 16 23 for isub=1:nargin-1 17 24 uid_sub=find(t,['/' Heading '/' varargin{isub}]); 25 if isempty(uid_sub) 26 s.(varargin{isub})=[]; 27 else 18 28 tsub=branch(t,uid_sub); 19 29 ss=convert(tsub); 20 30 s.(varargin{isub})=convert_string(ss); 31 end 21 32 end 22 33 else
Note: See TracChangeset
for help on using the changeset viewer.