[2] | 1 | %'geometry_calib': performs geometric calibration from a set of reference points |
---|
| 2 | % |
---|
| 3 | % function varargout = geometry_calib(varargin) |
---|
| 4 | % |
---|
| 5 | %A%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
---|
| 6 | % Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.org. |
---|
| 7 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
---|
| 8 | % This file is part of the toolbox UVMAT. |
---|
| 9 | % |
---|
| 10 | % UVMAT is free software; you can redistribute it and/or modify |
---|
| 11 | % it under the terms of the GNU General Public License as published by |
---|
| 12 | % the Free Software Foundation; either version 2 of the License, or |
---|
| 13 | % (at your option) any later version. |
---|
| 14 | % |
---|
| 15 | % UVMAT is distributed in the hope that it will be useful, |
---|
| 16 | % but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 17 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 18 | % GNU General Public License (file UVMAT/COPYING.txt) for more details. |
---|
| 19 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
---|
| 20 | |
---|
| 21 | function varargout = geometry_calib(varargin) |
---|
| 22 | % GEOMETRY_CALIB M-file for geometry_calib.fig |
---|
| 23 | % GEOMETRY_CALIB, by itself, creates a MenuCoord GEOMETRY_CALIB or raises the existing |
---|
| 24 | % singleton*. |
---|
| 25 | % |
---|
| 26 | % H = GEOMETRY_CALIB returns the handle to a MenuCoord GEOMETRY_CALIB or the handle to |
---|
| 27 | % the existing singleton*. |
---|
| 28 | % |
---|
| 29 | % GEOMETRY_CALIB('CALLBACK',hObject,eventData,handles,...) calls the local |
---|
| 30 | % function named CALLBACK in GEOMETRY_CALIB.M with the given input arguments. |
---|
| 31 | % |
---|
| 32 | % GEOMETRY_CALIB('Property','Value',...) creates a MenuCoord GEOMETRY_CALIB or raises the |
---|
| 33 | % existing singleton*. Starting from the left, property value pairs are |
---|
| 34 | % applied to the GUI before geometry_calib_OpeningFunction gets called. An |
---|
| 35 | % unrecognized property name or invalid value makes property application |
---|
| 36 | % stop. All inputs are passed to geometry_calib_OpeningFcn via varargin. |
---|
| 37 | % |
---|
| 38 | % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one |
---|
| 39 | % instance to run (singleton)". |
---|
| 40 | % |
---|
| 41 | % See also: GUIDE, GUIDATA, GUIHANDLES |
---|
| 42 | |
---|
| 43 | % Edit the above text to modify the response to help geometry_calib |
---|
| 44 | |
---|
| 45 | % Last Modified by GUIDE v2.5 28-Dec-2009 23:41:18 |
---|
| 46 | |
---|
| 47 | % Begin initialization code - DO NOT edit |
---|
| 48 | gui_Singleton = 1; |
---|
| 49 | gui_State = struct('gui_Name', mfilename, ... |
---|
| 50 | 'gui_Singleton', gui_Singleton, ... |
---|
| 51 | 'gui_OpeningFcn', @geometry_calib_OpeningFcn, ... |
---|
| 52 | 'gui_OutputFcn', @geometry_calib_OutputFcn, ... |
---|
| 53 | 'gui_LayoutFcn', [] , ... |
---|
| 54 | 'gui_Callback', []); |
---|
| 55 | if nargin & isstr(varargin{1}) |
---|
| 56 | gui_State.gui_Callback = str2func(varargin{1}); |
---|
| 57 | end |
---|
| 58 | |
---|
| 59 | if nargout |
---|
| 60 | [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); |
---|
| 61 | else |
---|
| 62 | gui_mainfcn(gui_State, varargin{:}); |
---|
| 63 | end |
---|
| 64 | % End initialization code - DO NOT edit |
---|
| 65 | |
---|
| 66 | |
---|
| 67 | % --- Executes just before geometry_calib is made visible. |
---|
| 68 | %INPUT: |
---|
| 69 | %handles: handles of the geometry_calib interface elements |
---|
| 70 | % PlotHandles: set of handles of the elements contolling the plotting |
---|
| 71 | % parameters on the uvmat interface (obtained by 'get_plot_handle.m') |
---|
| 72 | function geometry_calib_OpeningFcn(hObject, eventdata, handles, handles_uvmat,pos,inputfile) |
---|
| 73 | set(handles.Phi,'TooltipString','Phi: rotation angle of the physical point coordiantes (in degrees)')% TO PUT IN GUIDE |
---|
| 74 | % Choose default command line output for geometry_calib |
---|
| 75 | handles.output = hObject; |
---|
| 76 | |
---|
| 77 | % Update handles structure |
---|
| 78 | guidata(hObject, handles); |
---|
| 79 | movegui(hObject,'east');% position the GUI ton the right of the screen |
---|
| 80 | if exist('handles_uvmat','var') %& isfield(data,'ParentButton') |
---|
| 81 | set(hObject,'DeleteFcn',{@closefcn,handles_uvmat})% |
---|
| 82 | end |
---|
| 83 | %set the position of the interface |
---|
| 84 | if exist('pos','var')& length(pos)>2 |
---|
| 85 | pos_gui=get(hObject,'Position'); |
---|
| 86 | pos_gui(1)=pos(1); |
---|
| 87 | pos_gui(2)=pos(2); |
---|
| 88 | set(hObject,'Position',pos_gui); |
---|
| 89 | end |
---|
| 90 | inputxml=''; |
---|
| 91 | if exist('inputfile','var')& ~isempty(inputfile) |
---|
| 92 | [Path,Name,ext]=fileparts(inputfile); |
---|
| 93 | form=imformats(ext([2:end])); |
---|
| 94 | if ~isempty(form)% if the input file is an image |
---|
| 95 | struct.XmlInputfile=inputfile; |
---|
| 96 | set(hObject,'UserData',struct) |
---|
| 97 | [Pathsub,RootFile,field_count,str2,str_a,str_b,ext,nom_type,subdir]=name2display(inputfile); |
---|
| 98 | inputxml=[fullfile(Pathsub,RootFile) '.xml']; |
---|
| 99 | end |
---|
| 100 | end |
---|
| 101 | set(handles.ListCoord,'String',{''}) |
---|
| 102 | if exist(inputxml,'file') |
---|
| 103 | loadfile(handles,inputxml)% load the point coordiantes existing in the xml file |
---|
| 104 | end |
---|
| 105 | |
---|
| 106 | set(handles.ListCoord,'KeyPressFcn',{@key_press_fcn,handles})%set keyboard action function |
---|
| 107 | %set(hObject,'KeyPressFcn',{'keyboard_callback',handles})%set keyboard action function on uvmat interface when geometry_calib is on top |
---|
| 108 | %htable=uitable(10,5) |
---|
| 109 | %set(htable,'ColumnNames',{'x','y','z','X(pixels)','Y(pixels)'}) |
---|
| 110 | |
---|
| 111 | % --- Outputs from this function are returned to the command line. |
---|
| 112 | function varargout = geometry_calib_OutputFcn(hObject, eventdata, handles) |
---|
| 113 | % varargout cell array for returning output args (see VARARGOUT); |
---|
| 114 | % hObject handle to figure |
---|
| 115 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 116 | % handles structure with handles and user data (see GUIDATA) |
---|
| 117 | |
---|
| 118 | % Get default command line output from handles structure |
---|
| 119 | varargout{1} = handles.output; |
---|
| 120 | varargout{2}=handles; |
---|
| 121 | |
---|
| 122 | %------------ |
---|
| 123 | function Phi_Callback(hObject, eventdata, handles) |
---|
| 124 | |
---|
| 125 | |
---|
| 126 | |
---|
| 127 | |
---|
| 128 | %-------------------------------------------------- |
---|
| 129 | %read input xml file and update the edit boxes |
---|
| 130 | function loadfile(handles,fileinput) |
---|
| 131 | |
---|
| 132 | %read the input xml file |
---|
| 133 | t=xmltree(fileinput); |
---|
| 134 | s=convert(t);%convert to matlab structure |
---|
| 135 | %read data currently displayed on the interface |
---|
| 136 | PointCoord=[]; |
---|
| 137 | Coord_cell=get(handles.ListCoord,'String'); |
---|
| 138 | data=read_geometry_calib(Coord_cell); |
---|
| 139 | %data=read_geometry_calib(handles); |
---|
| 140 | Coord=[]; %default |
---|
| 141 | if isfield(data,'Coord') |
---|
| 142 | Coord=data.Coord; |
---|
| 143 | end |
---|
| 144 | TabChar_0=get(handles.ListCoord,'String'); |
---|
| 145 | nbcoord_0=size(TabChar_0,1); |
---|
| 146 | if isequal(get(handles.edit_append,'Value'),2) %edit mode A REVOIR |
---|
| 147 | val=get(handles.ListCoord,'Value')-1; |
---|
| 148 | else |
---|
| 149 | val=length(TabChar_0); |
---|
| 150 | end |
---|
| 151 | nbcoord=0; |
---|
| 152 | |
---|
| 153 | %case of calibration (ImaDoc) input file |
---|
| 154 | hcalib=get(handles.calib_type,'parent'); |
---|
| 155 | CalibData=get(hcalib,'UserData'); |
---|
| 156 | CalibData.XmlInput=fileinput; |
---|
| 157 | if isfield(s,'Heading') |
---|
| 158 | CalibData.Heading=s.Heading; |
---|
| 159 | end |
---|
| 160 | |
---|
| 161 | set(hcalib,'UserData',CalibData);%store the heading in the interface 'UserData' |
---|
| 162 | if isfield(s,'GeometryCalib') |
---|
| 163 | Calib=s.GeometryCalib; |
---|
| 164 | if isfield(Calib,'CalibrationType') |
---|
| 165 | CalibrationType=Calib.CalibrationType; |
---|
| 166 | switch CalibrationType |
---|
| 167 | case 'linear' |
---|
| 168 | set(handles.calib_type,'Value',2) |
---|
| 169 | case 'tsai' |
---|
| 170 | set(handles.calib_type,'Value',3) |
---|
| 171 | end |
---|
| 172 | end |
---|
| 173 | if isfield(Calib,'SourceCalib') |
---|
| 174 | if isfield(Calib.SourceCalib,'PointCoord') |
---|
| 175 | PointCoord=Calib.SourceCalib.PointCoord; |
---|
| 176 | end |
---|
| 177 | end |
---|
| 178 | nbcoord=length(PointCoord); |
---|
| 179 | if ~isfield(Calib,'ErrorRms')&~isfield(Calib,'ErrorMax') %old convention of Gauthier (cord in mm) |
---|
| 180 | for i=1:length(PointCoord) |
---|
| 181 | line=str2num(PointCoord{i}); |
---|
| 182 | Coord(i+val,4:5)=line(4:5);%px x |
---|
| 183 | Coord(i+val,1:3)=line(1:3)/10;%phys x |
---|
| 184 | end |
---|
| 185 | else |
---|
| 186 | for i=1:length(PointCoord) |
---|
| 187 | line=str2num(PointCoord{i}); |
---|
| 188 | Coord(i,4:5)=line(4:5);%px x |
---|
| 189 | Coord(i,1:3)=line(1:3);%phys x |
---|
| 190 | end |
---|
| 191 | end |
---|
| 192 | end |
---|
| 193 | %case of xml files of points |
---|
| 194 | if isfield(s,'Coord') |
---|
| 195 | PointCoord=s.Coord; |
---|
| 196 | nbcoord=length(PointCoord); |
---|
| 197 | %case of image coordinates |
---|
| 198 | if isfield(s,'CoordType')& isequal(s.CoordType,'px') |
---|
| 199 | for i=1:nbcoord |
---|
| 200 | line=str2num(PointCoord{i}); |
---|
| 201 | Coord(i+val,4:5)=line(1:2); |
---|
| 202 | end |
---|
| 203 | %case of physical coordinates |
---|
| 204 | else |
---|
| 205 | for i=1:nbcoord |
---|
| 206 | line=str2num(PointCoord{i}); |
---|
| 207 | Coord(i+val,1:3)=line(1:3); |
---|
| 208 | nbcolumn=size(Coord,2); |
---|
| 209 | if nbcolumn<5 |
---|
| 210 | Coord(i+val,nbcolumn+1:5)=zeros(1,5-nbcolumn); |
---|
| 211 | end |
---|
| 212 | end |
---|
| 213 | end |
---|
| 214 | end |
---|
| 215 | CoordCell={}; |
---|
| 216 | for iline=1:size(Coord,1) |
---|
| 217 | for j=1:5 |
---|
| 218 | CoordCell{iline,j}=num2str(Coord(iline,j),4); |
---|
| 219 | end |
---|
| 220 | end |
---|
| 221 | Tabchar=cell2tab(CoordCell,' | ');%transform cells into table ready for display |
---|
| 222 | set(handles.ListCoord,'Value',1) |
---|
| 223 | set(handles.ListCoord,'String',Tabchar) |
---|
| 224 | |
---|
| 225 | |
---|
| 226 | %---------------------------------------------------- |
---|
| 227 | % executed when closing: set the parent interface button to value 0 |
---|
| 228 | function closefcn(gcbo,eventdata,handles_uvmat) |
---|
| 229 | huvmat=findobj(allchild(0),'Name','uvmat'); |
---|
| 230 | if exist('handles_uvmat','var') |
---|
| 231 | set(handles_uvmat.cal,'Value',0) |
---|
| 232 | uvmat('cal_Callback',huvmat,[],handles_uvmat); |
---|
| 233 | % set(parent_button,'Value',0)%put unactivated buttons to green |
---|
| 234 | % set(parent_button,'BackgroundColor',[0 1 0]); |
---|
| 235 | end |
---|
| 236 | |
---|
| 237 | |
---|
| 238 | % % --- Executes on button press in MenuCoord. |
---|
| 239 | % function MenuCoord_Callback(hObject, eventdata, handles) |
---|
| 240 | |
---|
| 241 | % |
---|
| 242 | % % --- Executes on button press in delete. |
---|
| 243 | % function delete_Callback(hObject, eventdata, handles) |
---|
| 244 | % SetData=get(gcbf,'UserData');%get the interface data |
---|
| 245 | % IndexObj=SetData.IndexObj; |
---|
| 246 | % delete_object(IndexObj); |
---|
| 247 | |
---|
| 248 | |
---|
| 249 | %------------------------------------------------------------------ |
---|
| 250 | % --- Executes on button press in calibrate_lin. |
---|
| 251 | function APPLY_Callback(hObject, eventdata, handles) |
---|
| 252 | %------------------------------------------------------------------ |
---|
| 253 | calib_cell=get(handles.calib_type,'String'); |
---|
| 254 | val=get(handles.calib_type,'Value'); |
---|
| 255 | calib_type=calib_cell{val}; |
---|
| 256 | Coord_cell=get(handles.ListCoord,'String'); |
---|
| 257 | Object=read_geometry_calib(Coord_cell); |
---|
| 258 | |
---|
| 259 | if isequal(calib_type,'rescale') |
---|
| 260 | GeometryCalib=calib_rescale(Object.Coord); |
---|
| 261 | elseif isequal(calib_type,'linear') |
---|
| 262 | GeometryCalib=calib_linear(Object.Coord); |
---|
| 263 | elseif isequal(calib_type,'tsai') |
---|
| 264 | GeometryCalib=calib_tsai(Object.Coord); |
---|
| 265 | end |
---|
| 266 | unitlist=get(handles.CoordUnit,'String'); |
---|
| 267 | unit=unitlist{get(handles.CoordUnit,'value')}; |
---|
| 268 | GeometryCalib.CoordUnit=unit; |
---|
| 269 | |
---|
| 270 | huvmat=findobj(allchild(0),'Name','uvmat'); |
---|
| 271 | hhuvmat=guidata(huvmat);%handles of elements in the GUI uvmat |
---|
| 272 | RootPath=''; |
---|
| 273 | RootFile=''; |
---|
| 274 | if ~isempty(hhuvmat.RootPath)& ~isempty(hhuvmat.RootFile) |
---|
| 275 | testhandle=1; |
---|
| 276 | RootPath=get(hhuvmat.RootPath,'String'); |
---|
| 277 | RootFile=get(hhuvmat.RootFile,'String'); |
---|
| 278 | filebase=fullfile(RootPath,RootFile); |
---|
| 279 | outputfile=[filebase '.xml']; |
---|
| 280 | else |
---|
| 281 | question={'save the calibration data and point coordinates in'}; |
---|
| 282 | def={fullfile(RootPath,['ObjectCalib.xml'])}; |
---|
| 283 | options.Resize='on'; |
---|
| 284 | answer=inputdlg(question,'save average in a new file',1,def,options); |
---|
| 285 | outputfile=answer{1}; |
---|
| 286 | end |
---|
| 287 | testappend=0; |
---|
| 288 | if exist(outputfile,'file');%=1 if the output file already exists, 0 else |
---|
| 289 | t=xmltree(outputfile); %read the file |
---|
| 290 | backupfile=outputfile; |
---|
| 291 | testexist=2; |
---|
| 292 | while testexist==2 |
---|
| 293 | backupfile=[backupfile '~'];% make a backup name by adding ~ to the xml file name |
---|
| 294 | testexist=exist(backupfile,'file'); |
---|
| 295 | end |
---|
| 296 | [success,message]=copyfile(outputfile,backupfile);%make backup |
---|
| 297 | t=xmltree(outputfile); %read the file |
---|
| 298 | uid=find(t,'ImaDoc'); |
---|
| 299 | if ~isequal(uid,1)%if the xml file is not ImaDoc, delete it (after backup) |
---|
| 300 | if isequal(success,1) |
---|
| 301 | delete(outputfile) |
---|
| 302 | else |
---|
| 303 | msgbox_uvmat('ERROR',['error in the backup of the existing xml file: ' message]) |
---|
| 304 | return |
---|
| 305 | end |
---|
| 306 | else |
---|
| 307 | uid_calib=find(t,'ImaDoc/GeometryCalib'); |
---|
| 308 | testappend=1; |
---|
| 309 | if isempty(uid_calib) |
---|
| 310 | [t,uid_calib]=add(t,1,'element','GeometryCalib'); |
---|
| 311 | else %if GeometryCalib already exists, delete its content |
---|
| 312 | uid_child=children(t,uid_calib); |
---|
| 313 | t=delete(t,uid_child); |
---|
| 314 | testappend=1; |
---|
| 315 | end |
---|
| 316 | end |
---|
| 317 | end |
---|
| 318 | if ~testappend %create a new xml file for calibration data |
---|
| 319 | t=xmltree; |
---|
| 320 | t=set(t,1,'name','ImaDoc'); |
---|
| 321 | [t,uid_calib]=add(t,1,'element','GeometryCalib'); |
---|
| 322 | end |
---|
| 323 | % hgrid=get(handles.REPLICATE,'parent');%read the calibration image source on the interface userdata |
---|
| 324 | % imagename=get(hgrid,'UserData'); |
---|
| 325 | % if exist(imagename,'file') |
---|
| 326 | % GeometryCalib.SourceCalib.ImageCalib=imagename; |
---|
| 327 | % end |
---|
| 328 | GeometryCalib.SourceCalib.PointCoord=Object.Coord; |
---|
| 329 | t=struct2xml(GeometryCalib,t,uid_calib); |
---|
| 330 | save(t,outputfile); |
---|
| 331 | msgbox_uvmat('CONFIRMATION',{[outputfile ' updated with calibration data'];... |
---|
| 332 | ['Error rms (along x,y)=' num2str(GeometryCalib.ErrorRms) ' pixels'];... |
---|
| 333 | ['Error max (along x,y)=' num2str(GeometryCalib.ErrorMax) ' pixels']}) |
---|
| 334 | |
---|
| 335 | %display image with new calibration in the currently opened uvmat interface |
---|
| 336 | hhh=findobj(hhuvmat.axes3,'Tag','calib_marker');% delete calib points and markers |
---|
| 337 | if ~isempty(hhh) |
---|
| 338 | delete(hhh); |
---|
| 339 | end |
---|
| 340 | hhh=findobj(hhuvmat.axes3,'Tag','calib_points'); |
---|
| 341 | if ~isempty(hhh) |
---|
| 342 | delete(hhh); |
---|
| 343 | end |
---|
| 344 | set(hhuvmat.FixedLimits,'Value',0)% put FixedLimits option to 'off' |
---|
| 345 | set(hhuvmat.FixedLimits,'BackgroundColor',[0.7 0.7 0.7]) |
---|
| 346 | uvmat('RootPath_Callback',hObject,eventdata,hhuvmat); %file input with xml reading in uvmat |
---|
| 347 | |
---|
| 348 | %------------------------------------------------------------------ |
---|
| 349 | % --- Executes on button press in calibrate_lin. |
---|
| 350 | function REPLICATE_Callback(hObject, eventdata, handles) |
---|
| 351 | %------------------------------------------------------------------ |
---|
| 352 | calib_cell=get(handles.calib_type,'String'); |
---|
| 353 | val=get(handles.calib_type,'Value'); |
---|
| 354 | calib_type=calib_cell{val}; |
---|
| 355 | Coord_cell=get(handles.ListCoord,'String'); |
---|
| 356 | Object=read_geometry_calib(Coord_cell); |
---|
| 357 | |
---|
| 358 | if isequal(calib_type,'rescale') |
---|
| 359 | GeometryCalib=calib_rescale(Object.Coord); |
---|
| 360 | elseif isequal(calib_type,'linear') |
---|
| 361 | GeometryCalib=calib_linear(Object.Coord); |
---|
| 362 | elseif isequal(calib_type,'tsai') |
---|
| 363 | GeometryCalib=calib_tsai(Object.Coord); |
---|
| 364 | end |
---|
| 365 | % %record image source |
---|
| 366 | % hgrid=get(handles.REPLICATE,'parent');%read the calibration image source on the interface userdata |
---|
| 367 | % imagename=get(hgrid,'UserData'); |
---|
| 368 | % if exist(imagename,'file') |
---|
| 369 | % GeometryCalib.SourceCalib.ImageCalib=imagename; |
---|
| 370 | % end |
---|
| 371 | GeometryCalib.SourceCalib.PointCoord=Object.Coord; |
---|
| 372 | |
---|
| 373 | %open and read the dataview GUI |
---|
| 374 | h_dataview=findobj(allchild(0),'name','dataview'); |
---|
| 375 | Device=[];%default |
---|
| 376 | if isempty(h_dataview) |
---|
| 377 | h_dataview=dataview; |
---|
| 378 | hhdataview=guidata(h_dataview); |
---|
| 379 | drawnow |
---|
| 380 | hGUI=get(handles.REPLICATE,'parent');%read the calibration image source on the interface userdata |
---|
| 381 | CalibData=get(hGUI,'UserData'); |
---|
| 382 | if isfield(CalibData,'XmlInput') |
---|
| 383 | XmlInput=fileparts(CalibData.XmlInput); |
---|
| 384 | [XmlInput,filename,ext]=fileparts(XmlInput); |
---|
| 385 | end |
---|
| 386 | if isfield(CalibData,'Heading') |
---|
| 387 | Heading=CalibData.Heading; |
---|
| 388 | if isfield(Heading,'Record') && isequal([filename ext],Heading.Record) |
---|
| 389 | [XmlInput,filename,ext]=fileparts(XmlInput); |
---|
| 390 | end |
---|
| 391 | if isfield(Heading,'Device') && isequal([filename ext],Heading.Device) |
---|
| 392 | [XmlInput,filename,ext]=fileparts(XmlInput); |
---|
| 393 | Device=Heading.Device; |
---|
| 394 | end |
---|
| 395 | if isfield(Heading,'Experiment') && isequal([filename ext],Heading.Experiment) |
---|
| 396 | [PP,filename,ext]=fileparts(XmlInput); |
---|
| 397 | end |
---|
| 398 | testinput=0; |
---|
| 399 | if isfield(Heading,'SubCampaign') && isequal([filename ext],Heading.SubCampaign) |
---|
| 400 | set(hhdataview.RootDirectory,'String',XmlInput) |
---|
| 401 | set(hhdataview.SubCampaignTest,'Value',1) |
---|
| 402 | testinput=1; |
---|
| 403 | elseif isfield(Heading,'Campaign') && isequal([filename ext],Heading.Campaign) |
---|
| 404 | set(hhdataview.RootDirectory,'String',XmlInput) |
---|
| 405 | set(hhdataview.SubCampaignTest,'Value',0) |
---|
| 406 | testinput=1; |
---|
| 407 | end |
---|
| 408 | end |
---|
| 409 | if testinput |
---|
| 410 | dataview('RootDirectory_Callback',hObject,eventdata,hhdataview) |
---|
| 411 | ListDevices=get(hhdataview.ListDevices,'String'); |
---|
| 412 | for ilist=1:length(ListDevices) |
---|
| 413 | if isequal(ListDevices{ilist},Device) |
---|
| 414 | set(hhdataview.ListDevices,'Value',ilist) |
---|
| 415 | dataview('ListDevices_Callback',hObject,eventdata,hhdataview) |
---|
| 416 | break |
---|
| 417 | end |
---|
| 418 | end |
---|
| 419 | end |
---|
| 420 | return |
---|
| 421 | end |
---|
| 422 | |
---|
| 423 | hhdataview=guidata(h_dataview); |
---|
| 424 | CurrentPath=get(hhdataview.RootDirectory,'String'); |
---|
| 425 | ListExperiments=get(hhdataview.ListExperiments,'String'); |
---|
| 426 | Value=get(hhdataview.ListExperiments,'Value'); |
---|
| 427 | if ~isequal(Value,1) |
---|
| 428 | ListExperiments=ListExperiments(Value); |
---|
| 429 | end |
---|
| 430 | ListDevices=get(hhdataview.ListDevices,'String'); |
---|
| 431 | Value=get(hhdataview.ListDevices,'Value'); |
---|
| 432 | if isequal(Value,1) |
---|
| 433 | warndlg_uvmat('manually select in the GUI dataview the device being calibrated','ERROR') |
---|
| 434 | return |
---|
| 435 | else |
---|
| 436 | ListDevices=ListDevices(Value); |
---|
| 437 | end |
---|
| 438 | ListRecords=get(hhdataview.ListRecords,'String'); |
---|
| 439 | Value=get(hhdataview.ListRecords,'Value'); |
---|
| 440 | if ~isequal(Value,1) |
---|
| 441 | ListRecords=ListRecords(Value); |
---|
| 442 | end |
---|
| 443 | [ListDevices,ListRecords,ListXml,List]=ListDir(CurrentPath,ListExperiments,ListDevices,ListRecords); |
---|
| 444 | ListXml=get(hhdataview.ListXml,'String'); |
---|
| 445 | Value=get(hhdataview.ListXml,'Value'); |
---|
| 446 | if isequal(Value,1) |
---|
| 447 | warndlg_uvmat('you need to select in the GUI dataview the xml files to edit','ERROR') |
---|
| 448 | return |
---|
| 449 | else |
---|
| 450 | ListXml=ListXml(Value); |
---|
| 451 | end |
---|
| 452 | |
---|
| 453 | %update all the selected xml files |
---|
| 454 | answer=msgbox_uvmat('INPUT_Y-N',[num2str(length(Value)) ' xml files for device ' ListDevices{1} ' will be refreshed with ' calib_type ' calibration data']); |
---|
| 455 | if ~isequal(answer{1},'OK') |
---|
| 456 | return |
---|
| 457 | end |
---|
| 458 | % 'TEST' |
---|
| 459 | % List |
---|
| 460 | % return |
---|
| 461 | for iexp=1:length(List.Experiment) |
---|
| 462 | ExpName=List.Experiment{iexp}.name; |
---|
| 463 | if isfield(List.Experiment{iexp},'Device') |
---|
| 464 | for idevice=1:length(List.Experiment{iexp}.Device) |
---|
| 465 | DeviceName=List.Experiment{iexp}.Device{idevice}.name; |
---|
| 466 | if isfield(List.Experiment{iexp}.Device{idevice},'xmlfile') |
---|
| 467 | for ixml=1:length(List.Experiment{iexp}.Device{idevice}.xmlfile) |
---|
| 468 | FileName=List.Experiment{iexp}.Device{idevice}.xmlfile{ixml}; |
---|
| 469 | for ilistxml=1:length(ListXml) |
---|
| 470 | if isequal(FileName,ListXml{ilistxml}) |
---|
| 471 | set(hhdataview.ListXml,'Value',Value(ilistxml)) |
---|
| 472 | drawnow |
---|
| 473 | xmlfullname=fullfile(CurrentPath,ExpName,DeviceName,FileName); |
---|
| 474 | update_imadoc(GeometryCalib,xmlfullname) |
---|
| 475 | break |
---|
| 476 | end |
---|
| 477 | end |
---|
| 478 | end |
---|
| 479 | elseif isfield(List.Experiment{iexp}.Device{idevice},'Record') |
---|
| 480 | for irecord=1:length(List.Experiment{iexp}.Device{idevice}.Record) |
---|
| 481 | RecordName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.name; |
---|
| 482 | if isfield(List.Experiment{iexp}.Device{idevice}.Record{irecord},'xmlfile') |
---|
| 483 | for ixml=1:length(List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile) |
---|
| 484 | FileName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile{ixml}; |
---|
| 485 | for ilistxml=1:length(ListXml) |
---|
| 486 | if isequal(FileName,ListXml{ilistxml}) |
---|
| 487 | set(hhdataview.ListXml,'Value',Value(ilistxml)) |
---|
| 488 | drawnow |
---|
| 489 | xmlfullname=fullfile(CurrentPath,ExpName,DeviceName,RecordName,FileName); |
---|
| 490 | update_imadoc(GeometryCalib,xmlfullname) |
---|
| 491 | break |
---|
| 492 | end |
---|
| 493 | end |
---|
| 494 | end |
---|
| 495 | end |
---|
| 496 | end |
---|
| 497 | end |
---|
| 498 | end |
---|
| 499 | end |
---|
| 500 | end |
---|
| 501 | set(hhdataview.ListXml,'Value',Value) |
---|
| 502 | |
---|
| 503 | |
---|
| 504 | %------------------------------------------------------------- |
---|
| 505 | function update_imadoc(GeometryCalib,outputfile) |
---|
| 506 | testappend=0; |
---|
| 507 | if exist(outputfile,'file');%=1 if the output file already exists, 0 else |
---|
| 508 | t=xmltree(outputfile); %read the file |
---|
| 509 | uid=find(t,'ImaDoc'); |
---|
| 510 | if isequal(uid,1)%if the xml file is ImaDoc |
---|
| 511 | uid_calib=find(t,'ImaDoc/GeometryCalib'); |
---|
| 512 | if ~isempty(uid) %if GeometryCalib already exists, delete its content |
---|
| 513 | backupfile=outputfile; |
---|
| 514 | testexist=2; |
---|
| 515 | while testexist==2 |
---|
| 516 | backupfile=[backupfile '~']; |
---|
| 517 | testexist=exist(backupfile,'file'); |
---|
| 518 | end |
---|
| 519 | [success,message]=copyfile(outputfile,backupfile);%make backup |
---|
| 520 | if isequal(success,1) |
---|
| 521 | delete(outputfile) |
---|
| 522 | else |
---|
| 523 | return |
---|
| 524 | end |
---|
| 525 | uid_child=children(t,uid_calib); |
---|
| 526 | t=delete(t,uid_child); |
---|
| 527 | testappend=1; |
---|
| 528 | end |
---|
| 529 | end |
---|
| 530 | end |
---|
| 531 | if ~testappend |
---|
| 532 | t=xmltree; |
---|
| 533 | t=set(t,1,'name','ImaDoc'); |
---|
| 534 | [t,uid_calib]=add(t,1,'element','GeometryCalib'); |
---|
| 535 | % t=struct2xml(GeometryCalib,t,uid_calib); |
---|
| 536 | end |
---|
| 537 | |
---|
| 538 | t=struct2xml(GeometryCalib,t,uid_calib); |
---|
| 539 | save(t,outputfile); |
---|
| 540 | |
---|
| 541 | |
---|
| 542 | %----------------------------------------------------------------- |
---|
| 543 | % determine the parameters for a calibration by an affine function (rescaling and offset, no rotation) |
---|
| 544 | function GeometryCalib=calib_rescale(Coord) |
---|
| 545 | %------------------------------------------------------------------ |
---|
| 546 | |
---|
| 547 | X=Coord(:,1); |
---|
| 548 | Y=Coord(:,2); |
---|
| 549 | x_ima=Coord(:,4); |
---|
| 550 | y_ima=Coord(:,5); |
---|
| 551 | [px,sx]=polyfit(X,x_ima,1); |
---|
| 552 | [py,sy]=polyfit(Y,y_ima,1); |
---|
| 553 | T_x=px(2); |
---|
| 554 | T_y=py(2); |
---|
| 555 | GeometryCalib.CalibrationType='rescale'; |
---|
| 556 | GeometryCalib.focal=1; |
---|
| 557 | GeometryCalib.CoordUnit=[];% default value, to be updated by the calling function |
---|
| 558 | GeometryCalib.Tx_Ty_Tz=[T_x T_y 1]; |
---|
| 559 | GeometryCalib.R=[px(1),0,0;0,py(1),0;0,0,1]; |
---|
| 560 | |
---|
| 561 | %check error |
---|
| 562 | Calib.dpx=1; |
---|
| 563 | Calib.dpy=1; |
---|
| 564 | Calib.sx=1; |
---|
| 565 | Calib.Cx=0; |
---|
| 566 | Calib.Cy=0; |
---|
| 567 | Calib.Tz=1; |
---|
| 568 | Calib.kappa1=0; |
---|
| 569 | Calib.f=GeometryCalib.focal; |
---|
| 570 | Calib.Tx=T_x; |
---|
| 571 | Calib.Ty=T_y; |
---|
| 572 | Calib.R=GeometryCalib.R; |
---|
| 573 | [Xpoints,Ypoints]=px_XYZ(Calib,X,Y,0); |
---|
| 574 | GeometryCalib.ErrorRms(1)=sqrt(mean((Xpoints-x_ima).*(Xpoints-x_ima))); |
---|
| 575 | GeometryCalib.ErrorMax(1)=max(abs(Xpoints-x_ima)); |
---|
| 576 | GeometryCalib.ErrorRms(2)=sqrt(mean((Ypoints-y_ima).*(Ypoints-y_ima))); |
---|
| 577 | GeometryCalib.ErrorMax(2)=max(abs(Ypoints-y_ima)); |
---|
| 578 | |
---|
| 579 | |
---|
| 580 | %------------------------------------------------------------------ |
---|
| 581 | % determine the parameters for a calibration by a linear transform matrix (rescale and rotation) |
---|
| 582 | function GeometryCalib=calib_linear(Coord) |
---|
| 583 | %------------------------------------------------------------------ |
---|
| 584 | X=Coord(:,1); |
---|
| 585 | Y=Coord(:,2); |
---|
| 586 | x_ima=Coord(:,4); |
---|
| 587 | y_ima=Coord(:,5); |
---|
| 588 | XY_mat=[ones(size(X)) X Y]; |
---|
| 589 | a_X1=XY_mat\x_ima; %transformation matrix for X |
---|
| 590 | x1=XY_mat*a_X1;%reconstruction |
---|
| 591 | err_X1=max(abs(x1-x_ima));%error |
---|
| 592 | a_Y1=XY_mat\y_ima;%transformation matrix for X |
---|
| 593 | y1=XY_mat*a_Y1; |
---|
| 594 | err_Y1=max(abs(y1-y_ima));%error |
---|
| 595 | T_x=a_X1(1); |
---|
| 596 | T_y=a_Y1(1); |
---|
| 597 | GeometryCalib.CalibrationType='linear'; |
---|
| 598 | GeometryCalib.focal=1; |
---|
| 599 | GeometryCalib.CoordUnit=[];% default value, to be updated by the calling function |
---|
| 600 | GeometryCalib.Tx_Ty_Tz=[T_x T_y 1]; |
---|
| 601 | GeometryCalib.R=[a_X1(2),a_X1(3),0;a_Y1(2),a_Y1(3),0;0,0,1]; |
---|
| 602 | |
---|
| 603 | %check error |
---|
| 604 | GeometryCalib.ErrorRms(1)=sqrt(mean((x1-x_ima).*(x1-x_ima))); |
---|
| 605 | GeometryCalib.ErrorMax(1)=max(abs(x1-x_ima)); |
---|
| 606 | GeometryCalib.ErrorRms(2)=sqrt(mean((y1-y_ima).*(y1-y_ima))); |
---|
| 607 | GeometryCalib.ErrorMax(2)=max(abs(y1-y_ima)); |
---|
| 608 | |
---|
| 609 | |
---|
| 610 | |
---|
| 611 | |
---|
| 612 | %------------------------------------------------------------------ |
---|
| 613 | function GeometryCalib=calib_tsai(Coord) |
---|
| 614 | %------------------------------------------------------------------ |
---|
| 615 | %TSAI |
---|
| 616 | % 'calibration_lin' provides a linear transform on coordinates, |
---|
| 617 | path_uvmat=which('uvmat');% check the path detected for source file uvmat |
---|
| 618 | path_UVMAT=fileparts(path_uvmat); %path to UVMAT |
---|
| 619 | if isunix |
---|
| 620 | %fid = fopen(fullfile(path_UVMAT,'PARAM_LINUX.txt'),'r');%open the file with civ binary names |
---|
| 621 | xmlfile=fullfile(path_UVMAT,'PARAM_LINUX.xml'); |
---|
| 622 | if exist(xmlfile,'file') |
---|
| 623 | t=xmltree(xmlfile); |
---|
| 624 | sparam=convert(t); |
---|
| 625 | end |
---|
| 626 | else |
---|
| 627 | %fid = fopen(fullfile(path_UVMAT,'PARAM_WIN.txt'),'r');%open the file with civ binary names |
---|
| 628 | xmlfile=fullfile(path_UVMAT,'PARAM_WIN.xml'); |
---|
| 629 | if exist(xmlfile,'file') |
---|
| 630 | t=xmltree(xmlfile); |
---|
| 631 | sparam=convert(t); |
---|
| 632 | end |
---|
| 633 | end |
---|
| 634 | if ~isfield(sparam,'GeometryCalib_exe') |
---|
| 635 | warndlg_uvmat(['calibration program <GeometryCalib_exe> undefined in parameter file ' xmlfile],'ERROR') |
---|
| 636 | return |
---|
| 637 | end |
---|
| 638 | Tsai_exe=sparam.GeometryCalib_exe; |
---|
| 639 | if ~exist(Tsai_exe,'file') |
---|
| 640 | warndlg_uvmat(['calibration program ' Tsai_exe ' does not exist'],'ERROR') |
---|
| 641 | return |
---|
| 642 | end |
---|
| 643 | |
---|
| 644 | textcoord=num2str(Coord,4); |
---|
| 645 | dlmwrite('t.txt',textcoord,''); |
---|
| 646 | % ['!' Tsai_exe ' -f1 0 -f2 t.txt'] |
---|
| 647 | eval(['!' Tsai_exe ' -f t.txt > tsaicalib.log']); |
---|
| 648 | if ~exist('calib.dat','file') |
---|
| 649 | warndlg_uvmat('no output from calibration program Tsai_exe: possibly too few points','ERROR') |
---|
| 650 | end |
---|
| 651 | calibdat=dlmread('calib.dat'); |
---|
| 652 | GeometryCalib.CalibrationType='tsai'; |
---|
| 653 | GeometryCalib.focal=calibdat(10); |
---|
| 654 | GeometryCalib.dpx_dpy=[calibdat(5) calibdat(6)]; |
---|
| 655 | GeometryCalib.Cx_Cy=[calibdat(7) calibdat(8)]; |
---|
| 656 | GeometryCalib.sx=calibdat(9); |
---|
| 657 | GeometryCalib.kappa1=calibdat(11); |
---|
| 658 | GeometryCalib.CoordUnit=[];% default value, to be updated by the calling function |
---|
| 659 | GeometryCalib.Tx_Ty_Tz=[calibdat(12) calibdat(13) calibdat(14)]; |
---|
| 660 | Rx_Ry_Rz=calibdat([15:17]); |
---|
| 661 | sa = sin(Rx_Ry_Rz(1)) ; |
---|
| 662 | ca=cos(Rx_Ry_Rz(1)); |
---|
| 663 | sb=sin(Rx_Ry_Rz(2)); |
---|
| 664 | cb =cos(Rx_Ry_Rz(2)); |
---|
| 665 | sg =sin(Rx_Ry_Rz(3)); |
---|
| 666 | cg =cos(Rx_Ry_Rz(3)); |
---|
| 667 | r1 = cb * cg; |
---|
| 668 | r2 = cg * sa * sb - ca * sg; |
---|
| 669 | r3 = sa * sg + ca * cg * sb; |
---|
| 670 | r4 = cb * sg; |
---|
| 671 | r5 = sa * sb * sg + ca * cg; |
---|
| 672 | r6 = ca * sb * sg - cg * sa; |
---|
| 673 | r7 = -sb; |
---|
| 674 | r8 = cb * sa; |
---|
| 675 | r9 = ca * cb; |
---|
| 676 | %EN DEDUIRE MATRICE R ?? |
---|
| 677 | GeometryCalib.R=[r1,r2,r3;r4,r5,r6;r7,r8,r9]; |
---|
| 678 | %erreur a caracteriser? |
---|
| 679 | %check error |
---|
| 680 | Calib.dpx=GeometryCalib.dpx_dpy(1); |
---|
| 681 | Calib.dpy=GeometryCalib.dpx_dpy(2); |
---|
| 682 | Calib.sx=GeometryCalib.sx; |
---|
| 683 | Calib.Cx=GeometryCalib.Cx_Cy(1); |
---|
| 684 | Calib.Cy=GeometryCalib.Cx_Cy(2); |
---|
| 685 | Calib.kappa1=GeometryCalib.kappa1; |
---|
| 686 | Calib.f=GeometryCalib.focal; |
---|
| 687 | Calib.Tx=GeometryCalib.Tx_Ty_Tz(1); |
---|
| 688 | Calib.Ty=GeometryCalib.Tx_Ty_Tz(2); |
---|
| 689 | Calib.Tz=GeometryCalib.Tx_Ty_Tz(3); |
---|
| 690 | Calib.R=GeometryCalib.R; |
---|
| 691 | X=Coord(:,1); |
---|
| 692 | Y=Coord(:,2); |
---|
| 693 | Z=Coord(:,3); |
---|
| 694 | x_ima=Coord(:,4); |
---|
| 695 | y_ima=Coord(:,5); |
---|
| 696 | [Xpoints,Ypoints]=px_XYZ(Calib,X,Y,Z); |
---|
| 697 | |
---|
| 698 | GeometryCalib.ErrorRms(1)=sqrt(mean((Xpoints-x_ima).*(Xpoints-x_ima))); |
---|
| 699 | GeometryCalib.ErrorMax(1)=max(abs(Xpoints-x_ima)); |
---|
| 700 | GeometryCalib.ErrorRms(2)=sqrt(mean((Ypoints-y_ima).*(Ypoints-y_ima))); |
---|
| 701 | GeometryCalib.ErrorMax(2)=max(abs(Ypoints-y_ima)); |
---|
| 702 | % Nfx |
---|
| 703 | % dx |
---|
| 704 | % dy |
---|
| 705 | % 5 dpx |
---|
| 706 | % 6 dpy |
---|
| 707 | % cx |
---|
| 708 | % cy |
---|
| 709 | % sx |
---|
| 710 | % f |
---|
| 711 | % kappa1 |
---|
| 712 | % tx |
---|
| 713 | % ty |
---|
| 714 | % tz |
---|
| 715 | % rx |
---|
| 716 | % ry |
---|
| 717 | % rz |
---|
| 718 | % p1 |
---|
| 719 | % p2 |
---|
| 720 | |
---|
| 721 | %calibcoeff=str2num(calibdat) |
---|
| 722 | |
---|
| 723 | |
---|
| 724 | |
---|
| 725 | % --- Executes on button press in rotation. |
---|
| 726 | function rotation_Callback(hObject, eventdata, handles) |
---|
| 727 | angle_rot=(pi/180)*str2num(get(handles.Phi,'String')); |
---|
| 728 | Coord_cell=get(handles.ListCoord,'String'); |
---|
| 729 | data=read_geometry_calib(Coord_cell); |
---|
| 730 | data.Coord(:,1)=cos(angle_rot)*data.Coord(:,1)+sin(angle_rot)*data.Coord(:,2); |
---|
| 731 | data.Coord(:,1)=-sin(angle_rot)*data.Coord(:,1)+cos(angle_rot)*data.Coord(:,2); |
---|
| 732 | set(handles.XObject,'String',num2str(data.Coord(:,1),4)); |
---|
| 733 | set(handles.YObject,'String',num2str(data.Coord(:,2),4)); |
---|
| 734 | |
---|
| 735 | |
---|
| 736 | function XImage_Callback(hObject, eventdata, handles) |
---|
| 737 | update_list(hObject, eventdata,handles) |
---|
| 738 | |
---|
| 739 | function YImage_Callback(hObject, eventdata, handles) |
---|
| 740 | update_list(hObject, eventdata,handles) |
---|
| 741 | |
---|
| 742 | function XObject_Callback(hObject, eventdata, handles) |
---|
| 743 | update_list(hObject, eventdata,handles) |
---|
| 744 | |
---|
| 745 | function YObject_Callback(hObject, eventdata, handles) |
---|
| 746 | update_list(hObject, eventdata,handles) |
---|
| 747 | |
---|
| 748 | function ZObject_Callback(hObject, eventdata, handles) |
---|
| 749 | update_list(hObject, eventdata,handles) |
---|
| 750 | |
---|
| 751 | function update_list(hObject, eventdata, handles) |
---|
| 752 | str4=get(handles.XImage,'String'); |
---|
| 753 | str5=get(handles.YImage,'String'); |
---|
| 754 | str1=get(handles.XObject,'String'); |
---|
| 755 | tt=double(str1); |
---|
| 756 | str2=get(handles.YObject,'String'); |
---|
| 757 | str3=get(handles.ZObject,'String'); |
---|
| 758 | if ~isempty(str1) & ~isequal(double(str1),32) & (isempty(str3)|isequal(double(str3),32)) |
---|
| 759 | str3='0';%put z to 0 by default |
---|
| 760 | end |
---|
| 761 | strline=[str1 ' | ' str2 ' | ' str3 ' | ' str4 ' | ' str5]; |
---|
| 762 | Coord=get(handles.ListCoord,'String'); |
---|
| 763 | val=get(handles.ListCoord,'Value'); |
---|
| 764 | Coord{val}=strline; |
---|
| 765 | set(handles.ListCoord,'String',Coord) |
---|
| 766 | |
---|
| 767 | %-------------------------------------------------------------------- |
---|
| 768 | % --- Executes on selection change in ListCoord. |
---|
| 769 | %-------------------------------------------------------------------- |
---|
| 770 | function ListCoord_Callback(hObject, eventdata, handles) |
---|
| 771 | % hObject handle to ListCoord (see GCBO) |
---|
| 772 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 773 | % handles structure with handles and user data (see GUIDATA) |
---|
| 774 | |
---|
| 775 | % Hints: contents = get(hObject,'String') returns ListCoord contents as cell array |
---|
| 776 | % contents{get(hObject,'Value')} returns selected item from ListCoord |
---|
| 777 | %set(handles.edit_append,'Value',2); %set to edit mode |
---|
| 778 | Coord_cell=get(handles.ListCoord,'String'); |
---|
| 779 | val=get(handles.ListCoord,'Value'); |
---|
| 780 | if length(Coord_cell)>0 |
---|
| 781 | coord_str=Coord_cell{val}; |
---|
| 782 | k=findstr('|',coord_str); |
---|
| 783 | if isempty(k) |
---|
| 784 | return |
---|
| 785 | end |
---|
| 786 | set(handles.XObject,'String',coord_str(1:k(1)-5)) |
---|
| 787 | set(handles.YObject,'String',coord_str(k(1)+5:k(2)-5)) |
---|
| 788 | set(handles.ZObject,'String',coord_str(k(2)+5:k(3)-5)) |
---|
| 789 | set(handles.XImage,'String',coord_str(k(3)+5:k(4)-5)) |
---|
| 790 | set(handles.YImage,'String',coord_str(k(4)+5:end)) |
---|
| 791 | huvmat=findobj(allchild(0),'Name','uvmat');%find the current uvmat interface handle |
---|
| 792 | hplot=findobj(huvmat,'Tag','axes3');%main plotting axis of uvmat |
---|
| 793 | h_menu_coord=findobj(huvmat,'Tag','menu_coord'); |
---|
| 794 | menu=get(h_menu_coord,'String'); |
---|
| 795 | choice=get(h_menu_coord,'Value'); |
---|
| 796 | if iscell(menu) |
---|
| 797 | option=menu{choice}; |
---|
| 798 | else |
---|
| 799 | option='px'; %default |
---|
| 800 | end |
---|
| 801 | if isequal(option,'phys') |
---|
| 802 | XCoord=str2num(coord_str(1:k(1)-5)); |
---|
| 803 | YCoord=str2num(coord_str(k(1)+5:k(2)-5)); |
---|
| 804 | elseif isequal(option,'px')|| isequal(option,'') |
---|
| 805 | XCoord=str2num(coord_str(k(3)+5:k(4)-5)); |
---|
| 806 | YCoord=str2num(coord_str(k(4)+5:end)); |
---|
| 807 | else |
---|
| 808 | warndlg_uvmat('the choice in menu_coord of uvmat must be px or phys ','ERROR') |
---|
| 809 | end |
---|
| 810 | huvmat=findobj(allchild(0),'Name','uvmat');%find the current uvmat interface handle |
---|
| 811 | hplot=findobj(huvmat,'Tag','axes3');%main plotting axis of uvmat |
---|
| 812 | hhh=findobj(hplot,'Tag','calib_marker'); |
---|
| 813 | if isempty(hhh) |
---|
| 814 | axes(hplot) |
---|
| 815 | line(XCoord,YCoord,'Color','m','Tag','calib_marker','LineStyle','.','Marker','o','MarkerSize',20); |
---|
| 816 | else |
---|
| 817 | set(hhh,'XData',XCoord) |
---|
| 818 | set(hhh,'YData',YCoord) |
---|
| 819 | end |
---|
| 820 | end |
---|
| 821 | |
---|
| 822 | |
---|
| 823 | %---------------------------------------------------- |
---|
| 824 | % --- Executes on button press in rotation_plus. |
---|
| 825 | function rotation_plus_Callback(hObject, eventdata, handles) |
---|
| 826 | Phi=0; |
---|
| 827 | Phi=get(handles.Phi,'String'); |
---|
| 828 | if ~isempty(Phi) |
---|
| 829 | Phi=str2num(Phi); |
---|
| 830 | end |
---|
| 831 | rotation(handles,Phi) |
---|
| 832 | |
---|
| 833 | %------------------------------------------------- |
---|
| 834 | % --- Executes on button press in rotation_minus. |
---|
| 835 | function rotation_minus_Callback(hObject, eventdata, handles) |
---|
| 836 | Phi=0; |
---|
| 837 | Phi=get(handles.Phi,'String'); |
---|
| 838 | if ~isempty(Phi) |
---|
| 839 | Phi=-str2num(Phi); |
---|
| 840 | end |
---|
| 841 | rotation(handles,Phi) |
---|
| 842 | |
---|
| 843 | %----------------------------------------------------- |
---|
| 844 | %rotation |
---|
| 845 | function rotation(handles,Phi) |
---|
| 846 | O_x=str2num(get(handles.O_x,'String')); |
---|
| 847 | O_y=str2num(get(handles.O_y,'String')); |
---|
| 848 | if isempty(O_x) |
---|
| 849 | O_x=0;%default |
---|
| 850 | end |
---|
| 851 | if isempty(O_y) |
---|
| 852 | O_y=0;%default |
---|
| 853 | end |
---|
| 854 | Coord_cell=get(handles.ListCoord,'String'); |
---|
| 855 | data=read_geometry_calib(Coord_cell); |
---|
| 856 | %data=read_geometry_calib(handles); |
---|
| 857 | r1=cos(pi*Phi/180); |
---|
| 858 | r2=-sin(pi*Phi/180); |
---|
| 859 | r3=sin(pi*Phi/180); |
---|
| 860 | r4=cos(pi*Phi/180); |
---|
| 861 | x=data.Coord(:,1); |
---|
| 862 | y=data.Coord(:,2); |
---|
| 863 | data.Coord(:,1)=r1*x+r2*y; |
---|
| 864 | data.Coord(:,2)=r3*x+r4*y; |
---|
| 865 | % data.Coord(:,[4 5])=data.Coord(:,[4 5]); |
---|
| 866 | for i=1:size(data.Coord,1) |
---|
| 867 | for j=1:5 |
---|
| 868 | Coord{i,j}=num2str(data.Coord(i,j),4);%phys x,y,z |
---|
| 869 | end |
---|
| 870 | end |
---|
| 871 | Tabchar=cell2tab(Coord,' | '); |
---|
| 872 | set(handles.ListCoord,'Value',1) |
---|
| 873 | set(handles.ListCoord,'String',Tabchar) |
---|
| 874 | |
---|
| 875 | |
---|
| 876 | function O_x_Callback(hObject, eventdata, handles) |
---|
| 877 | |
---|
| 878 | |
---|
| 879 | function O_y_Callback(hObject, eventdata, handles) |
---|
| 880 | |
---|
| 881 | |
---|
| 882 | function O_z_Callback(hObject, eventdata, handles) |
---|
| 883 | |
---|
| 884 | |
---|
| 885 | % --- Executes on selection change in edit_append. |
---|
| 886 | function edit_append_Callback(hObject, eventdata, handles) |
---|
| 887 | % val=get(handles.PLOT_append,'Value'); |
---|
| 888 | % if isequal(val,2); %append mode |
---|
| 889 | % %appeler mouse |
---|
| 890 | % end |
---|
| 891 | choice=get(handles.edit_append,'Value'); |
---|
| 892 | if choice==1 |
---|
| 893 | Coord=get(handles.ListCoord,'String'); |
---|
| 894 | val=length(Coord); |
---|
| 895 | if val>=1 & isequal(Coord{val},'') |
---|
| 896 | val=val-1; %do not take into account blank |
---|
| 897 | end |
---|
| 898 | Coord{val+1}=''; |
---|
| 899 | set(handles.ListCoord,'String',Coord) |
---|
| 900 | set(handles.ListCoord,'Value',val+1) |
---|
| 901 | end |
---|
| 902 | |
---|
| 903 | |
---|
| 904 | %A REVOIR |
---|
| 905 | % if choice==2 |
---|
| 906 | % %display image with px coordinates |
---|
| 907 | % hrootpath=findobj(huvmat,'Tag','RootPath'); |
---|
| 908 | % hrootfile=findobj(huvmat,'Tag','RootFile'); |
---|
| 909 | % RootPath=''; |
---|
| 910 | % RootFile=''; |
---|
| 911 | % % if ~isempty(hrootpath)& ~isempty(hrootfile) |
---|
| 912 | % testhandle=1; |
---|
| 913 | % RootPath=get(hrootpath,'String'); |
---|
| 914 | % RootFile=get(hrootfile,'String'); |
---|
| 915 | % % filebase=fullfile(RootPath,RootFile); |
---|
| 916 | % % outputfile=[filebase '.xml']; |
---|
| 917 | % Indices=get(findobj(huvmat,'Tag','FileIndex'),'String'); |
---|
| 918 | % Ext=get(findobj(huvmat,'Tag','FileExt'),'String'); |
---|
| 919 | % imagename=[fullfile(RootPath,RootFile) Indices Ext]; |
---|
| 920 | % % input.menu_coord=1; |
---|
| 921 | % h_menu_coord=findobj(huvmat,'Tag','menu_coord'); |
---|
| 922 | % set(h_menu_coord,'Value',3) |
---|
| 923 | % huvmat=uvmat(imagename);%open uvmat, set phys coord (Value 1) |
---|
| 924 | % |
---|
| 925 | % % end |
---|
| 926 | % end |
---|
| 927 | |
---|
| 928 | function NEW_Callback(hObject, eventdata, handles) |
---|
| 929 | %A METTRE SOUS UN BOUTON |
---|
| 930 | huvmat=findobj(allchild(0),'Name','uvmat'); |
---|
| 931 | hchild=get(huvmat,'children'); |
---|
| 932 | hcoord=findobj(hchild,'Tag','menu_coord'); |
---|
| 933 | coordtype=get(hcoord,'Value'); |
---|
| 934 | haxes=findobj(hchild,'Tag','axes3'); |
---|
| 935 | AxeData=get(haxes,'UserData'); |
---|
| 936 | if ~isequal(hcoord,2) |
---|
| 937 | set(hcoord,'Value',2) |
---|
| 938 | huvmat=uvmat(AxeData); |
---|
| 939 | 'relancer uvmat'; |
---|
| 940 | end |
---|
| 941 | if ~isfield(AxeData,'ZoomAxes') |
---|
| 942 | warndlg_uvmat('first draw a window around a grid marker','ERRROR') |
---|
| 943 | return |
---|
| 944 | end |
---|
| 945 | XLim=get(AxeData.ZoomAxes,'XLim'); |
---|
| 946 | YLim=get(AxeData.ZoomAxes,'YLim'); |
---|
| 947 | np=size(AxeData.A); |
---|
| 948 | ind_sub_x=round(XLim); |
---|
| 949 | ind_sub_y=np(1)-round(YLim); |
---|
| 950 | Mfiltre=AxeData.A([ind_sub_y(2):ind_sub_y(1)] ,ind_sub_x,:); |
---|
| 951 | Mfiltre_norm=double(Mfiltre); |
---|
| 952 | Mfiltre_norm=Mfiltre_norm/sum(sum(Mfiltre_norm)); |
---|
| 953 | Mfiltre_norm=100*(Mfiltre_norm-mean(mean(Mfiltre_norm))); |
---|
| 954 | Atype=class(AxeData.A); |
---|
| 955 | Data.NbDim=2; |
---|
| 956 | Data.A=filter2(Mfiltre_norm,double(AxeData.A)); |
---|
| 957 | Data.A=feval(Atype,Data.A); |
---|
| 958 | Data.AName='image'; |
---|
| 959 | Data.AX=AxeData.AX; |
---|
| 960 | Data.AY=AxeData.AY; |
---|
| 961 | Data.CoordType='px'; |
---|
| 962 | plot_field(Data) |
---|
| 963 | |
---|
| 964 | |
---|
| 965 | |
---|
| 966 | %'key_press_fcn:' function activated when a key is pressed on the keyboard |
---|
| 967 | %----------------------------------- |
---|
| 968 | function key_press_fcn(hObject,eventdata,handles) |
---|
| 969 | hh=get(hObject,'parent'); |
---|
| 970 | xx=double(get(hh,'CurrentCharacter')); %get the keyboard character |
---|
| 971 | |
---|
| 972 | if ismember(xx,[8 127])%backspace or delete |
---|
| 973 | Coord_cell=get(handles.ListCoord,'String'); |
---|
| 974 | data=read_geometry_calib(Coord_cell); |
---|
| 975 | Coord=[]; %default |
---|
| 976 | if isfield(data,'Coord') |
---|
| 977 | Coord=data.Coord; |
---|
| 978 | end |
---|
| 979 | val=get(handles.ListCoord,'Value'); |
---|
| 980 | Coord(val,:)=[];%suppress the selected item in the list |
---|
| 981 | CoordCell={}; |
---|
| 982 | for iline=1:size(Coord,1) |
---|
| 983 | for j=1:5 |
---|
| 984 | CoordCell{iline,j}=num2str(Coord(iline,j),4); |
---|
| 985 | end |
---|
| 986 | end |
---|
| 987 | Tabchar=cell2tab(CoordCell,' | ');%transform cells into table ready for display |
---|
| 988 | val=min(size(Coord,1),val); |
---|
| 989 | set(handles.ListCoord,'Value',max(val,1)) |
---|
| 990 | set(handles.ListCoord,'String',Tabchar) |
---|
| 991 | ListCoord_Callback(hObject, eventdata, handles) |
---|
| 992 | PLOT_Callback(hObject,eventdata,handles) |
---|
| 993 | end |
---|
| 994 | |
---|
| 995 | |
---|
| 996 | % --- Executes on button press in append_point. |
---|
| 997 | function append_point_Callback(hObject, eventdata, handles) |
---|
| 998 | |
---|
| 999 | Coord=get(handles.ListCoord,'String'); |
---|
| 1000 | val=length(Coord); |
---|
| 1001 | if val>=1 & isequal(Coord{val},'') |
---|
| 1002 | val=val-1; %do not take into account blank |
---|
| 1003 | end |
---|
| 1004 | Coord{val+1}=''; |
---|
| 1005 | set(handles.ListCoord,'String',Coord) |
---|
| 1006 | set(handles.ListCoord,'Value',val+1) |
---|
| 1007 | |
---|
| 1008 | |
---|
| 1009 | % -------------------------------------------------------------------- |
---|
| 1010 | function MenuOpen_Callback(hObject, eventdata, handles) |
---|
| 1011 | %get the object file |
---|
| 1012 | huvmat=findobj(allchild(0),'Name','uvmat'); |
---|
| 1013 | UvData=get(huvmat,'UserData'); |
---|
| 1014 | hchild=get(huvmat,'Children'); |
---|
| 1015 | hrootpath=findobj(hchild,'Tag','RootPath'); |
---|
| 1016 | oldfile=get(hrootpath,'String'); |
---|
| 1017 | if isempty(oldfile) |
---|
| 1018 | oldfile=''; |
---|
| 1019 | end |
---|
| 1020 | %[FileName,PathName] = uigetfile('*.civ','Select a .civ file',oldfile) |
---|
| 1021 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
| 1022 | {'*.xml;*.mat', ' (*.xml,*.mat)'; |
---|
| 1023 | '*.xml', '.xml files '; ... |
---|
| 1024 | '*.mat', '.mat matlab files '}, ... |
---|
| 1025 | 'Pick a file',oldfile); |
---|
| 1026 | fileinput=[PathName FileName];%complete file name |
---|
| 1027 | testblank=findstr(fileinput,' ');%look for blanks |
---|
| 1028 | if ~isempty(testblank) |
---|
| 1029 | msgbox_uvmat('ERROR','forbidden input file name or path: no blank character allowed') |
---|
| 1030 | return |
---|
| 1031 | end |
---|
| 1032 | sizf=size(fileinput); |
---|
| 1033 | if (~ischar(fileinput)|~isequal(sizf(1),1)),return;end |
---|
| 1034 | loadfile(handles,fileinput) |
---|
| 1035 | |
---|
| 1036 | |
---|
| 1037 | % -------------------------------------------------------------------- |
---|
| 1038 | function Untitled_3_Callback(hObject, eventdata, handles) |
---|
| 1039 | % hObject handle to Untitled_3 (see GCBO) |
---|
| 1040 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1041 | % handles structure with handles and user data (see GUIDATA) |
---|
| 1042 | |
---|
| 1043 | |
---|
| 1044 | % -------------------------------------------------------------------- |
---|
| 1045 | function MenuPlot_Callback(hObject, eventdata, handles) |
---|
| 1046 | |
---|
| 1047 | huvmat=findobj(allchild(0),'Name','uvmat');%find the current uvmat interface handle |
---|
| 1048 | UvData=get(huvmat,'UserData');%Data associated to the current uvmat interface |
---|
| 1049 | hhuvmat=guidata(huvmat); %handles of GUI elements in uvmat |
---|
| 1050 | hplot=findobj(huvmat,'Tag','axes3');%main plotting axis of uvmat |
---|
| 1051 | h_menu_coord=findobj(huvmat,'Tag','menu_coord'); |
---|
| 1052 | menu=get(h_menu_coord,'String'); |
---|
| 1053 | choice=get(h_menu_coord,'Value'); |
---|
| 1054 | if iscell(menu) |
---|
| 1055 | option=menu{choice}; |
---|
| 1056 | else |
---|
| 1057 | option='px'; %default |
---|
| 1058 | end |
---|
| 1059 | Coord_cell=get(handles.ListCoord,'String'); |
---|
| 1060 | ObjectData=read_geometry_calib(Coord_cell); |
---|
| 1061 | %ObjectData=read_geometry_calib(handles);%read the interface input parameters defining the object |
---|
| 1062 | if isequal(option,'phys') |
---|
| 1063 | ObjectData.Coord=ObjectData.Coord(:,[1:3]); |
---|
| 1064 | elseif isequal(option,'px')||isequal(option,'') |
---|
| 1065 | ObjectData.Coord=ObjectData.Coord(:,[4:5]); |
---|
| 1066 | else |
---|
| 1067 | msgbox_uvmat('ERROR','the choice in menu_coord of uvmat must be px or phys ') |
---|
| 1068 | end |
---|
| 1069 | axes(hhuvmat.axes3) |
---|
| 1070 | hh=findobj('Tag','calib_points'); |
---|
| 1071 | if isempty(hh) |
---|
| 1072 | hh=line(ObjectData.Coord(:,1),ObjectData.Coord(:,2),'Color','m','Tag','calib_points','LineStyle','.','Marker','+'); |
---|
| 1073 | else |
---|
| 1074 | set(hh,'XData',ObjectData.Coord(:,1)) |
---|
| 1075 | set(hh,'YData',ObjectData.Coord(:,2)) |
---|
| 1076 | end |
---|
| 1077 | |
---|
| 1078 | % -------------------------------------------------------------------- |
---|
| 1079 | function MenuHelp_Callback(hObject, eventdata, handles) |
---|
| 1080 | path_to_uvmat=which ('uvmat');% check the path of uvmat |
---|
| 1081 | pathelp=fileparts(path_to_uvmat); |
---|
| 1082 | helpfile=fullfile(pathelp,'UVMAT_DOC','uvmat_doc.html'); |
---|
| 1083 | if isempty(dir(helpfile)), warndlg_uvmat('The help file uvmat_doc.html needs to be put in the directory UVMAT/UVMAT_DOC','ERROR') |
---|
| 1084 | else |
---|
| 1085 | web([helpfile '#geometry_calib']) |
---|
| 1086 | end |
---|
| 1087 | |
---|
| 1088 | |
---|
| 1089 | |
---|
| 1090 | % -------------------------------------------------------------------- |
---|
| 1091 | function MenuCreateGrid_Callback(hObject, eventdata, handles) |
---|
| 1092 | % hObject handle to MenuCreateGrid (see GCBO) |
---|
| 1093 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1094 | % handles structure with handles and user data (see GUIDATA) |
---|
| 1095 | |
---|
| 1096 | |
---|
| 1097 | % -------------------------------------------------------------------- |
---|
| 1098 | function MenuTranslatePoints_Callback(hObject, eventdata, handles) |
---|
| 1099 | hcalib=get(handles.calib_type,'parent');%handles of the GUI geometry_calib |
---|
| 1100 | CalibData=get(hcalib,'UserData') |
---|
| 1101 | Tinput=[];%default |
---|
| 1102 | if isfield(CalibData,'translate') |
---|
| 1103 | Tinput=CalibData.translate; |
---|
| 1104 | end |
---|
| 1105 | T=translate_points(Tinput);%display translate_points GUI and get shift parameters |
---|
| 1106 | CalibData.translate=T; |
---|
| 1107 | set(hcalib,'UserData',CalibData) |
---|
| 1108 | Coord_cell=get(handles.ListCoord,'String'); |
---|
| 1109 | data=read_geometry_calib(Coord_cell); |
---|
| 1110 | % data=read_geometry_calib(handles); |
---|
| 1111 | data.Coord(:,1)=T(1)+data.Coord(:,1); |
---|
| 1112 | data.Coord(:,2)=T(2)+data.Coord(:,2); |
---|
| 1113 | data.Coord(:,3)=T(3)+data.Coord(:,3); |
---|
| 1114 | data.Coord(:,[4 5])=data.Coord(:,[4 5]); |
---|
| 1115 | for i=1:size(data.Coord,1) |
---|
| 1116 | for j=1:5 |
---|
| 1117 | Coord{i,j}=num2str(data.Coord(i,j),4);%phys x,y,z |
---|
| 1118 | end |
---|
| 1119 | end |
---|
| 1120 | Tabchar=cell2tab(Coord,' | '); |
---|
| 1121 | set(handles.ListCoord,'Value',1) |
---|
| 1122 | set(handles.ListCoord,'String',Tabchar) |
---|
| 1123 | |
---|
| 1124 | |
---|
| 1125 | % -------------------------------------------------------------------- |
---|
| 1126 | function MenuRotatePoints_Callback(hObject, eventdata, handles) |
---|
| 1127 | % hObject handle to MenuRotatePoints (see GCBO) |
---|
| 1128 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1129 | % handles structure with handles and user data (see GUIDATA) |
---|
| 1130 | |
---|
| 1131 | |
---|
| 1132 | % -------------------------------------------------------------------- |
---|
| 1133 | function Untitled_8_Callback(hObject, eventdata, handles) |
---|
| 1134 | % hObject handle to Untitled_8 (see GCBO) |
---|
| 1135 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1136 | % handles structure with handles and user data (see GUIDATA) |
---|
| 1137 | |
---|
| 1138 | |
---|
| 1139 | |
---|
| 1140 | function edit27_Callback(hObject, eventdata, handles) |
---|
| 1141 | |
---|
| 1142 | |
---|
| 1143 | function edit28_Callback(hObject, eventdata, handles) |
---|
| 1144 | % hObject handle to O_y (see GCBO) |
---|
| 1145 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1146 | % handles structure with handles and user data (see GUIDATA) |
---|
| 1147 | |
---|
| 1148 | % Hints: get(hObject,'String') returns contents of O_y as text |
---|
| 1149 | % str2double(get(hObject,'String')) returns contents of O_y as a double |
---|
| 1150 | |
---|
| 1151 | |
---|
| 1152 | % --- Executes on button press in rotation_plus. |
---|
| 1153 | function pushbutton16_Callback(hObject, eventdata, handles) |
---|
| 1154 | % hObject handle to rotation_plus (see GCBO) |
---|
| 1155 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1156 | % handles structure with handles and user data (see GUIDATA) |
---|
| 1157 | |
---|
| 1158 | |
---|
| 1159 | % --- Executes on button press in rotation_minus. |
---|
| 1160 | function pushbutton17_Callback(hObject, eventdata, handles) |
---|
| 1161 | % hObject handle to rotation_minus (see GCBO) |
---|
| 1162 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1163 | % handles structure with handles and user data (see GUIDATA) |
---|
| 1164 | |
---|
| 1165 | |
---|
| 1166 | |
---|
| 1167 | function edit30_Callback(hObject, eventdata, handles) |
---|
| 1168 | % hObject handle to Phi (see GCBO) |
---|
| 1169 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1170 | % handles structure with handles and user data (see GUIDATA) |
---|
| 1171 | |
---|
| 1172 | % Hints: get(hObject,'String') returns contents of Phi as text |
---|
| 1173 | % str2double(get(hObject,'String')) returns contents of Phi as a double |
---|
| 1174 | |
---|
| 1175 | |
---|
| 1176 | % --- Executes during object creation, after setting all properties. |
---|
| 1177 | function O_y_CreateFcn(hObject, eventdata, handles) |
---|
| 1178 | % hObject handle to O_y (see GCBO) |
---|
| 1179 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1180 | % handles empty - handles not created until after all CreateFcns called |
---|
| 1181 | |
---|
| 1182 | % Hint: edit controls usually have a white background on Windows. |
---|
| 1183 | % See ISPC and COMPUTER. |
---|
| 1184 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
| 1185 | set(hObject,'BackgroundColor','white'); |
---|
| 1186 | end |
---|
| 1187 | |
---|
| 1188 | |
---|
| 1189 | % --- Executes during object creation, after setting all properties. |
---|
| 1190 | function O_x_CreateFcn(hObject, eventdata, handles) |
---|
| 1191 | % hObject handle to O_x (see GCBO) |
---|
| 1192 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1193 | % handles empty - handles not created until after all CreateFcns called |
---|
| 1194 | |
---|
| 1195 | % Hint: edit controls usually have a white background on Windows. |
---|
| 1196 | % See ISPC and COMPUTER. |
---|
| 1197 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
| 1198 | set(hObject,'BackgroundColor','white'); |
---|
| 1199 | end |
---|
| 1200 | |
---|
| 1201 | |
---|
| 1202 | % --- Executes during object creation, after setting all properties. |
---|
| 1203 | function T_x_CreateFcn(hObject, eventdata, handles) |
---|
| 1204 | % hObject handle to T_x (see GCBO) |
---|
| 1205 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1206 | % handles empty - handles not created until after all CreateFcns called |
---|
| 1207 | |
---|
| 1208 | % Hint: edit controls usually have a white background on Windows. |
---|
| 1209 | % See ISPC and COMPUTER. |
---|
| 1210 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
| 1211 | set(hObject,'BackgroundColor','white'); |
---|
| 1212 | end |
---|
| 1213 | |
---|
| 1214 | |
---|
| 1215 | % --- Executes during object creation, after setting all properties. |
---|
| 1216 | function T_y_CreateFcn(hObject, eventdata, handles) |
---|
| 1217 | % hObject handle to T_y (see GCBO) |
---|
| 1218 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1219 | % handles empty - handles not created until after all CreateFcns called |
---|
| 1220 | |
---|
| 1221 | % Hint: edit controls usually have a white background on Windows. |
---|
| 1222 | % See ISPC and COMPUTER. |
---|
| 1223 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
| 1224 | set(hObject,'BackgroundColor','white'); |
---|
| 1225 | end |
---|
| 1226 | |
---|
| 1227 | |
---|
| 1228 | % --- Executes during object creation, after setting all properties. |
---|
| 1229 | function T_z_CreateFcn(hObject, eventdata, handles) |
---|
| 1230 | % hObject handle to T_z (see GCBO) |
---|
| 1231 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1232 | % handles empty - handles not created until after all CreateFcns called |
---|
| 1233 | |
---|
| 1234 | % Hint: edit controls usually have a white background on Windows. |
---|
| 1235 | % See ISPC and COMPUTER. |
---|
| 1236 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
| 1237 | set(hObject,'BackgroundColor','white'); |
---|
| 1238 | end |
---|
| 1239 | |
---|
| 1240 | |
---|
| 1241 | |
---|
| 1242 | function edit31_Callback(hObject, eventdata, handles) |
---|
| 1243 | % hObject handle to edit31 (see GCBO) |
---|
| 1244 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1245 | % handles structure with handles and user data (see GUIDATA) |
---|
| 1246 | |
---|
| 1247 | % Hints: get(hObject,'String') returns contents of edit31 as text |
---|
| 1248 | % str2double(get(hObject,'String')) returns contents of edit31 as a double |
---|
| 1249 | |
---|
| 1250 | |
---|
| 1251 | % --- Executes during object creation, after setting all properties. |
---|
| 1252 | function edit31_CreateFcn(hObject, eventdata, handles) |
---|
| 1253 | % hObject handle to edit31 (see GCBO) |
---|
| 1254 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1255 | % handles empty - handles not created until after all CreateFcns called |
---|
| 1256 | |
---|
| 1257 | % Hint: edit controls usually have a white background on Windows. |
---|
| 1258 | % See ISPC and COMPUTER. |
---|
| 1259 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
| 1260 | set(hObject,'BackgroundColor','white'); |
---|
| 1261 | end |
---|
| 1262 | |
---|
| 1263 | |
---|
| 1264 | |
---|
| 1265 | function edit32_Callback(hObject, eventdata, handles) |
---|
| 1266 | % hObject handle to edit32 (see GCBO) |
---|
| 1267 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1268 | % handles structure with handles and user data (see GUIDATA) |
---|
| 1269 | |
---|
| 1270 | % Hints: get(hObject,'String') returns contents of edit32 as text |
---|
| 1271 | % str2double(get(hObject,'String')) returns contents of edit32 as a double |
---|
| 1272 | |
---|
| 1273 | |
---|
| 1274 | % --- Executes during object creation, after setting all properties. |
---|
| 1275 | function edit32_CreateFcn(hObject, eventdata, handles) |
---|
| 1276 | % hObject handle to edit32 (see GCBO) |
---|
| 1277 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1278 | % handles empty - handles not created until after all CreateFcns called |
---|
| 1279 | |
---|
| 1280 | % Hint: edit controls usually have a white background on Windows. |
---|
| 1281 | % See ISPC and COMPUTER. |
---|
| 1282 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
| 1283 | set(hObject,'BackgroundColor','white'); |
---|
| 1284 | end |
---|
| 1285 | |
---|
| 1286 | |
---|
| 1287 | |
---|
| 1288 | function edit33_Callback(hObject, eventdata, handles) |
---|
| 1289 | % hObject handle to edit33 (see GCBO) |
---|
| 1290 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1291 | % handles structure with handles and user data (see GUIDATA) |
---|
| 1292 | |
---|
| 1293 | % Hints: get(hObject,'String') returns contents of edit33 as text |
---|
| 1294 | % str2double(get(hObject,'String')) returns contents of edit33 as a double |
---|
| 1295 | |
---|
| 1296 | |
---|
| 1297 | % --- Executes on button press in pushbutton18. |
---|
| 1298 | function pushbutton18_Callback(hObject, eventdata, handles) |
---|
| 1299 | % hObject handle to pushbutton18 (see GCBO) |
---|
| 1300 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1301 | % handles structure with handles and user data (see GUIDATA) |
---|
| 1302 | |
---|
| 1303 | |
---|
| 1304 | % --- Executes on button press in pushbutton19. |
---|
| 1305 | function pushbutton19_Callback(hObject, eventdata, handles) |
---|
| 1306 | % hObject handle to pushbutton19 (see GCBO) |
---|
| 1307 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1308 | % handles structure with handles and user data (see GUIDATA) |
---|
| 1309 | |
---|
| 1310 | |
---|
| 1311 | |
---|
| 1312 | |
---|