Changeset 252 for trunk/src/civ_uvmat.m
- Timestamp:
- May 15, 2011, 11:17:08 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ_uvmat.m
r251 r252 32 32 PointCoord(:,1)=reshape(GridX,[],1); 33 33 PointCoord(:,2)=reshape(GridY,[],1); 34 if ~isempty(par_civ1.maskname)34 if isfield(par_civ1,'maskname') && ~isempty(par_civ1.maskname) 35 35 maskname=par_civ1.maskname; 36 36 mask=imread(maskname); … … 133 133 Data.fix=1; 134 134 Data.ListVarName=[Data.ListVarName {'vec_FixFlag'}]; 135 Data.VarDimName=[Data.Var dimName {'nb_vectors'}];135 Data.VarDimName=[Data.VarDimName {'nb_vectors'}]; 136 136 end 137 137 Data.vec_FixFlag=fix_uvmat(Param.Fix1,Data.vec_F,Data.vec_C,Data.vec_U,Data.vec_V,Data.vec_X,Data.vec_Y); … … 174 174 %% Civ2 175 175 if isfield (Param,'Civ2') 176 par_civ2=Param.Civ2 176 par_civ2=Param.Civ2; 177 177 image1=imread(par_civ2.filename_ima_a); 178 178 image2=imread(par_civ2.filename_ima_b); … … 235 235 Data.CivStage=Data.CivStage+1; 236 236 end 237 238 %% Fix2 239 if isfield (Param,'Fix2') 240 ListFixParam=fieldnames(Param.Fix2); 241 for ilist=1:length(ListFixParam) 242 ParamName=ListFixParam{ilist}; 243 ListName=['Fix1_' ParamName]; 244 eval(['Data.ListGlobalAttribute=[Data.ListGlobalAttribute ''' ParamName '''];']) 245 eval(['Data.' ListName '=Param.Fix2.' ParamName ';']) 246 end 247 if test_civx 248 if ~isfield(Data,'fix2') 249 Data.ListGlobalAttribute=[Data.ListGlobalAttribute 'fix2']; 250 Data.fix2=1; 251 Data.ListVarName=[Data.ListVarName {'vec2_FixFlag'}]; 252 Data.VarDimName=[Data.VarDimName {'nb_vectors2'}]; 253 end 254 Data.vec_FixFlag=fix_uvmat(Param.Fix2,Data.vec2_F,Data.vec2_C,Data.vec2_U,Data.vec2_V,Data.vec2_X,Data.vec2_Y); 255 else 256 Data.ListVarName=[Data.ListVarName {'Civ2_FF'}]; 257 Data.VarDimName=[Data.VarDimName {'nbvec2'}]; 258 nbvar=length(Data.ListVarName); 259 Data.VarAttribute{nbvar}.Role='errorflag'; 260 Data.Civ2_FF=fix_uvmat(Param.Fix2,Data.Civ2_F,Data.Civ2_C,Data.Civ2_U,Data.Civ2_V); 261 Data.CivStage=5; 262 end 263 end 264 265 %% Patch2 266 if isfield (Param,'Patch2') 267 Data.ListGlobalAttribute=[Data.ListGlobalAttribute {'Patch2_Rho','Patch2_Threshold','Patch2_SubDomain'}]; 268 Data.Patch2_Rho=str2double(Param.Patch2.Rho); 269 Data.Patch2_Threshold=str2double(Param.Patch2.Threshold); 270 Data.Patch2_SubDomain=str2double(Param.Patch2.SubDomain); 271 Data.ListVarName=[Data.ListVarName {'Civ2_U_Diff','Civ2_V_Diff','Civ2_X_SubRange','Civ2_Y_SubRange','Civ2_NbSites','Civ2_X_tps','Civ2_Y_tps','Civ2_U_tps','Civ2_V_tps'}]; 272 Data.VarDimName=[Data.VarDimName {'NbVec2','NbVec2',{'NbSubDomain2','Two'},{'NbSubDomain2','Two'},'NbSubDomain2',... 273 {'NbVec2Sub','NbSubDomain2'},{'NbVec2Sub','NbSubDomain2'},{'Nbtps2','NbSubDomain2'},{'Nbtps2','NbSubDomain2'}}]; 274 nbvar=length(Data.ListVarName); 275 Data.VarAttribute{nbvar-1}.Role='vector_x'; 276 Data.VarAttribute{nbvar}.Role='vector_y'; 277 Data.Civ2_U_Diff=zeros(size(Data.Civ2_X)); 278 Data.Civ2_V_Diff=zeros(size(Data.Civ2_X)); 279 if isfield(Data,'Civ2_FF') 280 ind_good=find(Data.Civ2_FF==0); 281 else 282 ind_good=1:numel(Data.Civ2_X); 283 end 284 [Data.Civ2_X_SubRange,Data.Civ2_Y_SubRange,Data.Civ2_NbSites,FFres,Ures, Vres,Data.Civ2_X_tps,Data.Civ2_Y_tps,Data.Civ2_U_tps,Data.Civ2_V_tps]=... 285 patch_uvmat(Data.Civ2_X(ind_good)',Data.Civ2_Y(ind_good)',Data.Civ2_U(ind_good)',Data.Civ2_V(ind_good)',Data.Patch2_Rho,Data.Patch2_Threshold,Data.Patch2_SubDomain); 286 Data.Civ2_U_Diff(ind_good)=Data.Civ2_U(ind_good)-Ures; 287 Data.Civ2_V_Diff(ind_good)=Data.Civ2_V(ind_good)-Vres; 288 Data.Civ2_FF(ind_good)=FFres; 289 Data.CivStage=3; 290 end 291 237 292 %% write result 238 293 % 'TESTcalc' … … 266 321 267 322 function FF=fix_uvmat(Param,F,C,U,V,X,Y) 268 %error=[]; %default269 Param270 323 FF=zeros(size(F));%default 271 324
Note: See TracChangeset
for help on using the changeset viewer.