Changeset 576 for trunk/src/set_grid.m
- Timestamp:
- Mar 4, 2013, 8:13:53 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/set_grid.m
r342 r576 22 22 function varargout = set_grid(varargin) 23 23 24 % Last Modified by GUIDE v2.5 23-Apr-2010 15:44:4724 % Last Modified by GUIDE v2.5 01-Mar-2013 22:41:43 25 25 26 26 % Begin initialization code - DO NOT PLOT … … 32 32 'gui_LayoutFcn', [] , ... 33 33 'gui_Callback', []); 34 % if nargin & isstr(varargin{1}) 35 % gui_State.gui_Callback = str2func(varargin{1}); 36 % end 34 37 35 if nargin && ischar(varargin{1}) 38 36 gui_State.gui_Callback = str2func(varargin{1}); … … 43 41 gui_mainfcn(gui_State, varargin{:}); 44 42 end 45 % End initialization code - DO NOT PLOT46 43 47 44 %------------------------------------------------------------------- … … 54 51 %'data': read from an existing object selected in the interface 55 52 % .TITLE : class of object ('POINTS','LINE',....) 56 % . DX,DY,DZ; meshes for regular grids53 % .num_DX,num_DY,DZ; meshes for regular grids 57 54 % .Coord: object position coordinates 58 55 % .ParentButton: handle of the uicontrol object calling the interface … … 60 57 % if =[] or absent, no plot (mask mode in uvmat) 61 58 % parameters on the uvmat interface (obtained by 'get_plot_handle.m') 62 function set_grid_OpeningFcn(hObject, eventdata, handles, inputfile,CoordType)59 function set_grid_OpeningFcn(hObject, eventdata, handles,InputFile,InputField) 63 60 64 61 % Choose default command line output for set_grid … … 68 65 guidata(hObject, handles); 69 66 70 %default 71 % set(hObject,'Unit','Normalized')% set the unit normalized to the screen size 72 % set(hObject,'Position',[0.7 0.1 0.25 0.5])%set the position of the set_grid interface 67 %default 73 68 set(hObject,'DeleteFcn',@closefcn) 74 % set(handles.TITLE,'Value',1) 75 %set(handles.ObjectStyle,'Value',1) 76 %set(handles.ProjMode,'Value',1) 77 set(handles.MenuCoord,'ListboxTop',1) 78 set(handles.MenuCoord,'Value',1); 79 set(handles.MenuCoord,'String',{'phys';'px'}); 80 if exist('inputfile','var')& ~isempty(inputfile) 81 set(handles.image_1,'String',inputfile) 82 set(handles.image_2,'String',inputfile) 83 end 84 if exist('CoordType','var') 85 if strcmp(CoordType,'px') 86 set(handles.MenuCoord,'Value',2) 87 end 69 set(hObject,'WindowButtonDownFcn',{'mouse_down'})%set mouse click action function 70 set(handles.CoordType,'ListboxTop',1) 71 set(handles.CoordType,'Value',1); 72 set(handles.CoordType,'String',{'phys';'px'}); 73 if exist('InputFile','var') 74 set(handles.ImageA,'String',InputFile) 75 end 76 77 %% use InputField input from uvmat 78 check_pixel=0; 79 if exist('InputField','var') 80 if strcmp(InputField.CoordUnit,'pixel') 81 set(handles.CoordType,'Value',2) 82 set(handles.TxtWarning,'Visible','on') 83 Mesh=20;%default mesh in pixel 84 check_pixel=1; 85 else 86 set(handles.CoordType,'Value',1) 87 InputField.CoordMesh=20*InputField.CoordMesh; % about 20 pixels 88 % adjust the mesh to a value 1, 2 , 5 *10^n 89 ord=10^(floor(log10(InputField.CoordMesh)));%order of magnitude 90 if InputField.CoordMesh/ord>=5 91 Mesh=5*ord; 92 elseif InputField.CoordMesh/ord>=2 93 Mesh=2*ord; 94 else 95 Mesh=ord; 96 end 97 end 98 Input.DX=Mesh; 99 Input.DY=Mesh; 100 Input.XMin=(Mesh/2)*ceil(InputField.XMin/(Mesh/2))-0.5*check_pixel; 101 Input.XMax=Input.XMin+Mesh*floor((InputField.XMax-Input.XMin)/Mesh)-0.5*check_pixel; 102 Input.YMin=(Mesh/2)*ceil(InputField.YMin/(Mesh/2))-0.5*check_pixel; 103 Input.YMax=Input.YMin+Mesh*floor((InputField.YMax-Input.YMin)/Mesh)-0.5*check_pixel; 104 errormsg=fill_GUI(Input,handles); 88 105 end 89 106 … … 93 110 varargout{1} = handles.output; 94 111 varargout{2}=handles; 95 96 97 %-----------------------------------------------------98 % --- Executes on button press in import.99 function import_Callback(hObject, eventdata, handles)100 %get the object file101 oldfile='';102 huvmat=findobj('Tag','uvmat');103 if isempty(huvmat)104 huvmat=findobj(allchild(0),'Name','series');105 end106 hchild=get(huvmat,'Children');107 hrootpath=findobj(hchild,'Tag','RootPath');108 oldfile=get(hrootpath,'String');109 if iscell(oldfile)110 oldfile=oldfile{1};111 end112 %[FileName,PathName] = uigetfile('*.civ','Select a .civ file',oldfile)113 [FileName, PathName, filterindex] = uigetfile( ...114 {'*.xml;*.mat', ' (*.xml,*.mat)';115 '*.xml', '.xml files '; ...116 '*.mat', '.mat matlab files '}, ...117 'Pick a file',oldfile);118 fileinput=[PathName FileName];%complete file name119 testblank=findstr(fileinput,' ');%look for blanks120 if ~isempty(testblank)121 errordlg('forbidden input file name: contain blanks')122 return123 end124 sizf=size(fileinput);125 if (~ischar(fileinput)|~isequal(sizf(1),1)),return;end126 127 %read the file128 t=xmltree(fileinput);129 s=convert(t);130 testmode=0;131 if isfield(s,'ProjMode')132 menu=get(handles.ProjMode,'String');133 for iline=1:length(menu)134 if isequal(menu{iline},s.ProjMode)135 set(handles.ProjMode,'Value',iline)136 testmode=1;137 break138 end139 end140 end141 142 ProjMode_Callback(hObject, eventdata, handles);%visualize the appropriate edit boxes143 if isfield(s,'CoordType')144 if isequal(s.CoordType,'phys')145 set(handles.MenuCoord,'Value',1)146 elseif isequal(s.CoordType,'px')147 set(handles.MenuCoord,'Value',2)148 else149 warndlg('unknown CoordType (px or phys) in set_grid.m')150 end151 end152 if isfield(s,'XMax')153 set(handles.XMax,'String',s.XMax)154 end155 if isfield(s,'XMin')156 set(handles.XMin,'String',s.XMin)157 end158 if isfield(s,'YMax')159 set(handles.YMax,'String',s.YMax)160 end161 if isfield(s,'YMin')162 set(handles.YMin,'String',s.YMin)163 end164 if isfield(s,'DX')165 set(handles.DX,'String',s.DX)166 end167 if isfield(s,'DY')168 set(handles.DY,'String',s.DY)169 end170 if ~isfield(s,'Coord')171 XObject='0';%default172 YObject='0';173 elseif ischar(s.Coord)174 line=str2num(s.Coord);175 XObject=num2str(line(1));176 YObject=num2str(line(2));177 else178 for i=1:length(s.Coord)179 line=str2num(s.Coord{i});180 XObject{i}=num2str(line(1));181 YObject{i}=num2str(line(2));182 end183 end184 set(handles.XObject,'String',XObject)185 set(handles.YObject,'String',YObject)186 %METTRA A JOUR ASPECT DE L'INTERFACE (COMME set_grid_Opening187 112 188 113 %---------------------------------------------------- … … 196 121 if isequal(tag,'edit') 197 122 set(parent_button,'BackgroundColor',[0.7 0.7 0.7]); 198 else 123 else 199 124 set(parent_button,'BackgroundColor',[0 1 0]); 200 125 end … … 204 129 % --- Executes on button press in plot: PLOT the defined object and its projected field 205 130 function plot_Callback(hObject, eventdata, handles) 206 grid_pix_A=get_grid(handles);207 huvmat= uvmat(get(handles.image_1,'String'));131 [grid_pix_A,grid_pix_B,grid_phys]=get_grid(read_GUI(handles.set_grid)); 132 huvmat=findobj(allchild(0),'tag','uvmat'); 208 133 hhuvmat=guidata(huvmat); 209 set(hhuvmat.transform_fct,'Value',1) 210 uvmat('run0_Callback',hObject,eventdata,hhuvmat); %file input with xml reading in uvmat 211 axes(hhuvmat.axes3); 134 axes(hhuvmat.PlotAxes); 212 135 hold on 213 plot(grid_pix_A(:,1),grid_pix_A(:,2),'.') 214 215 % --- Executes on button press in plot_2. 216 function plot_2_Callback(hObject, eventdata, handles) 217 [grid_pix_A,grid_pix_B]=get_grid(handles); 218 huvmat=uvmat(get(handles.image_2,'String')); 219 hhuvmat=guidata(huvmat); 220 set(hhuvmat.transform_fct,'Value',1) 221 uvmat('run0_Callback',hObject,eventdata,hhuvmat); %file input with xml reading in uvmat 222 axes(hhuvmat.axes3); 223 hold on 224 plot(grid_pix_B(:,1),grid_pix_B(:,2),'.') 225 226 227 228 % --- Executes on button press in MenuCoord. 229 function MenuCoord_Callback(hObject, eventdata, handles) 230 136 UvData=get(huvmat,'UserData'); 137 if isfield(UvData.Field, 'CoordUnit')&& strcmp(UvData.Field.CoordUnit,'pixel') 138 plot(grid_pix_A(:,1),grid_pix_A(:,2),'.') 139 else 140 plot(grid_phys(:,1),grid_phys(:,2),'.') 141 end 142 143 %% display grid in second image defiend 144 if ~isempty(grid_pix_B) 145 hviewfield=view_field(get(handles.imageB,'String')); 146 hhviewfield=guidata(hviewfield); 147 axes(hhviewfield.PlotAxes); 148 hold on 149 if isfield(UvData.Field, 'CoordUnit')&& strcmp(UvData.Field.CoordUnit,'pixel') 150 plot(grid_pix_B(:,1),grid_pix_B(:,2),'.') 151 else 152 plot(grid_phys(:,1),grid_phys(:,2),'.') 153 end 154 end 155 156 %------------------------------------------------------------------------ 157 % --- Executes on button press in CoordType. 158 function CoordType_Callback(hObject, eventdata, handles) 159 %------------------------------------------------------------------------ 160 set(handles.num_XMin,'String','') 161 set(handles.num_XMax,'String','') 162 set(handles.num_DX,'String','') 163 set(handles.num_YMin,'String','') 164 set(handles.num_YMax,'String','') 165 set(handles.num_DY,'String','') 166 set(handles.num_Z,'String','') 167 if isequal(get(handles.CoordType,'Value'),2) 168 set(handles.TxtWarning,'visible','on') 169 else 170 set(handles.TxtWarning,'visible','on') 171 end 231 172 232 173 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% … … 247 188 248 189 % ------------------------------------------------------ 249 function save_Callback(hObject, eventdata, handles)190 function Save_Callback(hObject, eventdata, handles) 250 191 % ------------------------------------------------------ 251 [grid_pix_A,grid_pix_B]=get_grid(handles); 192 [grid_pix_A,grid_pix_B]=get_grid(read_GUI(handles.set_grid)); 193 252 194 253 195 %ECRIRE FICHIERS 254 196 nbpointsA=size(grid_pix_A); 255 XA=grid_pix_A(:,1); 197 XA=grid_pix_A(:,1);%index=position+0.5 rounded at the nearest integer value 256 198 YA=grid_pix_A(:,2); 257 199 unitcolumn=32*ones(size(XA)); … … 263 205 textgrid={tete;txt}; 264 206 textout=char(textgrid); 265 imageA=get(handles. image_1,'String');207 imageA=get(handles.ImageA,'String'); 266 208 RootPath=fileparts_uvmat(imageA); 267 %[Pathsub]=name2display(imageA);268 209 Answer = msgbox_uvmat('INPUT_TXT','grid file name (*.grid)',fullfile(RootPath,'gridA.grid')); 269 % Answer = inputdlg('grid file name (*.grid)',' ',1,{fullfile(Pathsub,'gridA.grid')},'on');270 210 dlmwrite(Answer,textout,''); 271 211 msgbox_uvmat('CONFIRMATION',[Answer ' written as ASCII text file']); 272 212 if ~isempty(grid_pix_B) 273 213 nbpointsB=size(grid_pix_B); 274 XB= grid_pix_B(:,1);275 YB= grid_pix_B(:,2);214 XB=round(grid_pix_B(:,1)+0.5);%index=position+0.5 rounded at the nearest integer value 215 YB=round(grid_pix_B(:,2)+0.5); 276 216 unitcolumn=32*ones(size(XB)); 277 217 Xchar=num2str(XB); … … 287 227 end 288 228 289 %------------------------- 290 function [grid_pix_A,grid_pix_B]=get_grid(handles) 291 %Object=read_set_object(handles);%read the set_grid interface; 229 230 %------------------------------------------------------------------------ 231 function [grid_pix_A,grid_pix_B,grid_phys]=get_grid(GUI) 232 %------------------------------------------------------------------------ 292 233 grid_pix_B=[];%default 293 DX=str2num(get(handles.DX,'String')); 294 DY=str2num(get(handles.DY,'String')); 295 XMin=str2num(get(handles.XMin,'String')); 296 XMax=str2num(get(handles.XMax,'String')); 297 YMin=str2num(get(handles.YMin,'String')); 298 YMax=str2num(get(handles.YMax,'String')); 299 array_realx=XMin:DX:XMax; 300 array_realy=YMin:DY:YMax; 301 nx_patch=length(array_realx); 302 ny_patch=length(array_realy); 303 [grid_realx,grid_realy]=meshgrid(array_realx,array_realy); 304 grid_real(:,1)=reshape(grid_realx,nx_patch*ny_patch,1); 305 grid_real(:,2)=reshape(grid_realy,nx_patch*ny_patch,1); 306 grid_real(:,3)=zeros(nx_patch*ny_patch,1); 307 308 imageA=get(handles.image_1,'String'); 309 imageB=get(handles.image_2,'String'); 310 testB=1; 311 if isempty(imageA) || isequal(imageA,'') 312 if isempty(imageB) || isequal(imageB,'') 313 msgbox_uvmat('ERROR','at least one image file name must be introduced') 314 else 315 imageA=imageB; 316 testB=0; 317 end 318 end 319 if isempty(imageB) || isequal(imageB,'') || isequal(imageA,imageB) 320 testB=0; 321 end 322 323 testexist=exist(imageA,'file'); 324 if isequal(testexist,0) 234 array_x=GUI.XMin:GUI.DX:GUI.XMax;% array of x values 235 array_y=GUI.YMin:GUI.DY:GUI.YMax;% array of y values 236 [grid_x,grid_y]=meshgrid(array_x,array_y);% matrices of x and y values 237 grid_x=reshape(grid_x,[],1); %matrix of x values reshaped in line 238 grid_y=reshape(grid_y,[],1);%matrix of y values reshaped in line 239 % grid_z=zeros(nx_patch*ny_patch,1);% plane coordinates (TODO: 3D grids) 240 241 %% check the input image A 242 if ~exist(GUI.ImageA,'file') 325 243 msgbox_uvmat('ERROR',['input image file' imageA 'does not exist']) 326 244 return 327 245 end 328 %[Pathsub,RootFile,field_count,str2,str_a,str_b,FileExt,NomType,SubDir]=name2display(imageA); 329 [RootPath,~,RootFile,~,~,~,~,FileExt]=fileparts_uvmat(imageA); 330 form=imformats(FileExt(2:end)); 331 if isempty(form)% if the extension corresponds to an image format recognized by Matlab 332 msgbox_uvmat('ERROR',['error: ' imageA ' is not an image name recognized by Matlab ']) 333 return 334 end 335 fileAxml=[fullfile(RootPath,RootFile) '.xml']; 336 [XmlDataA,error]=imadoc2struct(fileAxml); 337 if isfield(XmlDataA,'GeometryCalib') 338 tsaiA=XmlDataA.GeometryCalib; 339 else 340 msgbox_uvmat('WARNING','no geometric calibration available for image A') 341 tsaiA=[]; 342 end 343 MenuCoord=get(handles.MenuCoord,'String'); 344 val=get(handles.MenuCoord,'Value'); 345 if isempty(tsaiA)||strcmp(MenuCoord{val},'px') 346 grid_imaA(:,1)=grid_real(:,1); 347 grid_imaA(:,2)=grid_real(:,2); 348 else 349 [grid_imaA(:,1),grid_imaA(:,2)]=px_XYZ(tsaiA,grid_real(:,1),grid_real(:,2),0); 350 end 351 A=imread(imageA); 352 siz=size(A); 353 npxA=siz(2); 354 npyA=siz(1); 355 356 flagA=grid_imaA(:,1)>0 & grid_imaA(:,1)<npxA & grid_imaA(:,2)>0 & grid_imaA(:,2)<npyA; 357 358 if testB 359 testexist=exist(imageB,'file'); 360 if isequal(testexist,0) 361 msgbox_uvmat('ERROR',['input image file' imageB 'does not exist']) 246 [FileType,tild,VideoObject]=get_file_type(GUI.ImageA); 247 switch FileType 248 case {'image','multimage','video','mmreader'}% case of input image or movie OK 249 otherwise 250 msgbox_uvmat('ERROR',['error: ' GUI.ImageA ' is not an image type recognized by Matlab ']) 362 251 return 363 end 364 %[RootPath,RootFile,field_count,str2,str_a,str_b,FileExt,NomType,SubDir]=name2display(imageB); 365 [RootPath,~,RootFile,~,~,~,~,FileExt]=fileparts_uvmat(imageB); 366 form=imformats(FileExt(2:end)); 367 if isempty(form)% if the extension corresponds to an image format recognized by Matlab 368 msgbox_uvmat('ERROR',['error: ' imageB ' is not an image name recognized by Matlab ']) 252 end 253 [RootPath,SubDir,RootFile,tild,tild,tild,tild,FileExt]=fileparts_uvmat(GUI.ImageA); 254 255 %% transform to pixels if the grid is defined in phys coordinates 256 grid_x_imaA=grid_x;%default grid in image A coordinates 257 grid_y_imaA=grid_y; 258 % MenuCoord=get(handles.CoordType,'String');% type of coordinates for grid definition, phys or pixel 259 if strcmp(GUI.CoordType,'phys') 260 fileAxml=fullfile(RootPath,[SubDir '.xml']);% new convention for xml name 261 if ~exist(fileAxml,'file') 262 fileAxml=[fullfile(RootPath,RootFile) '.xml'];% old convention for xml name 263 end 264 tsaiA=[];%default 265 if exist(fileAxml,'file') 266 [XmlDataA,errormsg]=imadoc2struct(fileAxml); 267 if ~isempty(errormsg) 268 msgbox_uvmat('ERROR',['error in ' fileAxml ': ' errormsg]) 269 return 270 end 271 if isfield(XmlDataA,'GeometryCalib') 272 tsaiA=XmlDataA.GeometryCalib; 273 end 274 end 275 if isempty(tsaiA) 276 msgbox_uvmat('WARNING','no geometric calibration available for image A, phys =pixel') 277 else 278 [grid_x_imaA,grid_y_imaA]=px_XYZ(tsaiA,grid_x,grid_y,GUI.Z); 279 end 280 end 281 282 %% detect the grid points which are inside image A 283 A=read_image(GUI.ImageA,FileType,VideoObject,1); 284 npxA=size(A,2); 285 npyA=size(A,1); 286 flag=grid_x_imaA>=1 & grid_x_imaA<=npxA & grid_y_imaA>=1 & grid_y_imaA<=npyA;% ='true' inside the image 287 288 %% detect the grid points which are inside image B if relevant (use for stereo PIV) 289 if isfield(GUI,'ImageB') 290 if ~exist(imageB,'file') 291 msgbox_uvmat('ERROR',['input image file' GUI.ImageB 'does not exist']) 369 292 return 370 293 end 371 fileBxml=[fullfile(RootPath,RootFile) '.xml']; 372 [XmlDataB,error]=imadoc2struct(fileBxml); 373 if isfield(XmlDataB,'GeometryCalib') 374 tsaiB=XmlDataB.GeometryCalib; 375 else 376 msgbox_uvmat('WARNING','no geometric calibration available for image B') 377 tsaiB=[]; 378 end 379 %[error,Heading,NomType_read,ext_ima_read,time,TimeUnit,mode,NbSlice,... 380 % npxB,npyB,tsaiB]=read_imadoc(fileBxml,0); 381 [grid_imaB(:,1),grid_imaB(:,2)]=px_XYZ(tsaiB,grid_real(:,1),grid_real(:,2),0); 382 % if isempty(npxB)|isempty(npyB) 383 B=imread(imageB); 384 siz=size(B); 385 npxB=siz(2); 386 npyB=siz(1); 387 % end 388 flagB=grid_imaB(:,1)>0 & grid_imaB(:,1)<npxB & grid_imaB(:,2)>0 & grid_imaB(:,2)<npyB; 389 end 390 if testB 391 ind_good=find(flagA==1&flagB==1); 392 XimaB=grid_imaB(ind_good,1); 393 YimaB=grid_imaB(ind_good,2); 394 else 395 ind_good=find(flagA==1); 396 end 397 XimaA=grid_imaA(ind_good,1); 398 YimaA=grid_imaA(ind_good,2); 399 400 grid_real_x=grid_real(ind_good,1); 401 grid_real_y=grid_real(ind_good,2); 402 nx_patch_new=length(grid_real_x); 403 grid_real2(:,1)=grid_real_x; 404 grid_real2(:,2)=grid_real_y; 405 grid_real2(:,3)=zeros(nx_patch_new,1); 406 if isempty(tsaiA)||strcmp(MenuCoord{val},'px') 407 grid_pix_A(:,1)=grid_real2(:,1); 408 grid_pix_A(:,2)= grid_real2(:,2); 409 else 410 [grid_pix_A(:,1),grid_pix_A(:,2)]=px_XYZ(tsaiA,grid_real2(:,1),grid_real2(:,2)); 411 end 412 if testB 413 [grid_pix_B(:,1),grid_pix_B(:,2)]=px_XYZ(tsaiB,grid_real2(:,1),grid_real2(:,2)); 414 end 415 294 [RootPathB,SubDirB,RootFileB,tild,tild,tild,tild,FileExt]=fileparts_uvmat(GUI.ImageB); 295 fileBxml=fullfile(RootPathB,[SubDirB '.xml']);% new convention for xml name 296 if ~exist(fileBxml,'file') 297 fileBxml=[fullfile(RootPathB,RootFileB) '.xml'];% old convention for xml name 298 end 299 tsaiB=[];%default 300 if exist(fileBxml,'file') 301 [XmlDataB,errormsg]=imadoc2struct(fileBxml); 302 if ~isempty(errormsg) 303 msgbox_uvmat('ERROR',['error in ' fileAxml ': ' errormsg]) 304 return 305 end 306 if isfield(XmlDataB,'GeometryCalib') 307 tsaiB=XmlDataB.GeometryCalib; 308 end 309 end 310 if isempty(tsaiB) 311 msgbox_uvmat('WARNING','no geometric calibration available for image B, phys =pixel') 312 grid_x_imaB=grid_x; 313 grid_y_imaB=grid_y; 314 else 315 [grid_x_imaB,grid_y_imaB]=px_XYZ(tsaiB,grid_x,grid_y,GUI.Z); 316 end 317 B=imread(GUI.ImageB); 318 npxB=size(B,2); 319 npyB=size(B,1); 320 flagB=grid_x_imaB>=1 & grid_x_imaB<=npxB & grid_y_imaB>=1 & grid_y_imaB<=npyB; 321 flag=flagA & flagB; 322 grid_pix_B(:,1)=round(grid_x_imaB(flag)); 323 grid_pix_B(:,2)=round(grid_y_imaB(flag)); 324 end 325 326 grid_x_imaA=grid_x_imaA(flag); 327 grid_y_imaA=grid_y_imaA(flag); 328 grid_pix_A=[grid_x_imaA grid_y_imaA]; 329 grid_x=grid_x(flag); 330 grid_y=grid_y(flag); 331 grid_phys=[grid_x grid_y]; 332 333 334 function GetImageB_Callback(hObject, eventdata, handles) 335 if isequal(get(handles.GetImageB,'Value'),1) 336 set(handles.ImageB,'Visible','on') 337 [FileName, PathName, filterindex] = uigetfile( ... 338 {'*.*', 'All Files (*.*)'}, ... 339 'Pick the second image file',fileparts(fileparts(get(handles.ImageA,'String')))); 340 ImageB=fullfile(PathName,FileName); 341 [FileType,tild,VideoObject]=get_file_type(ImageB); 342 switch FileType 343 case {'image','multimage','video','mmreader'}% case of input image or movie OK 344 set(handles.ImageB,'String',ImageB) 345 otherwise 346 msgbox_uvmat('ERROR',['error: ' imageB ' is not an image type recognized by Matlab ']) 347 return 348 end 349 else 350 set(handles.ImageB,'Visible','off') 351 end 416 352 417 353 … … 430 366 431 367 368 function ImageA_Callback(hObject, eventdata, handles) 369 % hObject handle to ImageA (see GCBO) 370 % eventdata reserved - to be defined in a future version of MATLAB 371 % handles structure with handles and user data (see GUIDATA) 372 373 % Hints: get(hObject,'String') returns contents of ImageA as text 374 % str2double(get(hObject,'String')) returns contents of ImageA as a double
Note: See TracChangeset
for help on using the changeset viewer.