Changeset 1143 for trunk/src/series


Ignore:
Timestamp:
May 9, 2024, 6:51:30 PM (5 months ago)
Author:
sommeria
Message:

new display of false vectors

Location:
trunk/src/series
Files:
5 edited

Legend:

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

    r1141 r1143  
    8181    set(handles.CheckThreshold,'Visible','on')
    8282    set(handles.CheckDeformation,'Value',0)% desactivate
    83     set(handles.num_SubDomainSize(1),'String','250')
    84     set(handles.num_SubDomainSize(2),'String','500')
     83%     set(handles.num_SubDomainSize(1),'String','250')
     84%     set(handles.num_SubDomainSize(2),'String','500')
    8585end
    8686switch Param.Action.ActionName
     
    9797FileType='image';%fdefault
    9898FileInfo=[];
    99 if isfield(SeriesData,'FileInfo')...
     99if isfield(SeriesData,'FileInfo')
    100100    FileType=SeriesData.FileInfo{1}.FileType;% info on the first input file series
    101101    FieldType=SeriesData.FileInfo{1}.FieldType;% info on the first input file series
  • trunk/src/series/civ_series.m

    r1137 r1143  
    22% --- call the sub-functions:
    33%   civ: PIV function itself
    4 %   fix: removes false vectors after detection by various criteria
     4%   detect_false: put a flag to false vectors after detection by various criteria
    55%   filter_tps: make interpolation-smoothing
    66%------------------------------------------------------------------------
     
    2222%     Param.ActionInput: substructure with the parameters provided by the GUI civ_input
    2323%                      .Civ1: parameters for civ1cc
    24 %                      .Fix1: parameters for fix1
     24%                      .Fix1: parameters for detect_false1
    2525%                      .Patch1:
    2626%                      .Civ2: for civ2
     
    131131            iview_A=2;% the second line is used for the input images of Civ2
    132132        end
    133 %         if strcmp(Param.ActionInput.ListCompareMode,'shift')
    134 %             iview_B=iview_A+1; % the second image series is on the next line of the input table
    135 %         end
    136133        if iview_A~=0
    137134            RootPath_A=Param.InputTable{iview_A,1};
     
    237234            NbField=numel(i1_series_Civ2);
    238235        else
    239             NbField=numel(i1_series_Civ1);% no image used (only fix or patch) TO CHECK
     236            NbField=numel(i1_series_Civ1);% no image used (only detect_false or patch) TO CHECK
    240237        end
    241238
     
    347344    ImageName_A='';ImageName_B='';%default
    348345    VideoObject_A=[];VideoObject_B=[];
     346   
    349347    %% Civ1
    350348    % if Civ1 computation is requested
     
    544542    %% Fix1
    545543    if isfield (Param.ActionInput,'Fix1')
    546         disp('fix1 started')
     544        disp('detect_false1 started')
    547545        if ~isfield (Param.ActionInput,'Civ1')% if we use existing Civ1, remove previous data beyond Civ1
    548546            Fix1_attr=find(strcmp('Fix1',Data.ListGlobalAttribute));
     
    563561        nbvar=length(Data.ListVarName);
    564562        Data.VarAttribute{nbvar}.Role='errorflag';
    565         Data.Civ1_FF=int8(fix(Param.ActionInput.Fix1,Data.Civ1_F,Data.Civ1_C,Data.Civ1_U,Data.Civ1_V));
     563        Data.Civ1_FF=int8(detect_false(Param.ActionInput.Fix1,Data.Civ1_F,Data.Civ1_C,Data.Civ1_U,Data.Civ1_V));
    566564        Data.CivStage=2;
    567565    end
     
    823821        if exist('ncfile','var')
    824822            CivFile=ncfile;
    825             [Data,tild,tild,errormsg]=nc2struct(CivFile);%read civ1 and fix1 data in the existing netcdf file
     823            [Data,tild,tild,errormsg]=nc2struct(CivFile);%read civ1 and detect_false1 data in the existing netcdf file
    826824            if ~isempty(errormsg)
    827825                disp_uvmat('ERROR',errormsg,checkrun)
     
    842840    %% Fix2
    843841    if isfield (Param.ActionInput,'Fix2')
    844         disp('fix2 started')
     842        disp('detect_false2 started')
    845843        list_param=fieldnames(Param.ActionInput.Fix2)';
    846844        Fix2_param=regexprep(list_param,'^.+','Fix2_$0');% insert 'Fix1_' before  each string in ListFixParam
     
    857855                Data.VarDimName=[Data.VarDimName {'nb_vectors2'}];
    858856            end
    859             Data.vec_FixFlag=fix(Param.Fix2,Data.vec2_F,Data.vec2_C,Data.vec2_U,Data.vec2_V,Data.vec2_X,Data.vec2_Y);
     857            Data.vec_FixFlag=detect_false(Param.Fix2,Data.vec2_F,Data.vec2_C,Data.vec2_U,Data.vec2_V);
    860858        else
    861859            Data.ListVarName=[Data.ListVarName {'Civ2_FF'}];
     
    863861            nbvar=length(Data.ListVarName);
    864862            Data.VarAttribute{nbvar}.Role='errorflag';
    865             Data.Civ2_FF=double(fix(Param.ActionInput.Fix2,Data.Civ2_F,Data.Civ2_C,Data.Civ2_U,Data.Civ2_V));
     863            Data.Civ2_FF=double(detect_false(Param.ActionInput.Fix2,Data.Civ2_F,Data.Civ2_C,Data.Civ2_U,Data.Civ2_V));
    866864            Data.CivStage=Data.CivStage+1;
    867865        end
     
    12931291end
    12941292
    1295 %'RUN_FIX': function for fixing velocity fields:
    1296 %-----------------------------------------------
    1297 % RUN_FIX(filename,field,flagindex,thresh_vecC,thresh_vel,iter,flag_mask,maskname,fileref,fieldref)
    1298 %
    1299 %filename: name of the netcdf file (used as input and output)
    1300 %field: structure specifying the names of the fields to fix (depending on civ1 or civ2)
    1301 %.vel_type='civ1' or 'civ2';
    1302 %.nb=name of the dimension common to the field to fix ('nb_vectors' for civ1);
    1303 %.fixflag=name of fix flag variable ('vec_FixFlag' for civ1)
    1304 %flagindex: flag specifying which values of vec_f are removed:
    1305 % if flagindex(1)=1: vec_f=-2 vectors are removed
    1306 % if flagindex(2)=1: vec_f=3 vectors are removed
    1307 % if flagindex(3)=1: vec_f=2 vectors are removed (if iter=1) or vec_f=4 vectors are removed (if iter=2)
    1308 %iter=1 for civ1 fields and iter=2 for civ2 fields
    1309 %thresh_vecC: threshold in the image correlation vec_C
    1310 %flag_mask: =1 mask used to remove vectors (0 else)
    1311 %maskname: name of the mask image file for fix
    1312 %thresh_vel: threshold on velocity, or on the difference with the reference file fileref if exists
    1313 %inf_sup=1: remove values smaller than threshold thresh_vel, =2, larger than threshold
    1314 %fileref: .nc file name for a reference velocity (='': refrence 0 used)
    1315 %fieldref: 'civ1','filter1'...feld used in fileref
    1316 
    1317 function FF=fix(Param,F,C,U,V,X,Y)
     1293
     1294function FF=detect_false(Param,F,C,U,V)
    13181295FF=zeros(size(F));%default
    1319 
    1320 %criterium on warn flags
    1321 FlagName={'CheckFmin2','CheckF2','CheckF3','CheckF4'};
    1322 FlagVal=[-2 2 3 4];
    1323 for iflag=1:numel(FlagName)
    1324     if isfield(Param,FlagName{iflag}) && Param.(FlagName{iflag})
    1325         FF=(FF==1| F==FlagVal(iflag));
    1326     end
    1327 end
    1328 %criterium on correlation values
     1296% FF=-2, for correlation max at edge
     1297% FF=-1, for too small correlation
     1298% FF=1, for velocity outside bounds
     1299% FF=2 for exclusion by difference with the smoothed field
     1300FF(F==-2)=-2;
    13291301if isfield (Param,'MinCorr')
    1330     FF=FF==1 | C<Param.MinCorr;
     1302     FF(C<Param.MinCorr)=-1;
    13311303end
    13321304if (isfield(Param,'MinVel')&&~isempty(Param.MinVel))||(isfield (Param,'MaxVel')&&~isempty(Param.MaxVel))
    13331305    Umod= U.*U+V.*V;
    13341306    if isfield (Param,'MinVel')&&~isempty(Param.MinVel)
    1335         FF=FF==1 | Umod<(Param.MinVel*Param.MinVel);
     1307        U2Min=Param.MinVel*Param.MinVel;
     1308        FF(Umod<U2Min)=1;
    13361309    end
    13371310    if isfield (Param,'MaxVel')&&~isempty(Param.MaxVel)
    1338         FF=FF==1 | Umod>(Param.MaxVel*Param.MaxVel);
    1339     end
    1340 end
     1311         U2Max=Param.MaxVel*Param.MaxVel;
     1312        FF(Umod>U2Max)=1;
     1313    end
     1314end
     1315
     1316
     1317%criterium on warn flags
     1318% FlagName={'CheckFmin2','CheckF2','CheckF3','CheckF4'};
     1319% FlagVal=[-2 2 3 4];
     1320% for iflag=1:numel(FlagName)
     1321%     if isfield(Param,FlagName{iflag}) && Param.(FlagName{iflag})
     1322%         FF=(FF==1| F==FlagVal(iflag));
     1323%     end
     1324% end
     1325% %criterium on correlation values
     1326% if isfield (Param,'MinCorr')
     1327%     FF=FF==1 | C<Param.MinCorr;
     1328% end
     1329% if (isfield(Param,'MinVel')&&~isempty(Param.MinVel))||(isfield (Param,'MaxVel')&&~isempty(Param.MaxVel))
     1330%     Umod= U.*U+V.*V;
     1331%     if isfield (Param,'MinVel')&&~isempty(Param.MinVel)
     1332%         FF=FF==1 | Umod<(Param.MinVel*Param.MinVel);
     1333%     end
     1334%     if isfield (Param,'MaxVel')&&~isempty(Param.MaxVel)
     1335%         FF=FF==1 | Umod>(Param.MaxVel*Param.MaxVel);
     1336%     end
     1337% end
    13411338
    13421339
  • trunk/src/series/extract_rdvision.m

    r1134 r1143  
    308308%             m.Data=data;
    309309    %%%%%%%
    310         timestamp=zeros(1,numel(m.Data));
    311         for ii=1: numel(m.Data)
    312             timestamp(ii)=m.Data(ii).timestamp;
    313         end
    314         if isequal(Param.IndexRange.first_i,1)
     310    timestamp=zeros(1,numel(m.Data));
     311    for ii=1: numel(m.Data)
     312        timestamp(ii)=m.Data(ii).timestamp;
     313    end
     314    if isequal(Param.IndexRange.first_i,1)
    315315        [nbfield1,nbfield2,msg]=copyfile_modif(filexml,timestamp,newxml); %copy the xml file in the upper folder
    316316        [XmlData,errormsg]=imadoc2struct(newxml);% check reading of the new xml file
     
    319319            return
    320320        end
    321         timestamp=timestamp(1:nbfield1*nbfield2);
    322         timestamp=reshape(timestamp,nbfield2,nbfield1);
    323         difftime=XmlData.Time(2:end,2:end)'-timestamp;
    324         disp(['time from xml and timestamp differ by ' num2str(max(max(abs(difftime))))])
    325         if max(abs(difftime))>0.01
    326             checkpreserve=1;% will not erase the initial files, possibility of error
    327         end     
    328         % checking consistency with the xml file
    329         %     if ~isequal(SeqData.nb_frames,numel(timestamp))
    330         %         disp_uvmat('ERRROR',['inconsistent number of images ' num2str(SeqData.nb_frames) ' with respect to the xml file: ' num2str(numel(timestamp))] ,checkrun);
    331         %         return
    332         %     end
     321        if numel(timestamp)~=nbfield1*nbfield2
     322            disp('WARNING: total image number defined by the xml file differs from  the number of frames ')
     323        else
     324            timestamp=reshape(timestamp,nbfield2,nbfield1);
     325            difftime=XmlData.Time(2:end,2:end)'-timestamp;
     326            disp(['time from xml and timestamp differ by ' num2str(max(max(abs(difftime))))])
     327            if max(abs(difftime))>0.01
     328                checkpreserve=1;% will not erase the initial files, possibility of error
     329            end
     330        end
    333331    else
    334332       [nbfield1,nbfield2,msg]=copyfile_modif(filexml,timestamp,'');
  • trunk/src/series/test_patch_tps.m

    r1142 r1143  
    220220for index=1:1%numel(filecell)
    221221    Data=read_field(filecell{1,index},'civdata',Param.InputFields);
    222             ind_good=find(Data.FF==0|Data.FF==20);%keep good civ data, and also the ones excluded by the criterium of discrepancy betwween smoothed and raw fields (FF=20)
     222            ind_good=find(Data.FF==0|Data.FF==20|Data.FF==2);%keep good civ data, and also the ones excluded by the criterium of discrepancy betwween smoothed and raw fields (FF=2 or 20 (old convention))
    223223        NbGood=numel(ind_good);
    224224        Xin=Data.X(ind_good);
     
    252252        DataOut.(['U_' str_i{irho}])=U_smooth;
    253253        DataOut.(['V_' str_i{irho}])=V_smooth;
    254         % DataOut.FF(ind_false)=FieldSmooth(irho);
    255254    end
    256255    time=toc
Note: See TracChangeset for help on using the changeset viewer.