Changeset 1018
- Timestamp:
- Nov 3, 2017, 9:58:48 PM (7 years ago)
- Location:
- trunk/src/series
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series/civ_input.m
r1017 r1018 713 713 if ischar(mode_list) 714 714 mode_list={mode_list}; 715 end 715 end 716 716 mode_value=get(handles.ListPairMode,'Value'); 717 if isempty(mode_value) 718 mode_value=1; 719 end 717 720 mode=mode_list{mode_value}; 718 721 end … … 908 911 mode_list=get(handles.ListPairMode,'String'); 909 912 mode_value=get(handles.ListPairMode,'Value'); 913 if isempty(mode_value) 914 mode_value=1; 915 end 910 916 if isempty(mode_list) 911 917 return … … 1559 1565 if strcmp(NomType,'_1') 1560 1566 NbSlice=i1_series(1,2,end); 1561 set(handles. NbSlice,'String',num2str(NbSlice))1567 set(handles.num_NbSlice,'String',num2str(NbSlice)) 1562 1568 end 1563 1569 set(hObject,'UserData',filemask);%store for future use -
trunk/src/series/extract_rdvision.m
r991 r1018 200 200 newxml=[newxml '.xml']; 201 201 202 %copyfile_modif(filexml,newxml); %copy the xml file in the upper folder203 204 %[XmlData,errormsg]=imadoc2struct(newxml);205 % nbfield2=size(XmlData.Time,2)-1;206 % if nbfield2>1207 % NomTypeNew='_1_1';208 % else209 % NomTypeNew='_1';210 % end211 202 %% get the names of .seq and .sqb files 212 203 switch Param.InputTable{iview,5} … … 214 205 filename_seq=fullfile(RootPath,Param.InputTable{iview,2},[Param.InputTable{iview,3} '.seq']); 215 206 filename_sqb=fullfile(RootPath,Param.InputTable{iview,2},[Param.InputTable{iview,3} '.sqb']); 207 216 208 logdir=[Param.OutputSubDir Param.OutputDirExt]; 217 209 [success,errormsg] = copyfile(filename_seq,[fullfile(RootPath,logdir,Param.InputTable{iview,3}) '.seq']); %copy the seq file in the upper folder 218 210 [success,errormsg] = copyfile(filename_sqb,[fullfile(RootPath,logdir,Param.InputTable{iview,3}) '.sqb']); %copy the sqb file in the upper folder 211 [success,errormsg] = copyfile(filexml,[fullfile(RootPath,logdir,Param.InputTable{iview,3}) '.xml']); %copy the original xml file in the upper folder 219 212 otherwise 220 213 errormsg='input file extension must be .seq or .sqb'; … … 240 233 SeqData.binrepertoire=regexprep(SeqData.binrepertoire,'\','/'); 241 234 [tild,SeqData.binrepertoire,DirExt]=fileparts(SeqData.binrepertoire); 242 %SeqData.binrepertoire=[SeqData.binrepertoire DirExt];243 235 end 244 236 … … 271 263 for ii=1: numel(m.Data) 272 264 timestamp(ii)=m.Data(ii).timestamp; 273 % j1=1; 274 % if ~isequal(nbfield2,1) 275 % j1=mod(ii-1,nbfield2)+1; 276 % end 277 % i1=floor((ii-1)/nbfield2)+1; 278 %diff_time(i1,j1)= timestamp(ii)-XmlData.Time(i1+1,j1+1); 279 end 280 [nbfield2,msg]=copyfile_modif(filexml,timestamp,newxml); %copy the xml file in the upper folder 265 end 266 [nbfield1,nbfield2,msg]=copyfile_modif(filexml,timestamp,newxml); %copy the xml file in the upper folder 281 267 [XmlData,errormsg]=imadoc2struct(newxml);% check reading of the new xml file 282 268 if ~isempty(errormsg) … … 284 270 return 285 271 end 286 if ~isequal(size(XmlData.Time(2:end,2:end)),size(reshape(timestamp(1:end),nbfield2,[])')) 287 disp(['size of record ' num2str(size(XmlData.Time(2:end,2:end))) ' does not fit with timestamp size ' num2str(size(reshape(timestamp(1:end),nbfield2,[])'))]) 288 return 289 end 290 difftime=XmlData.Time(2:end,2:end)-(reshape(timestamp(1:end),nbfield2,[]))'; 272 timestamp=timestamp(1:nbfield1*nbfield2); 273 timestamp=reshape(timestamp,nbfield2,nbfield1); 274 difftime=XmlData.Time(2:end,2:end)'-timestamp; 291 275 disp(['time from xml and timestamp differ by ' num2str(max(max(abs(difftime))))]) 292 276 if max(abs(difftime))>0.01 … … 295 279 296 280 %% checking consistency with the xml file 297 if ~isequal(SeqData.nb_frames,numel(timestamp))298 disp_uvmat('ERRROR',['inconsistent number of images ' num2str(SeqData.nb_frames) ' with respect to the xml file: ' num2str(numel(timestamp))] ,checkrun);299 return300 end281 % if ~isequal(SeqData.nb_frames,numel(timestamp)) 282 % disp_uvmat('ERRROR',['inconsistent number of images ' num2str(SeqData.nb_frames) ' with respect to the xml file: ' num2str(numel(timestamp))] ,checkrun); 283 % return 284 % end 301 285 302 286 if nbfield2>1 … … 329 313 330 314 %% remove binary files if transfer OK 331 if ~checkpreserve332 for iview=1:size(Param.InputTable,1)333 fullfile(RootPath,Param.InputTable{iview,2})334 source_dir=fullfile(RootPath,Param.InputTable{iview,2});335 [SUCCESS,MESSAGE]=rmdir(source_dir,'s')336 end337 end315 % if ~checkpreserve 316 % for iview=1:size(Param.InputTable,1) 317 % fullfile(RootPath,Param.InputTable{iview,2}) 318 % source_dir=fullfile(RootPath,Param.InputTable{iview,2}); 319 % [SUCCESS,MESSAGE]=rmdir(source_dir,'s') 320 % end 321 % end 338 322 delete(fullfile(RootPath,'Running.xml'))%delete the xml file to indicate that processing is finished 339 323 … … 451 435 452 436 453 function [nbfield 2,msg]=copyfile_modif(filexml,timestamp,newxml)437 function [nbfield1,nbfield2,msg]=copyfile_modif(filexml,timestamp,newxml) 454 438 msg=''; 455 439 t=xmltree(filexml); 456 440 457 %% correct NbDtj 458 uid_NbDtj=find(t,'ImaDoc/Camera/BurstTiming/NbDtj'); 459 uid_content=get(t,uid_NbDtj,'contents'); 460 t=set(t,uid_content,'value','1');% set NbDtj to 1 (correct error in the xml file) 461 462 %% check Dtj 441 %% read Dtk and NbDtk 442 NbDtk=1; %default 443 Dtk=[]; % default 444 uid_Dtk=find(t,'ImaDoc/Camera/BurstTiming/Dtk'); 445 uid_content_Dtk=get(t,uid_Dtk,'contents'); 446 if ~isempty(uid_content_Dtk) 447 Dtk=str2num(get(t,uid_content_Dtk,'value')); 448 uid_NbDtk=find(t,'ImaDoc/Camera/BurstTiming/NbDtk'); 449 uid_content_NbDtk=get(t,uid_NbDtk,'contents'); 450 if ~isempty(uid_content_NbDtk) 451 NbDtk=str2num(get(t,uid_content_NbDtk,'value')); 452 end 453 end 454 455 %% read Dti and NbDti 456 NbDti=1; %default 457 Dti=[]; % default 458 uid_Dti=find(t,'ImaDoc/Camera/BurstTiming/Dti'); 459 uid_content_Dti=get(t,uid_Dti,'contents'); 460 if ~isempty(uid_content_Dti) 461 Dti=str2num(get(t,uid_content_Dti,'value')); 462 uid_NbDti=find(t,'ImaDoc/Camera/BurstTiming/NbDti'); 463 uid_content_NbDti=get(t,uid_NbDti,'contents'); 464 if ~isempty(uid_content_NbDti) 465 NbDti=str2num(get(t,uid_content_NbDti,'value')); 466 end 467 end 468 469 %% read Dtj and NbDtj 470 NbDtj=1; %default 471 Dtj=[]; % default 463 472 uid_Dtj=find(t,'ImaDoc/Camera/BurstTiming/Dtj'); 464 uid_content=get(t,uid_Dtj,'contents'); 465 Dtjstring=get(t,uid_content,'value'); 466 if isempty(Dtjstring) 473 uid_content_Dtj=get(t,uid_Dtj,'contents'); 474 if ~isempty(uid_content_Dtj) 475 Dtj=str2num(get(t,uid_content_Dtj,'value')); 476 uid_NbDtj=find(t,'ImaDoc/Camera/BurstTiming/NbDtj'); 477 uid_content_NbDtj=get(t,uid_NbDtj,'contents'); 478 if ~isempty(uid_content_NbDtj) 479 NbDtj=str2num(get(t,uid_content_NbDtj,'value')); 480 end 481 end 482 483 %% correct NbDtj and NbDti (error from RDvision) 484 if NbDtj==numel(Dtj)% case of bursts 485 NbDtj=1; 486 uid_motor_nbslice=find(t,'ImaDoc/TranslationMotor/Nbslice'); 487 if ~isempty(uid_motor_nbslice)&& ~isempty(uid_Dtk)% case of multilevel 488 NbSlice=str2num(get(t,get(t,uid_motor_nbslice,'contents'),'value')); 489 NbDti=NbSlice-1; 490 end 491 end 492 493 if isempty(Dtj)% case of simple series 467 494 timestamp=timestamp'; 468 nbfield2=1;495 t=set(t,uid_content_NbDti,'value',num2str(numel(timestamp)-1));% correct NbDti in the xml file 469 496 else 470 Dtj=str2num(get(t,uid_content,'value')); 471 nbfield2=numel(Dtj)+1; 497 nbfieldi=(NbDti*numel(Dti)+1); 498 nbfieldk=(NbDtk*numel(Dtk)+1); 499 nbfield1=nbfieldi*nbfieldk; 500 nbfield2=NbDtj*numel(Dtj)+1; 501 NbFrames_xml=nbfield1*nbfield2; 502 if NbFrames_xml<numel(timestamp) 503 disp(['ERROR: size from xml ' num2str(NbFrame_xml) ' smaller than timestamp size ' num2str(numel(timestamp))]) 504 return 505 end 506 if NbFrames_xml>numel(timestamp) 507 nbfield1=floor(numel(timestamp)/nbfield2); 508 nbfieldk=floor(nbfield1/nbfieldi); 509 nbfield1=nbfieldi*nbfieldk; 510 NbDtk=nbfieldk-1; 511 t=set(t,uid_content_NbDtk,'value',num2str(NbDtk));% correct NbDtk in the xml file (in practice numel(Dtk)=1; 512 timestamp=timestamp(1:nbfield1*nbfield2); 513 disp(['image record stopped before end: max index i= ' num2str(nbfield1)]); 514 timestamp=reshape(timestamp,nbfield2,nbfield1); 515 end 516 % check Dtj with respect to timestamp 472 517 timestamp=(reshape(timestamp,nbfield2,[]))'; 473 518 diff_Dtj=diff(timestamp(1,:))-Dtj; … … 478 523 end 479 524 end 480 %% correct NbDti481 NbDti=size(timestamp,1)-1; %default for series or burst482 uid_motor_nbslice=find(t,'ImaDoc/TranslationMotor/Nbslice');483 uid_NbDtk=find(t,'ImaDoc/Camera/BurstTiming/NbDtk');484 if ~isempty(uid_motor_nbslice)&& ~isempty(uid_NbDtk)485 uid_content=get(t,uid_motor_nbslice,'contents');486 NbSlice=str2num(get(t,uid_content,'value'));487 NbDti=NbSlice-1;488 uid_NbDti=find(t,'ImaDoc/Camera/BurstTiming/NbDti');489 uid_content=get(t,uid_NbDti,'contents');490 t=set(t,uid_content,'value',num2str(NbDti));491 end492 525 493 526 %% adjust Dti 494 uid_Dti=find(t,'ImaDoc/Camera/BurstTiming/Dti');495 uid_content=get(t,uid_Dti,'contents');496 Dti=str2num(get(t,uid_content,'value'));497 527 Dti_stamp=(timestamp(1+NbDti,1)-timestamp(1,1))/NbDti; 528 t=set(t,uid_content_Dti,'value',num2str(Dti_stamp));%corret Dti 498 529 if abs(Dti_stamp-Dti)>Dti/1000 499 530 disp([msg 'Dti from xml file corrected by ' num2str(Dti_stamp-Dti) ', ']);%' … … 501 532 disp('Dti OK') 502 533 end 503 t=set(t,uid_content,'value',num2str(Dti_stamp));504 534 505 535 %% adjust Dtk 506 uid_Dtk=find(t,'ImaDoc/Camera/BurstTiming/Dtk');507 536 if ~isempty(uid_Dtk) 508 uid_content_Dtk=get(t,uid_Dtk,'contents'); 509 Dtk=str2num(get(t,uid_content_Dtk,'value')); 510 uid_content_NbDtk=get(t,uid_NbDtk,'contents'); 511 NbDtk=str2num(get(t,uid_content_NbDtk,'value')); 512 Dtk_stamp=(timestamp(end-NbDti,1)-timestamp(1,1))/NbDtk; 537 Dtk_stamp=(timestamp((NbDti+1)*NbDtk+1,1)-timestamp(1,1))/NbDtk; 538 t=set(t,uid_content_Dtk,'value',num2str(Dtk_stamp)); 513 539 if abs(Dtk_stamp-Dtk)>Dtk/1000 514 540 disp(['Dtk from xml file corrected by ' num2str(Dtk_stamp-Dtk)]); … … 519 545 end 520 546 547 %% save the new xml file 521 548 save(t,newxml) 522 549 [success,errormsg] = fileattrib(newxml,'+w','g');% allow writing access for the group of users
Note: See TracChangeset
for help on using the changeset viewer.