- Timestamp:
- Jun 23, 2024, 10:00:16 PM (6 months ago)
- Location:
- trunk/src
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/imadoc2struct.m
r1127 r1149 37 37 errormsg='';%default 38 38 s=[]; 39 % s.Heading=[];%default40 % s.Time=[]; %default41 % s.TimeUnit=[]; %default42 % s.GeometryCalib=[];43 % tsai=[];%default44 39 45 40 %% opening the xml file … … 72 67 s.TimeUnit=s.Camera.TimeUnit; 73 68 end 69 if ~isfield(s.Camera,'FirstFrameIndexI') 70 s.Camera.FirstFrameIndexI=1; %first index assumed equl to 1 by default 71 end 74 72 Timing=s.Camera.BurstTiming; 75 73 if ~iscell(Timing) 76 74 Timing={Timing}; 77 75 end 76 78 77 s.Time=[]; 79 78 for k=1:length(Timing) … … 126 125 end 127 126 end 128 if ~isfield(s.Camera,'FirstFrameIndexI') 129 s.Camera.FirstFrameIndexI=1; %first index qssumed equl to 1 by default 130 end 127 131 128 s.Time=[zeros(size(s.Time,1),1) s.Time]; %insert a vertical line of zeros (to deal with zero file indices) 132 129 if s.Camera.FirstFrameIndexI~=0 -
trunk/src/series/extract_multitif.m
r1144 r1149 91 91 first_j=[];% note that the function will propose to cover the whole range of indices 92 92 if isfield(Param.IndexRange,'MinIndex_j'); first_j=Param.IndexRange.MinIndex_j; end 93 % % last_j=[];94 % % if isfield(Param.IndexRange,'MaxIndex_j'); last_j=Param.IndexRange.MaxIndex_j; end95 93 PairString=''; 96 94 if isfield(Param.IndexRange,'PairString'); PairString=Param.IndexRange.PairString; end -
trunk/src/series/extract_rdvision.m
r1148 r1149 16 16 % in series), the function ouput paramOut set the activation of the needed GUI elements 17 17 % 18 % Param contains the elements:(use the menu bar command 'export/GUI config' in series to 18 % Param contains the elements:(use the menu bar command 'export/GUI config' in series to 19 19 % see the current structure Param) 20 20 % .InputTable: cell of input file names, (several lines for multiple input) … … 27 27 % .RUN =0 for GUI input, =1 for function activation 28 28 % .RunMode='local','background', 'cluster': type of function extract_rdvision.muse 29 % 29 % 30 30 % .IndexRange: set the file or frame indices on which the action must be performed 31 31 % .FieldTransform: .TransformName: name of the selected transform function … … 105 105 % check the names of .seq and .sqb files 106 106 iview=1; 107 switch Param.InputTable{iview,5} 108 case {'.seq','.sqb'} 109 filename_seq=fullfile(RootPath,Param.InputTable{iview,2},[Param.InputTable{iview,3} '.seq']); 110 filename_sqb=fullfile(RootPath,Param.InputTable{iview,2},[Param.InputTable{iview,3} '.sqb']); 111 if ~exist(filename_seq,'file') 112 msgbox_uvmat('ERROR',[filename_seq ' missing']); 113 end 114 if ~exist(filename_sqb,'file') 115 msgbox_uvmat('ERROR',[filename_sqb ' missing']); 116 end 117 filexml=[fullfile(RootPath,Param.InputTable{iview,2},Param.InputTable{iview,3}) '.xml'];%xml at the level of the image folder 118 if ~exist(filexml,'file') 119 msgbox_uvmat('ERROR',[filexml ' missing: needed to get the image organisation and timing ']); 120 return 121 end 122 [XmlData,errormsg]=imadoc2struct(filexml); 123 if ~isempty(errormsg) 124 msgbox_uvmat('ERROR',errormsg); 125 return 126 end 127 timexml=reshape(XmlData.Time(2:end,2:end)',1,[]); 128 otherwise 129 msgbox_uvmat('ERROR','bad input file : select .seq or .sqb for image extraction'); 107 if ~ismember(Param.InputTable{iview,5},{'.seq','.sqb'}) 108 msgbox_uvmat('ERROR','bad input file : select .seq or .sqb for image extraction'); 109 return 110 end 111 filename_seq=fullfile(RootPath,Param.InputTable{iview,2},[Param.InputTable{iview,3} '.seq']); 112 filename_sqb=fullfile(RootPath,Param.InputTable{iview,2},[Param.InputTable{iview,3} '.sqb']); 113 if ~exist(filename_seq,'file') 114 msgbox_uvmat('ERROR',[filename_seq ' missing']); 115 return 116 end 117 if ~exist(filename_sqb,'file') 118 msgbox_uvmat('ERROR',[filename_sqb ' missing']); 119 return 120 end 121 filexml=[fullfile(RootPath,Param.InputTable{iview,2},Param.InputTable{iview,3}) '.xml'];%xml at the level of the image folder 122 if exist(filexml,'file') 123 [XmlData,errormsg]=imadoc2struct(filexml); 124 if ~isempty(errormsg) 125 msgbox_uvmat('ERROR',errormsg); 130 126 return 131 end 132 % get data from .seq file 127 end 128 ParamOut.ActionInput.Createxml=false; 129 % filexml=uigetfile_uvmat('pick xml file for timing',fullfile(RootPath,Param.InputTable{iview,2}),'.xml'); 130 % msgbox_uvmat('ERROR',[filexml ' missing: needed to get the image organisation and timing ']); 131 else 132 if isfield(Param,'ActionInput') && isfield(Param.ActionInput,'BurstLength') 133 BurstLength=num2str(Param.ActionInput.BurstLength); 134 else 135 BurstLength='1';%default for a simple image series 136 end 137 answer=msgbox_uvmat('INPUT_TXT',{['no xml file in ' Param.InputTable{iview,2}];' introduce the nbre of frames in a burst to create xml'},BurstLength); 138 ParamOut.ActionInput.BurstLength=str2double(answer); 139 % filexml=uigetfile_uvmat('pick xml file for timing',fullfile(RootPath,Param.InputTable{iview,2}),'.xml'); 140 % [XmlData,errormsg]=imadoc2struct(filexml); 141 ParamOut.ActionInput.Createxml=true; 142 end 143 144 % get data from .seq file 133 145 s=ini2struct(filename_seq); 134 146 SeqData=s.sequenceSettings; … … 140 152 'uint32' [1 1] 'file_idx';... 141 153 'uint32' [1 1] 'garbage2' },'Repeat',SeqData.nb_frames); 142 154 ParamOut.ActionInput.XmlData.SourceFolder=fileparts(m.Filename); 143 155 timestamp=zeros(1,numel(m.Data)); 144 156 for ii=1: numel(m.Data) 145 157 timestamp(ii)=m.Data(ii).timestamp; 146 158 end 159 if ParamOut.ActionInput.Createxml 160 ParamOut.ActionInput.XmlData.Camera.BurstTiming=time2xmlburst(timestamp,ParamOut.ActionInput.BurstLength); 161 Time=xmlburst2time(ParamOut.ActionInput.XmlData.Camera.BurstTiming); 162 else 163 Time=XmlData.Time; 164 end 165 timexml=reshape(Time(2:end,2:end)',1,[]); 147 166 if numel(timestamp)<= numel(timexml) 148 167 timexml=timexml(1:numel(timestamp)); 149 else 150 msgbox_uvmat('ERROR', 'time sequence defined by the xml file too small')168 else 169 msgbox_uvmat('ERROR',['time sequence from the xml file = ' num2str(numel(timexml)) ' smaller than timestamp length ' num2str(numel(timestamp))]) 151 170 return 152 171 end … … 171 190 end 172 191 disp(Param) 173 checkrun=strcmp(Param.RunMode,'local') 192 checkrun=strcmp(Param.RunMode,'local'); 174 193 hseries=findobj(allchild(0),'Tag','series'); 175 194 RUNHandle=findobj(hseries,'Tag','RUN');%handle of RUN button in GUI series … … 232 251 233 252 %% get the names of .seq and .sqb files and save them to the log output folder .extract 234 switch Param.InputTable{iview,5} 235 case {'.seq','.sqb'} 253 if ismember( Param.InputTable{iview,5}, {'.seq','.sqb'}) 236 254 filename_seq=fullfile(RootPath,Param.InputTable{iview,2},[Param.InputTable{iview,3} '.seq']); 237 255 filename_sqb=fullfile(RootPath,Param.InputTable{iview,2},[Param.InputTable{iview,3} '.sqb']); … … 253 271 disp(errormsg) 254 272 end 255 else256 disp(['error:' filexml ' missing']);257 return258 273 end 259 274 end 260 otherwise275 else 261 276 errormsg='input file extension must be .seq or .sqb'; 262 277 end … … 282 297 [tild,SeqData.binrepertoire,DirExt]=fileparts(SeqData.binrepertoire); 283 298 end 284 285 286 299 287 300 %% reading the .sqb file … … 307 320 % end 308 321 % m.Data=data; 309 %%%%%%% 310 [XmlData,errormsg]=imadoc2struct(filexml);% check reading of the xml file 311 if ~isempty(errormsg) 312 disp(errormsg) 313 return 314 end 315 [nbfield1,nbfield2]=size(XmlData.Time); 316 nbfield1=nbfield1-1;nbfield2=nbfield2-1; 317 318 timestamp=zeros(1,numel(m.Data)); 319 for ii=1: numel(m.Data) 320 timestamp(ii)=m.Data(ii).timestamp; 321 end 322 if isequal(Param.IndexRange.first_i,1) 323 %[nbfield1,nbfield2,msg]=copyfile_modif(filexml,timestamp,newxml); %copy the xml file in the upper folder 324 % [XmlData,errormsg]=imadoc2struct(newxml);% check reading of the new xml file 325 326 if numel(timestamp)~=nbfield1*nbfield2 327 disp('WARNING: total image number defined by the xml file differs from the number of frames ') 328 else 329 timestamp=reshape(timestamp,nbfield2,nbfield1); 330 difftime=XmlData.Time(2:end,2:end)'-timestamp; 331 disp(['time from xml and timestamp differ by ' num2str(max(max(abs(difftime))))]) 332 if max(abs(difftime))>0.01 333 checkpreserve=1;% will not erase the initial files, possibility of error 334 end 335 end 322 %%%%%%% 323 if Param.ActionInput.Createxml 324 nbfield2=Param.ActionInput.BurstLength; 325 else 326 [XmlData,errormsg]=imadoc2struct(filexml);% check reading of the xml file 327 if isempty(errormsg) 328 nbfield2=size(XmlData.Time,2)-1; 329 else 330 disp(errormsg) 331 return 332 end 333 end 334 335 336 337 % timestamp=zeros(1,numel(m.Data)); 338 % for ii=1: numel(m.Data) 339 % timestamp(ii)=m.Data(ii).timestamp; 340 % end 341 if isequal(Param.IndexRange.first_i,1) 342 if Param.ActionInput.Createxml 343 t=struct2xml(Param.ActionInput.XmlData); 344 t=set(t,1,'name','ImaDoc'); 345 save(t,newxml) 346 else 347 [success,errormsg]=copyfile(filexml,newxml); 348 end 349 % [nbfield1,nbfield2,msg]=copyfile_modif(filexml,timestamp,newxml); %copy the xml file in the upper folder 350 % if numel(timestamp)~=nbfield1*nbfield2 351 % disp('WARNING: total image number defined by the xml file differs from the number of frames ') 336 352 % else 337 % [nbfield1,nbfield2,msg]=copyfile_modif(filexml,timestamp,''); 338 end 339 if nbfield2>1 340 NomTypeNew='_1_1'; 341 else 342 NomTypeNew='_1'; 343 end 344 345 [BinList,errormsg]=binread_rdv_series(RootPath,SeqData,m.Data,nbfield2,NomTypeNew,Param.IndexRange.first_i,Param.IndexRange.last_i); 346 if ~isempty(errormsg) 347 disp_uvmat('ERROR',errormsg,checkrun) 348 return 349 end 350 351 end 352 353 % timestamp=reshape(timestamp,nbfield2,nbfield1); 354 % difftime=XmlData.Time(2:end,2:end)'-timestamp; 355 % disp(['time from xml and timestamp differ by ' num2str(max(max(abs(difftime))))]) 356 % if max(abs(difftime))>0.01 357 % checkpreserve=1;% will not erase the initial files, possibility of error 358 % end 359 % end 360 end 361 if nbfield2>1 362 NomTypeNew='_1_1'; 363 else 364 NomTypeNew='_1'; 365 end 366 367 [BinList,errormsg]=binread_rdv_series(RootPath,SeqData,m.Data,nbfield2,NomTypeNew,Param.IndexRange.first_i,Param.IndexRange.last_i); 368 if ~isempty(errormsg) 369 disp_uvmat('ERROR',errormsg,checkrun) 370 return 371 end 372 end 353 373 %% remove binary files if transfer OK 354 374 % if ~checkpreserve
Note: See TracChangeset
for help on using the changeset viewer.