- Timestamp:
- Apr 5, 2011, 12:46:34 AM (14 years ago)
- Location:
- trunk/src
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r230 r231 2119 2119 disp(cmd_str); 2120 2120 else %run PIVlab if selected 2121 image1=imread(par_civ1.filename_ima_a); 2122 image2=imread(par_civ1.filename_ima_b); 2123 stepx=str2num(par_civ1.dx); 2124 stepy=str2num(par_civ1.dy); 2125 ibx2=ceil(str2num(par_civ1.ibx)/2); 2126 iby2=ceil(str2num(par_civ1.iby)/2); 2127 isx2=ceil(str2num(par_civ1.isx)/2); 2128 isy2=ceil(str2num(par_civ1.isy)/2); 2129 shiftx=str2num(par_civ1.shiftx); 2130 shifty=str2num(par_civ1.shifty); 2131 % ibx=2*ibx2-1;%ibx and iby odd, reduced by 1 if even 2132 % iby=2*iby2-1; 2133 miniy=max(1+isy2-shifty,1+iby2); 2134 minix=max(1+isx2-shiftx,1+ibx2); 2135 maxiy=min(size(image1,1)-isy2-shifty,size(image1,1)-iby2); 2136 maxix=min(size(image1,2)-isx2-shiftx,size(image1,2)-ibx2); 2137 % maxix=stepx*(floor(size(image1_roi,2)/stepx))-(2*ibx2-2)+ibx2; 2138 [GridX,GridY]=meshgrid(miniy:stepy:maxiy,minix:stepx:maxix); 2139 PointCoord(:,1)=reshape(GridX,[],1); 2140 PointCoord(:,2)=reshape(GridY,[],1); 2141 [xtable ytable utable vtable ctable typevector] = pivlab (image1,image2,ibx2,iby2,isx2,isy2,shiftx,shifty,PointCoord, 1, []); 2142 Data.ListGlobalAttribute={'title','Time','Dt'}; 2143 Data.title='PIVlab'; 2144 Data.Time=str2double(par_civ1.T0); 2145 Data.Dt=str2double(par_civ1.Dt); 2146 Data.ListVarName={'X','Y','U','V','C','FF'};% cell array containing the names of the fields to record 2147 Data.VarDimName={'nbvec','nbvec','nbvec','nbvec','nbvec','nbvec'}; 2148 Data.VarAttribute{1}.Role='coord_x'; 2149 Data.VarAttribute{2}.Role='coord_y'; 2150 Data.VarAttribute{3}.Role='vector_x'; 2151 Data.VarAttribute{4}.Role='vector_y'; 2152 Data.VarAttribute{5}.Role='errorflag'; 2153 Data.X=reshape(xtable,[],1); 2154 Data.Y=reshape(ytable,[],1); 2155 Data.U=reshape(utable,[],1); 2156 Data.V=reshape(vtable,[],1); 2157 Data.C=reshape(ctable,[],1); 2158 Data.FF=reshape(~typevector,[],1); 2121 Data=civ_uvmat(par_civ1); 2122 % image1=imread(par_civ1.filename_ima_a); 2123 % image2=imread(par_civ1.filename_ima_b); 2124 % stepx=str2num(par_civ1.dx); 2125 % stepy=str2num(par_civ1.dy); 2126 % ibx2=ceil(str2num(par_civ1.ibx)/2); 2127 % iby2=ceil(str2num(par_civ1.iby)/2); 2128 % isx2=ceil(str2num(par_civ1.isx)/2); 2129 % isy2=ceil(str2num(par_civ1.isy)/2); 2130 % shiftx=str2num(par_civ1.shiftx); 2131 % shifty=str2num(par_civ1.shifty); 2132 % % ibx=2*ibx2-1;%ibx and iby odd, reduced by 1 if even 2133 % % iby=2*iby2-1; 2134 % miniy=max(1+isy2-shifty,1+iby2); 2135 % minix=max(1+isx2-shiftx,1+ibx2); 2136 % maxiy=min(size(image1,1)-isy2-shifty,size(image1,1)-iby2); 2137 % maxix=min(size(image1,2)-isx2-shiftx,size(image1,2)-ibx2); 2138 % [GridX,GridY]=meshgrid(minix:stepx:maxix,miniy:stepy:maxiy); 2139 % PointCoord(:,1)=reshape(GridX,[],1); 2140 % PointCoord(:,2)=reshape(GridY,[],1); 2141 % % caluclate velocity data (y and v in indices, reverse to y component) 2142 % [xtable ytable utable vtable ctable typevector] = pivlab (image1,image2,ibx2,iby2,isx2,isy2,shiftx,shifty,PointCoord, 1, []); 2143 % Data.ListGlobalAttribute={'title','Time','Dt'}; 2144 % Data.title='PIVlab'; 2145 % Data.Time=str2double(par_civ1.T0); 2146 % Data.Dt=str2double(par_civ1.Dt); 2147 % Data.ListVarName={'X','Y','U','V','C','FF'};% cell array containing the names of the fields to record 2148 % Data.VarDimName={'nbvec','nbvec','nbvec','nbvec','nbvec','nbvec'}; 2149 % Data.VarAttribute{1}.Role='coord_x'; 2150 % Data.VarAttribute{2}.Role='coord_y'; 2151 % Data.VarAttribute{3}.Role='vector_x'; 2152 % Data.VarAttribute{4}.Role='vector_y'; 2153 % Data.VarAttribute{5}.Role='errorflag'; 2154 % Data.X=reshape(xtable,[],1); 2155 % Data.Y=reshape(size(image1,1)-ytable+1,[],1); 2156 % Data.U=reshape(utable,[],1); 2157 % Data.V=reshape(-vtable,[],1); 2158 % Data.C=reshape(ctable,[],1); 2159 % Data.FF=reshape(~typevector,[],1); 2159 2160 errormsg=struct2nc(filecell.nc.civ1{ifile,j},Data); 2160 2161 if isempty(errormsg) … … 4289 4290 end 4290 4291 4291 4292 %------------------------------------------------------------------------ 4293 % --- civ using pivlab 4294 function Data=civ_uvmat(par_civ1) 4295 %------------------------------------------------------------------------ 4296 image1=imread(par_civ1.filename_ima_a); 4297 image2=imread(par_civ1.filename_ima_b); 4298 stepx=str2num(par_civ1.dx); 4299 stepy=str2num(par_civ1.dy); 4300 ibx2=ceil(str2num(par_civ1.ibx)/2); 4301 iby2=ceil(str2num(par_civ1.iby)/2); 4302 isx2=ceil(str2num(par_civ1.isx)/2); 4303 isy2=ceil(str2num(par_civ1.isy)/2); 4304 shiftx=str2num(par_civ1.shiftx); 4305 shifty=str2num(par_civ1.shifty); 4306 miniy=max(1+isy2-shifty,1+iby2); 4307 minix=max(1+isx2-shiftx,1+ibx2); 4308 maxiy=min(size(image1,1)-isy2-shifty,size(image1,1)-iby2); 4309 maxix=min(size(image1,2)-isx2-shiftx,size(image1,2)-ibx2); 4310 [GridX,GridY]=meshgrid(minix:stepx:maxix,miniy:stepy:maxiy); 4311 PointCoord(:,1)=reshape(GridX,[],1); 4312 PointCoord(:,2)=reshape(GridY,[],1); 4313 4314 % caluclate velocity data (y and v in indices, reverse to y component) 4315 [xtable ytable utable vtable ctable typevector] = pivlab (image1,image2,ibx2,iby2,isx2,isy2,shiftx,shifty,PointCoord, 1, []); 4316 Data.ListGlobalAttribute={'title','Time','Dt'}; 4317 Data.title='PIVlab'; 4318 Data.Time=str2double(par_civ1.T0); 4319 Data.Dt=str2double(par_civ1.Dt); 4320 Data.ListVarName={'X','Y','U','V','C','FF'};% cell array containing the names of the fields to record 4321 Data.VarDimName={'nbvec','nbvec','nbvec','nbvec','nbvec','nbvec'}; 4322 Data.VarAttribute{1}.Role='coord_x'; 4323 Data.VarAttribute{2}.Role='coord_y'; 4324 Data.VarAttribute{3}.Role='vector_x'; 4325 Data.VarAttribute{4}.Role='vector_y'; 4326 Data.VarAttribute{5}.Role='errorflag'; 4327 Data.X=reshape(xtable,[],1); 4328 Data.Y=reshape(size(image1,1)-ytable+1,[],1); 4329 Data.U=reshape(utable,[],1); 4330 Data.V=reshape(-vtable,[],1); 4331 Data.C=reshape(ctable,[],1); 4332 Data.FF=reshape(~typevector,[],1); 4292 4333 4293 4334 %------------------------------------------------------------------------ … … 4638 4679 Data.nx=[1 size(Data.A,2)]; 4639 4680 par_civ1=read_param_civ1(handles,filecell.ima1.civ1{1}); 4640 4641 stepx=str2num(par_civ1.dx); 4642 stepy=str2num(par_civ1.dy); 4643 ibx2=ceil(str2num(par_civ1.ibx)/2); 4644 iby2=ceil(str2num(par_civ1.iby)/2); 4645 isx2=ceil(str2num(par_civ1.isx)/2); 4646 isy2=ceil(str2num(par_civ1.isy)/2); 4647 shiftx=str2num(par_civ1.shiftx); 4648 shifty=str2num(par_civ1.shifty); 4649 % ibx=2*ibx2-1;%ibx and iby odd, reduced by 1 if even 4650 % iby=2*iby2-1; 4651 miniy=max(1+isy2-shifty,1+iby2); 4652 minix=max(1+isx2-shiftx,1+ibx2); 4653 maxiy=min(size(image1,1)-isy2-shifty,size(image1,1)-iby2); 4654 maxix=min(size(image1,2)-isx2-shiftx,size(image1,2)-ibx2); 4655 % maxix=stepx*(floor(size(image1_roi,2)/stepx))-(2*ibx2-2)+ibx2; 4656 [GridX,GridY]=meshgrid(miniy:stepy:maxiy,minix:stepx:maxix); 4657 PointCoord(:,1)=reshape(GridX,[],1); 4658 PointCoord(:,2)=reshape(GridY,[],1); 4659 hh=view_field(Data); 4660 set(0,'CurrentFigure',hh) 4661 plot(PointCoord(:,2),PointCoord(:,1),'+') 4662 ViewData=get(hh,'UserData'); 4681 par_civ1.filename_ima_a=filecell.ima1.civ1{1}; 4682 par_civ1.filename_ima_b=filecell.ima2.civ1{1}; 4683 par_civ1.T0=0; 4684 par_civ1.Dt=1; 4685 Data=civ_uvmat(par_civ1); 4686 % stepx=str2num(par_civ1.dx); 4687 % stepy=str2num(par_civ1.dy); 4688 % ibx2=ceil(str2num(par_civ1.ibx)/2); 4689 % iby2=ceil(str2num(par_civ1.iby)/2); 4690 % isx2=ceil(str2num(par_civ1.isx)/2); 4691 % isy2=ceil(str2num(par_civ1.isy)/2); 4692 % shiftx=str2num(par_civ1.shiftx); 4693 % shifty=str2num(par_civ1.shifty); 4694 % % ibx=2*ibx2-1;%ibx and iby odd, reduced by 1 if even 4695 % % iby=2*iby2-1; 4696 % miniy=max(1+isy2-shifty,1+iby2) 4697 % minix=max(1+isx2-shiftx,1+ibx2) 4698 % maxiy=min(size(Data.A,1)-isy2-shifty,size(Data.A,1)-iby2) 4699 % maxix=min(size(Data.A,2)-isx2-shiftx,size(Data.A,2)-ibx2) 4700 % % maxix=stepx*(floor(size(image1_roi,2)/stepx))-(2*ibx2-2)+ibx2; 4701 % [GridX,GridY]=meshgrid(minix:stepx:maxix,miniy:stepy:maxiy); 4702 % PointCoord(:,1)=reshape(GridX,[],1); 4703 % PointCoord(:,2)=reshape(GridY,[],1); 4704 Data.ListVarName=[Data.ListVarName {'ny','nx','A'}]; 4705 Data.VarDimName=[Data.VarDimName {'ny','nx',{'ny','nx'}}]; 4706 Data.A=imread(filecell.ima1.civ1{1}); 4707 Data.ny=[size(Data.A,1) 1]; 4708 Data.nx=[1 size(Data.A,2)]; 4709 hview_field=view_field(Data); 4710 set(0,'CurrentFigure',hview_field) 4711 hhview_field=guihandles(hview_field); 4712 set(hview_field,'CurrentAxes',hhview_field.axes3) 4713 %hpoints=line(PointCoord(:,1),PointCoord(:,2),'Color','y','LineStyle','.','Marker','*','LineWidth',4,'Tag','grid_points'); 4714 ViewData=get(hview_field,'UserData'); 4715 ViewData.CivHandle=handles.civ;% indicate the handle of the civ GUI in view_field 4663 4716 ViewData.axes3.B=imread(filecell.ima2.civ1{1});%store the second image in the UserData of the GUI view_field 4717 ViewData.axes3.X=Data.X; %keep the set of points in memeory 4718 ViewData.axes3.Y=Data.Y; 4719 set(hview_field,'UserData',ViewData) 4664 4720 corrfig=findobj(allchild(0),'tag','corrfig');% look for a current figure for image correlation display 4665 4721 if isempty(corrfig) … … 4669 4725 set(corrfig,'DeleteFcn',{@closeview_field})% 4670 4726 end 4671 set(hh,'UserData',ViewData)4672 4727 else 4673 4728 corrfig=findobj(allchild(0),'tag','corrfig');% look for a current figure for image correlation display -
trunk/src/geometry_calib.m
r227 r231 1072 1072 end 1073 1073 end 1074 axes(hhuvmat.axes3) 1074 %axes(hhuvmat.axes3) 1075 set(0,'CurrentFigure',huvmat) 1076 set(huvmat,'CurrentAxes',hhuvmat.axes3) 1075 1077 hh=findobj('Tag','calib_points'); 1076 1078 if ~isempty(ObjectData.Coord) && isempty(hh) -
trunk/src/get_field.m
r227 r231 168 168 inputfile=get(handles.inputfile,'String'); 169 169 Field=nc2struct(inputfile,[]);% reads the field description, without data 170 Field.ListGlobalAttribute171 170 if isfield(Field,'Txt') 172 171 msgbox_uvmat('ERROR',Field.Txt) … … 835 834 huvmat=findobj(allchild(0),'tag','uvmat'); 836 835 if isempty(huvmat) 837 uvmat(inputfile) 836 input.InputFile=inputfile; 837 input.FieldsString={'get_field...'}; 838 uvmat(input) 838 839 else 839 840 set(huvmat,'Visible','on')%make uvmat visible (bugs can hide it in some cases) -
trunk/src/mouse_down.m
r210 r231 239 239 if ~isempty(hset_object) 240 240 sethandles=guidata(hset_object); 241 ObjectData=read_set_object(sethandles); 241 ObjectData=read_set_object(sethandles); %read object features in the GUI set_object 242 242 ObjectData.Coord=[]; %reset previous object coordinates 243 243 ObjectData.Coord(1,1)=xy(1,1); … … 263 263 end 264 264 set(hhuvmat.list_object_1,'String',list_str) 265 list_str{end+1}='...';265 %list_str{end+1}='...'; 266 266 set(hhuvmat.list_object_2,'String',list_str) 267 267 if strcmp(fig_tag,'view_field')%we are in view_field plot -
trunk/src/mouse_motion.m
r225 r231 29 29 end 30 30 FigData=get(hObject,'UserData'); 31 31 32 if ishandle(FigData)% case of a zoom plot, the handle of the parent rectangle is stored in UserData, its parent is the plotting axes of the rectangle 32 33 currentfig=get(get(FigData,'parent'),'parent'); … … 48 49 test_ruler=isequal(get(hhuvmat.MenuRuler,'checked'),'on'); 49 50 end 50 hciv=findobj(allchild(0),'tag','civ');%find the civ interface handle 51 if ~isempty(hciv) && strcmp(get(currentfig,'tag'),'view_field') 52 hhciv=guidata(hciv); 53 test_piv =get(hhciv.TestCiv1,'Value'); 54 end 51 test_piv=0; 52 if isfield(FigData,'CivHandle') 53 if ~ishandle(FigData.CivHandle) 54 delete(hObject) 55 return 56 end 57 hhciv=guidata(FigData.CivHandle); 58 test_piv=1; 59 end 60 % hciv=findobj(allchild(0),'tag','civ');%find the civ interface handle 61 % if ~isempty(hciv) && strcmp(get(currentfig,'tag'),'view_field') 62 % hhciv=guidata(hciv); 63 % test_piv =get(hhciv.TestCiv1,'Value'); 64 % end 55 65 56 66 %find the current axe 'haxes' and display the current mouse position or uicontrol tag … … 209 219 if test_piv 210 220 par=civ('read_param_civ1',hhciv); 211 if isfield(Field,'A') 212 dx=str2double(par.dx); 213 dy=str2double(par.dy); 214 xround=x(1)+dx*round((xy(1,1)-x(1))/dx);% index x of pixel 215 yround=y(1)+dy*round((xy(1,2)-y(1))/dy);% index y of pixel 216 end 221 % PointCoord=Field.X; 222 [dd,ind_pt]=min(abs(Field.X-xy(1,1))+abs(Field.Y-xy(1,2))); 223 % [dd,ind_y]=min(abs(Field.Y-xy(1,2))); 224 xround=Field.X(ind_pt); 225 yround=Field.Y(ind_pt); 226 % if isfield(Field,'A') 227 % dx=str2double(par.dx); 228 % dy=str2double(par.dy); 229 % xround=x(1)+dx*round((xy(1,1)-x(1))/dx);% index x of pixel 230 % yround=y(1)+dy*round((xy(1,2)-y(1))/dy);% index y of pixel 231 % end 217 232 % mark the correlation box with a rectangle 218 233 ibx2=floor((str2double(par.ibx)-1)/2); … … 238 253 set(hhhh,'Position',[xround-isx2+shiftx yround-isy2+shifty 2*isx2 2*isy2]) 239 254 end 240 Asub=Field.A(yround-iby2:yround+iby2,xround-ibx2:xround+ibx2);%first sub-image 241 Asub=reshape(Asub,[],1);%first sub-image reshaped as matlab vector 242 rangx(1)=-(isx2-ibx2)+shiftx; 243 rangx(2)=isx2-ibx2+shiftx; 244 rangy(1)=-(isy2-iby2)-shifty; 245 rangy(2)=(isy2-iby2)-shifty 246 correl=zeros(rangy(2)-rangy(1)+1,rangx(2)-rangx(1)+1); 247 for id=rangx(1):rangx(2) 248 for jd=rangy(1):rangy(2) 249 Bsub=Field.B(yround-iby2+jd:yround+iby2+jd,xround-ibx2+id:xround+ibx2+id); 250 Bsub=reshape(Bsub,[],1); 251 correl(jd-rangy(1)+1,id-rangx(1)+1)=corr(double(Asub),double(Bsub)); 252 end 253 end 255 [xtable ytable utable vtable ctable typevector result_conv] = pivlab (Field.A,Field.B,ibx2,iby2,isx2,isy2,shiftx,shifty,[xround yround], 1, []); 256 % Asub=Field.A(yround-iby2:yround+iby2,xround-ibx2:xround+ibx2);%first sub-image 257 % Asub=reshape(Asub,[],1);%first sub-image reshaped as matlab vector 258 rangx(1)=-(isx2-ibx2)+shiftx; 259 rangx(2)=isx2-ibx2+shiftx; 260 rangy(1)=-(isy2-iby2)-shifty; 261 rangy(2)=(isy2-iby2)-shifty; 262 % correl=zeros(rangy(2)-rangy(1)+1,rangx(2)-rangx(1)+1); 263 % for id=rangx(1):rangx(2) 264 % for jd=rangy(1):rangy(2) 265 % Bsub=Field.B(yround-iby2+jd:yround+iby2+jd,xround-ibx2+id:xround+ibx2+id); 266 % Bsub=reshape(Bsub,[],1); 267 % correl(jd-rangy(1)+1,id-rangx(1)+1)=corr(double(Asub),double(Bsub)); 268 % end 269 % end 254 270 %correl=uint8(63.5*correl+63.5); 255 271 hcorr=[]; … … 264 280 if ~isempty(corrfig) 265 281 set(0,'CurrentFigure',corrfig(1)) 266 AxeData.CurrentCorrImage=imagesc(rangx,-rangy,correl,[0 1]); 282 AxeData.CurrentCorrImage=imagesc(rangx,-rangy,result_conv,[0 1]); 283 AxeData.CurrentVector=line([0 utable],[0 vtable],'Tag','vector'); 284 267 285 colorbar 268 286 set(haxes,'UserData',AxeData) … … 270 288 end 271 289 else 272 set(AxeData.CurrentCorrImage,'CData',correl) 290 % set(AxeData.CurrentCorrImage,'CData',correl) 291 set(AxeData.CurrentCorrImage,'CData',result_conv) 273 292 set(AxeData.CurrentCorrImage,'XData',rangx) 274 293 set(AxeData.CurrentCorrImage,'YData',-rangy) 294 set(AxeData.CurrentVector,'XData',[0 utable],'YData',[0 -vtable]) 275 295 end 276 296 end -
trunk/src/pivlab.m
r227 r231 19 19 % mask: =[] for no mask 20 20 % roi: 4 element vector defining a region of interest: x position, y position, width, height, (in image indices), for the whole image, roi=[]; 21 function [xtable ytable utable vtable ctable typevector ] = pivlab (image1,image2,ibx2,iby2,isx2,isy2,shiftx,shifty, PointCoord, subpixfinder,mask)21 function [xtable ytable utable vtable ctable typevector result_conv errormsg] = pivlab (image1,image2,ibx2,iby2,isx2,isy2,shiftx,shifty, GridIndices, subpixfinder,mask) 22 22 %this funtion performs the DCC PIV analysis. Recent window-deformation 23 23 %methods perform better and will maybe be implemented in the future. 24 errormsg=''; 24 25 warning off %MATLAB:log:logOfZero 25 % if numel(roi)>0 26 % xroi=roi(1); 27 % yroi=roi(2); 28 % widthroi=roi(3); 29 % heightroi=roi(4); 30 % image1_roi=double(image1(yroi:yroi+heightroi,xroi:xroi+widthroi)); 31 % image2_roi=double(image2(yroi:yroi+heightroi,xroi:xroi+widthroi)); 32 % else 26 [npy_ima npx_ima]=size(image1); 27 if ~isequal(size(image1),size(image2)) 28 errormsg='image pair with unequal size'; 29 return 30 end 33 31 xroi=0; 34 32 yroi=0; 35 33 image1_roi=double(image1); 36 34 image2_roi=double(image2); 37 % end38 35 if numel(mask)>0 39 36 cellmask=mask; 40 mask=zeros(size(image1 _roi));37 mask=zeros(size(image1)); 41 38 for i=1:size(cellmask,1); 42 39 masklayerx=cellmask{i,1}; 43 40 masklayery=cellmask{i,2}; 44 mask = mask + poly2mask(masklayerx-xroi,masklayery-yroi, size(image1_roi,1),size(image1_roi,2)); %kleineres eingangsbild und maske geshiftet41 mask = mask + poly2mask(masklayerx-xroi,masklayery-yroi,npy_ima,npx_ima); %kleineres eingangsbild und maske geshiftet 45 42 end 46 43 else 47 mask=zeros(size(image1 _roi));44 mask=zeros(size(image1)); 48 45 end 49 46 mask(mask>1)=1; 50 % ibx=2*ibx2-1%ibx and iby odd, reduced by 1 if even 51 % iby=2*iby2-1 47 48 % ibx=2*ibx2-1;%ibx and iby odd, reduced by 1 if even 49 % iby=2*iby2-1; 52 50 % miniy=1+iby2 53 51 % minix=1+ibx2 … … 77 75 image2_roi=padarray(image2_roi,[iby2 ibx2], min(min(image1_roi))); 78 76 mask=padarray(mask,[iby2 ibx2],0); 79 SubPixOffset=0.5;%odd values chosen for ibx and iby80 81 nbvec=size( PointCoord,1);77 %SubPixOffset=0.5;%odd values chosen for ibx and iby 78 79 nbvec=size(GridIndices,1); 82 80 xtable=zeros(nbvec,1); 83 81 ytable=xtable; … … 96 94 %% MAINLOOP 97 95 for ivec=1:nbvec 98 iref=PointCoord(ivec,1); 99 jref=PointCoord(ivec,2); 96 iref=GridIndices(ivec,1); 97 jref=GridIndices(ivec,2); 98 %jref=npy_ima-PointCoord(ivec,2)+1; 100 99 image1_crop=image1_roi(jref-iby2:jref+iby2,iref-ibx2:iref+ibx2); 101 100 image2_crop=image2_roi(jref+shifty-isy2:jref+shifty+isy2,iref+shiftx-isx2:iref+shiftx+isx2); 102 % n=round((j-miniy)/maxiy*100);103 % for i = minix:step:maxix % horizontal loop104 % nrx=nrx+1;%used to determine the pos of the vector in resulting matrix105 % if nrxreal < numelementsx106 % nrxreal=nrxreal+1;107 % else108 % nrxreal=1;109 % end110 % startpoint=[i j];111 % image1_crop=image1_roi(j:j+iby-1, i:i+ibx-1);112 % image2_crop=image2_roi(ceil(j-iby/2):ceil(j+1.5*iby-1), ceil(i-ibx/2):ceil(i+1.5*ibx-1));113 % corrmax=0;114 101 if mask(jref,iref)==0 115 102 %reference: Oliver Pust, PIV: Direct Cross-Correlation … … 121 108 corrmax= max(max(result_conv)); 122 109 result_conv=(result_conv/corrmax)*255; %normalize, peak=always 255 110 % result_conv=flipdim(result_conv,2);%reverse x direction 123 111 %Find the 255 peak 124 112 [y,x] = find(result_conv==255); … … 126 114 try 127 115 if subpixfinder==1 128 [vector] = SUBPIXGAUSS (result_conv, ibx,iby,x,y,SubPixOffset);116 [vector] = SUBPIXGAUSS (result_conv,x,y); 129 117 elseif subpixfinder==2 130 [vector] = SUBPIX2DGAUSS (result_conv, ibx,iby,x,y,SubPixOffset);118 [vector] = SUBPIX2DGAUSS (result_conv,x,y); 131 119 end 132 catch 133 vector=[NaN NaN]; %if something goes wrong with cross correlation..... 120 catch ME 121 errormsg=ME.message 122 vector=[0 0]; %if something goes wrong with cross correlation..... 134 123 end 135 124 else 136 vector=[ NaN NaN]; %if something goes wrong with cross correlation.....125 vector=[0 0]; %if something goes wrong with cross correlation..... 137 126 end 138 127 else %if mask was not 0 then 139 vector=[ NaN NaN];128 vector=[0 0]; 140 129 typevector(ivec)=0; 141 130 end 142 131 143 132 %Create the vector matrix x, y, u, v 144 xtable(ivec)= PointCoord(ivec,2);145 ytable(ivec)= PointCoord(ivec,1);133 xtable(ivec)=GridIndices(ivec,1); 134 ytable(ivec)=GridIndices(ivec,2); 146 135 utable(ivec)=vector(1); 147 136 vtable(ivec)=vector(2); 148 ctable(ivec)=corrmax/sum(sum(image1_crop.*image1_crop)); 149 end 150 % xtable=xtable-ibx2; 151 % ytable=ytable-iby2; 152 % 153 % xtable=xtable+xroi; 154 % ytable=ytable+yroi; 155 % 156 % utable(utable>ibx/1.5)=NaN; 157 % vtable(utable>ibx/1.5)=NaN; 158 % vtable(vtable>iby/1.5)=NaN; 159 % utable(vtable>iby/1.5)=NaN; 160 161 function [vector] = SUBPIXGAUSS (result_conv,ibx,iby,x,y,SubPixOffset) 137 sum_square=sum(sum(image1_crop.*image1_crop)); 138 ctable(ivec)=corrmax/sum_square; 139 end 140 result_conv=result_conv/255; 141 142 143 function [vector] = SUBPIXGAUSS (result_conv,x,y) 144 162 145 if size(x,1)>1 %if there are more than 1 peaks just take the first 163 146 x=x(1:1); … … 177 160 f2 = log(result_conv(y,x+1)); 178 161 peakx = x+ (f1-f2)/(2*f1-4*f0+2*f2); 179 % 180 SubpixelX=peakx-(ibx/2)-SubPixOffset; 181 SubpixelY=peaky-(iby/2)-SubPixOffset; 182 vector=[SubpixelX, SubpixelY]; 162 [npy,npx]=size(result_conv); 163 vector=[peakx-floor(npx/2)-1 peaky-floor(npy/2)-1]; 183 164 else 184 165 vector=[NaN NaN]; 185 166 end 186 167 187 function [vector] = SUBPIX2DGAUSS (result_conv, ibx,iby,x,y,SubPixOffset)168 function [vector] = SUBPIX2DGAUSS (result_conv,x,y) 188 169 if size(x,1)>1 %if there are more than 1 peaks just take the first 189 170 x=x(1:1); … … 213 194 c11=(1/4)*sum(sum(c11)); 214 195 c20=(1/6)*sum(sum(c20)); 215 c02=(1/6)*sum(sum(c02)); 216 %c00=(1/9)*sum(sum(c00)); 217 196 c02=(1/6)*sum(sum(c02)); 218 197 deltax=(c11*c01-2*c10*c02)/(4*c20*c02-c11^2); 219 198 deltay=(c11*c10-2*c01*c20)/(4*c20*c02-c11^2); 220 199 peakx=x+deltax; 221 200 peaky=y+deltay; 222 223 SubpixelX=peakx-(ibx/2)-SubPixOffset; 224 SubpixelY=peaky-(iby/2)-SubPixOffset; 225 vector=[SubpixelX, SubpixelY]; 201 202 [npy,npx]=size(result_conv); 203 vector=[peakx-floor(npx/2)-1 peaky-floor(npy/2)-1]; 204 % SubpixelX=peakx-(ibx/2)-SubPixOffset; 205 % SubpixelY=peaky-(iby/2)-SubPixOffset; 206 % vector=[SubpixelX, SubpixelY]; 226 207 else 227 208 vector=[NaN NaN]; -
trunk/src/plot_field.m
r227 r231 1093 1093 end 1094 1094 if test_vec 1095 XMin= [XMin min(vec_X)];1096 XMax= [XMax max(vec_X)];1097 YMin= [YMin min(vec_Y)];1098 YMax= [YMax max(vec_Y)];1099 end 1100 PlotParamOut.RangeX=[ min(XMin) max(XMax)]; %range of x, to be stored in the user data of the plot axes1101 PlotParamOut.RangeY=[ min(YMin) max(YMax)]; %range of x, to be stored in the user data of the plot axes1095 XMin=min(XMin,min(vec_X)); 1096 XMax=max(XMax,max(vec_X)); 1097 YMin=min(YMin,min(vec_Y)); 1098 YMax=max(YMax,max(vec_Y)); 1099 end 1100 PlotParamOut.RangeX=[XMin XMax]; %range of x, to be stored in the user data of the plot axes 1101 PlotParamOut.RangeY=[YMin YMax]; %range of x, to be stored in the user data of the plot axes 1102 1102 if ~fix_lim 1103 PlotParamOut.MinX= min(XMin);1104 PlotParamOut.MaxX= max(XMax);1105 PlotParamOut.MinY= min(YMin);1106 PlotParamOut.MaxY= max(YMax);1103 PlotParamOut.MinX=XMin; 1104 PlotParamOut.MaxX=XMax; 1105 PlotParamOut.MinY=YMin; 1106 PlotParamOut.MaxY=YMax; 1107 1107 if XMax>XMin 1108 1108 set(haxes,'XLim',[XMin XMax]);% set x limits of frame in axes coordinates -
trunk/src/plot_object.m
r187 r231 70 70 test_newobj=0; 71 71 haxes=get(hplot,'parent'); 72 currentfig=get(haxes,'parent'); 72 73 elseif isequal(get(hplot,'Type'),'axes')% hplot is the handle of an axis 74 haxes=hplot; 73 75 currentfig=get(hplot,'parent'); 74 set(0,'CurrentFigure',currentfig)75 haxes=hplot;76 set(currentfig,'CurrentAxes',haxes);76 % set(0,'CurrentFigure',currentfig) 77 78 % set(currentfig,'CurrentAxes',haxes); 77 79 elseif isequal(get(hplot,'Type'),'figure')% hplot is the handle of a figure 78 80 set(0,'CurrentFigure',hplot);%set the input figure as the current one 79 81 haxes=findobj(hplot,'Type','axes');%look for axes in the figure 80 82 haxes=haxes(1); 81 set(hplot,'CurrentAxes',haxes);%set the first found axis as the current one 83 currentfig=hplot; 84 % set(hplot,'CurrentAxes',haxes);%set the first found axis as the current one 82 85 else 83 figure; %create new figure86 currentfig=figure; %create new figure 84 87 hplot=axes;%create new axes 85 88 haxes=hplot; 86 89 end 87 90 else 88 figure; %create new figure91 currentfig=figure; %create new figure 89 92 hplot=axes;%create new axes 90 93 haxes=hplot; 91 94 end 95 set(0,'CurrentFigure',currentfig)%set the currentfigure as the current one 96 set(currentfig,'CurrentAxes',haxes);%set the current axes in the current figure 92 97 93 98 %% default input parameters … … 333 338 %% create the object 334 339 if test_newobj 335 axes(haxes)340 % axes(haxes) 336 341 hother=findobj('Tag','proj_object');%find all the proj objects 337 342 for iobj=1:length(hother) -
trunk/src/proj_field.m
r227 r231 1256 1256 %% case of input fields defined on a structured grid 1257 1257 else 1258 'TESTproj' 1259 VarName=FieldData.ListVarName{VarIndex(1)}%get the first variable of the cell to get the input matrix dimensions 1258 VarName=FieldData.ListVarName{VarIndex(1)};%get the first variable of the cell to get the input matrix dimensions 1260 1259 eval(['DimValue=size(FieldData.' VarName ');'])%input matrix dimensions 1261 1260 DimValue(DimValue==1)=[];%remove singleton dimensions … … 1267 1266 return 1268 1267 else 1269 VarType.coord1270 1268 if numel(find(VarType.coord))==2% the third matrix dimension does not correspond to a space coordinate 1271 1269 nbcolor=DimValue(3); … … 1275 1273 end 1276 1274 end 1277 testangle 1275 AYName=FieldData.ListVarName{VarType.coord(NbDim-1)};%name of input x coordinate (name preserved on projection) 1276 AXName=FieldData.ListVarName{VarType.coord(NbDim)};%name of input y coordinate (name preserved on projection) 1278 1277 if testangle% TODO modify name also in case of origin shift in x or y 1279 AY Name='Y';1280 AX Name='X';1278 AYProjName='Y'; 1279 AXProjName='X'; 1281 1280 count=0; 1282 1281 %modify coordinate names if they are already used 1283 1282 while ~(isempty(find(strcmp('AXName',ProjData.ListVarName),1)) && isempty(find(strcmp('AYName',ProjData.ListVarName),1))) 1284 1283 count=count+1; 1285 AY Name=[AYName '_' num2str(count)];1286 AX Name=[AXName '_' num2str(count)];1284 AYProjName=[AYProjName '_' num2str(count)]; 1285 AXProjName=[AXProjName '_' num2str(count)]; 1287 1286 end 1288 1287 else 1289 AYName=FieldData.ListVarName{VarType.coord(NbDim-1)}%name of input x coordinate (name preserved on projection) 1290 AXName=FieldData.ListVarName{VarType.coord(NbDim)}%name of input y coordinate (name preserved on projection) 1291 end 1292 eval(['AX=FieldData.' AXName ';']) 1293 eval(['AY=FieldData.' AYName ';']) 1288 AYProjName=AYName;% (name preserved on projection) 1289 AXProjName=AXName;%name of input y coordinate (name preserved on projection) 1290 end 1294 1291 ListDimName=FieldData.VarDimName{VarIndex(1)}; 1295 ProjData.ListVarName=[ProjData.ListVarName {AYName} {AXName}]; %TODO: check if it already exists in Projdata (several cells)1296 ProjData.VarDimName=[ProjData.VarDimName {AYName} {AXName}];1292 ProjData.ListVarName=[ProjData.ListVarName {AYProjName} {AXProjName}]; %TODO: check if it already exists in Projdata (several cells) 1293 ProjData.VarDimName=[ProjData.VarDimName {AYProjName} {AXProjName}]; 1297 1294 Coord_z=[]; 1298 1295 Coord_y=[]; … … 1392 1389 coord_x_proj=linspace(XMax,XMin,npX);%abscissa of the new pixels along the line 1393 1390 end 1394 % case with no rotation andinterpolation1395 if isequal(ProjMode,'projection') && ~testangle1396 if ~testXMin && ~testXMax && ~testYMin && ~testYMax && NbDim==21397 ProjData=FieldData; 1391 % case with no interpolation 1392 if isequal(ProjMode,'projection') && (~testangle || test90y || test90x) 1393 if NbDim==2 && ~testXMin && ~testXMax && ~testYMin && ~testYMax 1394 ProjData=FieldData;% no change by projection 1398 1395 else 1399 indY=NbDim-1; 1396 test_direct 1397 indY=NbDim-1 1400 1398 if test_direct(indY) 1401 1399 min_indy=ceil((YMin-Coord{indY}(1))/DYinit)+1; … … 1404 1402 Ybound(2)=Coord{indY}(1)+DYinit*(max_indy-1); 1405 1403 else 1406 min_indy=ceil((Coord{indY}(1)-YMax)/DYinit)+1 ;1407 max_indy=floor((Coord{indY}(1)-YMin)/DYinit)+1 ;1408 Ybound(2)=Coord{indY}(1)-DYinit*(max_indy-1) ;1409 Ybound(1)=Coord{indY}(1)-DYinit*(min_indy-1) ;1404 min_indy=ceil((Coord{indY}(1)-YMax)/DYinit)+1 1405 max_indy=floor((Coord{indY}(1)-YMin)/DYinit)+1 1406 Ybound(2)=Coord{indY}(1)-DYinit*(max_indy-1) 1407 Ybound(1)=Coord{indY}(1)-DYinit*(min_indy-1) 1410 1408 end 1411 1409 if test_direct(NbDim)==1 … … 1417 1415 min_indx=ceil((Coord{NbDim}(1)-XMax)/DXinit)+1; 1418 1416 max_indx=floor((Coord{NbDim}(1)-XMin)/DXinit)+1; 1419 Xbound(2)=Coord{NbDim}(1)+DXinit*(max_indx-1); 1420 1421 1417 Xbound(2)=Coord{NbDim}(1)+DXinit*(max_indx-1); 1422 1418 Xbound(1)=Coord{NbDim}(1)+DXinit*(min_indx-1); 1423 1419 end … … 1426 1422 1427 1423 if test90y 1428 'TEST3D'1429 1424 ind_new=[3 2 1]; 1430 DimCell=DimCell(ind_new); 1431 DimValue=DimValue(ind_new); 1432 DimCell(1)=[]; %suppress x variable 1433 DimValue(1)=[]; 1425 DimCell={AYProjName,AXProjName} 1426 % DimValue=DimValue(ind_new); 1434 1427 iz=ceil((ObjectData.Coord(1,1)-Coord{3}(1))/DX)+1; 1435 1428 for ivar=VarIndex … … 1438 1431 ProjData.VarDimName=[ProjData.VarDimName {DimCell}]; 1439 1432 ProjData.VarAttribute{length(ProjData.ListVarName)}=FieldData.VarAttribute{ivar}; %reproduce the variable attributes 1440 eval(['size(FieldData.' VarName ')']) 1441 eval(['ProjData.' VarName '=permute(FieldData.' VarName ',ind_new)'])% permute x and z indices for 90 degree rotation 1442 eval(['size(ProjData.' VarName ')']) 1443 eval(['ProjData.' VarName '=squeeze(FieldData.' VarName '(iz,:,:));'])% select the z index iz 1444 end 1445 eval(['ProjData.' AYName '=[Ybound(1) Ybound(2)];']) %record the new (projected ) y coordinates 1446 eval(['ProjData.' AXName '=[Coord{1}(end),Coord{1}(1)];']) %record the new (projected ) x coordinates 1433 eval(['ProjData.' VarName '=permute(FieldData.' VarName ',ind_new);'])% permute x and z indices for 90 degree rotation 1434 eval(['ProjData.' VarName '=squeeze(ProjData.' VarName '(iz,:,:));'])% select the z index iz 1435 end 1436 eval(['ProjData.' AYProjName '=[Ybound(1) Ybound(2)];']) %record the new (projected ) y coordinates 1437 eval(['ProjData.' AXProjName '=[Coord{1}(end),Coord{1}(1)];']) %record the new (projected ) x coordinates 1447 1438 else 1448 1439 if NbDim==3 … … 1470 1461 end 1471 1462 end 1472 eval(['ProjData.' AY Name '=[Ybound(1) Ybound(2)];']) %record the new (projected ) y coordinates1473 eval(['ProjData.' AX Name '=[Xbound(1) Xbound(2)];']) %record the new (projected ) x coordinates1463 eval(['ProjData.' AYProjName '=[Ybound(1) Ybound(2)];']) %record the new (projected ) y coordinates 1464 eval(['ProjData.' AXProjName '=[Xbound(1) Xbound(2)];']) %record the new (projected ) x coordinates 1474 1465 end 1475 1466 end … … 1575 1566 end 1576 1567 end 1577 1568 ProjData 1569 ProjData.VarDimName{3} 1578 1570 %----------------------------------------------------------------- 1579 1571 %projection in a volume -
trunk/src/read_get_field.m
r227 r231 597 597 end 598 598 if empty_coord_y 599 if numel(DimCellA)<2 600 errormsg=['coordinates need to be defined for the scalar ' VarNameA]; 601 return 602 end 599 603 coord_y_name=DimCellA{NbDim-1}; 600 604 SubField.ListVarName=[{coord_y_name} SubField.ListVarName]; -
trunk/src/set_object.m
r227 r231 652 652 if ~isempty(huvmat) 653 653 hhuvmat=guidata(huvmat); 654 % set(hhuvmat.create,'Value',0)655 % set(hhuvmat.create,'BackgroundColor',[0 1 0])%put unactivated buttons to green656 % set(hhuvmat.LINE,'Value',0)657 % set(hhuvmat.LINE,'BackgroundColor',[0 1 0])%put unactivated buttons to green658 % set(hhuvmat.PATCH,'Value',0)659 % set(hhuvmat.PATCH,'BackgroundColor',[0 1 0])%put unactivated buttons to green660 % set(hhuvmat.PLANE,'Value',0)661 % set(hhuvmat.PLANE,'BackgroundColor',[0 1 0])%put unactivated buttons to green662 % set(hhuvmat.VOLUME,'Value',0)663 % set(hhuvmat.VOLUME,'BackgroundColor',[0 1 0])%put unactivated buttons to green664 654 set(hhuvmat.edit,'Value',0) 665 655 set(hhuvmat.edit,'BackgroundColor',[0.7 0.7 0.7])%put unactivated buttons to gree … … 686 676 IndexObj_2=get(hhuvmat.list_object_2,'Value'); 687 677 List2=get(hhuvmat.list_object_2,'String'); 688 if IndexObj_2==length(List2)689 IndexObj_2=[];% '...' selected690 end691 678 else 692 679 IndexObj_2=[]; … … 709 696 if isempty(hview_field) 710 697 hview_field=view_field; 711 % elseif strcmp(ObjectData.ProjMode,'none')||strcmp(ObjectData.ProjMode,'mask_inside')||strcmp(ObjectData.ProjMode,'mask_outside')712 698 end 713 699 PlotHandles=guidata(hview_field); … … 716 702 PlotHandles=hhuvmat; 717 703 plotaxes=hhuvmat.axes3;%handle of axes3 in view_field 704 718 705 end 719 706 … … 742 729 ListObject{IndexObj,1}=ObjectName; 743 730 set(hhuvmat.list_object_1,'String',ListObject) 744 set(hhuvmat.list_object_2,'String', [ListObject;{'...'}])731 set(hhuvmat.list_object_2,'String',ListObject) 745 732 746 733 %% update the object plot and projection field -
trunk/src/uvmat.m
r227 r231 302 302 set(handles.transform_fct,'String',menu_str) 303 303 set(handles.transform_fct,'UserData',fct_handle)% store the list of path in UserData of ACTION 304 set(handles.uvmat,'UserData',UvData) 304 305 305 306 306 %% check the path and date of modification of all functions in uvmat … … 324 324 inputfile=input.InputFile; 325 325 end 326 if isfield(Field,'TimeIndex') 327 set(handles.i1,num2str(Field.TimeIndex)) 326 if isfield(input,'TimeIndex') 327 set(handles.i1,num2str(input.TimeIndex)) 328 end 329 if isfield(input,'FieldsString') 330 % set(handles.Fields,'Value',1) 331 UvData.FieldsString=input.FieldsString; 328 332 end 329 333 elseif ischar(input)% file name introduced as input … … 335 339 return 336 340 end 337 Field.ListVarName={'A','coord_y','coord_x'}; 338 Field.VarDimName={{'coord_y','coord_x'},'cord_y','coord_x'}; 339 Field.A=input; 340 Field.coord_x=[0.5 size(input,2)-0.5]; 341 Field.coord_y=[size(input,1)-0.5 0.5]; 342 end 343 if ~isempty(inputfile) 344 %%%%% display the input field %%%%%%% 345 display_file_name(hObject, eventdata, handles,inputfile) 346 %%%%%%% 341 UvData.Field.ListVarName={'A','coord_y','coord_x'}; 342 UvData.Field.VarDimName={{'coord_y','coord_x'},'cord_y','coord_x'}; 343 UvData.Field.A=input; 344 UvData.Field.coord_x=[0.5 size(input,2)-0.5]; 345 UvData.Field.coord_y=[size(input,1)-0.5 0.5]; 347 346 testinputfield=1; 348 347 end … … 360 359 end 361 360 end 361 end 362 set(handles.uvmat,'UserData',UvData) 363 if ~isempty(inputfile) 364 %%%%% display the input field %%%%%%% 365 display_file_name(hObject, eventdata, handles,inputfile) 366 %%%%%%% 367 testinputfield=1; 362 368 end 363 369 … … 856 862 UvData.XmlData=XmlData; 857 863 UvData.NewSeries=1; 858 set(handles.uvmat,'UserData',UvData) 864 859 865 860 866 %display warning message … … 867 873 if ~testima 868 874 testcivx=0; 869 hget_field=findobj('Name','get_field'); 870 % if isequal(FileExt,'.nc')||isequal(FileExt,'.cdf') 871 if isempty(hget_field) 875 % hget_field=findobj('Name','get_field'); 876 % if isequal(FileExt,'.nc')||isequal(FileExt,'.cdf') 877 if isfield(UvData,'FieldsString') && isequal(UvData.FieldsString,{'get_field...'})% field menu defined as input (from get_field) 878 set(handles.Fields,'Value',1) 879 set(handles.Fields,'String',{'get_field...'}) 880 UvData=rmfield(UvData,'FieldsString'); 881 else 882 %if isempty(hget_field) 872 883 Data=nc2struct(FileName,'ListGlobalAttribute','absolut_time_T0','civ'); 873 884 if ~isempty(Data.absolut_time_T0)&& ~isequal(Data.civ,0)%if the new input is Civx … … 878 889 col_vec(1)=[];%remove 'velocity' option for vector color (must be a scalar) 879 890 testcivx=1; 880 end 881 else882 hhget_field=guidata(hget_field);883 if ~strcmp(get(hhget_field.inputfile,'String'),FileName)%delete any existing get_field GUI with file name different than the input884 delete(hget_field)885 end886 end887 if ~testcivx891 end 892 % else 893 % hhget_field=guidata(hget_field); 894 % if ~strcmp(get(hhget_field.inputfile,'String'),FileName)%delete any existing get_field GUI with file name different than the input 895 % delete(hget_field) 896 % end 897 % end 898 if ~testcivx 888 899 set(handles.Fields,'Value',1) % set menu to 'get_field... 889 900 set(handles.Fields,'String',{'get_field...'}) 890 col_vec={'get_field...'}; 891 end 892 set(handles.col_vec,'String',col_vec) 893 % else 894 % msgbox_uvmat('ERROR',['invalid input file extension ' FileExt]) 895 % return 896 % end 897 end 901 col_vec={'get_field...'}; 902 end 903 set(handles.col_vec,'String',col_vec) 904 % else 905 % msgbox_uvmat('ERROR',['invalid input file extension ' FileExt]) 906 % return 907 % end 908 end 909 end 910 set(handles.uvmat,'UserData',UvData) 898 911 899 912 %% set index navigation options and refresh plots … … 2533 2546 end 2534 2547 else 2535 % create a default projection menuplane 2536 %UvData.Object{1}.Style='none';%main plotting plane 2537 UvData.Object{1}.ProjMode='projection';%main plotting plane 2538 UvData.Object{1}.DisplayHandle_uvmat=[]; %plane not visible in uvmat 2539 set(handles.list_object_1,'Value',1); 2540 set(handles.list_object_1,'String',{''}); 2548 % create a default projection 2549 % UvData.Object{1}.ProjMode='projection';%main plotting plane 2550 % UvData.Object{1}.DisplayHandle_uvmat=[]; %plane not visible in uvmat 2551 % set(handles.list_object_1,'Value',1); 2552 % set(handles.list_object_1,'String',{''}); 2541 2553 end 2542 2554 % if ~isfield(UvData.Object{1},'plotaxes') … … 2573 2585 % second projection object (view_field display) 2574 2586 IndexObj_2=get(handles.list_object_2,'Value');%selected projection object for the second view 2587 if IndexObj_2==0 2588 IndexObj_2=1; 2589 end 2575 2590 if isequal(get(handles.list_object_2,'Visible'),'on') && IndexObj_2 <= numel(UvData.Object)&& ~isempty(UvData.Object{IndexObj_2}) 2576 2591 IndexObj(2)=IndexObj_2; … … 3949 3964 list_object=get(handles.list_object_1,'String'); 3950 3965 set(handles.list_object_1,'Value',1) 3951 set(handles.list_object_1,'String', list_object(1))3966 set(handles.list_object_1,'String',{''}) 3952 3967 set(handles.list_object_2,'Value',2) 3953 set(handles.list_object_2,'String', [list_object(1);{'...'}])3968 set(handles.list_object_2,'String',{''}) 3954 3969 list_object_2_Callback(hObject, eventdata, handles) 3955 3970 … … 4317 4332 IndexObj=get(handles.list_object_1,'Value'); 4318 4333 str_1=list_str{IndexObj}; 4319 val_2=get(handles.list_object_2,'Value');4320 str_2=get(handles.list_object_2,'String');4321 if isequal(val_2,IndexObj)% if the first selection is equal to the second, it will suppress the second4322 set(handles.list_object_2,'Value',numel(str_2))%select the end of the list ('...')4323 list_object_2_Callback(hObject, eventdata, handles)4324 end4334 % val_2=get(handles.list_object_2,'Value'); 4335 % str_2=get(handles.list_object_2,'String'); 4336 % if isequal(val_2,IndexObj)% if the first selection is equal to the second, it will suppress the second 4337 % set(handles.list_object_2,'Value',numel(str_2))%select the end of the list ('...') 4338 % list_object_2_Callback(hObject, eventdata, handles) 4339 % end 4325 4340 update_object(handles,IndexObj,1,str_1) 4326 4341 … … 4331 4346 list_str=get(handles.list_object_2,'String'); 4332 4347 IndexObj=get(handles.list_object_2,'Value'); 4333 if ischar(list_str) || strcmp(list_str{IndexObj},'...')4348 if ischar(list_str) || isempty(list_str{IndexObj})% || strcmp(list_str{IndexObj},'...') 4334 4349 hview_field=findobj(allchild(0),'Tag','view_field'); 4335 4350 if ~isempty(hview_field) … … 4386 4401 PlotHandles=guidata(hview_field); 4387 4402 end 4388 plot_field(ProjData,PlotHandles.axes3,PlotHandles);4403 %plot_field(ProjData,PlotHandles.axes3,PlotHandles); 4389 4404 set(handles.uvmat,'UserData',UvData) 4390 4405 hother=findobj('Tag','proj_object');%find all the proj objects … … 4670 4685 end 4671 4686 end 4672 end 4673 4687 end 4674 4688 %mask name 4675 4689 RootPath=get(handles.RootPath,'String'); … … 4687 4701 4688 4702 %display the mask 4689 figure; 4703 hfigmask=figure; 4704 set(hfigmask,'Name','mask image') 4690 4705 vec=linspace(0,1,256);%define a linear greyscale colormap 4691 4706 map=[vec' vec' vec']; -
trunk/src/view_field.m
r220 r231 733 733 hhuvmat=guidata(huvmat); 734 734 list_object_2=get(hhuvmat.list_object_2,'String'); 735 set(hhuvmat.list_object_2,'Value', numel(list_object_2))%select the last value ('...')735 set(hhuvmat.list_object_2,'Value',1)%select the last value ('...') 736 736 end 737 737 delete(hObject)
Note: See TracChangeset
for help on using the changeset viewer.