[2] | 1 | %'set_grid':produce grid for PIV with one or two images (stereo case) |
---|
| 2 | %------------------------------------------------------------------------ |
---|
| 3 | % function varargout = set_grid(varargin) |
---|
| 4 | % associated with the GUI set_grid.fig |
---|
| 5 | % |
---|
| 6 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
---|
| 7 | % Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.org. |
---|
| 8 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
---|
| 9 | % This file is part of the toolbox UVMAT. |
---|
| 10 | % |
---|
| 11 | % UVMAT is free software; you can redistribute it and/or modify |
---|
| 12 | % it under the terms of the GNU General Public License as published by |
---|
| 13 | % the Free Software Foundation; either version 2 of the License, or |
---|
| 14 | % (at your option) any later version. |
---|
| 15 | % |
---|
| 16 | % UVMAT is distributed in the hope that it will be useful, |
---|
| 17 | % but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 18 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 19 | % GNU General Public License (file UVMAT/COPYING.txt) for more details. |
---|
| 20 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
---|
| 21 | |
---|
| 22 | function varargout = set_grid(varargin) |
---|
| 23 | |
---|
[84] | 24 | % Last Modified by GUIDE v2.5 23-Apr-2010 15:44:47 |
---|
[2] | 25 | |
---|
[84] | 26 | % Begin initialization code - DO NOT PLOT |
---|
[2] | 27 | gui_Singleton = 1; |
---|
| 28 | gui_State = struct('gui_Name', mfilename, ... |
---|
| 29 | 'gui_Singleton', gui_Singleton, ... |
---|
| 30 | 'gui_OpeningFcn', @set_grid_OpeningFcn, ... |
---|
| 31 | 'gui_OutputFcn', @set_grid_OutputFcn, ... |
---|
| 32 | 'gui_LayoutFcn', [] , ... |
---|
| 33 | 'gui_Callback', []); |
---|
[315] | 34 | % if nargin & isstr(varargin{1}) |
---|
| 35 | % gui_State.gui_Callback = str2func(varargin{1}); |
---|
| 36 | % end |
---|
| 37 | if nargin && ischar(varargin{1}) |
---|
[2] | 38 | gui_State.gui_Callback = str2func(varargin{1}); |
---|
| 39 | end |
---|
| 40 | if nargout |
---|
| 41 | [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); |
---|
| 42 | else |
---|
| 43 | gui_mainfcn(gui_State, varargin{:}); |
---|
| 44 | end |
---|
[84] | 45 | % End initialization code - DO NOT PLOT |
---|
[2] | 46 | |
---|
| 47 | %------------------------------------------------------------------- |
---|
| 48 | % --- Executes just before set_grid is made visible. |
---|
| 49 | %INPUT: |
---|
| 50 | % handles: handles of the set_grid interface elements |
---|
| 51 | %'IndexObj': index of the object (on the UvData list) that set_grid will modify |
---|
| 52 | % if =[] or absent: index still undefined (create mode in uvmat) |
---|
| 53 | % if=0; no associated object (used for series), the button 'PLOT' is then unvisible |
---|
| 54 | %'data': read from an existing object selected in the interface |
---|
| 55 | % .TITLE : class of object ('POINTS','LINE',....) |
---|
| 56 | % .DX,DY,DZ; meshes for regular grids |
---|
| 57 | % .Coord: object position coordinates |
---|
| 58 | % .ParentButton: handle of the uicontrol object calling the interface |
---|
| 59 | % PlotHandles: set of handles of the elements contolling the plotting of the projected field: |
---|
| 60 | % if =[] or absent, no plot (mask mode in uvmat) |
---|
| 61 | % parameters on the uvmat interface (obtained by 'get_plot_handle.m') |
---|
[84] | 62 | function set_grid_OpeningFcn(hObject, eventdata, handles,inputfile,CoordType) |
---|
[2] | 63 | |
---|
| 64 | % Choose default command line output for set_grid |
---|
| 65 | handles.output = hObject; |
---|
| 66 | |
---|
| 67 | % Update handles structure |
---|
| 68 | guidata(hObject, handles); |
---|
| 69 | |
---|
| 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 |
---|
| 73 | set(hObject,'DeleteFcn',@closefcn) |
---|
[84] | 74 | % set(handles.TITLE,'Value',1) |
---|
| 75 | %set(handles.ObjectStyle,'Value',1) |
---|
| 76 | %set(handles.ProjMode,'Value',1) |
---|
[2] | 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] | 84 | if exist('CoordType','var') |
---|
| 85 | if strcmp(CoordType,'px') |
---|
| 86 | set(handles.MenuCoord,'Value',2) |
---|
| 87 | end |
---|
| 88 | end |
---|
[2] | 89 | |
---|
| 90 | % --- Outputs from this function are returned to the command line. |
---|
| 91 | function varargout = set_grid_OutputFcn(hObject, eventdata, handles) |
---|
| 92 | % Get default command line output from handles structure |
---|
| 93 | varargout{1} = handles.output; |
---|
| 94 | varargout{2}=handles; |
---|
| 95 | |
---|
| 96 | |
---|
| 97 | %----------------------------------------------------- |
---|
| 98 | % --- Executes on button press in import. |
---|
| 99 | function import_Callback(hObject, eventdata, handles) |
---|
| 100 | %get the object file |
---|
| 101 | oldfile=''; |
---|
| 102 | huvmat=findobj('Tag','uvmat'); |
---|
| 103 | if isempty(huvmat) |
---|
| 104 | huvmat=findobj(allchild(0),'Name','series'); |
---|
| 105 | end |
---|
| 106 | hchild=get(huvmat,'Children'); |
---|
| 107 | hrootpath=findobj(hchild,'Tag','RootPath'); |
---|
| 108 | oldfile=get(hrootpath,'String'); |
---|
| 109 | if iscell(oldfile) |
---|
| 110 | oldfile=oldfile{1}; |
---|
| 111 | end |
---|
| 112 | %[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 name |
---|
| 119 | testblank=findstr(fileinput,' ');%look for blanks |
---|
| 120 | if ~isempty(testblank) |
---|
| 121 | errordlg('forbidden input file name: contain blanks') |
---|
| 122 | return |
---|
| 123 | end |
---|
| 124 | sizf=size(fileinput); |
---|
| 125 | if (~ischar(fileinput)|~isequal(sizf(1),1)),return;end |
---|
| 126 | |
---|
| 127 | %read the file |
---|
| 128 | 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 | break |
---|
| 138 | end |
---|
| 139 | end |
---|
| 140 | end |
---|
| 141 | |
---|
| 142 | ProjMode_Callback(hObject, eventdata, handles);%visualize the appropriate edit boxes |
---|
| 143 | 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 | else |
---|
| 149 | warndlg('unknown CoordType (px or phys) in set_grid.m') |
---|
| 150 | end |
---|
| 151 | end |
---|
| 152 | if isfield(s,'XMax') |
---|
| 153 | set(handles.XMax,'String',s.XMax) |
---|
| 154 | end |
---|
| 155 | if isfield(s,'XMin') |
---|
| 156 | set(handles.XMin,'String',s.XMin) |
---|
| 157 | end |
---|
| 158 | if isfield(s,'YMax') |
---|
| 159 | set(handles.YMax,'String',s.YMax) |
---|
| 160 | end |
---|
| 161 | if isfield(s,'YMin') |
---|
| 162 | set(handles.YMin,'String',s.YMin) |
---|
| 163 | end |
---|
| 164 | if isfield(s,'DX') |
---|
| 165 | set(handles.DX,'String',s.DX) |
---|
| 166 | end |
---|
| 167 | if isfield(s,'DY') |
---|
| 168 | set(handles.DY,'String',s.DY) |
---|
| 169 | end |
---|
| 170 | if ~isfield(s,'Coord') |
---|
| 171 | XObject='0';%default |
---|
| 172 | YObject='0'; |
---|
| 173 | elseif ischar(s.Coord) |
---|
| 174 | line=str2num(s.Coord); |
---|
| 175 | XObject=num2str(line(1)); |
---|
| 176 | YObject=num2str(line(2)); |
---|
| 177 | else |
---|
| 178 | 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 | end |
---|
| 183 | end |
---|
| 184 | set(handles.XObject,'String',XObject) |
---|
| 185 | set(handles.YObject,'String',YObject) |
---|
| 186 | %METTRA A JOUR ASPECT DE L'INTERFACE (COMME set_grid_Opening |
---|
| 187 | |
---|
| 188 | %---------------------------------------------------- |
---|
| 189 | % executed when closing: set the parent interface button to value 0 |
---|
| 190 | function closefcn(gcbo,eventdata) |
---|
| 191 | huvmat=findobj(allchild(0),'Name','uvmat');%find the current uvmat interface handle |
---|
| 192 | parent_button=findobj(huvmat,'Tag','grid'); |
---|
| 193 | if ~isempty(parent_button) |
---|
| 194 | set(parent_button,'Value',0)%put unactivated buttons to green |
---|
| 195 | tag=get(parent_button,'Tag'); |
---|
| 196 | if isequal(tag,'edit') |
---|
| 197 | set(parent_button,'BackgroundColor',[0.7 0.7 0.7]); |
---|
| 198 | else |
---|
| 199 | set(parent_button,'BackgroundColor',[0 1 0]); |
---|
| 200 | end |
---|
| 201 | end |
---|
| 202 | |
---|
| 203 | %----------------------------------------------------------------------- |
---|
[84] | 204 | % --- Executes on button press in plot: PLOT the defined object and its projected field |
---|
| 205 | function plot_Callback(hObject, eventdata, handles) |
---|
| 206 | grid_pix_A=get_grid(handles); |
---|
| 207 | huvmat=uvmat(get(handles.image_1,'String')); |
---|
| 208 | 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); |
---|
| 212 | hold on |
---|
| 213 | plot(grid_pix_A(:,1),grid_pix_A(:,2),'.') |
---|
[2] | 214 | |
---|
[84] | 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),'.') |
---|
[2] | 225 | |
---|
[84] | 226 | |
---|
| 227 | |
---|
[2] | 228 | % --- Executes on button press in MenuCoord. |
---|
| 229 | function MenuCoord_Callback(hObject, eventdata, handles) |
---|
| 230 | |
---|
| 231 | |
---|
| 232 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
| 233 | % --- Executes on button press in delete. |
---|
| 234 | function delete_Callback(hObject, eventdata, handles) |
---|
| 235 | |
---|
| 236 | %SetData=get(gcbf,'UserData');%get the interface data |
---|
| 237 | %IndexObj=SetData.IndexObj; |
---|
| 238 | huvmat=findobj('Name','uvmat');%find the current uvmat interface handle |
---|
| 239 | UvData=get(huvmat,'UserData');%Data associated to the current uvmat interface |
---|
| 240 | if isfield(UvData,'CurrentObjectIndex') |
---|
| 241 | IndexObj=UvData.CurrentObjectIndex; |
---|
| 242 | else |
---|
| 243 | IndexObj=[]; |
---|
| 244 | end |
---|
| 245 | delete_object(IndexObj); |
---|
| 246 | |
---|
| 247 | |
---|
| 248 | % ------------------------------------------------------ |
---|
| 249 | function save_Callback(hObject, eventdata, handles) |
---|
| 250 | % ------------------------------------------------------ |
---|
[84] | 251 | [grid_pix_A,grid_pix_B]=get_grid(handles); |
---|
| 252 | |
---|
| 253 | %ECRIRE FICHIERS |
---|
| 254 | nbpointsA=size(grid_pix_A); |
---|
| 255 | XA=grid_pix_A(:,1); |
---|
| 256 | YA=grid_pix_A(:,2); |
---|
| 257 | unitcolumn=32*ones(size(XA)); |
---|
| 258 | Xchar=num2str(XA); |
---|
| 259 | blanc=char(unitcolumn); |
---|
| 260 | Ychar=num2str(YA); |
---|
| 261 | tete=['1 ' num2str(nbpointsA(1))]; |
---|
| 262 | txt=[Xchar blanc Ychar]; |
---|
| 263 | textgrid={tete;txt}; |
---|
| 264 | textout=char(textgrid); |
---|
| 265 | imageA=get(handles.image_1,'String'); |
---|
[342] | 266 | RootPath=fileparts_uvmat(imageA); |
---|
| 267 | %[Pathsub]=name2display(imageA); |
---|
| 268 | Answer = msgbox_uvmat('INPUT_TXT','grid file name (*.grid)',fullfile(RootPath,'gridA.grid')); |
---|
[84] | 269 | % Answer = inputdlg('grid file name (*.grid)',' ',1,{fullfile(Pathsub,'gridA.grid')},'on'); |
---|
| 270 | dlmwrite(Answer,textout,''); |
---|
| 271 | msgbox_uvmat('CONFIRMATION',[Answer ' written as ASCII text file']); |
---|
| 272 | if ~isempty(grid_pix_B) |
---|
| 273 | nbpointsB=size(grid_pix_B); |
---|
| 274 | XB=grid_pix_B(:,1); |
---|
| 275 | YB=grid_pix_B(:,2); |
---|
| 276 | unitcolumn=32*ones(size(XB)); |
---|
| 277 | Xchar=num2str(XB); |
---|
| 278 | blanc=char(unitcolumn); |
---|
| 279 | Ychar=num2str(YB); |
---|
| 280 | tete=['1 ' num2str(nbpointsB(1))]; |
---|
| 281 | txt=[Xchar blanc Ychar]; |
---|
| 282 | textgrid={tete;txt}; |
---|
| 283 | textout=char(textgrid); |
---|
[342] | 284 | Answer = msgbox_uvmat('INPUT_TXT','grid file name (*.grid)',fullfile(RootPath,'gridB.grid')); |
---|
[84] | 285 | dlmwrite(Answer,textout,''); |
---|
| 286 | msgbox_uvmat('CONFIRMATION',[Answer ' written as ASCII text file']); |
---|
| 287 | end |
---|
| 288 | |
---|
| 289 | %------------------------- |
---|
[342] | 290 | function [grid_pix_A,grid_pix_B]=get_grid(handles) |
---|
[84] | 291 | %Object=read_set_object(handles);%read the set_grid interface; |
---|
| 292 | 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')); |
---|
[342] | 299 | array_realx=XMin:DX:XMax; |
---|
| 300 | array_realy=YMin:DY:YMax; |
---|
[84] | 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); |
---|
[2] | 307 | |
---|
| 308 | imageA=get(handles.image_1,'String'); |
---|
| 309 | imageB=get(handles.image_2,'String'); |
---|
| 310 | testB=1; |
---|
[46] | 311 | if isempty(imageA) || isequal(imageA,'') |
---|
| 312 | if isempty(imageB) || isequal(imageB,'') |
---|
[38] | 313 | msgbox_uvmat('ERROR','at least one image file name must be introduced') |
---|
[2] | 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) |
---|
| 325 | msgbox_uvmat('ERROR',['input image file' imageA 'does not exist']) |
---|
| 326 | return |
---|
| 327 | end |
---|
[342] | 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)); |
---|
[2] | 331 | if isempty(form)% if the extension corresponds to an image format recognized by Matlab |
---|
[46] | 332 | msgbox_uvmat('ERROR',['error: ' imageA ' is not an image name recognized by Matlab ']) |
---|
[2] | 333 | return |
---|
| 334 | end |
---|
[342] | 335 | fileAxml=[fullfile(RootPath,RootFile) '.xml']; |
---|
[2] | 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 |
---|
[84] | 343 | MenuCoord=get(handles.MenuCoord,'String'); |
---|
| 344 | val=get(handles.MenuCoord,'Value'); |
---|
| 345 | if isempty(tsaiA)||strcmp(MenuCoord{val},'px') |
---|
[73] | 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 |
---|
[2] | 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) |
---|
[38] | 361 | msgbox_uvmat('ERROR',['input image file' imageB 'does not exist']) |
---|
[2] | 362 | return |
---|
| 363 | end |
---|
[342] | 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)); |
---|
[2] | 367 | if isempty(form)% if the extension corresponds to an image format recognized by Matlab |
---|
[342] | 368 | msgbox_uvmat('ERROR',['error: ' imageB ' is not an image name recognized by Matlab ']) |
---|
| 369 | return |
---|
[2] | 370 | end |
---|
[342] | 371 | fileBxml=[fullfile(RootPath,RootFile) '.xml']; |
---|
| 372 | [XmlDataB,error]=imadoc2struct(fileBxml); |
---|
[2] | 373 | if isfield(XmlDataB,'GeometryCalib') |
---|
[342] | 374 | tsaiB=XmlDataB.GeometryCalib; |
---|
[2] | 375 | else |
---|
[342] | 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,... |
---|
[2] | 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); |
---|
[342] | 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; |
---|
[2] | 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); |
---|
[84] | 406 | if isempty(tsaiA)||strcmp(MenuCoord{val},'px') |
---|
[73] | 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 |
---|
[2] | 412 | if testB |
---|
| 413 | [grid_pix_B(:,1),grid_pix_B(:,2)]=px_XYZ(tsaiB,grid_real2(:,1),grid_real2(:,2)); |
---|
| 414 | end |
---|
| 415 | |
---|
| 416 | |
---|
| 417 | |
---|
[84] | 418 | %------------------------------------------------------------------------ |
---|
[2] | 419 | % --- Executes on button press in HELP. |
---|
| 420 | function HELP_Callback(hObject, eventdata, handles) |
---|
[84] | 421 | %------------------------------------------------------------------------ |
---|
[2] | 422 | path_to_uvmat=which ('uvmat');% check the path of uvmat |
---|
| 423 | pathelp=fileparts(path_to_uvmat); |
---|
[84] | 424 | helpfile=fullfile(pathelp,'uvmat_doc','uvmat_doc.html'); |
---|
[2] | 425 | if isempty(dir(helpfile)), errordlg('Please put the help file uvmat_doc.html in the directory UVMAT/UVMAT_DOC') |
---|
| 426 | else |
---|
| 427 | web([helpfile '#set_grid']) |
---|
| 428 | end |
---|
| 429 | |
---|
[84] | 430 | |
---|
| 431 | |
---|