Changeset 1150 for trunk/src/imadoc2struct.m
- Timestamp:
- Jun 24, 2024, 6:38:26 PM (3 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/imadoc2struct.m
r1149 r1150 70 70 s.Camera.FirstFrameIndexI=1; %first index assumed equl to 1 by default 71 71 end 72 Timing=s.Camera.BurstTiming; 73 if ~iscell(Timing) 74 Timing={Timing}; 75 end 72 s.Time=xmlburst2time(s.Camera.BurstTiming,s.Camera.FirstFrameIndexI); 73 end 76 74 77 s.Time=[];78 for k=1:length(Timing)79 Frequency=1;80 if isfield(Timing{k},'FrameFrequency')81 Frequency=Timing{k}.FrameFrequency;82 end83 Dtj=[];84 if isfield(Timing{k},'Dtj')85 Dtj=Timing{k}.Dtj/Frequency;%Dtj converted from frame unit to TimeUnit (e.g. 's');86 end87 NbDtj=1;88 if isfield(Timing{k},'NbDtj')&&~isempty(Timing{k}.NbDtj)89 NbDtj=Timing{k}.NbDtj;90 end91 Dti=[];92 if isfield(Timing{k},'Dti')93 Dti=Timing{k}.Dti/Frequency;%Dti converted from frame unit to TimeUnit (e.g. 's');94 end95 NbDti=1;96 if isfield(Timing{k},'NbDti')&&~isempty(Timing{k}.NbDti)97 NbDti=Timing{k}.NbDti;98 end99 Time_val=Timing{k}.Time;%time in TimeUnit100 if ~isempty(Dti)101 Dti=reshape(Dti'*ones(1,NbDti),NbDti*numel(Dti),1); %concatene Dti vector NbDti times102 Time_val=[Time_val;Time_val(end)+cumsum(Dti)];%append the times defined by the intervals Dti103 end104 if ~isempty(Dtj)105 Dtj=reshape(Dtj'*ones(1,NbDtj),1,NbDtj*numel(Dtj)); %concatene Dtj vector NbDtj times106 Dtj=[0 Dtj];107 Time_val=Time_val*ones(1,numel(Dtj))+ones(numel(Time_val),1)*cumsum(Dtj);% produce a time matrix with Dtj108 end109 % reading Dtk110 Dtk=[];%default111 NbDtk=1;%default112 if isfield(Timing{k},'Dtk')113 Dtk=Timing{k}.Dtk;114 end115 if isfield(Timing{k},'NbDtk')&&~isempty(Timing{k}.NbDtk)116 NbDtk=Timing{k}.NbDtk;117 end118 if isempty(Dtk)119 s.Time=[s.Time;Time_val];120 else121 for kblock=1:NbDtk+1122 Time_val_k=Time_val+(kblock-1)*Dtk;123 s.Time=[s.Time;Time_val_k];124 end125 end126 end127 128 s.Time=[zeros(size(s.Time,1),1) s.Time]; %insert a vertical line of zeros (to deal with zero file indices)129 if s.Camera.FirstFrameIndexI~=0130 s.Time=[zeros(s.Camera.FirstFrameIndexI,size(s.Time,2)); s.Time]; %insert a horizontal line of zeros131 end132 end133 75 134 76 function [s,errormsg]=read_subtree(subt,Data,NbOccur,NumTest)
Note: See TracChangeset
for help on using the changeset viewer.