Changeset 1196 for trunk/src/series
- Timestamp:
- Mar 10, 2026, 12:37:44 PM (4 weeks ago)
- Location:
- trunk/src/series
- Files:
-
- 3 edited
-
civ_input.m (modified) (6 diffs)
-
civ_series.m (modified) (3 diffs)
-
merge_proj.m (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series/civ_input.m
r1188 r1196 186 186 % CoordUnit='';%default 187 187 % pxcm_search=1; 188 if isfield(SeriesData,'Time') && numel(SeriesData.Time')>=1 && ~isempty(SeriesData.Time{1})188 if isfield(SeriesData,'Time') && numel(SeriesData.Time')>=1 && ~isempty(SeriesData.Time{1}) 189 189 time=SeriesData.Time{1}; 190 190 end … … 192 192 TimeUnit=Param.IndexRange.TimeUnit; 193 193 end 194 % if isfield(SeriesData,'GeometryCalib')195 % tsai=SeriesData.GeometryCalib;196 % if isfield(tsai,'fx_fy')197 % pxcm_search=max(tsai.fx_fy(1),tsai.fx_fy(2));%pixels:cm estimated for the search range198 % end199 % if isfield(tsai,'CoordUnit')200 % CoordUnit=tsai.CoordUnit;201 % end202 % end203 194 204 195 %% timing display … … 249 240 set(handles.(ListOptions{index}),'value',0) 250 241 fill_civ_input(Data,handles); %fill civ_input with the parameters retrieved from an input Civ file 242 if index<=3 243 set(handles.(ListOptions{index}),'Visible','off') 244 PanelTag=regexprep(ListOptions{index},'Check','') 245 set(handles.(PanelTag),'Visible','off') 246 end 251 247 end 252 248 if isempty(FileInfo) … … 259 255 set(handles.(ListOptions{index}),'String',regexprep(ListOptions{index},'Check','redo ')) 260 256 end 261 % for index = ind_opening+1:6262 % set(handles.(ListOptions{index}),'value',1)263 % end264 257 set(handles.CheckCiv3,'Visible','off')% make visible the switch 'iterate/repet' for Civ2. 265 set(handles.CheckCiv3,'Value',0)% select'iterate/repet' by default266 else 258 %set(handles.CheckCiv3,'Value',0)% select'iterate/repet' by default 259 else %civ3 proposed 267 260 for index = 1:3 268 261 set(handles.(ListOptions{index}),'value',0) … … 273 266 set(handles.CheckCiv3,'Visible','on')% make visible the switch 'iterate/repet' for Civ2. 274 267 set(handles.CheckCiv3,'Value',1)% select'iterate/repet' by default 268 set(handles.CheckCiv3,'String',{'civ3'})% select'iterate/repet' by default 275 269 end 276 270 checkrefresh=1; … … 631 625 for ilist=1:length(options) 632 626 if checkbox(ilist) 633 % set(handles.(options{ilist}),'Visible','on')634 627 set(handles.(options{ilist}),'Enable','on') 635 % set(handles.(['Check' options{ilist}]),'Strin636 628 else 637 % set(handles.(options{ilist}),'Visible','off')638 629 set(handles.(options{ilist}),'Enable','off') 639 630 end -
trunk/src/series/civ_series.m
r1195 r1196 974 974 Data.VarAttribute{4}.scale_factor=1/inv_scale_factor; 975 975 Data.VarAttribute{5}.Role='ancillary'; 976 Data.VarAttribute{5}.scale_factor=1/ inv_scale_factor;976 Data.VarAttribute{5}.scale_factor=1/100;%scla factor for correlation 977 977 Data.VarAttribute{6}.Role='errorflag'; 978 978 Data.X=uint16(Civ_X); … … 980 980 Data.U=int16(inv_scale_factor*Civ_U); 981 981 Data.V=int16(inv_scale_factor*Civ_V); 982 Data.C=uint8( inv_scale_factor*Civ_C);982 Data.C=uint8(100*Civ_C); 983 983 Data.FF=uint8(Civ_FF); 984 % add smoothed field if ptch is done 984 985 if (Param.ActionInput.CheckPatch1 && ~Param.ActionInput.CheckCiv2) ||Param.ActionInput.CheckPatch2 985 986 nbvar=6; 986 % Data.ListVarName=[Data.ListVarName {'U_smooth','V_smooth','SubRange','NbCentres','Coord_tps','U_tps','V_tps'}];987 % Data.VarDimName=[Data.VarDimName {'nb_vec','nb_vec',{'nb_coord','nb_bounds','nb_subdomain'},{'nb_subdomain'},...988 % {'nb_tps','nb_coord','nb_subdomain'},{'nb_tps','nb_subdomain'},{'nb_tps','nb_subdomain'}}];989 987 Data.ListVarName=[Data.ListVarName {'U_smooth','V_smooth'}]; 990 988 Data.VarDimName=[Data.VarDimName {'nb_vec','nb_vec'}]; … … 995 993 Data.U_smooth=int16(inv_scale_factor*Civ_U_smooth); 996 994 Data.V_smooth=int16(inv_scale_factor*Civ_V_smooth); 997 % Data.VarAttribute{nbvar+5}.Role='coord_tps'; 998 % Data.VarAttribute{nbvar+6}.Role='vector_x'; 999 % Data.VarAttribute{nbvar+7}.Role='vector_y'; 1000 % Data.U_smooth=int16(inv_scale_factor*U_smooth); 1001 % Data.V_smooth=int16(inv_scale_factor*V_smooth); 1002 % Data.SubRange=SubRange; 1003 % Data.NbCentres=NbCentres; 1004 % Data.Coord_tps=Coord_tps; 1005 % Data.U_tps=U_tps; 1006 % Data.V_tps=V_tps; 1007 end 1008 % 1009 % if ~isempty(inv_scale_factor) 1010 % Data=compress_data(Data,inv_scale_factor);% compress the data using integers instead of (single precision)floating reals 1011 % end 995 end 1012 996 errormsg=struct2nc(ncfile_out,Data); 1013 997 if isempty(errormsg) -
trunk/src/series/merge_proj.m
r1194 r1196 92 92 msgbox_uvmat('WARNING',['the first input file ' FirstFileName ' does not exist']) 93 93 end 94 VelocityRange=[];%default 95 VelGradientRange=[];%default 96 if isfield(Param,'ActionInput') 97 if isfield(Param.ActionInput,'VelocityRange') 98 VelocityRange= Param.ActionInput.VelocityRange; 99 end 100 if isfield(Param.ActionInput,'VelGradientRange') 101 VelGradientRange= Param.ActionInput.VelGradientRange; 102 end 103 end 104 prompt = {'velocity range (max modulus) for 16 bit integer records (32 bit reals if empty)';... 105 'range (max modulus) for vel derivatives (curl, div...) for 16 bit integer records (32 bit reals if empty)'}; 106 dlg_title = 'set scale_factor for result writing as 16 bit integer (instead of 32 bit reals by default)'; 107 num_lines= 2; 108 def = { num2str(VelocityRange),num2str(VelGradientRange)}; 109 answer = inputdlg(prompt,dlg_title,num_lines,def); 110 if isempty(answer) 111 return 112 end 113 ParamOut.ActionInput.VelocityRange=str2num(answer{1}); 114 ParamOut.ActionInput.VelGradientRange=str2num(answer{2}); 94 115 return 95 116 end … … 109 130 WaitbarHandle=findobj(hseries,'Tag','Waitbar');%handle of waitbar in GUI series 110 131 end 132 scale_factor_inv_uv=[]; 133 if isfield(Param.ActionInput,'VelocityRange') && ~isempty(Param.ActionInput.VelocityRange) 134 scale_factor_inv_uv=floor(32767/Param.ActionInput.VelocityRange); 135 end 136 scale_factor_inv_dudv=[]; 137 if isfield(Param.ActionInput,'VelGradientRange') && ~isempty(Param.ActionInput.VelGradientRange) 138 scale_factor_inv_dudv=floor(32767/Param.ActionInput.VelGradientRange); 139 end 111 140 112 141 %% define the directory for result file (with path=RootPath{1}) … … 139 168 140 169 %% determine the file type on each line from the first input file 141 NcTypeOptions={'netcdf','civx','civdata','pivdata_fluidimage'}; 170 NcTypeOptions={'netcdf','civx','civdata','civdata_compress','pivdata_fluidimage'}; 171 frame_index=cell(NbView,1);FileInfo=cell(NbView,1);MovieObject=cell(NbView,1);ParamIn=cell(NbView,1); 172 FileType=cell(NbView,1);CheckImage=zeros(NbView,1);CheckNc=zeros(NbView,1); 142 173 for iview=1:NbView 143 174 if ~exist(filecell{iview,1}','file') … … 150 181 FileType{iview}='netcdf'; 151 182 end 152 CheckImage {iview}=strcmp(FileInfo{iview}.FieldType,'image');% =1 for images153 if CheckImage {iview}183 CheckImage(iview)=strcmp(FileInfo{iview}.FieldType,'image');% =1 for images 184 if CheckImage(iview) 154 185 ParamIn{iview}=MovieObject{iview}; 155 186 else 156 187 ParamIn{iview}=Param.InputFields; 157 188 end 158 CheckNc {iview}=~isempty(find(strcmp(FileType{iview},NcTypeOptions)));% =1 for netcdf files189 CheckNc(iview)=ismember(FileType{iview},NcTypeOptions);% =1 for netcdf files 159 190 if ~isempty(j1_series{iview}) 160 191 frame_index{iview}=j1_series{iview}; … … 163 194 end 164 195 end 165 if NbView >1 && max( cell2mat(CheckImage))>0 && ~isfield(Param,'ProjObject')196 if NbView >1 && max(CheckImage)>0 && ~isfield(Param,'ProjObject') 166 197 disp_uvmat('ERROR','projection on a common grid is needed to concatene images: use a Projection Object of type ''plane'' with ProjMode=''interp_lin''',checkrun) 167 198 return … … 201 232 end 202 233 end 203 %%%%%%%%%%%% END STANDARD PART %%%%%%%%%%%%204 % EDIT FROM HERE205 234 206 235 %% check the validity of input file types 207 for iview=1:NbView 208 if ~isequal(CheckImage{iview},1)&&~isequal(CheckNc{iview},1) 209 disp_uvmat('ERROR','input set of input series: need either netcdf either image series',checkrun) 236 if ~(CheckImage | CheckNc) 237 disp_uvmat('ERROR',' netcdf or image series needed as input',checkrun) 210 238 return 211 end212 239 end 213 240 214 241 %% output file type 215 if min( cell2mat(CheckImage))==1 && (~Param.CheckObject || strcmp(Param.ProjObject.Type,'plane'))242 if min(CheckImage)==1 && (~Param.CheckObject || strcmp(Param.ProjObject.Type,'plane')) 216 243 FileExtOut='.png'; %image output (input and proj result = image) 217 244 else 218 245 FileExtOut='.nc'; %netcdf output 219 246 end 220 if isempty(j1_series{1}) 247 if isempty(j1_series{1})||max(j1_series{1})==1 221 248 NomTypeOut='_1'; 222 249 else … … 232 259 233 260 234 %% Set field names and velocity types235 %use Param.InputFields for all views236 237 261 %% MAIN LOOP ON FIELDS 238 %%%%%%%%%%%%% STANDARD PART (DO NOT EDIT) %%%%%%%%%%%%239 262 240 263 %%%%%%%%%%%%%%%% loop on field indices %%%%%%%%%%%%%%%% … … 261 284 end 262 285 j1=1; 263 j2=1;264 286 if ~isempty(j1_series{1}) 265 287 j1=j1_series{1}(index); … … 277 299 for iview=1:NbView 278 300 %% reading input file(s) 279 [Data{iview}, tild,errormsg] = read_field(filecell{iview,index},FileType{iview},ParamIn{iview},frame_index{iview}(index));301 [Data{iview},~,errormsg] = read_field(filecell{iview,index},FileType{iview},ParamIn{iview},frame_index{iview}(index)); 280 302 if isempty(errormsg) 281 303 disp([filecell{iview,index} ' read OK']) … … 307 329 308 330 %% calculate tps coefficients if needed 309 310 check_proj_tps= strcmp(FileType{iview},'civdata') && isfield(Param,'ProjObject')&&~isempty(Param.ProjObject)... 331 check_proj_tps= ismember(FileType{iview},{'civdata','civdata_compress'}) && isfield(Param,'ProjObject')&&~isempty(Param.ProjObject)... 311 332 && strcmp(Param.ProjObject.ProjMode,'interp_tps')&&~isfield(Data{iview},'Coord_tps'); 312 333 if check_proj_tps 313 Data{iview}=tps_coeff_field(Data{iview},check_proj_tps);334 Data{iview}=tps_coeff_field(Data{iview},check_proj_tps); 314 335 end 315 336 … … 326 347 if Param.CheckMask % introduce multilevel mask like for civ 327 348 NbSlice=Param.MaskTable{iview,2}; 328 [RootPath_mask,SubDir_mask,RootFile_mask, i1_mask,i2_mask,j1_mask,j2_mask,Ext_mask]=fileparts_uvmat(Param.MaskTable{iview,1});349 [RootPath_mask,SubDir_mask,RootFile_mask,~,~,~,~,Ext_mask]=fileparts_uvmat(Param.MaskTable{iview,1}); 329 350 i1_mask=mod(i1-1,NbSlice)+1; 330 351 maskname=fullfile_uvmat(RootPath_mask,SubDir_mask,RootFile_mask,Ext_mask,'_1',i1_mask); … … 334 355 [MaskData,~,errormsg] = read_field(maskname,'image'); 335 356 if ~isempty(NbSlice_calib) 336 MaskData.ZIndex=mod(i1_series{iview}(index)-1,NbSlice_calib{iview})+1;%Zindex for phys transform337 end357 MaskData.ZIndex=mod(i1_series{iview}(index)-1,NbSlice_calib{iview})+1;%Zindex for phys transform 358 end 338 359 if ~isempty(transform_fct) && nargin(transform_fct)>=2 339 360 MaskData=transform_fct(MaskData,XmlData{iview}); … … 351 372 else 352 373 MergeData=transform_fct(Data{1},XmlData{1},Data{2}); %combine the two input file series 353 % else354 % MergeData=transform_fct(Data{1},XmlData{1},Data{2},XmlData{2});%combine the two input file series with calibration parameters355 374 end 356 375 if ~isempty(errormsg) … … 362 381 if ~isempty(time) 363 382 timeread=time(index); 364 elseif ~isempty(find(timeread ))% time defined from ImaDoc383 elseif ~isempty(find(timeread, 1))% time defined from ImaDoc 365 384 timeread=mean(timeread(timeread~=0));% take average over times form the files (when defined) 366 385 else … … 372 391 if strcmp(FileExtOut,'.png') %output as image 373 392 if index==1 374 if strcmp(class(MergeData.A),'uint8')375 BitDepth=8;393 if isa(MergeData.A,'uint8') 394 BitDepth=8; 376 395 else 377 BitDepth=16;396 BitDepth=16; 378 397 end 379 398 %write xml calibration file, using the first file … … 429 448 MergeData.Time=timeread; 430 449 end 431 % position of projection plane 450 % position of projection plane 432 451 if isfield(Data{1},'ProjObjectCoord')&& isfield(Data{1},'ProjObjectAngle') 433 452 ProjObjectCoord=Data{1}.ProjObjectCoord; … … 471 490 end 472 491 end 492 if ~isempty(scale_factor_inv_uv) 493 index_U=find(strcmp(MergeData.ListVarName,'U')); 494 if ~isempty(index_U) 495 MergeData.VarAttribute{index_U}.scale_factor=1/scale_factor_inv_uv; 496 MergeData.U=int16(scale_factor_inv_uv*MergeData.U); 497 end 498 index_V=find(strcmp(MergeData.ListVarName,'V')); 499 if ~isempty(index_V) 500 MergeData.VarAttribute{index_V}.scale_factor=1/scale_factor_inv_uv; 501 MergeData.V=int16(scale_factor_inv_uv*MergeData.V); 502 end 503 end 504 if ~isempty(scale_factor_inv_dudv) 505 index_var=find(strcmp(MergeData.ListVarName,'curl')); 506 if ~isempty(index_var) 507 MergeData.VarAttribute{index_var}.scale_factor=1/scale_factor_inv_dudv; 508 MergeData.curl=int16(scale_factor_inv_uv*MergeData.curl); 509 end 510 index_var=find(strcmp(MergeData.ListVarName,'div')); 511 if ~isempty(index_var) 512 MergeData.VarAttribute{index_var}.scale_factor=1/scale_factor_inv_dudv; 513 MergeData.div=int16(scale_factor_inv_dudv*MergeData.div); 514 end 515 end 473 516 error=struct2nc(OutputFile,MergeData);%save result file 474 517 if isempty(error) … … 495 538 NbView=length(Data); 496 539 if NbView==1% if there is only one field, just reproduce it in MergeData 497 return 540 return 498 541 end 499 542
Note: See TracChangeset
for help on using the changeset viewer.
