source:trunk/src/geometry_calib.m@2

Last change on this file since 2 was 2, checked in by gostiaux, 14 years ago
• Initial import
• Add .m files in src
• Add .fig files in src
File size: 46.1 KB
Line
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
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
21function 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%
42
43% Edit the above text to modify the response to help geometry_calib
44
46
47% Begin initialization code - DO NOT edit
48gui_Singleton = 1;
49gui_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',   []);
55if nargin & isstr(varargin{1})
56    gui_State.gui_Callback = str2func(varargin{1});
57end
58
59if nargout
60    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
61else
62    gui_mainfcn(gui_State, varargin{:});
63end
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')
72function geometry_calib_OpeningFcn(hObject, eventdata, handles, handles_uvmat,pos,inputfile)
73set(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
75handles.output = hObject;
76
77% Update handles structure
78guidata(hObject, handles);
79movegui(hObject,'east');% position the GUI ton the right of the screen
80if exist('handles_uvmat','var') %& isfield(data,'ParentButton')
81     set(hObject,'DeleteFcn',{@closefcn,handles_uvmat})%
82end
83%set the position of the interface
84if 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);
89end
90inputxml='';
91if 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
100end
101set(handles.ListCoord,'String',{''})
102if exist(inputxml,'file')
104end
105
106set(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.
112function 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
119varargout{1} = handles.output;
120varargout{2}=handles;
121
122%------------
123function Phi_Callback(hObject, eventdata, handles)
124
125
126
127
128%--------------------------------------------------
129%read input xml file and update the edit boxes
131
133t=xmltree(fileinput);
134s=convert(t);%convert to matlab structure
135%read data currently displayed on the interface
136PointCoord=[];
137Coord_cell=get(handles.ListCoord,'String');
140Coord=[]; %default
141if isfield(data,'Coord')
142    Coord=data.Coord;
143end
144TabChar_0=get(handles.ListCoord,'String');
145nbcoord_0=size(TabChar_0,1);
146if isequal(get(handles.edit_append,'Value'),2) %edit mode  A REVOIR
147    val=get(handles.ListCoord,'Value')-1;
148else
149   val=length(TabChar_0);
150end
151nbcoord=0;
152
153%case of calibration (ImaDoc) input file
154hcalib=get(handles.calib_type,'parent');
155CalibData=get(hcalib,'UserData');
156CalibData.XmlInput=fileinput;
159end
160
161set(hcalib,'UserData',CalibData);%store the heading in the interface 'UserData'
162if 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
192end
193%case of xml files of points
194if 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
214end
215CoordCell={};
216for iline=1:size(Coord,1)
217    for j=1:5
218        CoordCell{iline,j}=num2str(Coord(iline,j),4);
219    end
220end
221Tabchar=cell2tab(CoordCell,'    |    ');%transform cells into table ready for display
222set(handles.ListCoord,'Value',1)
223set(handles.ListCoord,'String',Tabchar)
224
225
226%----------------------------------------------------
227% executed when closing: set the parent interface button to value 0
228function closefcn(gcbo,eventdata,handles_uvmat)
229huvmat=findobj(allchild(0),'Name','uvmat');
230if 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]);
235end
236
237
238% % --- Executes on button press in MenuCoord.
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.
251function APPLY_Callback(hObject, eventdata, handles)
252%------------------------------------------------------------------
253calib_cell=get(handles.calib_type,'String');
254val=get(handles.calib_type,'Value');
255calib_type=calib_cell{val};
256Coord_cell=get(handles.ListCoord,'String');
258
259if isequal(calib_type,'rescale')
260    GeometryCalib=calib_rescale(Object.Coord);
261elseif isequal(calib_type,'linear')
262    GeometryCalib=calib_linear(Object.Coord);
263elseif isequal(calib_type,'tsai')
264    GeometryCalib=calib_tsai(Object.Coord);
265end
266unitlist=get(handles.CoordUnit,'String');
267unit=unitlist{get(handles.CoordUnit,'value')};
268GeometryCalib.CoordUnit=unit;
269
270huvmat=findobj(allchild(0),'Name','uvmat');
271hhuvmat=guidata(huvmat);%handles of elements in the GUI uvmat
272RootPath='';
273RootFile='';
274if ~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'];
280else
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);
286end
287testappend=0;
288if exist(outputfile,'file');%=1 if the output file already exists, 0 else
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
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
308        testappend=1;
309        if isempty(uid_calib)
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
317end
318if ~testappend %create a new xml file for calibration data
319    t=xmltree;
322end
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
328GeometryCalib.SourceCalib.PointCoord=Object.Coord;
329t=struct2xml(GeometryCalib,t,uid_calib);
330save(t,outputfile);
331msgbox_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
336hhh=findobj(hhuvmat.axes3,'Tag','calib_marker');% delete calib points and markers
337if ~isempty(hhh)
338    delete(hhh);
339end
340hhh=findobj(hhuvmat.axes3,'Tag','calib_points');
341if ~isempty(hhh)
342    delete(hhh);
343end
344set(hhuvmat.FixedLimits,'Value',0)% put FixedLimits option to 'off'
345set(hhuvmat.FixedLimits,'BackgroundColor',[0.7 0.7 0.7])
346uvmat('RootPath_Callback',hObject,eventdata,hhuvmat); %file input with xml reading  in uvmat
347
348%------------------------------------------------------------------
349% --- Executes on button press in calibrate_lin.
350function REPLICATE_Callback(hObject, eventdata, handles)
351%------------------------------------------------------------------
352calib_cell=get(handles.calib_type,'String');
353val=get(handles.calib_type,'Value');
354calib_type=calib_cell{val};
355Coord_cell=get(handles.ListCoord,'String');
357
358if isequal(calib_type,'rescale')
359    GeometryCalib=calib_rescale(Object.Coord);
360elseif isequal(calib_type,'linear')
361    GeometryCalib=calib_linear(Object.Coord);
362elseif isequal(calib_type,'tsai')
363    GeometryCalib=calib_tsai(Object.Coord);
364end
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
371GeometryCalib.SourceCalib.PointCoord=Object.Coord;
372
373%open and read the dataview GUI
374h_dataview=findobj(allchild(0),'name','dataview');
375Device=[];%default
376if 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
389            [XmlInput,filename,ext]=fileparts(XmlInput);
390        end
392            [XmlInput,filename,ext]=fileparts(XmlInput);
394        end
396            [PP,filename,ext]=fileparts(XmlInput);
397        end
398        testinput=0;
400            set(hhdataview.RootDirectory,'String',XmlInput)
401            set(hhdataview.SubCampaignTest,'Value',1)
402            testinput=1;
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
421end
422
423hhdataview=guidata(h_dataview);
424CurrentPath=get(hhdataview.RootDirectory,'String');
425ListExperiments=get(hhdataview.ListExperiments,'String');
426Value=get(hhdataview.ListExperiments,'Value');
427if ~isequal(Value,1)
428    ListExperiments=ListExperiments(Value);
429end
430ListDevices=get(hhdataview.ListDevices,'String');
431Value=get(hhdataview.ListDevices,'Value');
432if isequal(Value,1)
433    warndlg_uvmat('manually select in the GUI dataview the device being calibrated','ERROR')
434    return
435else
436    ListDevices=ListDevices(Value);
437end
438ListRecords=get(hhdataview.ListRecords,'String');
439Value=get(hhdataview.ListRecords,'Value');
440if ~isequal(Value,1)
441    ListRecords=ListRecords(Value);
442end
443[ListDevices,ListRecords,ListXml,List]=ListDir(CurrentPath,ListExperiments,ListDevices,ListRecords);
444ListXml=get(hhdataview.ListXml,'String');
445Value=get(hhdataview.ListXml,'Value');
446if isequal(Value,1)
447    warndlg_uvmat('you need to select in the GUI dataview the xml files to edit','ERROR')
448    return
449else
450    ListXml=ListXml(Value);
451end
452
453%update all the selected xml files
454answer=msgbox_uvmat('INPUT_Y-N',[num2str(length(Value)) ' xml files for device ' ListDevices{1} ' will be refreshed with ' calib_type ' calibration data']);
456    return
457end
458% 'TEST'
459% List
460% return
461for 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);
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);
491                                    break
492                                end
493                            end
494                        end
495                    end
496                end
497            end
498        end
499    end
500end
501set(hhdataview.ListXml,'Value',Value)
502
503
504%-------------------------------------------------------------
506testappend=0;
507if exist(outputfile,'file');%=1 if the output file already exists, 0 else
510    if isequal(uid,1)%if the xml file is  ImaDoc
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
530end
531if ~testappend
532    t=xmltree;
535%     t=struct2xml(GeometryCalib,t,uid_calib);
536end
537
538t=struct2xml(GeometryCalib,t,uid_calib);
539save(t,outputfile);
540
541
542%-----------------------------------------------------------------
543% determine the parameters for a calibration by an affine function (rescaling and offset, no rotation)
544function GeometryCalib=calib_rescale(Coord)
545%------------------------------------------------------------------
546
547X=Coord(:,1);
548Y=Coord(:,2);
549x_ima=Coord(:,4);
550y_ima=Coord(:,5);
551[px,sx]=polyfit(X,x_ima,1);
552[py,sy]=polyfit(Y,y_ima,1);
553T_x=px(2);
554T_y=py(2);
555GeometryCalib.CalibrationType='rescale';
556GeometryCalib.focal=1;
557GeometryCalib.CoordUnit=[];% default value, to be updated by the calling function
558GeometryCalib.Tx_Ty_Tz=[T_x T_y 1];
559GeometryCalib.R=[px(1),0,0;0,py(1),0;0,0,1];
560
561%check error
562Calib.dpx=1;
563Calib.dpy=1;
564Calib.sx=1;
565Calib.Cx=0;
566Calib.Cy=0;
567Calib.Tz=1;
568Calib.kappa1=0;
569Calib.f=GeometryCalib.focal;
570Calib.Tx=T_x;
571Calib.Ty=T_y;
572Calib.R=GeometryCalib.R;
573[Xpoints,Ypoints]=px_XYZ(Calib,X,Y,0);
574GeometryCalib.ErrorRms(1)=sqrt(mean((Xpoints-x_ima).*(Xpoints-x_ima)));
575GeometryCalib.ErrorMax(1)=max(abs(Xpoints-x_ima));
576GeometryCalib.ErrorRms(2)=sqrt(mean((Ypoints-y_ima).*(Ypoints-y_ima)));
577GeometryCalib.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)
582function GeometryCalib=calib_linear(Coord)
583%------------------------------------------------------------------
584X=Coord(:,1);
585Y=Coord(:,2);
586x_ima=Coord(:,4);
587y_ima=Coord(:,5);
588XY_mat=[ones(size(X)) X Y];
589a_X1=XY_mat\x_ima; %transformation matrix for X
590x1=XY_mat*a_X1;%reconstruction
591err_X1=max(abs(x1-x_ima));%error
592a_Y1=XY_mat\y_ima;%transformation matrix for X
593y1=XY_mat*a_Y1;
594err_Y1=max(abs(y1-y_ima));%error
595T_x=a_X1(1);
596T_y=a_Y1(1);
597GeometryCalib.CalibrationType='linear';
598GeometryCalib.focal=1;
599GeometryCalib.CoordUnit=[];% default value, to be updated by the calling function
600GeometryCalib.Tx_Ty_Tz=[T_x T_y 1];
601GeometryCalib.R=[a_X1(2),a_X1(3),0;a_Y1(2),a_Y1(3),0;0,0,1];
602
603%check error
604GeometryCalib.ErrorRms(1)=sqrt(mean((x1-x_ima).*(x1-x_ima)));
605GeometryCalib.ErrorMax(1)=max(abs(x1-x_ima));
606GeometryCalib.ErrorRms(2)=sqrt(mean((y1-y_ima).*(y1-y_ima)));
607GeometryCalib.ErrorMax(2)=max(abs(y1-y_ima));
608
609
610
611
612%------------------------------------------------------------------
613function GeometryCalib=calib_tsai(Coord)
614%------------------------------------------------------------------
615%TSAI
616% 'calibration_lin' provides a linear transform on coordinates,
617path_uvmat=which('uvmat');% check the path detected for source file uvmat
618path_UVMAT=fileparts(path_uvmat); %path to UVMAT
619if 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
626else
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
633end
634if ~isfield(sparam,'GeometryCalib_exe')
635    warndlg_uvmat(['calibration program <GeometryCalib_exe> undefined in parameter file ' xmlfile],'ERROR')
636    return
637end
638Tsai_exe=sparam.GeometryCalib_exe;
639if ~exist(Tsai_exe,'file')
640    warndlg_uvmat(['calibration program ' Tsai_exe ' does not exist'],'ERROR')
641    return
642end
643
644textcoord=num2str(Coord,4);
645dlmwrite('t.txt',textcoord,'');
646% ['!' Tsai_exe ' -f1 0 -f2 t.txt']
647    eval(['!' Tsai_exe ' -f t.txt > tsaicalib.log']);
648if ~exist('calib.dat','file')
649    warndlg_uvmat('no output from calibration program Tsai_exe: possibly too few points','ERROR')
650end
652GeometryCalib.CalibrationType='tsai';
653GeometryCalib.focal=calibdat(10);
654GeometryCalib.dpx_dpy=[calibdat(5) calibdat(6)];
655GeometryCalib.Cx_Cy=[calibdat(7) calibdat(8)];
656GeometryCalib.sx=calibdat(9);
657GeometryCalib.kappa1=calibdat(11);
658GeometryCalib.CoordUnit=[];% default value, to be updated by the calling function
659GeometryCalib.Tx_Ty_Tz=[calibdat(12) calibdat(13) calibdat(14)];
660Rx_Ry_Rz=calibdat([15:17]);
661sa = sin(Rx_Ry_Rz(1)) ;
662ca=cos(Rx_Ry_Rz(1));
663sb=sin(Rx_Ry_Rz(2));
664cb =cos(Rx_Ry_Rz(2));
665sg =sin(Rx_Ry_Rz(3));
666cg =cos(Rx_Ry_Rz(3));
667r1 = cb * cg;
668r2 = cg * sa * sb - ca * sg;
669r3 = sa * sg + ca * cg * sb;
670r4 = cb * sg;
671r5 = sa * sb * sg + ca * cg;
672r6 = ca * sb * sg - cg * sa;
673r7 = -sb;
674r8 = cb * sa;
675r9 = ca * cb;
676%EN DEDUIRE MATRICE R ??
677GeometryCalib.R=[r1,r2,r3;r4,r5,r6;r7,r8,r9];
678%erreur a caracteriser?
679%check error
680Calib.dpx=GeometryCalib.dpx_dpy(1);
681Calib.dpy=GeometryCalib.dpx_dpy(2);
682Calib.sx=GeometryCalib.sx;
683Calib.Cx=GeometryCalib.Cx_Cy(1);
684Calib.Cy=GeometryCalib.Cx_Cy(2);
685Calib.kappa1=GeometryCalib.kappa1;
686Calib.f=GeometryCalib.focal;
687Calib.Tx=GeometryCalib.Tx_Ty_Tz(1);
688Calib.Ty=GeometryCalib.Tx_Ty_Tz(2);
689Calib.Tz=GeometryCalib.Tx_Ty_Tz(3);
690Calib.R=GeometryCalib.R;
691X=Coord(:,1);
692Y=Coord(:,2);
693Z=Coord(:,3);
694x_ima=Coord(:,4);
695y_ima=Coord(:,5);
696[Xpoints,Ypoints]=px_XYZ(Calib,X,Y,Z);
697
698GeometryCalib.ErrorRms(1)=sqrt(mean((Xpoints-x_ima).*(Xpoints-x_ima)));
699GeometryCalib.ErrorMax(1)=max(abs(Xpoints-x_ima));
700GeometryCalib.ErrorRms(2)=sqrt(mean((Ypoints-y_ima).*(Ypoints-y_ima)));
701GeometryCalib.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.
726function rotation_Callback(hObject, eventdata, handles)
727angle_rot=(pi/180)*str2num(get(handles.Phi,'String'));
728Coord_cell=get(handles.ListCoord,'String');
730data.Coord(:,1)=cos(angle_rot)*data.Coord(:,1)+sin(angle_rot)*data.Coord(:,2);
731data.Coord(:,1)=-sin(angle_rot)*data.Coord(:,1)+cos(angle_rot)*data.Coord(:,2);
732set(handles.XObject,'String',num2str(data.Coord(:,1),4));
733set(handles.YObject,'String',num2str(data.Coord(:,2),4));
734
735
736function XImage_Callback(hObject, eventdata, handles)
737update_list(hObject, eventdata,handles)
738
739function YImage_Callback(hObject, eventdata, handles)
740update_list(hObject, eventdata,handles)
741
742function XObject_Callback(hObject, eventdata, handles)
743update_list(hObject, eventdata,handles)
744
745function YObject_Callback(hObject, eventdata, handles)
746update_list(hObject, eventdata,handles)
747
748function ZObject_Callback(hObject, eventdata, handles)
749update_list(hObject, eventdata,handles)
750
751function update_list(hObject, eventdata, handles)
752str4=get(handles.XImage,'String');
753str5=get(handles.YImage,'String');
754str1=get(handles.XObject,'String');
755tt=double(str1);
756str2=get(handles.YObject,'String');
757str3=get(handles.ZObject,'String');
758if ~isempty(str1) & ~isequal(double(str1),32) & (isempty(str3)|isequal(double(str3),32))
759    str3='0';%put z to 0 by default
760end
761strline=[str1 '    |    ' str2 '    |    ' str3 '    |    ' str4 '    |    ' str5];
762Coord=get(handles.ListCoord,'String');
763val=get(handles.ListCoord,'Value');
764Coord{val}=strline;
765set(handles.ListCoord,'String',Coord)
766
767%--------------------------------------------------------------------
768% --- Executes on selection change in ListCoord.
769%--------------------------------------------------------------------
770function 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
778Coord_cell=get(handles.ListCoord,'String');
779val=get(handles.ListCoord,'Value');
780if 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
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
820end
821
822
823%----------------------------------------------------
824% --- Executes on button press in rotation_plus.
825function rotation_plus_Callback(hObject, eventdata, handles)
826Phi=0;
827Phi=get(handles.Phi,'String');
828if ~isempty(Phi)
829    Phi=str2num(Phi);
830end
831rotation(handles,Phi)
832
833%-------------------------------------------------
834% --- Executes on button press in rotation_minus.
835function rotation_minus_Callback(hObject, eventdata, handles)
836Phi=0;
837Phi=get(handles.Phi,'String');
838if ~isempty(Phi)
839    Phi=-str2num(Phi);
840end
841rotation(handles,Phi)
842
843%-----------------------------------------------------
844%rotation
845function rotation(handles,Phi)
846O_x=str2num(get(handles.O_x,'String'));
847O_y=str2num(get(handles.O_y,'String'));
848if isempty(O_x)
849    O_x=0;%default
850end
851if isempty(O_y)
852    O_y=0;%default
853end
854Coord_cell=get(handles.ListCoord,'String');
857r1=cos(pi*Phi/180);
858r2=-sin(pi*Phi/180);
859r3=sin(pi*Phi/180);
860r4=cos(pi*Phi/180);
861x=data.Coord(:,1);
862y=data.Coord(:,2);
863data.Coord(:,1)=r1*x+r2*y;
864data.Coord(:,2)=r3*x+r4*y;
865% data.Coord(:,[4 5])=data.Coord(:,[4 5]);
866for 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
870end
871Tabchar=cell2tab(Coord,'    |    ');
872set(handles.ListCoord,'Value',1)
873set(handles.ListCoord,'String',Tabchar)
874
875
876function O_x_Callback(hObject, eventdata, handles)
877
878
879function O_y_Callback(hObject, eventdata, handles)
880
881
882function O_z_Callback(hObject, eventdata, handles)
883
884
885% --- Executes on selection change in edit_append.
886function 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
891choice=get(handles.edit_append,'Value');
892if 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)
901end
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];
923%         huvmat=uvmat(imagename);%open uvmat, set phys coord (Value 1)
924%
925% %     end
926% end
927
928function NEW_Callback(hObject, eventdata, handles)
929%A METTRE SOUS UN BOUTON
930huvmat=findobj(allchild(0),'Name','uvmat');
931hchild=get(huvmat,'children');
933coordtype=get(hcoord,'Value');
934haxes=findobj(hchild,'Tag','axes3');
935AxeData=get(haxes,'UserData');
936if ~isequal(hcoord,2)
937    set(hcoord,'Value',2)
938    huvmat=uvmat(AxeData);
939    'relancer uvmat';
940end
941if ~isfield(AxeData,'ZoomAxes')
942    warndlg_uvmat('first draw a window around a grid marker','ERRROR')
943    return
944end
945XLim=get(AxeData.ZoomAxes,'XLim');
946YLim=get(AxeData.ZoomAxes,'YLim');
947np=size(AxeData.A);
948ind_sub_x=round(XLim);
949ind_sub_y=np(1)-round(YLim);
950Mfiltre=AxeData.A([ind_sub_y(2):ind_sub_y(1)] ,ind_sub_x,:);
951Mfiltre_norm=double(Mfiltre);
952Mfiltre_norm=Mfiltre_norm/sum(sum(Mfiltre_norm));
953Mfiltre_norm=100*(Mfiltre_norm-mean(mean(Mfiltre_norm)));
954Atype=class(AxeData.A);
955Data.NbDim=2;
956Data.A=filter2(Mfiltre_norm,double(AxeData.A));
957Data.A=feval(Atype,Data.A);
958Data.AName='image';
959Data.AX=AxeData.AX;
960Data.AY=AxeData.AY;
961Data.CoordType='px';
962plot_field(Data)
963
964
965
966%'key_press_fcn:' function activated when a key is pressed on the keyboard
967%-----------------------------------
968function key_press_fcn(hObject,eventdata,handles)
969hh=get(hObject,'parent');
970xx=double(get(hh,'CurrentCharacter')); %get the keyboard character
971
972if ismember(xx,[8 127])%backspace or delete
973    Coord_cell=get(handles.ListCoord,'String');
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)
993end
994
995
996% --- Executes on button press in append_point.
997function 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% --------------------------------------------------------------------
1011%get the object file
1012huvmat=findobj(allchild(0),'Name','uvmat');
1013UvData=get(huvmat,'UserData');
1014hchild=get(huvmat,'Children');
1015hrootpath=findobj(hchild,'Tag','RootPath');
1016oldfile=get(hrootpath,'String');
1017if isempty(oldfile)
1018    oldfile='';
1019end
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);
1026fileinput=[PathName FileName];%complete file name
1027testblank=findstr(fileinput,' ');%look for blanks
1028if ~isempty(testblank)
1029    msgbox_uvmat('ERROR','forbidden input file name or path: no blank character allowed')
1030    return
1031end
1032sizf=size(fileinput);
1033if (~ischar(fileinput)|~isequal(sizf(1),1)),return;end
1035
1036
1037% --------------------------------------------------------------------
1038function 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% --------------------------------------------------------------------
1046
1047huvmat=findobj(allchild(0),'Name','uvmat');%find the current uvmat interface handle
1048UvData=get(huvmat,'UserData');%Data associated to the current uvmat interface
1049hhuvmat=guidata(huvmat); %handles of GUI elements in uvmat
1050hplot=findobj(huvmat,'Tag','axes3');%main plotting axis of uvmat
1056else
1057    option='px'; %default
1058end
1059Coord_cell=get(handles.ListCoord,'String');
1062if isequal(option,'phys')
1063    ObjectData.Coord=ObjectData.Coord(:,[1:3]);
1064elseif isequal(option,'px')||isequal(option,'')
1065    ObjectData.Coord=ObjectData.Coord(:,[4:5]);
1066else
1067    msgbox_uvmat('ERROR','the choice in menu_coord of uvmat must be px or phys ')
1068end
1069axes(hhuvmat.axes3)
1070hh=findobj('Tag','calib_points');
1071if isempty(hh)
1072    hh=line(ObjectData.Coord(:,1),ObjectData.Coord(:,2),'Color','m','Tag','calib_points','LineStyle','.','Marker','+');
1073else
1074    set(hh,'XData',ObjectData.Coord(:,1))
1075    set(hh,'YData',ObjectData.Coord(:,2))
1076end
1077
1078% --------------------------------------------------------------------
1080path_to_uvmat=which ('uvmat');% check the path of uvmat
1081pathelp=fileparts(path_to_uvmat);
1082    helpfile=fullfile(pathelp,'UVMAT_DOC','uvmat_doc.html');
1083if isempty(dir(helpfile)), warndlg_uvmat('The help file uvmat_doc.html needs to be put in the directory UVMAT/UVMAT_DOC','ERROR')
1084else
1085   web([helpfile '#geometry_calib'])
1086end
1087
1088
1089
1090% --------------------------------------------------------------------
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% --------------------------------------------------------------------
1099hcalib=get(handles.calib_type,'parent');%handles of the GUI geometry_calib
1100CalibData=get(hcalib,'UserData')
1101Tinput=[];%default
1102if isfield(CalibData,'translate')
1103    Tinput=CalibData.translate;
1104end
1105T=translate_points(Tinput);%display translate_points GUI and get shift parameters
1106CalibData.translate=T;
1107set(hcalib,'UserData',CalibData)
1108Coord_cell=get(handles.ListCoord,'String');
1111data.Coord(:,1)=T(1)+data.Coord(:,1);
1112data.Coord(:,2)=T(2)+data.Coord(:,2);
1113data.Coord(:,3)=T(3)+data.Coord(:,3);
1114data.Coord(:,[4 5])=data.Coord(:,[4 5]);
1115for 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
1119end
1120Tabchar=cell2tab(Coord,'    |    ');
1121set(handles.ListCoord,'Value',1)
1122set(handles.ListCoord,'String',Tabchar)
1123
1124
1125% --------------------------------------------------------------------
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% --------------------------------------------------------------------
1133function 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
1140function edit27_Callback(hObject, eventdata, handles)
1141
1142
1143function 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.
1153function 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.
1160function 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
1167function 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.
1177function 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.
1184if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1185    set(hObject,'BackgroundColor','white');
1186end
1187
1188
1189% --- Executes during object creation, after setting all properties.
1190function 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.
1197if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1198    set(hObject,'BackgroundColor','white');
1199end
1200
1201
1202% --- Executes during object creation, after setting all properties.
1203function 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.
1210if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1211    set(hObject,'BackgroundColor','white');
1212end
1213
1214
1215% --- Executes during object creation, after setting all properties.
1216function 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.
1223if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1224    set(hObject,'BackgroundColor','white');
1225end
1226
1227
1228% --- Executes during object creation, after setting all properties.
1229function 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.
1236if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1237    set(hObject,'BackgroundColor','white');
1238end
1239
1240
1241
1242function 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.
1252function 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.
1259if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1260    set(hObject,'BackgroundColor','white');
1261end
1262
1263
1264
1265function 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.
1275function 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.
1282if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1283    set(hObject,'BackgroundColor','white');
1284end
1285
1286
1287
1288function 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.
1298function 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.
1305function 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
Note: See TracBrowser for help on using the repository browser.