Changeset 1143 for trunk/src/series
- Timestamp:
- May 9, 2024, 6:51:30 PM (5 months ago)
- Location:
- trunk/src/series
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series/civ_input.m
r1141 r1143 81 81 set(handles.CheckThreshold,'Visible','on') 82 82 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') 85 85 end 86 86 switch Param.Action.ActionName … … 97 97 FileType='image';%fdefault 98 98 FileInfo=[]; 99 if isfield(SeriesData,'FileInfo') ...99 if isfield(SeriesData,'FileInfo') 100 100 FileType=SeriesData.FileInfo{1}.FileType;% info on the first input file series 101 101 FieldType=SeriesData.FileInfo{1}.FieldType;% info on the first input file series -
trunk/src/series/civ_series.m
r1137 r1143 2 2 % --- call the sub-functions: 3 3 % civ: PIV function itself 4 % fix: removesfalse vectors after detection by various criteria4 % detect_false: put a flag to false vectors after detection by various criteria 5 5 % filter_tps: make interpolation-smoothing 6 6 %------------------------------------------------------------------------ … … 22 22 % Param.ActionInput: substructure with the parameters provided by the GUI civ_input 23 23 % .Civ1: parameters for civ1cc 24 % .Fix1: parameters for fix124 % .Fix1: parameters for detect_false1 25 25 % .Patch1: 26 26 % .Civ2: for civ2 … … 131 131 iview_A=2;% the second line is used for the input images of Civ2 132 132 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 table135 % end136 133 if iview_A~=0 137 134 RootPath_A=Param.InputTable{iview_A,1}; … … 237 234 NbField=numel(i1_series_Civ2); 238 235 else 239 NbField=numel(i1_series_Civ1);% no image used (only fixor patch) TO CHECK236 NbField=numel(i1_series_Civ1);% no image used (only detect_false or patch) TO CHECK 240 237 end 241 238 … … 347 344 ImageName_A='';ImageName_B='';%default 348 345 VideoObject_A=[];VideoObject_B=[]; 346 349 347 %% Civ1 350 348 % if Civ1 computation is requested … … 544 542 %% Fix1 545 543 if isfield (Param.ActionInput,'Fix1') 546 disp(' fix1 started')544 disp('detect_false1 started') 547 545 if ~isfield (Param.ActionInput,'Civ1')% if we use existing Civ1, remove previous data beyond Civ1 548 546 Fix1_attr=find(strcmp('Fix1',Data.ListGlobalAttribute)); … … 563 561 nbvar=length(Data.ListVarName); 564 562 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)); 566 564 Data.CivStage=2; 567 565 end … … 823 821 if exist('ncfile','var') 824 822 CivFile=ncfile; 825 [Data,tild,tild,errormsg]=nc2struct(CivFile);%read civ1 and fix1 data in the existing netcdf file823 [Data,tild,tild,errormsg]=nc2struct(CivFile);%read civ1 and detect_false1 data in the existing netcdf file 826 824 if ~isempty(errormsg) 827 825 disp_uvmat('ERROR',errormsg,checkrun) … … 842 840 %% Fix2 843 841 if isfield (Param.ActionInput,'Fix2') 844 disp(' fix2 started')842 disp('detect_false2 started') 845 843 list_param=fieldnames(Param.ActionInput.Fix2)'; 846 844 Fix2_param=regexprep(list_param,'^.+','Fix2_$0');% insert 'Fix1_' before each string in ListFixParam … … 857 855 Data.VarDimName=[Data.VarDimName {'nb_vectors2'}]; 858 856 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); 860 858 else 861 859 Data.ListVarName=[Data.ListVarName {'Civ2_FF'}]; … … 863 861 nbvar=length(Data.ListVarName); 864 862 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)); 866 864 Data.CivStage=Data.CivStage+1; 867 865 end … … 1293 1291 end 1294 1292 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 1294 function FF=detect_false(Param,F,C,U,V) 1318 1295 FF=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 1300 FF(F==-2)=-2; 1329 1301 if isfield (Param,'MinCorr') 1330 FF=FF==1 | C<Param.MinCorr;1302 FF(C<Param.MinCorr)=-1; 1331 1303 end 1332 1304 if (isfield(Param,'MinVel')&&~isempty(Param.MinVel))||(isfield (Param,'MaxVel')&&~isempty(Param.MaxVel)) 1333 1305 Umod= U.*U+V.*V; 1334 1306 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; 1336 1309 end 1337 1310 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 1314 end 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 1341 1338 1342 1339 -
trunk/src/series/extract_rdvision.m
r1134 r1143 308 308 % m.Data=data; 309 309 %%%%%%% 310 311 312 313 314 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) 315 315 [nbfield1,nbfield2,msg]=copyfile_modif(filexml,timestamp,newxml); %copy the xml file in the upper folder 316 316 [XmlData,errormsg]=imadoc2struct(newxml);% check reading of the new xml file … … 319 319 return 320 320 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 333 331 else 334 332 [nbfield1,nbfield2,msg]=copyfile_modif(filexml,timestamp,''); -
trunk/src/series/test_patch_tps.m
r1142 r1143 220 220 for index=1:1%numel(filecell) 221 221 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)) 223 223 NbGood=numel(ind_good); 224 224 Xin=Data.X(ind_good); … … 252 252 DataOut.(['U_' str_i{irho}])=U_smooth; 253 253 DataOut.(['V_' str_i{irho}])=V_smooth; 254 % DataOut.FF(ind_false)=FieldSmooth(irho);255 254 end 256 255 time=toc
Note: See TracChangeset
for help on using the changeset viewer.