Changeset 1068 for trunk/src/series


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

replicate updated

Location:
trunk/src/series
Files:
5 edited

Legend:

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

    r1065 r1068  
    8989    end
    9090    % estimated CPUTime
    91 Data.CPUTime=1; % 1 minute per field pair
     91    CPUtime_unit=0.01;%estimated time for a multiplication (in microsecond)
     92    if isfield(Param.SeriesData,'FileInfo')&&isfield(Param.SeriesData.FileInfo{1},'Height')&&isfield(Param.SeriesData.FileInfo{1},'Width')
     93        pixnbre=Param.SeriesData.FileInfo{1}.Height*Param.SeriesData.FileInfo{1}.Width; % total number of pxels for input images 
     94        CPUtime=0;
     95        if isfield(Data.ActionInput,'Civ1')
     96            %BoxSize=Data.ActionInput.Civ1.CorrBoxSize(1)*Data.ActionInput.Civ1.CorrBoxSize(2);
     97            tic
     98            testboxa=rand(Data.ActionInput.Civ1.CorrBoxSize(1),Data.ActionInput.Civ1.CorrBoxSize(2));
     99            testboxb=rand(Data.ActionInput.Civ1.SearchBoxSize(1),Data.ActionInput.Civ1.SearchBoxSize(2));
     100            anss=conv2(testboxa,testboxb);
     101            CPUtime_unit=toc;
     102            nb_box=pixnbre/(Data.ActionInput.Civ1.Dx*Data.ActionInput.Civ1.Dy);   
     103            %nbpos=Data.ActionInput.Civ1.SearchBoxSize-Data.ActionInput.Civ1.CorrBoxSize;
     104            CPUtime=2*CPUtime_unit*nb_box%*BoxSize*nbpos(1)*nbpos(2);% adjustement factor 2 used
     105        end
     106        if isfield(Data.ActionInput,'Patch1')
     107            CPUtime=2*CPUtime;
     108        end
     109        if isfield(Data.ActionInput,'Civ2')
     110            tic
     111            testboxa=rand(Data.ActionInput.Civ2.CorrBoxSize(1),Data.ActionInput.Civ2.CorrBoxSize(2));
     112            testboxb=rand(Data.ActionInput.Civ2.SearchBoxSize(1),Data.ActionInput.Civ2.SearchBoxSize(2));
     113            anss=conv2(testboxa,testboxb);
     114            CPUtime_unit=toc;
     115            nb_box=pixnbre/(Data.ActionInput.Civ2.Dx*Data.ActionInput.Civ2.Dy);
     116            %BoxSize=Data.ActionInput.Civ2.CorrBoxSize(1)*Data.ActionInput.Civ2.CorrBoxSize(2);
     117            %nbpos=Data.ActionInput.Civ2.SearchBoxSize-Data.ActionInput.Civ2.CorrBoxSize;
     118            CPUtime=CPUtime+2*CPUtime_unit*nb_box;%*BoxSize*nbpos(1)*nbpos(2);
     119        end
     120        if isfield(Data.ActionInput,'Patch2')
     121            CPUtime=(4/3)*CPUtime;
     122        end
     123        Data.CPUTime=ceil(CPUtime/6); % estimated CPU time per field pair in minute
     124        Data.CPUTime=Data.CPUTime/10; % displqy CPU time with 1 digit beyond dot
     125    end
    92126    return
    93127end
  • trunk/src/series/extract_multitif.m

    r1061 r1068  
    7373    ParamOut.OutputDirExt='.png';%set the output dir extension
    7474    ParamOut.OutputFileMode='NbSlice';% '=NbInput': 1 output file per input file index, '=NbInput_i': 1 file per input file index i, '=NbSlice': 1 file per slice
    75       ParamOut.CheckOverwriteVisible='on'; % manage the overwrite of existing files (default=1)
     75    ParamOut.CheckOverwriteVisible='on'; % manage the overwrite of existing files (default=1)
     76    ParamOut.CPUTime=7;% expected time for writting one image ( in minute)
    7677    %% root input file(s) and type
    7778    % check the existence of the first file in the series
     
    113114end
    114115
    115 %% list of input images
    116 % DirImages=fullfile(Param.InputTable{1,1},Param.InputTable{1,2});
    117 % ListStruct=dir(DirImages);
    118 % ListCells=struct2cell(ListStruct);% transform dir struct to a cell arrray
    119 % check_bad=strcmp('.',ListCells(1,:))|strcmp('..',ListCells(1,:));%detect the dir '.' to exclude it
    120 % check_dir=cell2mat(ListCells(4,:));% =1 for directories, =0 for files
    121 % ListFile=ListCells(1,find(~check_dir & ~check_bad));
    122 
    123 %% check file names
    124 % RootName=regexprep(ListFile{1},'.tif$','')
    125 % rank(1)=1;
    126 % for ilist=2:numel(ListFile)
    127 %     rank_str=regexprep(ListFile{ilist},'.tif$','');
    128 %     rank(ilist)=regexprep(rank_str,['^' RootName '@'],'');
    129 % %     if ~isequal(str2num(rank),ilist-1)
    130 % %         disp(['error in the list of input file # ' num2str(ilist-1)])
    131 % %         return
    132 % %     end
    133 % end
    134 
    135116%% output directory
    136117OutputDir=fullfile(Param.InputTable{1,1},[Param.OutputSubDir Param.OutputDirExt]);
     
    156137end
    157138
    158 %% Main loop
    159 
    160 
    161 % count=0;
    162 %count=316;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%CORRECTION EXP08: 4684 images -> start at 316 start 67->_11_1
    163 %count=1934%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%CORRECTION EXP07: 3066 images
    164139%% loop on the files
    165140% include the first tiff file with no index in the first iteration
     
    174149end
    175150for ifile=firstindex:Param.IndexRange.last_i
     151    tic
    176152    if firstindex==0 && ifile==0% first slice of processing
    177153        ImageName=fullfile(Param.InputTable{1,1},Param.InputTable{1,2},'im.tif')
     
    181157    NbFrames=numel(imfinfo(ImageName));
    182158    for iframe=1:NbFrames
    183         iframe
    184159        if isequal(ImagesPerLevel,1)% mode series
    185160            OutputFile=fullfile(OutputDir,['img_' num2str(count+1) '.png']);
     
    198173        count=count+1;
    199174    end
     175    tt=toc;
     176    disp(['elapsed time (in min.) for the file im@' num2str(ifile,'%04d')])
     177    disp(num2str(tt/60))
    200178end
    201179
  • 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
  • trunk/src/series/merge_proj_polar.m

    r1061 r1068  
    6363    ParamOut.AllowInputSort='on';% allow alphabetic sorting of the list of input file SubDir (options 'off'/'on', 'off' by default)
    6464    ParamOut.WholeIndexRange='off';% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default)
    65     ParamOut.NbSlice='on'; %nbre of slices ('off' by default)
     65    ParamOut.NbSlice='off'; %nbre of slices ('off' by default)
    6666    ParamOut.VelType='one';% menu for selecting the velocity type (options 'off'/'one'/'two',  'off' by default)
    6767    ParamOut.FieldName='off';% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default)
     
    268268    CheckOverwrite=Param.CheckOverwrite;
    269269end
    270 
     270NbField
    271271for index=1:NbField
    272     disp(['index=' num2str(index)])
    273     disp(['ellapsed time ' num2str(toc(tstart)/60,4) ' minutes'])
    274272    update_waitbar(WaitbarHandle,index/NbField)
    275273    if ~isempty(RUNHandle) && ~strcmp(get(RUNHandle,'BusyAction'),'queue')
     
    352350        %% calculate tps coefficients
    353351        Data{iview}=tps_coeff_field(Data{iview},1);
    354        
     352        'tps_coeff done'
    355353        %% projection on the polar grid
    356354        [DataOut,VarAttribute,errormsg]=calc_field_tps(Data{iview}.Coord_tps,Data{iview}.NbCentre,Data{iview}.SubRange,...
    357355            cat(3,Data{iview}.U_tps,Data{iview}.V_tps),FieldNames,cat(3,XI,YI));
     356        if ~isempty(errormsg)
     357            disp(errormsg)
     358        end
     359       
    358360        % set to NaN interpolation points which are too far from any initial data (more than 2 CoordMesh)
    359361        Coord=permute(Data{iview}.Coord_tps,[1 3 2]);
     
    366368            G=TriScatteredInterp(Coord,Coord(:,2),'nearest');
    367369        end
     370        'Interp done'
    368371        Distx=F(XI,YI)-XI;% diff of x coordinates with the nearest measurement point
    369372        Disty=G(XI,YI)-YI;% diff of y coordinates with the nearest measurement point
     
    390393   
    391394    %% merge the NbView fields
     395    ProjData
    392396    [MergeData,errormsg]=merge_field(ProjData);
    393397    if ~isempty(errormsg)
     
    446450       TimeData.div=MergeData.div;
    447451
    448             [error,ncid]=struct2nc(OutputFile,TimeData);%save result file
     452            error=struct2nc(OutputFile,TimeData);%save result file
    449453        if isempty(error)
    450454            disp(['output file ' OutputFile ' written'])
     
    453457        end
    454458            ellapsed_time=toc(tstart);
    455     disp(['total ellapsed time ' num2str(ellapsed_time/60,2) ' minutes'])
    456 end
    457 
    458 ellapsed_time=toc(tstart);
    459 disp(['total ellapsed time ' num2str(ellapsed_time/60,2) ' minutes'])
     459    disp(['ellapsed time since start ' num2str(ellapsed_time/60,2) ' minutes'])
     460end
     461
    460462disp([ num2str(ellapsed_time/(60*NbField),3) ' minutes per iteration'])
    461463
Note: See TracChangeset for help on using the changeset viewer.