- Timestamp:
- Apr 26, 2012, 8:59:09 AM (13 years ago)
- Location:
- trunk/src
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/calc_field.m
r389 r397 23 23 % file, depending on the scalar 24 24 25 function [DataOut,errormsg]=calc_field(FieldName,DataIn, VelType,XI,YI)25 function [DataOut,errormsg]=calc_field(FieldName,DataIn,Coord_interp) 26 26 27 27 %list of defined scalars to display in menus (in addition to 'ima_cor'). … … 66 66 67 67 %% interpolation with new civ data 68 if isfield(DataIn,'SubRange') &&(strcmp(VelType,'filter1')||strcmp(VelType,'filter2')) 68 if isfield(DataIn,'SubRange') && isfield(DataIn,'Coord_tps')&& exist('Coord_interp','var') 69 DataOut.ListGlobalAttribute=DataIn.ListGlobalAttribute; %reproduce global attribute 70 for ilist=1:numel(DataOut.ListGlobalAttribute) 71 DataOut.(DataOut.ListGlobalAttribute{ilist})=DataIn.(DataIn.ListGlobalAttribute{ilist}); 72 end 73 DataOut.ListVarName={'coord_y','coord_x','FF'}; 74 DataOut.VarDimName{1}='coord_y'; 75 DataOut.VarDimName{2}='coord_x'; 69 76 XMax=max(max(DataIn.SubRange(1,:,:)));% extrema of the coordinates 70 77 YMax=max(max(DataIn.SubRange(2,:,:))); 71 78 XMin=min(min(DataIn.SubRange(1,:,:))); 72 79 YMin=min(min(DataIn.SubRange(2,:,:))); 73 if ~(exist('XI','var')&&exist('YI','var')) 74 Mesh=sqrt((YMax-YMin)*(XMax-XMin)/numel(DataIn.Coord_tps(:,1,:)));%2D 75 xI=XMin:Mesh:XMax; 76 yI=YMin:Mesh:YMax; 77 [XI,YI]=meshgrid(xI,yI);% interpolation grid 78 XI=reshape(XI,[],1); 79 YI=reshape(YI,[],1); 80 end 81 DataOut.ListGlobalAttribute=DataIn.ListGlobalAttribute; %reproduce global attribute 82 for ilist=1:numel(DataOut.ListGlobalAttribute) 83 DataOut.(DataOut.ListGlobalAttribute{ilist})=DataIn.(DataIn.ListGlobalAttribute{ilist}); 84 end 85 DataOut.ListVarName={'coord_y','coord_x','FF'}; 86 DataOut.VarDimName{1}='coord_y'; 87 DataOut.VarDimName{2}='coord_x'; 88 DataOut.coord_y=[yI(1) yI(end)]; 89 DataOut.coord_x=[xI(1) xI(end)]; 90 switch FieldName{1} 91 case {'velocity','u','v'} 92 DataOut.U=zeros(size(XI)); 93 DataOut.V=zeros(size(XI)); 94 case 'vort' 95 DataOut.vort=zeros(size(XI)); 96 case 'div' 97 DataOut.div=zeros(size(XI)); 98 case 'strain' 99 DataOut.strain=zeros(size(XI)); 100 end 101 nbval=zeros(size(XI)); 80 % if ~exist('Coord_interp','var') 81 % Mesh=sqrt((YMax-YMin)*(XMax-XMin)/numel(DataIn.Coord_tps(:,1,:)));%2D 82 % xI=XMin:Mesh:XMax; 83 % yI=YMin:Mesh:YMax; 84 % [XI,YI]=meshgrid(xI,yI);% interpolation grid 85 % Coord_interp(:,1)=reshape(XI,[],1); 86 % Coord_interp(:,2)=reshape(YI,[],1); 87 % DataOut.coord_y=[yI(1) yI(end)]; 88 % DataOut.coord_x=[xI(1) xI(end)]; 89 % end 90 check_der=0; 91 check_val=0; 92 for ilist=1:length(FieldName) 93 switch FieldName{ilist} 94 case 'velocity' 95 check_val=1; 96 DataOut.U=zeros(size(Coord_interp,1)); 97 DataOut.V=zeros(size(Coord_interp,1)); 98 case{'vort','div','strain'}% case of spatial derivatives 99 check_der=1; 100 DataOut.(FieldName{ilist})=zeros(size(Coord_interp,1)); 101 otherwise % case of a scalar 102 check_val=1; 103 DataOut.(FieldName{ilist})=zeros(size(Coord_interp,1)); 104 end 105 end 106 nbval=zeros(size(Coord_interp,1)); 102 107 NbSubDomain=size(DataIn.SubRange,3); 103 108 for isub=1:NbSubDomain … … 107 112 nbvec_sub=numel(find(DataIn.Indices_tps(:,isub))); 108 113 end 109 ind_sel=find( XI>=DataIn.SubRange(1,1,isub) & XI<=DataIn.SubRange(1,2,isub) & YI>=DataIn.SubRange(2,1,isub) & YI<=DataIn.SubRange(2,2,isub));114 ind_sel=find(Coord_interp>=DataIn.SubRange(:,1,isub) & Coord_interp<=DataIn.SubRange(:,2,isub)); 110 115 %rho smoothing parameter 111 epoints = [XI(ind_sel) YI(ind_sel)];% coordinates of interpolation sites112 ctrs=DataIn.Coord_tps(1:nbvec_sub,:,isub);%(=initial points) ctrs116 % epoints = Coord_interp(ind_sel) ;% coordinates of interpolation sites 117 % ctrs=DataIn.Coord_tps(1:nbvec_sub,:,isub);%(=initial points) ctrs 113 118 nbval(ind_sel)=nbval(ind_sel)+1;% records the number of values for eacn interpolation point (in case of subdomain overlap) 119 if check_val 120 EM = tps_eval(Coord_interp(ind_sel),DataIn.Coord_tps(1:nbvec_sub,:,isub));%kernels for calculating the velocity from tps 'sources' 121 end 122 if check_der 123 [EMDX,EMDY] = tps_eval_dxy(Coord_interp(ind_sel),DataIn.Coord_tps(1:nbvec_sub,:,isub));%kernels for calculating the spatial derivatives from tps 'sources' 124 end 125 for ilist=1:length(FieldName) 126 switch FieldName{ilist} 127 case 'velocity' 128 ListFields={'U', 'V'}; 129 VarAttributes{1}.Role='vector_x'; 130 VarAttributes{2}.Role='vector_y'; 131 DataOut.U(ind_sel)=DataOut.U(ind_sel)+EM *DataIn.U_tps(1:nbvec_sub+3,isub); 132 DataOut.V(ind_sel)=DataOut.V(ind_sel)+EM *DataIn.V_tps(1:nbvec_sub+3,isub); 133 case 'u' 134 ListFields={'U'}; 135 VarAttributes{1}.Role='scalar'; 136 DataOut.U(ind_sel)=DataOut.U(ind_sel)+EM *DataIn.U_tps(1:nbvec_sub+3,isub); 137 case 'v' 138 ListFields={'V'}; 139 VarAttributes{1}.Role='scalar'; 140 DataOut.V(ind_sel)=DataOut.V(ind_sel)+EM *DataIn.V_tps(1:nbvec_sub+3,isub); 141 case 'vort' 142 ListFields={'vort'}; 143 VarAttributes{1}.Role='scalar'; 144 DataOut.vort(ind_sel)=DataOut.vort(ind_sel)+EMDY *DataIn.U_tps(1:nbvec_sub+3,isub)-EMDX *DataIn.V_tps(1:nbvec_sub+3,isub); 145 case 'div' 146 ListFields={'div'}; 147 VarAttributes{1}.Role='scalar'; 148 DataOut.div(ind_sel)=DataOut.div(ind_sel)+EMDX*DataIn.U_tps(1:nbvec_sub+3,isub)+EMDY *DataIn.V_tps(1:nbvec_sub+3,isub); 149 case 'strain' 150 ListFields={'strain'}; 151 VarAttributes{1}.Role='scalar'; 152 DataOut.strain(ind_sel)=DataOut.strain(ind_sel)+EMDY*DataIn.U_tps(1:nbvec_sub+3,isub)+EMDX *DataIn.V_tps(1:nbvec_sub+3,isub); 153 end 154 end 155 DataOut.FF=nbval==0; %put errorflag to 1 for points outside the interpolation rang 156 DataOut.FF=reshape(DataOut.FF,numel(yI),numel(xI)); 157 nbval(nbval==0)=1; 114 158 switch FieldName{1} 115 159 case {'velocity','u','v'} 116 EM = tps_eval(epoints,ctrs);%kernels for calculating the velocity from tps 'sources' 117 case{'vort','div','strain'} 118 [EMDX,EMDY] = tps_eval_dxy(epoints,ctrs);%kernels for calculating the spatial derivatives from tps 'sources' 119 end 120 switch FieldName{1} 121 case 'velocity' 122 ListFields={'U', 'V'}; 123 VarAttributes{1}.Role='vector_x'; 124 VarAttributes{2}.Role='vector_y'; 125 DataOut.U(ind_sel)=DataOut.U(ind_sel)+EM *DataIn.U_tps(1:nbvec_sub+3,isub); 126 DataOut.V(ind_sel)=DataOut.V(ind_sel)+EM *DataIn.V_tps(1:nbvec_sub+3,isub); 127 case 'u' 128 ListFields={'U'}; 129 VarAttributes{1}.Role='scalar'; 130 DataOut.U(ind_sel)=DataOut.U(ind_sel)+EM *DataIn.U_tps(1:nbvec_sub+3,isub); 131 case 'v' 132 ListFields={'V'}; 133 VarAttributes{1}.Role='scalar'; 134 DataOut.V(ind_sel)=DataOut.V(ind_sel)+EM *DataIn.V_tps(1:nbvec_sub+3,isub); 160 DataOut.U=reshape(DataOut.U./nbval,numel(yI),numel(xI)); 161 DataOut.V=reshape(DataOut.V./nbval,numel(yI),numel(xI)); 135 162 case 'vort' 136 ListFields={'vort'}; 137 VarAttributes{1}.Role='scalar'; 138 DataOut.vort(ind_sel)=DataOut.vort(ind_sel)+EMDY *DataIn.U_tps(1:nbvec_sub+3,isub)-EMDX *DataIn.V_tps(1:nbvec_sub+3,isub); 163 DataOut.vort=reshape(DataOut.vort,numel(yI),numel(xI)); 139 164 case 'div' 140 ListFields={'div'}; 141 VarAttributes{1}.Role='scalar'; 142 DataOut.div(ind_sel)=DataOut.div(ind_sel)+EMDX*DataIn.U_tps(1:nbvec_sub+3,isub)+EMDY *DataIn.V_tps(1:nbvec_sub+3,isub); 165 DataOut.div=reshape(DataOut.div,numel(yI),numel(xI)); 143 166 case 'strain' 144 ListFields={'strain'}; 145 VarAttributes{1}.Role='scalar'; 146 DataOut.strain(ind_sel)=DataOut.strain(ind_sel)+EMDY*DataIn.U_tps(1:nbvec_sub+3,isub)+EMDX *DataIn.V_tps(1:nbvec_sub+3,isub); 147 end 148 end 149 DataOut.FF=nbval==0; %put errorflag to 1 for points outside the interpolation rang 150 DataOut.FF=reshape(DataOut.FF,numel(yI),numel(xI)); 151 nbval(nbval==0)=1; 152 switch FieldName{1} 153 case {'velocity','u','v'} 154 DataOut.U=reshape(DataOut.U./nbval,numel(yI),numel(xI)); 155 DataOut.V=reshape(DataOut.V./nbval,numel(yI),numel(xI)); 156 case 'vort' 157 DataOut.vort=reshape(DataOut.vort,numel(yI),numel(xI)); 158 case 'div' 159 DataOut.div=reshape(DataOut.div,numel(yI),numel(xI)); 160 case 'strain' 161 DataOut.strain=reshape(DataOut.strain,numel(yI),numel(xI)); 162 end 163 DataOut.ListVarName=[DataOut.ListVarName ListFields]; 164 for ilist=3:numel(DataOut.ListVarName) 165 DataOut.VarDimName{ilist}={'coord_y','coord_x'}; 166 end 167 DataOut.VarAttribute={[],[]}; 168 DataOut.VarAttribute{3}.Role='errorflag'; 169 DataOut.VarAttribute=[DataOut.VarAttribute VarAttributes]; 167 DataOut.strain=reshape(DataOut.strain,numel(yI),numel(xI)); 168 end 169 DataOut.ListVarName=[DataOut.ListVarName ListFields]; 170 for ilist=3:numel(DataOut.ListVarName) 171 DataOut.VarDimName{ilist}={'coord_y','coord_x'}; 172 end 173 DataOut.VarAttribute={[],[]}; 174 DataOut.VarAttribute{3}.Role='errorflag'; 175 DataOut.VarAttribute=[DataOut.VarAttribute VarAttributes]; 176 end 170 177 else 171 178 … … 200 207 DataOut.VarAttribute{nbcoord+ivar}.Role=RoleList{ivar}; 201 208 DataOut.VarAttribute{nbcoord+ivar}.units=units_cell{ivar}; 202 eval(['DataOut.' ListVarName{ivar} '=ValueList{ivar};'])209 DataOut.(ListVarName{ivar})=ValueList{ivar}; 203 210 end 204 211 end -
trunk/src/civ.m
r389 r397 520 520 dt=0.04;%default 521 521 if exist([RootName ext_imadoc],'file')==2 522 info=aviinfo([RootName ext_imadoc]);%read infos on the avi movie 523 dt=1/info.FramesPerSecond;%time interval between successive frames 524 MaxIndex_i=info.NumFrames;%number of frames 525 end 526 time=(dt*(0:MaxIndex_i-1))';%list of image times 527 TimeUnit='s'; 528 end 529 set(handles.ImaDoc,'BackgroundColor',[1 1 1])% set display box back to whiter 530 end 531 522 hhh=which('videoreader'); 523 if isempty(hhh)%use old video function of matlab 524 imainfo=aviinfo([RootName ext_imadoc]);%read infos on the avi movie 525 dt=1/imainfo.FramesPerSecond;%time interval between successive frames 526 MaxIndex_i=imainfo.NumFrames;%number of frames 527 % XmlData.Time=(0:1/imainfo.FramesPerSecond:(imainfo.NumFrames-1)/imainfo.FramesPerSecond)'; 528 % nbfield=imainfo.NumFrames; 529 % set(handles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FramesPerSecond) 'ms']);%display the elementary time interval in millisec 530 % ColorType=imainfo.ImageType;%='truecolor' for color images 531 else %use video function videoreader of matlab 532 imainfo=get(videoreader([RootName ext_imadoc]));%read infos on the avi movie 533 dt=1/imainfo.FrameRate;%time interval between successive frames 534 MaxIndex_i=imainfo.NumberOfFrames;%number of frames 535 % XmlData.Time=(0:1/imainfo.FrameRate:(imainfo.NumberOfFrames-1)/imainfo.FrameRate)'; 536 % nbfield=imainfo.NumberOfFrames; 537 % set(handles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FrameRate) 'ms']);%display the elementary time interval in millisec 538 % ColorType='truecolor'; 539 end 540 541 time=(dt*(0:MaxIndex_i-1))';%list of image times 542 TimeUnit='s'; 543 end 544 set(handles.ImaDoc,'BackgroundColor',[1 1 1])% set display box back to whiter 545 end 546 end 532 547 %% timing display 533 548 %show the reference image edit box if relevant (not needed for movies or in the absence of time information … … 1223 1238 Param.Civ1.Time=((time(i2_civ1(ifile)+1,j2_civ1(j)+1)+time(i1_civ1(ifile)+1,j1_civ1(j)+1))/2); 1224 1239 Param.Civ1.term_a=num2stra(j1_civ1(j),nom_type_nc);%UTILITE? 1225 Param.Civ1.term_b=num2stra(j2_civ1(j),nom_type_nc);% 1226 ImageInfo=imfinfo(filecell.ima1.civ1{1,1});%read the first image to get the size 1240 Param.Civ1.term_b=num2stra(j2_civ1(j),nom_type_nc);% 1241 form=imformats(regexprep(get(handles.ImaExt,'String'),'^.',''));%look for image formats 1242 if isempty(form) 1243 ImageInfo=get(VideoReader(filecell.ima1.civ1{1,1})); 1244 Param.Civ1.ImageBitDepth=ImageInfo.BitsPerPixel/3; 1245 else 1246 ImageInfo=imfinfo(filecell.ima1.civ1{1,1});%read the first image to get the size 1247 Param.Civ1.ImageBitDepth=ImageInfo.BitDepth; 1248 end 1227 1249 Param.Civ1.ImageWidth=ImageInfo.Width; 1228 1250 Param.Civ1.ImageHeight=ImageInfo.Height; 1229 Param.Civ1.ImageBitDepth=ImageInfo.BitDepth;1230 1251 Param.Civ1.i1=i1_civ1; 1231 1252 Param.Civ1.i2=i2_civ1; … … 1394 1415 end 1395 1416 end 1396 ImageInfo=imfinfo(filecell.ima1.civ2{1,1});%read the first image to get the size 1417 form=imformats(regexprep(get(handles.ImaExt,'String'),'^.',''));%look for image formats 1418 if isempty(form) 1419 ImageInfo=get(VideoReader(filecell.ima1.civ2{1,1})); 1420 Param.Civ2.ImageBitDepth=ImageInfo.BitsPerPixel/3; 1421 else 1422 ImageInfo=imfinfo(filecell.ima1.civ2{1,1});%read the first image to get the size 1423 Param.Civ2.ImageBitDepth=ImageInfo.BitDepth; 1424 end 1397 1425 Param.Civ2.ImageWidth=ImageInfo.Width; 1398 1426 Param.Civ2.ImageHeight=ImageInfo.Height; 1399 Param.Civ2.ImageBitDepth=ImageInfo.BitDepth;1400 1427 Param.Civ2.i1=i1_civ2; 1401 1428 Param.Civ2.i2=i2_civ2; 1402 % TODO: case of movie1403 1429 switch CivMode 1404 1430 case 'CivX' … … 3928 3954 par_civ1.ImageHeight=size(Data.A,1); 3929 3955 par_civ1.Mask='all';% will provide only the grid set for PIV, no image correlation 3930 par_civ1.i1= i1_civ1;3931 par_civ1.i2= i2_civ1;3956 par_civ1.i1=1;%i1_civ1; 3957 par_civ1.i2=2;%i2_civ1; 3932 3958 Param.Civ1=par_civ1; 3933 3959 Grid=civ_matlab(Param);% get the grid of x, y positions set for PIV -
trunk/src/civ_matlab.m
r389 r397 72 72 end 73 73 else 74 if isfield(par_civ1,'ImageA') && ischar(par_civ1.ImageA) % case with no image: only the PIV grid is calculated74 if isfield(par_civ1,'ImageA')&&(ischar(par_civ1.ImageA)||strcmp(class(par_civ1.ImageA),'VideoReader')) % case with no image: only the PIV grid is calculated 75 75 [Field,ParamOut,errormsg] = read_field(par_civ1.ImageA,par_civ1.FileTypeA,[],par_civ1.i1); 76 76 par_civ1.ImageA=Field.A;%imread(par_civ1.ImageA);%[Field,ParamOut,errormsg] = read_field(ObjectName,FileType,ParamIn,num) 77 77 end 78 if isfield(par_civ1,'ImageB')&& ischar(par_civ1.ImageB)78 if isfield(par_civ1,'ImageB')&& (ischar(par_civ1.ImageB)||strcmp(class(par_civ1.ImageA),'VideoReader')) 79 79 [Field,ParamOut,errormsg] = read_field(par_civ1.ImageB,par_civ1.FileTypeB,[],par_civ1.i2); 80 80 par_civ1.ImageB=Field.A;%=imread(par_civ1.ImageB); … … 177 177 Data.Patch1_Threshold=Param.Patch1.MaxDiff; 178 178 Data.Patch1_SubDomain=Param.Patch1.SubdomainSize; 179 nbvar=length(Data.ListVarName); 179 180 Data.ListVarName=[Data.ListVarName {'Civ1_U_smooth','Civ1_V_smooth','Civ1_SubRange','Civ1_NbSites','Civ1_Coord_tps','Civ1_U_tps','Civ1_V_tps'}]; 180 181 Data.VarDimName=[Data.VarDimName {'NbVec1','NbVec1',{'NbCoord','Two','NbSubDomain1'},{'NbSubDomain1'},... 181 182 {'NbVec1Sub','NbCoord','NbSubDomain1'},{'Nbtps1','NbSubDomain1'},{'Nbtps1','NbSubDomain1'}}]; 182 nbvar=length(Data.ListVarName); 183 Data.VarAttribute{nbvar-1}.Role='vector_x'; 184 Data.VarAttribute{nbvar}.Role='vector_y'; 183 Data.VarAttribute{nbvar+1}.Role='vector_x'; 184 Data.VarAttribute{nbvar+2}.Role='vector_y'; 185 Data.VarAttribute{nbvar+5}.Role='coord_tps'; 186 Data.VarAttribute{nbvar+6}.Role='vector_x_tps'; 187 Data.VarAttribute{nbvar+7}.Role='vector_y_tps'; 185 188 Data.Civ1_U_smooth=zeros(size(Data.Civ1_X)); 186 189 Data.Civ1_V_smooth=zeros(size(Data.Civ1_X)); … … 204 207 par_civ2=Param.Civ2; 205 208 if ~isfield (Param,'Civ1') || ~strcmp(Param.Civ1.ImageA,par_civ2.ImageA) 206 par_civ2.ImageA=imread(Param.Civ2.ImageA);%read first image if not already done for civ1 209 %read first image if not already done for civ1 210 [Field,ParamOut,errormsg] = read_field(par_civ2.ImageA,par_civ2.FileTypeA,[],par_civ2.i1); 211 par_civ2.ImageA=Field.A; 212 % par_civ2.ImageA=imread(Param.Civ2.ImageA); 207 213 else 208 214 par_civ2.ImageA=par_civ1.ImageA; 209 215 end 210 216 if ~isfield (Param,'Civ1') || ~strcmp(Param.Civ1.ImageB,par_civ2.ImageB) 211 par_civ2.ImageB=imread(Param.Civ2.ImageB);%read second image if not already done for civ1 212 else 217 %read first image if not already done for civ1 218 [Field,ParamOut,errormsg] = read_field(par_civ2.ImageB,par_civ2.FileTypeB,[],par_civ2.i2); 219 par_civ2.ImageB=Field.A; 220 % par_civ2.ImageB=imread(Param.Civ2.ImageB); 221 else 213 222 par_civ2.ImageB=par_civ1.ImageB; 214 223 end … … 330 339 else 331 340 Data.ListVarName=[Data.ListVarName {'Civ2_FF'}]; 332 Data.VarDimName=[Data.VarDimName {' nbvec2'}];341 Data.VarDimName=[Data.VarDimName {'NbVec2'}]; 333 342 nbvar=length(Data.ListVarName); 334 343 Data.VarAttribute{nbvar}.Role='errorflag'; … … 345 354 Data.Patch2_Threshold=Param.Patch2.MaxDiff; 346 355 Data.Patch2_SubDomain=Param.Patch2.SubdomainSize; 347 Data.ListVarName=[Data.ListVarName {'Civ2_U_Diff','Civ2_V_Diff','Civ2_SubRange','Civ2_NbSites','Civ2_Coord_tps','Civ2_U_tps','Civ2_V_tps'}]; 356 nbvar=length(Data.ListVarName); 357 Data.ListVarName=[Data.ListVarName {'Civ2_U_smooth','Civ2_V_smooth','Civ2_SubRange','Civ2_NbSites','Civ2_Coord_tps','Civ2_U_tps','Civ2_V_tps'}]; 348 358 Data.VarDimName=[Data.VarDimName {'NbVec2','NbVec2',{'NbCoord','Two','NbSubDomain2'},{'NbSubDomain2'},... 349 359 {'NbVec2Sub','NbCoord','NbSubDomain2'},{'Nbtps2','NbSubDomain2'},{'Nbtps2','NbSubDomain2'}}]; … … 351 361 % Data.VarDimName=[Data.VarDimName {'NbVec2','NbVec2',{'NbSubDomain2','Two'},{'NbSubDomain2','Two'},... 352 362 % {'NbVec2Sub','NbSubDomain2'},{'NbVec2Sub','NbSubDomain2'},{'Nbtps2','NbSubDomain2'},{'Nbtps2','NbSubDomain2'},{'NbVec2Sub','NbSubDomain2'}}]; 353 nbvar=length(Data.ListVarName); 354 Data.VarAttribute{nbvar-1}.Role='vector_x'; 355 Data.VarAttribute{nbvar}.Role='vector_y'; 356 Data.Civ2_U_Diff=zeros(size(Data.Civ2_X)); 357 Data.Civ2_V_Diff=zeros(size(Data.Civ2_X)); 363 364 Data.VarAttribute{nbvar+1}.Role='vector_x'; 365 Data.VarAttribute{nbvar+2}.Role='vector_y'; 366 Data.VarAttribute{nbvar+5}.Role='coord_tps'; 367 Data.VarAttribute{nbvar+6}.Role='vector_x_tps'; 368 Data.VarAttribute{nbvar+7}.Role='vector_y_tps'; 369 Data.Civ2_U_smooth=zeros(size(Data.Civ2_X)); 370 Data.Civ2_V_smooth=zeros(size(Data.Civ2_X)); 358 371 if isfield(Data,'Civ2_FF') 359 372 ind_good=find(Data.Civ2_FF==0); … … 363 376 [Data.Civ2_SubRange,Data.Civ2_NbSites,Data.Civ2_Coord_tps,Data.Civ2_U_tps,Data.Civ2_V_tps,tild,Ures, Vres,tild,FFres]=... 364 377 filter_tps([Data.Civ2_X(ind_good) Data.Civ2_Y(ind_good)],Data.Civ2_U(ind_good),Data.Civ2_V(ind_good),[],Data.Patch2_SubDomain,Data.Patch2_Rho,Data.Patch2_Threshold); 365 Data.Civ2_U_Diff(ind_good)=Data.Civ2_U(ind_good)-Ures;366 Data.Civ2_V_Diff(ind_good)=Data.Civ2_V(ind_good)-Vres;367 368 378 Data.Civ2_U_smooth(ind_good)=Ures; 379 Data.Civ2_V_smooth(ind_good)=Vres; 380 Data.Civ2_FF(ind_good)=FFres; 381 Data.CivStage=Data.CivStage+1; 369 382 end 370 383 -
trunk/src/find_field_indices.m
r236 r397 102 102 % find the spatial dimensions and vector components 103 103 ListRole={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','warnflag','errorflag',... 104 'ancillary','image','color','discrete','scalar' };104 'ancillary','image','color','discrete','scalar','coord_tps'}; 105 105 for icell=1:length(CellVarIndex) 106 106 for ilist=1:numel(ListRole) -
trunk/src/find_file_series.m
r395 r397 55 55 if strcmp( FileType,'multimage')||strcmp( FileType,'video') 56 56 NomType='*'; 57 i1_series=(1:FileInfo.N bFrame)';57 i1_series=(1:FileInfo.NumberOfFrames)'; 58 58 end 59 59 60 60 if strcmp(NomType,'')||strcmp(NomType,'*')||strcmp(option,'filetype') 61 61 if exist(fullfileinput,'file') 62 RootFile=fileinput;% case of constant name (no indexing)63 %[tild,RootFile]=fileparts(fileinput);% case of constant name (no indexing)62 % RootFile=fileinput;% case of constant name (no indexing) 63 [tild,RootFile]=fileparts(fileinput);% case of constant name (no indexing) 64 64 else 65 65 RootFile=''; -
trunk/src/get_file_type.m
r387 r397 10 10 % INPUT: 11 11 % fileinput: name, including path, of the file to analyse 12 function [FileType,FileInfo, Object]=get_file_type(fileinput)12 function [FileType,FileInfo,VideoObject]=get_file_type(fileinput) 13 13 FileType=''; 14 14 FileInfo=[]; 15 Object=[];15 VideoObject=[]; 16 16 [tild,tild,FileExt]=fileparts(fileinput); 17 17 … … 70 70 if error_nc 71 71 try 72 if exist('VideoReader','file')%recent version of Matlab 73 Object=VideoReader(fileinput); 74 else 75 Object=mmreader(fileinput);%older Matlab function for movies 76 end 77 FileType='video'; 78 FileInfo.NbFrame=get(Object,'NumberOfFrames'); 72 if exist('VideoReader.m','file')%recent version of Matlab 73 VideoObject=VideoReader(fileinput); 74 FileInfo.NumberOfFrames=get(VideoObject,'NumberOfFrames'); 75 FileType='video'; 76 end 79 77 end 80 78 end -
trunk/src/plot_field.m
r389 r397 286 286 if length(FieldData.VarAttribute)>=VarIndex(ivar) 287 287 VarAttribute=FieldData.VarAttribute{VarIndex(ivar)}; 288 if isfield(VarAttribute,'Role')&&strcmp(VarAttribute.Role,'ancillary') 288 if isfield(VarAttribute,'Role')&&(strcmp(VarAttribute.Role,'ancillary')||strcmp(VarAttribute.Role,'coord_tps')... 289 ||strcmp(VarAttribute.Role,'vector_x_tps')||strcmp(VarAttribute.Role,'vector_y_tps')) 289 290 checkancillary=1; 290 291 end … … 296 297 VarValue=VarValue'; 297 298 end 299 if size(VarValue,1)==1 298 300 txt=[VarName '=' num2str(VarValue)]; 299 301 txt_cell=[txt_cell;{txt}]; 302 end 300 303 end 301 304 end -
trunk/src/plot_object.m
r379 r397 168 168 yline=[yline; ObjectData.Coord(1,2)]; 169 169 elseif isequal(ObjectData.Type,'plane')|| isequal(ObjectData.Type,'volume') 170 phi=ObjectData. Phi*pi/180;%angle in radians170 phi=ObjectData.Angle(3)*pi/180;%angle in radians 171 171 Xend_x=xline(1)+XMax*cos(phi); 172 172 Xend_y=yline(1)+XMax*sin(phi); -
trunk/src/proj_field.m
r388 r397 1 1 %'proj_field': projects the field on a projection object 2 2 %-------------------------------------------------------------------------- 3 % function [ProjData,errormsg]=proj_field(FieldData,ObjectData )3 % function [ProjData,errormsg]=proj_field(FieldData,ObjectData,FieldName) 4 4 % 5 5 % OUTPUT: … … 20 20 % .ProjMode=mode of projection ; 21 21 % .CoordUnit: 'px', 'cm' units for the coordinates defining the object 22 % . Phi angle of rotation (=0by default)22 % .Angle ( angles of rotation (=[0 0 0] by default) 23 23 % .ProjAngle=angle of projection; 24 24 % .DX,.DY,.DZ=increments along each coordinate … … 82 82 function [ProjData,errormsg]=proj_field(FieldData,ObjectData,FieldName) 83 83 errormsg='';%default 84 if ~exist('FieldName','var') 85 FieldName=''; 86 end 84 87 %% case of no projection (object is used only as graph display) 85 88 if isfield(ObjectData,'ProjMode') && (isequal(ObjectData.ProjMode,'none')||isequal(ObjectData.ProjMode,'mask_inside')||isequal(ObjectData.ProjMode,'mask_outside')) 89 if ~isempty(FieldName) 90 [ProjData,errormsg]=calc_field(FieldName,FieldData); 91 else 86 92 ProjData=[]; 93 end 87 94 return 88 95 end … … 123 130 %%%%%%%%%% 124 131 125 %% apply projection depending on the object style132 %% apply projection depending on the object type 126 133 switch ObjectData.Type 127 134 case 'points' … … 136 143 end 137 144 case 'plane' 138 [ProjData,errormsg] = proj_plane(FieldData,ObjectData );145 [ProjData,errormsg] = proj_plane(FieldData,ObjectData,FieldName); 139 146 case 'volume' 140 147 [ProjData,errormsg] = proj_volume(FieldData,ObjectData); … … 892 899 if isfield(ObjectData,'ProjMode'),ProjMode=ObjectData.ProjMode; end; 893 900 894 % axis origin901 %% axis origin 895 902 if isempty(ObjectData.Coord) 896 903 ObjectData.Coord(1,1)=0;%origin of the plane set to [0 0] by default … … 899 906 end 900 907 901 % rotation angles908 %% rotation angles 902 909 PlaneAngle=[0 0 0]; 903 910 norm_plane=[0 0 1]; … … 921 928 testangle=~isequal(PlaneAngle,[0 0 0]);% && ~test90y && ~test90x;%=1 for slanted plane 922 929 923 % mesh sizes DX and DY930 %% mesh sizes DX and DY 924 931 DX=0; 925 932 DY=0; %default … … 936 943 end 937 944 938 % extrema along each axis945 %% extrema along each axis 939 946 testXMin=0; 940 947 testXMax=0; … … 958 965 end 959 966 960 % initiate Matlab structure for physical field967 %% initiate Matlab structure for physical field 961 968 [ProjData,errormsg]=proj_heading(FieldData,ObjectData); 962 969 ProjData.NbDim=2; … … 968 975 ProjData.Mesh=FieldData.Mesh; 969 976 end 970 971 977 error=0;%default 972 978 flux=0; … … 1017 1023 1018 1024 %% case of input fields with unstructured coordinates 1025 coord_z=0;%default 1019 1026 if testX 1020 1027 XName=FieldData.ListVarName{ivar_X}; 1021 1028 YName=FieldData.ListVarName{ivar_Y}; 1022 eval(['coord_x=FieldData.' XName ';'])1023 eval(['coord_y=FieldData.' YName ';'])1029 coord_x=FieldData.(XName); 1030 coord_y=FieldData.(YName); 1024 1031 if length(ivar_Z)==1 1025 1032 ZName=FieldData.ListVarName{ivar_Z}; 1026 eval(['coord_z=FieldData.' ZName ';'])1033 coord_z=FieldData.(ZName); 1027 1034 end 1028 1035 … … 1051 1058 1052 1059 %rotate coordinates if needed: 1060 Psi=PlaneAngle(1); 1061 Theta=PlaneAngle(2); 1062 Phi=PlaneAngle(3); 1053 1063 if testangle && ~test90y && ~test90x;%=1 for slanted plane 1054 % coord_X=coord_x;1055 % coord_Y=coord_y;1056 % if ~isequal(Theta,0)1057 % coord_Y=coord_Y *cos(Theta);1058 % end1059 % else1060 1064 coord_X=(coord_x *cos(Phi) + coord_y* sin(Phi)); 1061 1065 coord_Y=(-coord_x *sin(Phi) + coord_y *cos(Phi))*cos(Theta); 1062 % end1063 % if ~isempty(ivar_Z)1064 1066 coord_Y=coord_Y+coord_z *sin(Theta); 1065 % end1066 % if testangle1067 1067 coord_X=(coord_X *cos(Psi) - coord_Y* sin(Psi));%A VERIFIER 1068 1068 1069 coord_Y=(coord_X *sin(Psi) + coord_Y* cos(Psi)); 1069 1070 else … … 1163 1164 FF=zeros(1,length(coord_y_proj)*length(coord_x_proj)); 1164 1165 testFF=0; 1166 FieldName 1165 1167 if ~isempty(FieldName) 1166 FieldData=calc_field(FieldName,FieldData,XI,YI); 1167 end 1168 for ivar=VarIndex 1169 VarName=FieldData.ListVarName{ivar}; 1170 if ~( ivar==ivar_X || ivar==ivar_Y || ivar==ivar_Z || ivar==ivar_F || ivar==ivar_FF || test_anc(ivar)==1) 1171 ivar_new=ivar_new+1; 1172 ProjData.ListVarName=[ProjData.ListVarName {VarName}]; 1168 ProjData=calc_field(FieldName,FieldData,[XI YI]); 1169 else 1170 for ivar=VarIndex 1171 VarName=FieldData.ListVarName{ivar}; 1172 if ~( ivar==ivar_X || ivar==ivar_Y || ivar==ivar_Z || ivar==ivar_F || ivar==ivar_FF || test_anc(ivar)==1) 1173 ivar_new=ivar_new+1; 1174 ProjData.ListVarName=[ProjData.ListVarName {VarName}]; 1175 ProjData.VarDimName=[ProjData.VarDimName {DimCell}]; 1176 if isfield(FieldData,'VarAttribute') && length(FieldData.VarAttribute) >=ivar 1177 ProjData.VarAttribute{ivar_new+nbcoord}=FieldData.VarAttribute{ivar}; 1178 end 1179 if ~isequal(ivar_FF,0) 1180 FieldData.(VarName)=FieldData.(VarName)(indsel); 1181 end 1182 % if isfield(FieldData,[VarName '_tps']) 1183 % [XI,YI]=meshgrid(coord_x_proj,coord_y_proj'); 1184 % XI=reshape(XI,[],1); 1185 % YI=reshape(YI,[],1); 1186 % 1187 ProjData.(VarName)=griddata_uvmat(double(coord_X),double(coord_Y),double(FieldData.(VarName)),coord_x_proj,coord_y_proj',rho); 1188 varline=reshape(ProjData.(VarName),1,length(coord_y_proj)*length(coord_x_proj)); 1189 FFlag= isnan(varline); %detect undefined values NaN 1190 indnan=find(FFlag); 1191 if~isempty(indnan) 1192 varline(indnan)=zeros(size(indnan)); 1193 ProjData.(VarName)=reshape(varline,length(coord_y_proj),length(coord_x_proj)); 1194 FF(indnan)=ones(size(indnan)); 1195 testFF=1; 1196 end 1197 if ivar==ivar_U 1198 ivar_U=ivar_new; 1199 end 1200 if ivar==ivar_V 1201 ivar_V=ivar_new; 1202 end 1203 if ivar==ivar_W 1204 ivar_W=ivar_new; 1205 end 1206 end 1207 end 1208 if testFF 1209 ProjData.FF=reshape(FF,length(coord_y_proj),length(coord_x_proj)); 1210 ProjData.ListVarName=[ProjData.ListVarName {'FF'}]; 1173 1211 ProjData.VarDimName=[ProjData.VarDimName {DimCell}]; 1174 if isfield(FieldData,'VarAttribute') && length(FieldData.VarAttribute) >=ivar 1175 ProjData.VarAttribute{ivar_new+nbcoord}=FieldData.VarAttribute{ivar}; 1176 end 1177 if ~isequal(ivar_FF,0) 1178 FieldData.(VarName)=FieldData.(VarName)(indsel); 1179 end 1180 % if isfield(FieldData,[VarName '_tps']) 1181 % [XI,YI]=meshgrid(coord_x_proj,coord_y_proj'); 1182 % XI=reshape(XI,[],1); 1183 % YI=reshape(YI,[],1); 1184 % 1185 if ~isempty(FieldName) 1186 ProjData.(VarName)=griddata_uvmat(double(coord_X),double(coord_Y),double(FieldData.(VarName)),coord_x_proj,coord_y_proj',rho); 1187 end 1188 varline=reshape(ProjData.(VarName),1,length(coord_y_proj)*length(coord_x_proj)); 1189 FFlag= isnan(varline); %detect undefined values NaN 1190 indnan=find(FFlag); 1191 if~isempty(indnan) 1192 varline(indnan)=zeros(size(indnan)); 1193 ProjData.(VarName)=reshape(varline,length(coord_y_proj),length(coord_x_proj)); 1194 FF(indnan)=ones(size(indnan)); 1195 testFF=1; 1196 end 1197 if ivar==ivar_U 1198 ivar_U=ivar_new; 1199 end 1200 if ivar==ivar_V 1201 ivar_V=ivar_new; 1202 end 1203 if ivar==ivar_W 1204 ivar_W=ivar_new; 1205 end 1206 end 1207 end 1208 if testFF 1209 ProjData.FF=reshape(FF,length(coord_y_proj),length(coord_x_proj)); 1210 ProjData.ListVarName=[ProjData.ListVarName {'FF'}]; 1211 ProjData.VarDimName=[ProjData.VarDimName {DimCell}]; 1212 ProjData.VarAttribute{ivar_new+1+nbcoord}.Role='errorflag'; 1212 ProjData.VarAttribute{ivar_new+1+nbcoord}.Role='errorflag'; 1213 end 1213 1214 end 1214 1215 end -
trunk/src/read_civdata.m
r389 r397 153 153 'Civ1_X','Civ1_Y','Civ1_Z','Civ1_U','Civ1_V','Civ1_W','Civ1_C','Civ1_F','Civ1_FF',... 154 154 'Civ1_Coord_tps','Civ1_U_tps','Civ1_V_tps','Civ1_W_tps','Civ1_SubRange','Civ1_NbSites'}; 155 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag',' ancillary','ancillary',...156 ' ancillary','ancillary','ancillary','ancillary'};155 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag','coord_tps','vector_x_tps',... 156 'vector_y_tps','vector_z_tps','ancillary','ancillary'}; 157 157 units={'pixel','pixel','pixel','pixel','pixel','pixel','','','','pixel','pixel','pixel','pixel','pixel',''}; 158 158 case 'filter1' … … 160 160 'Civ1_X','Civ1_Y','Civ1_Z','Civ1_U_smooth','Civ1_V_smooth','Civ1_W','Civ1_C','Civ1_F','Civ1_FF',... 161 161 'Civ1_Coord_tps','Civ1_U_tps','Civ1_V_tps','Civ1_W_tps','Civ1_SubRange','Civ1_NbSites'}; 162 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag',' ancillary','ancillary',...163 ' ancillary','ancillary','ancillary','ancillary'};162 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag','coord_tps','vector_x_tps',... 163 'vector_y_tps','vector_z_tps','ancillary','ancillary'}; 164 164 units={'pixel','pixel','pixel','pixel','pixel','pixel','','','','pixel','pixel','pixel','pixel','pixel',''}; 165 165 case 'civ2' … … 167 167 'Civ2_X','Civ2_Y','Civ2_Z','Civ2_U','Civ2_V','Civ2_W','Civ2_C','Civ2_F','Civ2_FF',... 168 168 'Civ2_Coord_tps','Civ2_U_tps','Civ2_V_tps','','Civ2_SubRange','Civ2_NbSites'}; 169 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag','','','','','','','',''}; 169 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag','coord_tps','vector_x_tps',... 170 'vector_y_tps','vector_z_tps','ancillary','ancillary'}; 170 171 units={'pixel','pixel','pixel','pixel','pixel','pixel','','','','pixel','pixel','pixel','pixel','pixel',''}; 171 172 case 'filter2' … … 173 174 'Civ2_X','Civ2_Y','Civ2_Z','Civ2_U_smooth','Civ2_V_smooth','Civ2_W','Civ2_C','Civ2_F','Civ2_FF',... 174 175 'Civ2_Coord_tps','Civ2_U_tps','Civ2_V_tps','','Civ2_SubRange','Civ2_NbSites'}; 175 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag','','','','','','','',''}; 176 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag','coord_tps','vector_x_tps',... 177 'vector_y_tps','vector_z_tps','ancillary','ancillary'}; 176 178 units={'pixel','pixel','pixel','pixel','pixel','pixel','','','','pixel','pixel','pixel','pixel','pixel',''}; 177 179 end -
trunk/src/read_field.m
r380 r397 155 155 end 156 156 FieldName='image'; 157 % case 'avi'158 % try159 % mov=aviread(ObjectName,num);160 % catch ME161 % errormsg=ME.message;162 % return163 % end164 % A=frame2im(mov(1));165 % FieldName='image';166 157 case 'vol' 167 158 A=imread(ObjectName); … … 183 174 Npz=1;%default 184 175 npxy=size(A); 185 Rangx=[0.5 npxy(2)-0.5]; % coordinates of the first and last pixel centers186 Rangy=[npxy(1)-0.5 0.5]; %176 % Rangx=[0.5 npxy(2)-0.5]; % coordinates of the first and last pixel centers 177 % Rangy=[npxy(1)-0.5 0.5]; % 187 178 Field.NbDim=2;%default 188 179 Field.AName='image'; -
trunk/src/set_object.m
r388 r397 397 397 ObjectData=read_GUI(handles.set_object);%read the parameters defining the object in the GUI set_object 398 398 ObjectName=ObjectData.Name;%name of the current object defined in set_object 399 if iscell(ObjectData.Coord)%check for empty line 400 ObjectData.Coord=[0 0 0]; 401 hhset_object=guidata(handles.set_object); 402 set(hhset_object.Coord,'Data',ObjectData.Coord) 403 end 399 404 checknan=isnan(sum(ObjectData.Coord,2));%check for NaN lines 400 405 if ~isempty(checknan) … … 403 408 if isempty(ObjectName) 404 409 if get(hhuvmat.edit_object,'Value')% edit mode 410 if isempty(ListObject) 411 ObjectName='Plane'; 412 else 405 413 ObjectName=ListObject{IndexObj(end)};%take the name of the last (second) selected item 414 end 406 415 else %new object 407 416 StyleList=get(handles.Type,'String'); -
trunk/src/update_imadoc.m
r200 r397 47 47 % in case of movie (avi file), copy timing info in the new xml file 48 48 [pp,outputroot]=fileparts(outputfile); 49 i nfo=[];49 imainfo=[]; 50 50 if exist(fullfile(pp,[outputroot '.avi']),'file') 51 info=aviinfo(fullfile(pp,[outputroot '.avi'])); 52 elseif exist(fullfile(pp,[outputroot '.AVI']),'file') 53 info=fullfile(pp,[outputroot '.AVI']); 54 end 55 if ~isempty(info) 56 [t,uid_camera]=add(t,1,'element','Camera'); 57 Camera.TimeUnit='s'; 58 Camera.BurstTiming.Time=0; 59 Camera.BurstTiming.Dti=1/info.FramesPerSecond; 60 Camera.BurstTiming.NbDti=info.NumFrames-1; 61 t=struct2xml(Camera,t,uid_camera); 51 FileName=fullfile(pp,[outputroot '.avi']); 52 hhh=which('videoreader'); 53 if isempty(hhh)%use old video function of matlab 54 imainfo=aviinfo(FileName); 55 imainfo.FrameRate=imainfo.FramesPerSecond; 56 imainfo.NumberOfFrames=imainfo.NumFrames; 57 else %use video function videoreader of matlab 58 imainfo=get(videoreader(FileName)); 59 end 60 if ~isempty(imainfo) 61 [t,uid_camera]=add(t,1,'element','Camera'); 62 Camera.TimeUnit='s'; 63 Camera.BurstTiming.Time=0; 64 Camera.BurstTiming.Dti=1/imainfo.FrameRate; 65 Camera.BurstTiming.NbDti=imainfo.NumberOfFrames-1; 66 t=struct2xml(Camera,t,uid_camera); 67 end 68 [t,uid_calib]=add(t,1,'element','GeometryCalib'); 62 69 end 63 [t,uid_calib]=add(t,1,'element','GeometryCalib');64 70 end 65 71 t=struct2xml(GeometryCalib,t,uid_calib); -
trunk/src/uvmat.m
r389 r397 641 641 % --- Update information about a new field series (indices to scan, timing, 642 642 % calibration from an xml file, then refresh current plots 643 function update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType, MovieObject,index)643 function update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,VideoObject,index) 644 644 %------------------------------------------------------------------------ 645 645 %% define the relevant handles depending on the index (1=first file series, 2= second file series) … … 689 689 imainfo=[]; 690 690 ColorType='falsecolor'; %default 691 hhh=''; 692 if isequal(lower(FileExt),'.avi') %.avi file 691 hhh=[]; 692 UvData.MovieObject{index}=VideoObject; 693 if ~isempty(VideoObject) 694 imainfo=get(VideoObject); 693 695 testima=1; 694 imainfo=aviinfo([FileName]);695 nbfield=imainfo.NumFrames;696 696 nbfield_j=1; 697 set(handles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FramesPerSecond) 'ms']);%display the elementary time interval in millisec698 XmlData.Time=(0:1/imainfo.FramesPerSecond:(imainfo.NumFrames-1)/imainfo.FramesPerSecond)';699 697 TimeUnit='s'; 700 hhh=which('mmreader'); 701 ColorType=imainfo.ImageType;%='truecolor' for color images 698 XmlData.Time=(0:1/imainfo.FrameRate:(imainfo.NumberOfFrames-1)/imainfo.FrameRate)'; 699 % % nbfield=imainfo.NumberOfFrames; 700 set(handles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FrameRate) 'ms']);%display the elementary time interval in millisec 701 ColorType='truecolor'; 702 702 elseif ~isempty(FileExt(2:end))&&(~isempty(imformats(FileExt(2:end))) || isequal(FileExt,'.vol'))%&& isequal(NomType,'*')% multi-frame image 703 703 testima=1; 704 704 if ~isequal(SubDir,'') 705 RootFile=get(handles.RootFile,'String');705 RootFile=get(handles.RootFile,'String'); 706 706 imainfo=imfinfo([fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]); 707 707 else … … 712 712 nbfield=length(imainfo); 713 713 nbfield_j=1; 714 end 715 end 716 if ~strcmp(hhh,'')% if the function mmreader is found (recent version of matlab) 717 UvData.MovieObject{index}=mmreader([FileBase FileIndices FileExt]); 718 else 719 UvData.MovieObject{index}=[]; 714 end 720 715 end 721 716 if isfield(imainfo,'Width') && isfield(imainfo,'Height') … … 1923 1918 % num_i1,num_i2,num_j1,num_j2; frame indices 1924 1919 % Field: structure describing an optional input field (then replace the input file) 1920 1925 1921 function errormsg=refresh_field(handles,filename,filename_1,num_i1,num_i2,num_j1,num_j2,Field) 1926 1922 %------------------------------------------------------------------------ … … 2224 2220 2225 2221 %% calculate scalar 2226 if (strcmp(FileType,'civdata')||strcmp(FileType,'civx'))&&~strcmp(ParamOut.FieldName,'velocity')&& ~strcmp(ParamOut.FieldName,'get_field...');% ~isequal(ParamOut.CivStage,0)%&&~isempty(FieldName)%2227 Field{1}=calc_field([{ParamOut.FieldName} {ParamOut.ColorVar}],Field{1},ParamOut.VelType);2228 end2229 if numel(Field)==2 && ~test_keepdata_1 && (strcmp(FileType,'civdata')||strcmp(FileType,'civx')) &&~strcmp(ParamOut.FieldName,'velocity') && ~strcmp(ParamOut_1.FieldName,'get_field...')2230 Field{2}=calc_field([{ParamOut_1.FieldName} {ParamOut_1.ColorVar}],Field{2},ParamOut_1.VelType);2231 end2222 % if (strcmp(FileType,'civdata')||strcmp(FileType,'civx'))&&~strcmp(ParamOut.FieldName,'velocity')&& ~strcmp(ParamOut.FieldName,'get_field...');% ~isequal(ParamOut.CivStage,0)%&&~isempty(FieldName)% 2223 % Field{1}=calc_field([{ParamOut.FieldName} {ParamOut.ColorVar}],Field{1}); 2224 % end 2225 % if numel(Field)==2 && ~test_keepdata_1 && (strcmp(FileType,'civdata')||strcmp(FileType,'civx')) &&~strcmp(ParamOut.FieldName,'velocity') && ~strcmp(ParamOut_1.FieldName,'get_field...') 2226 % Field{2}=calc_field([{ParamOut_1.FieldName} {ParamOut_1.ColorVar}],Field{2}); 2227 % end 2232 2228 2233 2229 %% combine the two input fields (e.g. substract velocity fields) … … 2450 2446 for imap=1:numel(IndexObj) 2451 2447 iobj=IndexObj(imap); 2452 [ObjectData,errormsg]=proj_field(UvData.Field,UvData.Object{iobj}) ;% project field on the object2448 [ObjectData,errormsg]=proj_field(UvData.Field,UvData.Object{iobj})% project field on the object 2453 2449 2454 2450 if ~isempty(errormsg) … … 4589 4585 delete(hset_object)% delete existing version of set_object 4590 4586 end 4587 if ~isfield(ObjectData,'Type')% default plane 4588 ObjectData.Type='plane'; 4589 end 4591 4590 hset_object=set_object(ObjectData,[],ZBounds); 4591 if get(handles.edit_object,'Value')% edit mode 4592 hhset_object=guidata(hset_object); 4593 set(hhset_object.PLOT,'Enable','on') 4594 end 4592 4595 4593 4596
Note: See TracChangeset
for help on using the changeset viewer.