Ignore:
Timestamp:
Jul 9, 2019, 10:10:18 AM (5 years ago)
Author:
sommeria
Message:

replicate updated

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series/extract_rdvision.m

    r1066 r1068  
    489489
    490490%% correct NbDtj and NbDti (error from RDvision)
    491 if NbDtj==numel(Dtj)% case of bursts
    492     NbDtj=1;
    493     uid_motor_nbslice=find(t,'ImaDoc/TranslationMotor/Nbslice');
    494     if ~isempty(uid_motor_nbslice)&& ~isempty(uid_Dtk)% case of multilevel
    495         NbSlice=str2num(get(t,get(t,uid_motor_nbslice,'contents'),'value'));
    496         NbDti=NbSlice-1;
    497     end
    498 end
     491% if NbDtj==numel(Dtj)% case of bursts
     492%     NbDtj=1;
     493%     uid_motor_nbslice=find(t,'ImaDoc/TranslationMotor/Nbslice');
     494%     if ~isempty(uid_motor_nbslice)&& ~isempty(uid_Dtk)% case of multilevel
     495%         NbSlice=str2num(get(t,get(t,uid_motor_nbslice,'contents'),'value'));
     496%         NbDti=NbSlice-1;
     497%     end
     498% end
    499499
    500500if isempty(Dtj)% case of simple series
     
    509509    nbfield2=NbDtj*numel(Dtj)+1;
    510510    NbFrames_xml=nbfield1*nbfield2;
    511    if NbFrames_xml<numel(timestamp)
    512        disp(['ERROR: size from xml ' num2str(NbFrame_xml) ' smaller than timestamp size ' num2str(numel(timestamp))])
    513        return
    514    end
    515    if NbFrames_xml>numel(timestamp)
    516        nbfield1=floor(numel(timestamp)/nbfield2);
    517        nbfieldk=floor(nbfield1/nbfieldi);
    518        nbfield1=nbfieldi*nbfieldk;
    519        NbDtk=nbfieldk-1;
    520        t=set(t,uid_content_NbDtk,'value',num2str(NbDtk));% correct NbDtk in the xml file (in practice numel(Dtk)=1;
    521        timestamp=timestamp(1:nbfield1*nbfield2);
    522        disp(['image record stopped before end: max index i= ' num2str(nbfield1)]);
    523        timestamp=reshape(timestamp,nbfield2,nbfield1);
    524    end
    525    % check Dtj with respect to timestamp
    526     timestamp=(reshape(timestamp,nbfield2,[]))';
    527     diff_Dtj=diff(timestamp(1,:))-Dtj;
    528     if max(abs(diff_Dtj))>min(Dtj)/1000
    529         disp(['Dtj from xml file differs from time stamp by ' num2str(max(abs(diff_Dtj))) ', '])%'
    530     else
    531         disp('Dtj OK');
    532     end
     511%    if NbFrames_xml<numel(timestamp)
     512%        disp(['ERROR: size from xml ' num2str(NbFrame_xml) ' smaller than timestamp size ' num2str(numel(timestamp))])
     513%        return
     514%    end
     515%    if NbFrames_xml>numel(timestamp)
     516%        nbfield1=floor(numel(timestamp)/nbfield2);
     517%        nbfieldk=floor(nbfield1/nbfieldi);
     518%        nbfield1=nbfieldi*nbfieldk;
     519%        NbDtk=nbfieldk-1;
     520%        t=set(t,uid_content_NbDtk,'value',num2str(NbDtk));% correct NbDtk in the xml file (in practice numel(Dtk)=1;
     521%        timestamp=timestamp(1:nbfield1*nbfield2);
     522%        disp(['image record stopped before end: max index i= ' num2str(nbfield1)]);
     523%        timestamp=reshape(timestamp,nbfield2,nbfield1);
     524%    end
     525%    % check Dtj with respect to timestamp
     526%     timestamp=(reshape(timestamp,nbfield2,[]))';
     527%     diff_Dtj=diff(timestamp(1,:))-Dtj;
     528%     if max(abs(diff_Dtj))>min(Dtj)/1000
     529%         disp(['Dtj from xml file differs from time stamp by ' num2str(max(abs(diff_Dtj))) ', '])%'
     530%     else
     531%         disp('Dtj OK');
     532%     end
    533533end
    534534
    535535%% adjust Dti
    536 if NbDti+1>size(timestamp,1)
    537     NbDti=size(timestamp,1)-1;
    538 end
    539 Dti_stamp=(timestamp(1+NbDti,1)-timestamp(1,1))/NbDti;
    540 Dti_stamp=(timestamp(1+NbDti,1)-timestamp(2,1))/(NbDti-1);
    541 t=set(t,uid_content_Dti,'value',num2str(Dti_stamp));%corret Dti
    542 if abs(Dti_stamp-Dti)>Dti/1000
    543     disp([msg 'Dti from xml file corrected by ' num2str(Dti_stamp-Dti) ', ']);%'
    544 else
    545     disp('Dti OK')
    546 end
     536% if NbDti+1>size(timestamp,1)
     537%     NbDti=size(timestamp,1)-1;
     538% end
     539% Dti_stamp=(timestamp(1+NbDti,1)-timestamp(1,1))/NbDti;
     540% Dti_stamp=(timestamp(1+NbDti,1)-timestamp(2,1))/(NbDti-1);
     541% t=set(t,uid_content_Dti,'value',num2str(Dti_stamp));%corret Dti
     542% if abs(Dti_stamp-Dti)>Dti/1000
     543%     disp([msg 'Dti from xml file corrected by ' num2str(Dti_stamp-Dti) ', ']);%'
     544% else
     545%     disp('Dti OK')
     546% end
    547547
    548548%% adjust Dtk
Note: See TracChangeset for help on using the changeset viewer.