Changeset 927 for trunk/src/series/civ2vel_3C.m
- Timestamp:
- Feb 24, 2016, 7:39:00 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series/civ2vel_3C.m
r924 r927 34 34 35 35 %======================================================================= 36 % Copyright 2008-201 6, LEGI UMR 5519 / CNRS UGAG-INP, Grenoble, France36 % Copyright 2008-2015, LEGI UMR 5519 / CNRS UJF G-INP, Grenoble, France 37 37 % http://www.legi.grenoble-inp.fr 38 38 % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr … … 52 52 53 53 function ParamOut=civ2vel_3C(Param) 54 54 disp('test') 55 55 %% set the input elements needed on the GUI series when the function is selected in the menu ActionName or InputTable refreshed 56 56 if isstruct(Param) && isequal(Param.Action.RUN,0) … … 68 68 ParamOut.OutputFileMode='NbInput';% '=NbInput': 1 output file per input file index, '=NbInput_i': 1 file per input file index i, '=NbSlice': 1 file per slice 69 69 %check the input files 70 ParamOut.CheckOverwriteVisible='on'; % manage the overwrite of existing files (default=1) 70 71 first_j=[]; 71 72 if size(Param.InputTable,1)<2 … … 170 171 warning off 171 172 173 CheckOverwrite=1;%default 174 if isfield(Param,'CheckOverwrite') 175 CheckOverwrite=Param.CheckOverwrite; 176 end 172 177 for index=1:NbField 178 173 179 update_waitbar(WaitbarHandle,index/NbField) 180 181 182 183 184 %% generating the name of the merged field 185 i1=i1_series{1}(index); 186 if ~isempty(i2_series{end}) 187 i2=i2_series{end}(index); 188 else 189 i2=i1; 190 end 191 j1=1; 192 j2=1; 193 if ~isempty(j1_series{1}) 194 j1=j1_series{1}(index); 195 if ~isempty(j2_series{end}) 196 j2=j2_series{end}(index); 197 else 198 j2=j1; 199 end 200 end 201 OutputFile=fullfile_uvmat(RootPath{1},OutputDir,RootFile{1},'.nc','_1-2',i1,i2,j1,j2); 202 203 %% 204 205 174 206 if ~isempty(RUNHandle) && ~strcmp(get(RUNHandle,'BusyAction'),'queue') 175 207 disp('program stopped by user') … … 177 209 end 178 210 211 if (~CheckOverwrite && exist(OutputFile,'file')) 212 disp('existing output file already exists, skip to next field') 213 continue% skip iteration if the mode overwrite is desactivated and the result file already exists 214 end 215 179 216 %%%%%%%%%%%%%%%% loop on views (input lines) %%%%%%%%%%%%%%%% 180 217 Data=cell(1,NbView);%initiate the set Data … … 185 222 clear ZItemp 186 223 ZItemp=zeros(size(XI,1),size(XI,2),2); 224 225 if index==1 226 first_img=i1_series{1,1}(1,1); %id of the first image of the series 227 end 228 229 idtemp=0; 187 230 for indextemp=index:index+1; 231 idtemp=idtemp+1; 188 232 if NbView==3 % if there is only 1 stereo folder, extract directly Xphys,Yphys and Zphys 189 190 [Data{3},tild,errormsg] = nc2struct([Param.InputTable{3,1},'/',Param.InputTable{3,2},'/',Param.InputTable{3,3},'_',int2str(indextemp),'.nc']); 191 233 234 235 236 [Data{3},tild,errormsg] = nc2struct([Param.InputTable{3,1},'/',Param.InputTable{3,2},'/',Param.InputTable{3,3},'_',int2str(first_img+indextemp-1),'.nc']); 192 237 193 238 if exist('Data{3}.Civ3_FF','var') % FF is present, remove wrong vector … … 219 264 end 220 265 221 [Data{3},tild,errormsg] = nc2struct([Param.InputTable{3,1},'/',Param.InputTable{3,2},'/',Param.InputTable{3,3},'_',int2str(indextemp),'.nc']); 266 267 268 [Data{3},tild,errormsg] = nc2struct([Param.InputTable{3,1},'/',Param.InputTable{3,2},'/',Param.InputTable{3,3},'_',int2str(first_img+indextemp-1),'.nc']); 269 222 270 if exist('Data{3}.Civ3_FF','var') % if FF is present, remove wrong vector 223 271 temp=find(Data{3}.Civ3_FF==0); … … 241 289 242 290 243 [Data{4},tild,errormsg] = nc2struct([Param.InputTable{4,1},'/',Param.InputTable{4,2},'/',Param.InputTable{4,3},'_',int2str(indextemp),'.nc']); 291 292 [Data{4},tild,errormsg] = nc2struct([Param.InputTable{4,1},'/',Param.InputTable{4,2},'/',Param.InputTable{4,3},'_',int2str(first_img+indextemp-1),'.nc']); 244 293 if exist('Data{4}.Civ3_FF','var') % if FF is present, remove wrong vector 245 294 temp=find(Data{4}.Civ3_FF==0); … … 279 328 280 329 281 ZItemp(:,:,i ndextemp)=griddata(Xphys,Yphys,Zphys,XI,YI); %interpolation on the choosen gridd330 ZItemp(:,:,idtemp)=griddata(Xphys,Yphys,Zphys,XI,YI); %interpolation on the choosen gridd 282 331 283 332 end … … 320 369 Va=griddata(X1,Y1,V1,Xa,Ya); 321 370 322 [Ua,Va,Xa,Ya]=Ud2U(XmlData{1}.GeometryCalib,Xa,Ya,Ua,Va); % convert Xd data to X371 % [Ua,Va,Xa,Ya]=Ud2U(XmlData{1}.GeometryCalib,Xa,Ya,Ua,Va); % convert Xd data to X 323 372 [A]=get_coeff(XmlData{1}.GeometryCalib,Xa,Ya,XI,YI,ZI); %get coef A~ 324 373 … … 332 381 Vb=griddata(X2,Y2,V2,Xb,Yb); 333 382 334 [Ub,Vb,Xb,Yb]=Ud2U(XmlData{2}.GeometryCalib,Xb,Yb,Ub,Vb); % convert Xd data to X383 % [Ub,Vb,Xb,Yb]=Ud2U(XmlData{2}.GeometryCalib,Xb,Yb,Ub,Vb); % convert Xd data to X 335 384 [B]=get_coeff(XmlData{2}.GeometryCalib,Xb,Yb,XI,YI,ZI); %get coef B~ 336 385 … … 369 418 370 419 371 %% generating the name of the merged field 372 i1=i1_series{1}(index); 373 if ~isempty(i2_series{end}) 374 i2=i2_series{end}(index); 375 else 376 i2=i1; 377 end 378 j1=1; 379 j2=1; 380 if ~isempty(j1_series{1}) 381 j1=j1_series{1}(index); 382 if ~isempty(j2_series{end}) 383 j2=j2_series{end}(index); 384 else 385 j2=j1; 386 end 387 end 388 OutputFile=fullfile_uvmat(RootPath{1},OutputDir,RootFile{1},'.nc','_1-2',i1,i2,j1,j2); 420 389 421 390 422 %% recording the merged field … … 399 431 MergeData.coord_x=xI; 400 432 MergeData.coord_y=yI; 401 MergeData.Z=ZI;402 433 end 403 434 MergeData.U=U/Dt; 404 435 MergeData.V=V/Dt; 405 436 MergeData.W=W/Dt; 406 407 mfx=(XmlData{1}.GeometryCalib.fx_fy(1)+XmlData{2}.GeometryCalib.fx_fy(1))/2; 408 mfy=(XmlData{1}.GeometryCalib.fx_fy(2)+XmlData{2}.GeometryCalib.fx_fy(2))/2; 409 MergeData.Error=(sqrt(mfx^2+mfy^2)/4).*sqrt(sum(Error.*Error,3)); 437 MergeData.Z=ZI; 438 439 % mfx=(XmlData{1}.GeometryCalib.fx_fy(1)+XmlData{2}.GeometryCalib.fx_fy(1))/2; 440 % mfy=(XmlData{1}.GeometryCalib.fx_fy(2)+XmlData{2}.GeometryCalib.fx_fy(2))/2; 441 MergeData.Error=0.5*sqrt(sum(Error.^2,3)); 410 442 errormsg=struct2nc(OutputFile,MergeData);%save result file 411 443 if isempty(errormsg) … … 496 528 %% result 497 529 Den=(Dxb-Dxa).*(Dxb-Dxa)+(Dyb-Dya).*(Dyb-Dya); 498 error= ((Dyb-Dya).*(-u)-(Dxb-Dxa).*(-v))./Den;530 error=abs(((Dyb-Dya).*(-u)-(Dxb-Dxa).*(-v)))./Den; 499 531 % ex=-error.*(Dyb-Dya); 500 532 % ey=-error.*(Dxb-Dxa);
Note: See TracChangeset
for help on using the changeset viewer.