Changeset 156
- Timestamp:
- Dec 19, 2010, 10:11:04 PM (14 years ago)
- Location:
- trunk/src
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/calc_field.m
r124 r156 223 223 siz=size(ValCell{1}); 224 224 ValCell{1}=reshape(ValCell{1},siz(1),1); 225 Role{1}='scalar'; 225 226 if isfield(DataIn,'TimeUnit') 226 227 units={[DataIn.TimeUnit '-1']}; -
trunk/src/create_grid.m
r109 r156 12 12 function varargout = create_grid(varargin) 13 13 14 % Last Modified by GUIDE v2.5 05-Mar-2010 21:57:4414 % Last Modified by GUIDE v2.5 16-Dec-2010 00:17:20 15 15 16 16 % Begin initialization code - DO NOT EDIT … … 44 44 if exist('name','var') && ischar(name) 45 45 set(hObject,'name',name) 46 if strcmp(name,'detect_grid') 47 set(handles.white,'Visible','on') 48 set(handles.black,'Visible','on') 49 end 46 50 end 47 51 % Update handles structure … … 137 141 varargout{1}=[xarray yarray zarray]; 138 142 varargout{2}=T; 143 varargout{3}=get(handles.white,'Value') 139 144 end 140 145 … … 189 194 190 195 191 192 193 196 % --- Executes on button press in white. 197 function white_Callback(hObject, eventdata, handles) 198 val=get(handles.white,'Value'); 199 if val 200 set(handles.black,'Value',0) 201 else 202 set(handles.black,'Value',1) 203 end 204 % hObject handle to white (see GCBO) 205 % eventdata reserved - to be defined in a future version of MATLAB 206 % handles structure with handles and user data (see GUIDATA) 207 208 % Hint: get(hObject,'Value') returns toggle state of white 209 210 211 % --- Executes on button press in black. 212 function black_Callback(hObject, eventdata, handles) 213 val=get(handles.black,'Value'); 214 if val 215 set(handles.white,'Value',0) 216 else 217 set(handles.white,'Value',1) 218 end 219 -
trunk/src/dataview.m
r152 r156 102 102 set(handles.Cancel,'Visible','on') 103 103 set(handles.figure,'WindowStyle','modal')% Make% Make the GUI modal 104 set(hObject,'Visible','on') 105 drawnow 104 106 RootDirectory_Callback(hObject, eventdata, handles) 105 107 % UIWAIT makes translate_points wait for user response (see UIRESUME) … … 144 146 function RootDirectory_Callback(hObject, eventdata, handles) 145 147 %------------------------------------------------------------------------ 148 set(handles.RootDirectory,'BackgroundColor',[1 1 0]) 149 drawnow 146 150 CampaignDir=get(handles.RootDirectory,'String'); 147 151 ExpName={''}; … … 167 171 msgbox_uvmat('ERROR',['The input ' CampaignDir ' is not a directory']) 168 172 end 173 set(handles.RootDirectory,'BackgroundColor',[1 1 1]) 169 174 170 175 %------------------------------------------------------------------------ -
trunk/src/delete_object.m
r89 r156 17 17 if isequal(floor(hObject),hObject) %case of an index 18 18 if ~isempty(UvData) & isfield(UvData, 'Object') & length(UvData.Object)>=hObject 19 if isfield(UvData.Object{hObject},' HandlesDisplay')20 hdisplay=UvData.Object{hObject}. HandlesDisplay;19 if isfield(UvData.Object{hObject},'DisplayHandle_uvmat') 20 hdisplay=UvData.Object{hObject}.DisplayHandle_uvmat; 21 21 for iview=1:length(hdisplay) 22 22 if ishandle(hdisplay(iview)) & ~isequal(hdisplay(iview),0) … … 34 34 end 35 35 for iobj=hObject+1:length(UvData.Object) 36 hdisplay=UvData.Object{iobj}. HandlesDisplay;36 hdisplay=UvData.Object{iobj}.DisplayHandle_uvmat; 37 37 for iview=1:length(hdisplay) 38 38 if ishandle(hdisplay(iview)) && ~isequal(hdisplay(iview),0) -
trunk/src/geometry_calib.m
r149 r156 75 75 %------------------------------------------------------------------------ 76 76 % Choose default command line output for geometry_calib 77 77 78 handles.output = hObject; 78 79 … … 82 83 83 84 %set the position of the interface 84 if exist('pos','var')&& length(pos)> 285 86 pos_gui(1)=pos(1);87 pos_gui(2)=pos(2);88 set(hObject,'Position',pos _gui);85 if exist('pos','var')&& length(pos)>=4 86 % %pos_gui=get(hObject,'Position'); 87 % pos_gui(1)=pos(1); 88 % pos_gui(2)=pos(2); 89 set(hObject,'Position',pos); 89 90 end 90 91 91 92 %set menu of calibration options 92 %set(handles.calib_type,'String',{'rescale';'linear';'perspective';'normal';'tsai';'bouguet';'extrinsic'})93 93 set(handles.calib_type,'String',{'rescale';'linear';'3D_linear';'3D_quadr';'3D_extrinsic'}) 94 94 inputxml=''; … … 99 99 inputfile=[fullfile(Pathsub,RootFile) '.xml'];%xml file corresponding to the input file 100 100 end 101 end 102 set(handles.ListCoord,'String',{'......'}) 103 if exist(inputfile,'file') 104 Heading=loadfile(handles,inputfile);% load the point coordiantes existing in the xml file 105 end 106 if isfield(Heading,'Campaign')&& ischar(Heading.Campaign) 107 struct.Campaign=Heading.Campaign; 108 end 109 set(hObject,'UserData',struct) 101 set(handles.ListCoord,'String',{'......'}) 102 if exist(inputfile,'file') 103 Heading=loadfile(handles,inputfile);% load the point coordiantes existing in the xml file 104 if isfield(Heading,'Campaign')&& ischar(Heading.Campaign) 105 struct.Campaign=Heading.Campaign; 106 end 107 end 108 set(hObject,'UserData',struct) 109 end 110 110 111 set(handles.ListCoord,'KeyPressFcn',{@key_press_fcn,handles})%set keyboard action function 111 112 … … 126 127 if ~isempty(huvmat) 127 128 handles=guidata(huvmat); 128 set(handles.MenuMask,'enable','on')129 set(handles.MenuGrid,'enable','on')130 set(handles.MenuObject,'enable','on')131 set(handles.MenuEdit,'enable','on')132 set(handles.edit,'enable','on')129 % set(handles.MenuMask,'enable','on') 130 % set(handles.MenuGrid,'enable','on') 131 % set(handles.MenuObject,'enable','on') 132 % set(handles.MenuEdit,'enable','on') 133 % set(handles.edit,'enable','on') 133 134 hobject=findobj(handles.axes3,'tag','calib_points'); 134 135 if ~isempty(hobject) … … 1103 1104 grid_input=CalibData.grid;%retrieve the previously used grid 1104 1105 end 1105 [T,CalibData.grid ]=create_grid(grid_input,'detect_grid');%display the GUI create_grid, read the set of phys coordinates T1106 [T,CalibData.grid,white_test]=create_grid(grid_input,'detect_grid');%display the GUI create_grid, read the set of phys coordinates T 1106 1107 1107 1108 set(handles.geometry_calib,'UserData',CalibData)%store the phys grid parameters for later use … … 1200 1201 % [Amod,Rangx,Rangy]=phys_Ima(A-min(min(A)),GeometryCalib,0); 1201 1202 1202 1203 Amod=double(Amod); 1203 if white_test 1204 Amod=double(Amod);%will look for image maxima 1205 else 1206 Amod=-double(Amod);%will look for image minima 1207 end 1204 1208 % figure(12) %display corrected image 1205 1209 % Amax=max(max(Amod)); -
trunk/src/get_plot_handles.m
r128 r156 65 65 %PlotHandles.cal=handles.cal; 66 66 %PlotHandles.makemask=handles.makemask; 67 PlotHandles.edit =handles.edit;67 PlotHandles.edit_object=handles.edit_object; 68 68 PlotHandles.text_display_1=handles.text_display_1; 69 69 PlotHandles.text_display_2=handles.text_display_2; -
trunk/src/imadoc2struct.m
r116 r156 16 16 17 17 function [s,errormsg]=imadoc2struct(ImaDoc,option) 18 %% default input and output 18 19 if ~exist('option','var') 19 option=' default';20 option='*'; 20 21 end 21 22 errormsg=[];%default … … 26 27 tsai=[];%default 27 28 29 %% opening the xml file 28 30 if exist(ImaDoc,'file')~=2, errormsg=[ ImaDoc ' does not exist']; return;end;%input file does not exist 29 31 try … … 34 36 return 35 37 end 36 37 38 uid_root=find(t,'/ImaDoc'); 38 39 if isempty(uid_root), errormsg=[ImaDoc ' is not an image documentation file ImaDoc']; return; end;%not an ImaDoc .xml file 39 40 40 %Heading 41 42 %% Heading 41 43 uid_Heading=find(t,'/ImaDoc/Heading'); 42 44 if ~isempty(uid_Heading), … … 55 57 end 56 58 57 %Camera 58 uid_Camera=find(t,'/ImaDoc/Camera'); 59 if ~isempty(uid_Camera) 60 uid_ImageSize=find(t,'/ImaDoc/Camera/ImageSize'); 61 if ~isempty(uid_ImageSize); 62 ImageSize=get(t,children(t,uid_ImageSize),'value'); 63 xindex=findstr(ImageSize,'x'); 64 if length(xindex)>=2 65 s.Npx=str2double(ImageSize(1:xindex(1)-1)); 66 s.Npy=str2double(ImageSize(xindex(1)+1:xindex(2)-1)); 59 %% Camera and timing 60 if strcmp(option,'*') || strcmp(option,'Camera') 61 uid_Camera=find(t,'/ImaDoc/Camera'); 62 if ~isempty(uid_Camera) 63 uid_ImageSize=find(t,'/ImaDoc/Camera/ImageSize'); 64 if ~isempty(uid_ImageSize); 65 ImageSize=get(t,children(t,uid_ImageSize),'value'); 66 xindex=findstr(ImageSize,'x'); 67 if length(xindex)>=2 68 s.Npx=str2double(ImageSize(1:xindex(1)-1)); 69 s.Npy=str2double(ImageSize(xindex(1)+1:xindex(2)-1)); 70 end 71 end 72 uid_TimeUnit=find(t,'/ImaDoc/Camera/TimeUnit'); 73 if ~isempty(uid_TimeUnit) 74 s.TimeUnit=get(t,children(t,uid_TimeUnit),'value'); 75 end 76 uid_BurstTiming=find(t,'/ImaDoc/Camera/BurstTiming'); 77 if ~isempty(uid_BurstTiming) 78 for k=1:length(uid_BurstTiming) 79 subt=branch(t,uid_BurstTiming(k));%subtree under BurstTiming 80 % reading Dtk 81 Frequency=get_value(subt,'/BurstTiming/FrameFrequency',1); 82 Dtj=get_value(subt,'/BurstTiming/Dtj',[]); 83 Dtj=Dtj/Frequency;%Dtj converted from frame unit to TimeUnit (e.g. 's') 84 NbDtj=get_value(subt,'/BurstTiming/NbDtj',1); 85 Dti=get_value(subt,'/BurstTiming/Dti',[]); 86 Dti=Dti/Frequency;%Dtj converted from frame unit to TimeUnit (e.g. 's') 87 NbDti=get_value(subt,'/BurstTiming/NbDti',1); 88 Time_val=get_value(subt,'/BurstTiming/Time',0);%time in TimeUnit 89 if ~isempty(Dti) 90 Dti=reshape(Dti'*ones(1,NbDti),NbDti*numel(Dti),1); %concatene Dti vector NbDti times 91 Time_val=[Time_val;Time_val(end)+cumsum(Dti)];%append the times defined by the intervals Dti 92 end 93 if ~isempty(Dtj) 94 Dtj=reshape(Dtj'*ones(1,NbDtj),1,NbDtj*numel(Dtj)); %concatene Dti vector NbDti times 95 Dtj=[0 Dtj]; 96 Time_val=Time_val*ones(1,numel(Dtj))+ones(numel(Time_val),1)*cumsum(Dtj);% produce a time matrix with Dtj 97 end 98 % reading Dtk 99 Dtk=get_value(subt,'/BurstTiming/Dtk',[]); 100 NbDtk=get_value(subt,'/BurstTiming/NbDtk',1); 101 if isempty(Dtk) 102 s.Time=[s.Time;Time_val]; 103 else 104 for kblock=1:NbDtk+1 105 Time_val=Time_val+(kblock-1)*Dtk; 106 s.Time=[s.Time;Time_val]; 107 end 108 end 109 end 67 110 end 68 111 end 69 uid_TimeUnit=find(t,'/ImaDoc/Camera/TimeUnit'); 70 if ~isempty(uid_TimeUnit) 71 s.TimeUnit=get(t,children(t,uid_TimeUnit),'value'); 112 end 113 114 %% geometric calibration 115 if strcmp(option,'*') || strcmp(option,'GeometryCalib') 116 uid_GeometryCalib=find(t,'/ImaDoc/GeometryCalib'); 117 if ~isempty(uid_GeometryCalib) 118 if length(uid_GeometryCalib)>1 119 errormsg=['More than one GeometryCalib in ' filecivxml]; 120 return 121 end 122 subt=branch(t,uid_GeometryCalib);%subtree under GeometryCalib 123 cont=get(subt,1,'contents'); 124 if ~isempty(cont) 125 uid_CalibrationType=find(subt,'/GeometryCalib/CalibrationType'); 126 if isequal(length(uid_CalibrationType),1) 127 tsai.CalibrationType=get(subt,children(subt,uid_CalibrationType),'value'); 128 end 129 uid_CoordUnit=find(subt,'/GeometryCalib/CoordUnit'); 130 if isequal(length(uid_CoordUnit),1) 131 tsai.CoordUnit=get(subt,children(subt,uid_CoordUnit),'value'); 132 end 133 uid_fx_fy=find(subt,'/GeometryCalib/fx_fy'); 134 focal=[];%default fro old convention (Reg Wilson) 135 if isequal(length(uid_fx_fy),1) 136 tsai.fx_fy=str2num(get(subt,children(subt,uid_fx_fy),'value')); 137 else %old convention (Reg Wilson) 138 uid_focal=find(subt,'/GeometryCalib/focal'); 139 uid_dpx_dpy=find(subt,'/GeometryCalib/dpx_dpy'); 140 uid_sx=find(subt,'/GeometryCalib/sx'); 141 if ~isempty(uid_focal) && ~isempty(uid_dpx_dpy) && ~isempty(uid_sx) 142 dpx_dpy=str2num(get(subt,children(subt,uid_dpx_dpy),'value')); 143 sx=str2num(get(subt,children(subt,uid_sx),'value')); 144 focal=str2num(get(subt,children(subt,uid_focal),'value')); 145 tsai.fx_fy(1)=sx*focal/dpx_dpy(1); 146 tsai.fx_fy(2)=focal/dpx_dpy(2); 147 end 148 end 149 uid_Cx_Cy=find(subt,'/GeometryCalib/Cx_Cy'); 150 if ~isempty(uid_Cx_Cy) 151 tsai.Cx_Cy=str2num(get(subt,children(subt,uid_Cx_Cy),'value')); 152 end 153 uid_kc=find(subt,'/GeometryCalib/kc'); 154 if ~isempty(uid_kc) 155 tsai.kc=str2double(get(subt,children(subt,uid_kc),'value')); 156 else %old convention (Reg Wilson) 157 uid_kappa1=find(subt,'/GeometryCalib/kappa1'); 158 if ~isempty(uid_kappa1)&& ~isempty(focal) 159 kappa1=str2double(get(subt,children(subt,uid_kappa1),'value')); 160 tsai.kc=-kappa1*focal*focal; 161 end 162 end 163 uid_Tx_Ty_Tz=find(subt,'/GeometryCalib/Tx_Ty_Tz'); 164 if ~isempty(uid_Tx_Ty_Tz) 165 tsai.Tx_Ty_Tz=str2num(get(subt,children(subt,uid_Tx_Ty_Tz),'value')); 166 end 167 uid_R=find(subt,'/GeometryCalib/R'); 168 if ~isempty(uid_R) 169 RR=get(subt,children(subt,uid_R),'value'); 170 if length(RR)==3 171 tsai.R=[str2num(RR{1});str2num(RR{2});str2num(RR{3})]; 172 end 173 end 174 175 %look for laser plane definitions 176 uid_Angle=find(subt,'/GeometryCalib/PlaneAngle'); 177 uid_Pos=find(subt,'/GeometryCalib/SliceCoord'); 178 if isempty(uid_Pos) 179 uid_Pos=find(subt,'/GeometryCalib/PlanePos');%old convention 180 end 181 if ~isempty(uid_Angle) 182 tsai.PlaneAngle=str2num(get(subt,children(subt,uid_Angle),'value')); 183 end 184 if ~isempty(uid_Pos) 185 for j=1:length(uid_Pos) 186 tsai.SliceCoord(j,:)=str2num(get(subt,children(subt,uid_Pos(j)),'value')); 187 end 188 uid_DZ=find(subt,'/GeometryCalib/SliceDZ'); 189 uid_NbSlice=find(subt,'/GeometryCalib/NbSlice'); 190 if ~isempty(uid_DZ) && ~isempty(uid_NbSlice) 191 DZ=str2double(get(subt,children(subt,uid_DZ),'value')); 192 NbSlice=get(subt,children(subt,uid_NbSlice),'value'); 193 if isequal(NbSlice,'volume') 194 tsai.NbSlice='volume'; 195 NbSlice=NbDtj+1; 196 else 197 tsai.NbSlice=str2double(NbSlice); 198 end 199 tsai.SliceCoord=ones(NbSlice,1)*tsai.SliceCoord+DZ*(0:NbSlice-1)'*[0 0 1]; 200 end 201 end 202 if strcmp(option,'GeometryCalib') 203 tsai.PointCoord=get_value(subt,'/GeometryCalib/SourceCalib/PointCoord',[0 0 0 0 0]); 204 end 205 s.GeometryCalib=tsai; 206 end 72 207 end 73 uid_BurstTiming=find(t,'/ImaDoc/Camera/BurstTiming'); 74 if ~isempty(uid_BurstTiming) 75 for k=1:length(uid_BurstTiming) 76 subt=branch(t,uid_BurstTiming(k));%subtree under BurstTiming 77 % reading Dtk 78 Frequency=get_value(subt,'/BurstTiming/FrameFrequency',1); 79 Dtj=get_value(subt,'/BurstTiming/Dtj',[]); 80 Dtj=Dtj/Frequency;%Dtj converted from frame unit to TimeUnit (e.g. 's') 81 NbDtj=get_value(subt,'/BurstTiming/NbDtj',1); 82 Dti=get_value(subt,'/BurstTiming/Dti',[]); 83 Dti=Dti/Frequency;%Dtj converted from frame unit to TimeUnit (e.g. 's') 84 NbDti=get_value(subt,'/BurstTiming/NbDti',1); 85 Time_val=get_value(subt,'/BurstTiming/Time',0);%time in TimeUnit 86 if ~isempty(Dti) 87 Dti=reshape(Dti'*ones(1,NbDti),NbDti*numel(Dti),1); %concatene Dti vector NbDti times 88 Time_val=[Time_val;Time_val(end)+cumsum(Dti)];%append the times defined by the intervals Dti 89 end 90 if ~isempty(Dtj) 91 Dtj=reshape(Dtj'*ones(1,NbDtj),1,NbDtj*numel(Dtj)); %concatene Dti vector NbDti times 92 Dtj=[0 Dtj]; 93 Time_val=Time_val*ones(1,numel(Dtj))+ones(numel(Time_val),1)*cumsum(Dtj);% produce a time matrix with Dtj 94 end 95 % reading Dtk 96 Dtk=get_value(subt,'/BurstTiming/Dtk',[]); 97 NbDtk=get_value(subt,'/BurstTiming/NbDtk',1); 98 if isempty(Dtk) 99 s.Time=[s.Time;Time_val]; 100 else 101 for kblock=1:NbDtk+1 102 Time_val=Time_val+(kblock-1)*Dtk; 103 s.Time=[s.Time;Time_val]; 104 end 105 end 106 end 107 end 108 end 109 110 %read calibration 111 uid_GeometryCalib=find(t,'/ImaDoc/GeometryCalib'); 112 if ~isempty(uid_GeometryCalib) 113 if length(uid_GeometryCalib)>1 114 errormsg=['More than one GeometryCalib in ' filecivxml]; 115 return 116 end 117 subt=branch(t,uid_GeometryCalib);%subtree under GeometryCalib 118 cont=get(subt,1,'contents'); 119 if ~isempty(cont) 120 % uid_pixcmx=find(subt,'/GeometryCalib/Pxcmx'); 121 % uid_pixcmy=find(subt,'/GeometryCalib/Pxcmy'); 122 % if ~isempty(uid_pixcmx) && ~isempty(uid_pixcmy)%NON UTILISE 123 % pixcmx=str2num(get(subt,children(subt,uid_pixcmx),'value')); 124 % if isempty(pixcmx),pixcmx=1;end; %default 125 % pixcmy=str2num(get(subt,children(subt,uid_pixcmy),'value')); 126 % if isempty(pixcmy),pixcmy=1;end; %default 127 % tsai.Pxcmx=pixcmx; 128 % tsai.Pxcmy=pixcmy; 129 % end 130 %default values: 131 %tsai.dpx_dpy=1; 132 %tsai.dpy=1; 133 %tsai.sx=1; 134 % tsai.Cx_Cy=[0 0]; 135 % tsai.Cy=0; 136 % tsai.Tx_Ty_Tz=[0 0 1]; 137 % tsai.Tx=0; 138 % tsai.Ty=0; 139 % tsai.R=[1 0 0; 0 1 0; 0 0 0]; 140 uid_CalibrationType=find(subt,'/GeometryCalib/CalibrationType'); 141 if isequal(length(uid_CalibrationType),1) 142 tsai.CalibrationType=get(subt,children(subt,uid_CalibrationType),'value'); 143 end 144 uid_CoordUnit=find(subt,'/GeometryCalib/CoordUnit'); 145 if isequal(length(uid_CoordUnit),1) 146 tsai.CoordUnit=get(subt,children(subt,uid_CoordUnit),'value'); 147 end 148 uid_fx_fy=find(subt,'/GeometryCalib/fx_fy'); 149 focal=[];%default fro old convention (Reg Wilson) 150 if isequal(length(uid_fx_fy),1) 151 tsai.fx_fy=str2num(get(subt,children(subt,uid_fx_fy),'value')); 152 else %old convention (Reg Wilson) 153 uid_focal=find(subt,'/GeometryCalib/focal'); 154 uid_dpx_dpy=find(subt,'/GeometryCalib/dpx_dpy'); 155 uid_sx=find(subt,'/GeometryCalib/sx'); 156 if ~isempty(uid_focal) && ~isempty(uid_dpx_dpy) && ~isempty(uid_sx) 157 dpx_dpy=str2num(get(subt,children(subt,uid_dpx_dpy),'value')); 158 sx=str2num(get(subt,children(subt,uid_sx),'value')); 159 focal=str2num(get(subt,children(subt,uid_focal),'value')); 160 tsai.fx_fy(1)=sx*focal/dpx_dpy(1); 161 tsai.fx_fy(2)=focal/dpx_dpy(2); 162 end 163 end 164 uid_Cx_Cy=find(subt,'/GeometryCalib/Cx_Cy'); 165 if ~isempty(uid_Cx_Cy) 166 tsai.Cx_Cy=str2num(get(subt,children(subt,uid_Cx_Cy),'value')); 167 end 168 uid_kc=find(subt,'/GeometryCalib/kc'); 169 if ~isempty(uid_kc) 170 tsai.kc=str2num(get(subt,children(subt,uid_kc),'value')); 171 else %old convention (Reg Wilson) 172 uid_kappa1=find(subt,'/GeometryCalib/kappa1'); 173 if ~isempty(uid_kappa1)&& ~isempty(focal) 174 kappa1=str2num(get(subt,children(subt,uid_kappa1),'value')); 175 tsai.kc=-kappa1*focal*focal; 176 end 177 end 178 uid_Tx_Ty_Tz=find(subt,'/GeometryCalib/Tx_Ty_Tz'); 179 if ~isempty(uid_Tx_Ty_Tz) 180 tsai.Tx_Ty_Tz=str2num(get(subt,children(subt,uid_Tx_Ty_Tz),'value')); 181 end 182 uid_R=find(subt,'/GeometryCalib/R'); 183 if ~isempty(uid_R) 184 RR=get(subt,children(subt,uid_R),'value'); 185 if length(RR)==3 186 tsai.R=[str2num(RR{1});str2num(RR{2});str2num(RR{3})]; 187 end 188 end 189 190 %look for laser plane definitions 191 uid_Angle=find(subt,'/GeometryCalib/PlaneAngle'); 192 uid_Pos=find(subt,'/GeometryCalib/SliceCoord'); 193 if isempty(uid_Pos) 194 uid_Pos=find(subt,'/GeometryCalib/PlanePos');%old convention 195 end 196 if ~isempty(uid_Angle) 197 tsai.PlaneAngle=str2num(get(subt,children(subt,uid_Angle),'value')); 198 end 199 if ~isempty(uid_Pos) 200 for j=1:length(uid_Pos) 201 tsai.SliceCoord(j,:)=str2num(get(subt,children(subt,uid_Pos(j)),'value')); 202 end 203 uid_DZ=find(subt,'/GeometryCalib/SliceDZ'); 204 uid_NbSlice=find(subt,'/GeometryCalib/NbSlice'); 205 if ~isempty(uid_DZ) && ~isempty(uid_NbSlice) 206 DZ=str2double(get(subt,children(subt,uid_DZ),'value')); 207 NbSlice=get(subt,children(subt,uid_NbSlice),'value'); 208 if isequal(NbSlice,'volume') 209 tsai.NbSlice='volume'; 210 NbSlice=NbDtj+1; 211 else 212 tsai.NbSlice=str2double(NbSlice); 213 end 214 tsai.SliceCoord=ones(NbSlice,1)*tsai.SliceCoord+DZ*(0:NbSlice-1)'*[0 0 1]; 215 end 216 end 217 if strcmp(option,'GeometryCalib') 218 tsai.PointCoord=get_value(subt,'/GeometryCalib/SourceCalib/PointCoord',[0 0 0 0 0]);%time in TimeUnit 219 size(tsai.PointCoord) 220 end 221 s.GeometryCalib=tsai; 222 end 223 end 208 end 224 209 225 210 %-------------------------------------------------- -
trunk/src/mouse_down.m
r150 r156 24 24 function xy=mouse_down(hObject,eventdata) 25 25 26 MouseAction='none'; %default26 %MouseAction='none'; %default 27 27 huvmat=findobj(allchild(0),'tag','uvmat');%find the uvmat interface handle which controls theoption of mouse action 28 28 if isempty(huvmat) … … 30 30 end 31 31 hhuvmat=guidata(huvmat);%handles of elements in uvmat 32 guihandles=guidata(hObject);33 32 UvData=get(huvmat,'UserData'); 34 MouseAction='none'; %default33 %MouseAction='none'; %default 35 34 currentfig=hObject; 36 35 hhcurrentfig=guidata(currentfig); 37 test_zoom=get(hhcurrentfig.zoom,'Value') 38 %test_zoom=get(guihandles.zoom,'Value');% get the mouse action from the uvmat GUI: options: 39 if isfield(UvData,'MouseAction') 40 MouseAction=UvData.MouseAction;% get the mouse action from the uvmat GUI: options: 41 end 42 43 test_create=~test_zoom && (isequal(MouseAction,'create_object') || isequal(MouseAction,'create_mask')); 36 test_zoom=get(hhcurrentfig.zoom,'Value');%test for zoom action, first priority 37 % if isfield(UvData,'MouseAction') 38 % MouseAction=UvData.MouseAction;% get the mouse action from the uvmat GUI: options: 39 % end 40 44 41 %test_cal=get(handles.cal,'Value'); 45 test_cal=strcmp(MouseAction,'calib'); 46 test_ruler=strcmp(MouseAction,'ruler'); 47 test_edit=strcmp(MouseAction,'edit_object'); 48 test_edit_vect=strcmp(MouseAction,'edit_vect'); 42 % test_cal=strcmp(MouseAction,'calib'); 43 test_ruler=isequal(get(hhuvmat.MenuRuler,'checked'),'on');%test for ruler action, second priority 44 %test_ruler=strcmp(MouseAction,'ruler'); 45 %test_edit=strcmp(MouseAction,'edit_object'); 46 test_edit=get(hhuvmat.edit_object,'Value');%test for object editing, third priority 47 %test_edit_vect=strcmp(MouseAction,'edit_vect');%test for vector editing, priority 4 48 test_edit_vect=get(hhuvmat.edit_vect,'Value');%test for vector editing, priority 4 49 test_create=isequal(get(hhuvmat.MenuObject,'checked'),'on');% test for object creation, priority 5 50 if test_create 51 hset_object=findobj(allchild(0),'tag','set_object'); 52 test_create=~isempty(hset_object)&&~test_edit; 53 end 54 test_cal=isequal(get(hhuvmat.MenuCalib,'checked'),'on');% test for calibration 55 if test_cal% test for calibration popints, priority 6 56 h_calib=findobj(allchild(0),'tag','geometry_calib'); 57 if isempty(h_calib) 58 test_cal=0; 59 set(hhuvmat.MenuCalib,'checked','off');% test for calibration off 60 else 61 hh_calib=guidata(h_calib); 62 test_cal=get(hh_calib.edit_append,'Value'); 63 end 64 end 65 %test_create=~test_zoom && strcmp(MouseAction,'create_object')&&~test_edit && ~test_edit_vect ;% || isequal(MouseAction,'create_mask')); 49 66 xdisplay=[];%default 50 67 ydisplay=[];%default 51 68 AxeData=[];%default 52 69 53 % edit an existing point or line if found70 %% edit an existing point or line if found 54 71 hcurrentobject=gco;% current object handle (selected by the mouse) 55 72 hcurrentfig=hObject;% current figure handle … … 60 77 hchild=get(hcurrentfig,'Children');%handles of all objects in the current figure 61 78 haxes=[]; 62 % loop on all the objects in the current figure (selected by the last mouse click) 79 80 %% loop on all the objects in the current figure (selected by the last mouse click) 63 81 for ichild=1:length(hchild) 64 82 obj_pos=get(hchild(ichild),'Position');%position of the object … … 74 92 AxeData=get(haxes,'UserData');% data attached to the axis 75 93 AxeData.CurrentOrigin=[xy(1,1) xy(1,2)];% The current point set by the mouse becomes the current origin 76 if ~isequal(tag_obj,'proj_object') & ~test_create 77 x_mouse=xy(1,1);%default 78 y_mouse=xy(1,2);%default 79 u_mouse=[]; 80 v_mouse=[]; 81 w_mouse=[]; 82 A_mouse=[]; 83 c_text=[]; 84 f_text=[]; 85 ff_text=[]; 86 ivec=[]; 87 if isfield(AxeData,'X') & isfield(AxeData,'Y') & isfield(AxeData,'Mesh')% test on the existence of a vector field in the current axis 88 flag_vec=(AxeData.X<(xy(1,1)+AxeData.Mesh/4) & AxeData.X>(xy(1,1)-AxeData.Mesh/4)) & ...%flagx=1 for the vectors with x position selected by the mouse 89 (AxeData.Y<(xy(1,2)+AxeData.Mesh/4) & AxeData.Y>(xy(1,2)-AxeData.Mesh/4));%f 90 ivec=find(flag_vec,1);% search the (first) selected vector index ivec 94 if test_edit_vect && ~isequal(tag_obj,'proj_object') & ~test_create 95 ivec=[]; 96 FigData=get(hcurrentfig,'UserData'); 97 tagaxes=get(haxes,'tag'); 98 if isfield(FigData,tagaxes) 99 eval(['Field=FigData.' tagaxes ';']) 100 [CellVarIndex,NbDim,VarType]=find_field_indices(Field);%analyse the physical fields contained in Field 101 for icell=1:numel(CellVarIndex)%look for all physical fields 102 if NbDim(icell)==2 % select 2D field 103 if isfield(Field,'Mesh') && ~isempty(Field.Mesh)&& ~isempty(VarType{icell}.coord_x) && ~isempty(VarType{icell}.coord_y)%case of unstructured data 104 eval(['X=Field.' Field.ListVarName{VarType{icell}.coord_x} ';']) 105 eval(['Y=Field.' Field.ListVarName{VarType{icell}.coord_y} ';']) 106 flag_vec=(X<(xy(1,1)+Field.Mesh/4) & X>(xy(1,1)-Field.Mesh/4)) & ...%flagx=1 for the vectors with x position selected by the mouse 107 (Y<(xy(1,2)+Field.Mesh/4) & Y>(xy(1,2)-Field.Mesh/4));%f 108 ivec=find(flag_vec,1);% search the (first) selected vector index ivec 109 end 110 end 111 end 91 112 end 92 113 end … … 113 134 end 114 135 115 % zoom has first priority136 %% zoom has first priority 116 137 if test_zoom %&& ~test_create && ~test_edit && ~test_edit_vect && exist('xy','var') 117 138 AxeData.Drawing='zoom'; %initiate drawing mode … … 120 141 return 121 142 end 122 if isempty(huvmat) 123 return 124 end 125 126 % ruler has second priority143 if isempty(huvmat)%further options require the uvmat GUI 144 return 145 end 146 147 %% ruler has second priority 127 148 if test_ruler 128 UvData.RulerCoord(1,1)=xy(1,1); 129 UvData.RulerCoord(1,2)=xy(1,2); 130 UvData.RulerHandle=line([xy(1,1) xy(1,1)],[xy(1,2) xy(1,2)],'Color','m','Tag','ruler'); 131 set(huvmat,'UserData',UvData) 149 AxeData.RulerCoord(1,1)=xy(1,1); 150 AxeData.RulerCoord(1,2)=xy(1,2); 151 AxeData.RulerHandle=line([xy(1,1) xy(1,1)],[xy(1,2) xy(1,2)],'Color','m','Tag','ruler'); 132 152 AxeData.Drawing='ruler'; 133 153 set(haxes,'UserData',AxeData); … … 135 155 end 136 156 137 % selection of an existing projection object157 %% selection of an existing projection object (third priority) 138 158 if test_edit && (isequal(tag_obj,'proj_object')||isequal(tag_obj,'DeformPoint')) 139 159 if ~(isfield(AxeData,'Drawing') && isequal(AxeData.Drawing,'create')) … … 222 242 end 223 243 end 224 % create new projection object 244 245 %% create new projection object 225 246 if test_create && ~isempty(xy) && ~(isfield(AxeData,'Drawing')&& isequal(AxeData.Drawing,'create')) 226 ObjectData=read_set_object(UvData.sethandles); 227 ObjectData.Coord=[]; %reset previous object coordinates 228 ObjectData.Coord(1,1)=xy(1,1); 229 ObjectData.Coord(1,2)=xy(1,2); 230 ObjectData.Coord(1,3)=0; 231 if isfield(AxeData,'ObjectCoord') & size(AxeData.ObjectCoord,2)==3 232 ObjectData.Coord(1,3)=AxeData.ObjectCoord(1,3); %generaliser au cas avec angle 233 end 234 AxeData.CurrentObject=plot_object(ObjectData,[],haxes,'m');%draw the object and its handle becomes AxeData.CurrentObject 235 if isfield(UvData,'Object') 236 IndexObj=length(UvData.Object)+1;% add the object as index IndexObj on the list of the interface 237 else 238 IndexObj=2; 239 end 240 UvData.Object{IndexObj}=ObjectData; 241 UvData.Object{IndexObj}.HandlesDisplay(1)=AxeData.CurrentObject; 242 set(huvmat,'UserData',UvData) 243 list_str=get(hhuvmat.list_object_1,'String'); 244 object_name=get(UvData.sethandles.TITLE,'String') 245 if isempty(object_name)|| strcmp(object_name,'') 246 list_str{IndexObj}=[num2str(IndexObj) '-' ObjectData.Style]; 247 set(UvData.sethandles.TITLE,'String',list_str{IndexObj}) 248 else 249 list_str{IndexObj}=object_name; 250 end 251 set(hhuvmat.list_object_1,'String',list_str) 252 list_str{end+1}='...'; 253 set(hhuvmat.list_object_2,'String',list_str) 254 if strcmp(fig_tag,'view_field')%we are in view_field plot 255 set(hhuvmat.list_object_1,'Value',IndexObj)% the projection field will be plotted in uvmat frame 256 else%we are in uvmat plot 257 set(hhuvmat.list_object_2,'Value',IndexObj) 258 end 259 PlotData=get(AxeData.CurrentObject,'UserData'); 260 PlotData.IndexObj=IndexObj; 261 set(AxeData.CurrentObject,'UserData',PlotData); %record the object index in the graph 262 AxeData.Drawing='create'; 247 hset_object=findobj(allchild(0),'tag','set_object'); 248 if ~isempty(hset_object) 249 sethandles=guidata(hset_object); 250 ObjectData=read_set_object(sethandles); 251 ObjectData.Coord=[]; %reset previous object coordinates 252 ObjectData.Coord(1,1)=xy(1,1); 253 ObjectData.Coord(1,2)=xy(1,2); 254 ObjectData.Coord(1,3)=0; 255 if isfield(AxeData,'ObjectCoord') & size(AxeData.ObjectCoord,2)==3 256 ObjectData.Coord(1,3)=AxeData.ObjectCoord(1,3); %generaliser au cas avec angle 257 end 258 AxeData.CurrentObject=plot_object(ObjectData,[],haxes,'m');%draw the object and its handle becomes AxeData.CurrentObject 259 if isfield(UvData,'Object') 260 IndexObj=length(UvData.Object)+1;% add the object as index IndexObj on the list of the interface 261 else 262 IndexObj=2; 263 end 264 UvData.Object{IndexObj}=ObjectData; 265 list_str=get(hhuvmat.list_object_1,'String'); 266 object_name=get(sethandles.TITLE,'String'); 267 if isempty(object_name)|| strcmp(object_name,'') 268 list_str{IndexObj}=[num2str(IndexObj) '-' ObjectData.Style]; 269 set(sethandles.TITLE,'String',list_str{IndexObj}) 270 else 271 list_str{IndexObj}=object_name; 272 end 273 set(hhuvmat.list_object_1,'String',list_str) 274 list_str{end+1}='...'; 275 set(hhuvmat.list_object_2,'String',list_str) 276 if strcmp(fig_tag,'view_field')%we are in view_field plot 277 set(hhuvmat.list_object_1,'Value',IndexObj)% the projection field will be plotted in uvmat frame 278 UvData.Object{IndexObj}.DisplayHandle_uvmat=[]; 279 UvData.Object{IndexObj}.DisplayHandle_view_field=AxeData.CurrentObject; 280 else%we are in uvmat plot 281 set(hhuvmat.list_object_2,'Value',IndexObj) 282 UvData.Object{IndexObj}.DisplayHandle_uvmat=AxeData.CurrentObject; 283 UvData.Object{IndexObj}.DisplayHandle_view_field=[]; 284 end 285 set(huvmat,'UserData',UvData) 286 PlotData=get(AxeData.CurrentObject,'UserData'); 287 PlotData.IndexObj=IndexObj; 288 set(AxeData.CurrentObject,'UserData',PlotData); %record the object index in the graph 289 AxeData.Drawing='create'; 290 end 263 291 end 264 292 … … 267 295 h_geometry_calib=findobj(allchild(0),'Name','geometry_calib'); %find the geomterty_calib GUI 268 296 hh_geometry_calib=guidata(h_geometry_calib); 269 h_ListCoord=hh_geometry_calib.ListCoord; %findobj(h_geometry_calib,'Tag','ListCoord');270 297 h_edit_append=hh_geometry_calib.edit_append;%findobj(h_geometry_calib,'Tag','edit_append'); 271 298 if isequal(get(h_edit_append,'Value'),1) && ~isempty(haxes) 299 h_ListCoord=hh_geometry_calib.ListCoord; %findobj(h_geometry_calib,'Tag','ListCoord'); 272 300 coord_value=get(hhuvmat.transform_fct,'Value');% set uvmat to pixel coordinates, run it again if not 273 301 if ~(isequal(coord_value,1)||isequal(coord_value,3)); %active only with no transform or px (no phys) … … 303 331 Coord{val}=strline; 304 332 set(h_ListCoord,'String',Coord) 305 % set(h_ListCoord,'Value',val+1)306 333 data=read_geometry_calib(Coord);%transform char cell to numbers 307 334 XCoord=data.Coord(:,4); … … 330 357 331 358 % edit vectors 332 if test_edit_vect & ~isempty(ivec) 333 if ~(isfield(AxeData,'FF')&& ~isempty(AxeData.FF)) 334 AxeData.FF=zeros(size(AxeData.X)); 335 end 336 if isequal(AxeData.FF(ivec),0) 337 AxeData.FF(ivec)=100; %mark vector #ivec as false 359 if test_edit_vect && ~isempty(ivec) 360 %create the error flag FF if it does not exist 361 if ~isfield(Field,'FF') 362 Field.ListVarName=[Field.ListVarName 'FF']; 363 Field.VarDimName=[Field.VarDimName Field.VarDimName{VarType{icell}.coord_x}]; 364 nbvar=length(Field.ListVarName); 365 Field.VarAttribute{nbvar}.Role='errorflag'; 366 Field.FF=zeros(size(Field.X)); 367 end 368 if isequal(Field.FF(ivec),0) 369 Field.FF(ivec)=100 %mark vector #ivec as false 338 370 else 339 AxeData.FF(ivec)=0; 340 end 341 PlotParam=read_plot_param(hhuvmat); 342 [PlotType,ScalOut]= plot_field(AxeData,haxes,PlotParam,1); 371 Field.FF(ivec)=0; 372 end 373 PlotParam=read_plot_param(hhcurrentfig); 374 plot_field(Field,haxes,PlotParam); 375 eval(['FigData.' tagaxes '=Field;'])%record the modified field in FigData 376 set(hcurrentfig,'UserData',FigData); 343 377 end 344 378 set(haxes,'UserData',AxeData); -
trunk/src/mouse_motion.m
r153 r156 33 33 test_draw=0;%test for mouse drawing of object, =0 by default 34 34 test_object=0; %test for object editing or creation 35 test_edit =isfield(handles,'edit') && get(handles.edit,'Value');% edit test for mouse shap: an arrow35 test_edit_object=0;% edit test for mouse shap: an arrow 36 36 test_zoom_draw=0; % test for zoom drawing 37 37 test_ruler=0;%test for active ruler … … 40 40 if ~isempty(huvmat) 41 41 hhuvmat=guidata(huvmat); 42 end 43 if ~isempty(huvmat) 44 UvData=get(huvmat,'UserData'); 45 test_ruler=isfield(UvData,'MouseAction') && isequal(UvData.MouseAction,'ruler'); 46 end 47 hciv=findobj(allchild(0),'tag','civ');%find the uvmat interface handle 42 test_edit_object=get(hhuvmat.edit_object,'Value'); 43 test_ruler=isequal(get(hhuvmat.MenuRuler,'checked'),'on'); 44 end 45 hciv=findobj(allchild(0),'tag','civ');%find the civ interface handle 48 46 if ~isempty(hciv) && strcmp(get(currentfig,'tag'),'view_field') 49 47 hhciv=guidata(hciv); … … 85 83 test_zoom_draw=test_draw && isequal(AxeData.Drawing,'zoom')&& isfield(AxeData,'CurrentOrigin') && isequal(get(gcf,'SelectionType'),'normal'); 86 84 test_object=test_draw && isfield(AxeData,'CurrentObject') && ~isempty(AxeData.CurrentObject) && ishandle(AxeData.CurrentObject); 87 if ~test_edit && ~test_zoom_draw && ~test_ruler85 if ~test_edit_object && ~test_zoom_draw && ~test_ruler 88 86 pointershape='crosshair';%set pointer with cross shape (default when mouse is over an axis) 89 87 end … … 110 108 if ~isempty(ivec) 111 109 % mark the vectors with a circle in the absence of other operations 112 if ~test_object && ~test_edit && ~test_ruler110 if ~test_object && ~test_edit_object && ~test_ruler 113 111 pointershape='arrow'; %mouse indicates the detection of a vector 114 112 if isempty(hhh) … … 291 289 %%%%%%%%%%%%%%%%% 292 290 %% create or modify an object 293 294 291 if ~isempty(huvmat) && test_object 295 292 PlotData=get(AxeData.CurrentObject,'UserData'); … … 347 344 pointershape='crosshair';%default for geometry_calib: ready to create new points 348 345 hh_geometry_calib=guidata(h_geometry_calib); 349 if ~isempty(xy) 346 if ~isempty(xy) && isfield(hh_geometry_calib,'ListCoord') 350 347 h_ListCoord=hh_geometry_calib.ListCoord; %findobj(h_geometry_calib,'Tag','ListCoord'); 351 348 Coord=get(h_ListCoord,'String'); … … 368 365 hh=findobj('Tag','calib_points');%look for handle of calibration points 369 366 if ~isempty(hh) && ~isempty(get(hh,'UserData')) && get(hh_geometry_calib.edit_append,'Value') 370 index_point=get(hh,'UserData') ;367 index_point=get(hh,'UserData') 371 368 XCoord(index_point)=xy(1,1); 372 369 YCoord(index_point)=xy(1,2); … … 387 384 388 385 %% draw ruler 389 if test_ruler && is equal(AxeData.Drawing,'ruler')390 if isfield(UvData,'RulerHandle')391 pointershape='crosshair';392 RulerCoord=[UvData.RulerCoord ;xy(1,1:2)];393 set(UvData.RulerHandle,'XData',RulerCoord(:,1));394 set(UvData.RulerHandle,'YData',RulerCoord(:,2));395 386 if test_ruler && isfield(AxeData,'Drawing') && isequal(AxeData.Drawing,'ruler') 387 if isfield(AxeData,'RulerHandle') 388 pointershape='crosshair'; %give the mouse pointer a cross shape 389 RulerCoord=[AxeData.RulerCoord ;xy(1,1:2)]; %coordinates defining the ruler segment 390 set(AxeData.RulerHandle,'XData',RulerCoord(:,1));% updtate the x coordinates for the ruler graphic object 391 set(AxeData.RulerHandle,'YData',RulerCoord(:,2));% updtate the y coordinates for the ruler graphic object 392 end 396 393 end 397 394 -
trunk/src/mouse_up.m
r154 r156 23 23 24 24 function mouse_up(hObject,eventdata,handles) 25 MouseAction='none'; %default25 %MouseAction='none'; %default 26 26 test_zoom=0;%default 27 test_ruler=0;%default 27 28 currentfig=hObject; 28 29 tagfig=get(currentfig,'tag'); 29 30 hhcurrentfig=guidata(currentfig); 30 31 test_zoom=get(hhcurrentfig.zoom,'Value'); 31 if ~exist('handles','var') 32 handles=get(gcbo,'UserData'); 33 end 32 33 % if ~exist('handles','var') 34 % handles=get(gcbo,'UserData'); 35 % end 34 36 huvmat=findobj(allchild(0),'tag','uvmat');%find the uvmat interface handle 35 37 if ~isempty(huvmat) 36 38 hhuvmat=guidata(huvmat); 37 39 UvData=get(huvmat,'UserData'); 38 if isfield(UvData,'MouseAction')39 MouseAction=UvData.MouseAction;% set the mouse action (edit, create objects...)40 end41 % test_zoom=get(hhuvmat.zoom,'Value'); 40 % if isfield(UvData,'MouseAction') 41 % MouseAction=UvData.MouseAction;% set the mouse action (edit, create objects...) 42 % end 43 test_ruler=~test_zoom && isequal(get(hhuvmat.MenuRuler,'checked'),'on');%test for ruler action, second priority 42 44 end 43 45 currentfig=hObject; … … 48 50 49 51 %% finalize the fabrication or the translation/deformation of an object and plot the corresponding projected field 50 if ~isempty(huvmat) & isfield(AxeData,'Drawing') & ~isequal(AxeData.Drawing,'off')& isfield(AxeData,'CurrentObject')...51 & ishandle(AxeData.CurrentObject)52 if ~isempty(huvmat) && isfield(AxeData,'Drawing') && ~isequal(AxeData.Drawing,'off') && isfield(AxeData,'CurrentObject')... 53 && ~isempty(AxeData.CurrentObject) && ishandle(AxeData.CurrentObject) 52 54 xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates 53 55 PlotData=get(AxeData.CurrentObject,'UserData');%get data attached to the current projection object … … 131 133 % PlotHandles=[];%do not project data on the object during mask creation 132 134 % else 133 PlotHandles=get_plot_handles(handles);%get the handles of the graphic objects setting the plotting parameters135 % PlotHandles=get_plot_handles(handles);%get the handles of the graphic objects setting the plotting parameters 134 136 % end 135 UvData.Object=update_obj(UvData,IndexObj,ObjectData,PlotHandles); 136 if strcmp(tagfig,'uvmat')% uvmat plot selected, projection plot seen on view_field 137 % if strcmp(projview,'view_field') 138 hview_field=findobj(allchild(0),'tag','view_field'); 139 ViewFieldData=get(hview_field,'UserData'); 140 ViewFieldData.axes3=ObjectData; 141 set(hview_field,'UserData',ViewFieldData) 142 else 143 UvData.axes3=ObjectData; 144 end 145 if isfield(UvData.Object{IndexObj},'PlotParam') 146 write_plot_param(PlotHandles,UvData.Object{IndexObj}.PlotParam); %update the display of plotting parameters for the current object 147 end 148 set(hhuvmat.edit,'BackgroundColor',[1 1 0]);% paint the edit text in yellow 149 set(hhuvmat.edit,'Value',1);% 150 set(hhuvmat.edit,'Enable','on');% 137 138 %% update the object representation 139 ObjectData.DisplayHandle_uvmat=UvData.Object{IndexObj}.DisplayHandle_uvmat; 140 ObjectData.DisplayHandle_view_field=UvData.Object{IndexObj}.DisplayHandle_view_field; 141 UvData.Object{IndexObj}=ObjectData;%update the current object properties 142 hhuvmat=guidata(huvmat); 143 IndexObj_1=get(hhuvmat.list_object_1,'Value'); 144 IndexObj_2=get(hhuvmat.list_object_2,'Value'); 145 UvData.Object=update_obj(UvData,IndexObj_1,IndexObj_2); 146 147 %% plot the field projected on the object and store it on the corresponding figure 148 ProjData= proj_field(UvData.Field,ObjectData);%project the current interface field on ObjectData 149 if ~isempty(ProjData) 150 if strcmp(tagfig,'uvmat')% uvmat plot selected, projection plot seen on view_field 151 % if strcmp(projview,'view_field') 152 hview_field=findobj(allchild(0),'tag','view_field'); 153 if isempty(hview_field) 154 hview_field=view_field; 155 end 156 ViewFieldData=get(hview_field,'UserData'); 157 ViewFieldData.axes3=ProjData; 158 set(hview_field,'UserData',ViewFieldData) 159 PlotHandles=guidata(hview_field); 160 else 161 UvData.axes3=ProjData; 162 PlotHandles=hhuvmat; 163 end 164 [PlotType,PlotParam]=plot_field(ProjData,PlotHandles.axes3,PlotHandles);%update an existing field plot 165 write_plot_param(PlotHandles,PlotParam); %update the display of plotting parameters for the current object 166 end 167 % if isfield(UvData.Object{IndexObj},'PlotParam') 168 % write_plot_param(PlotHandles,UvData.Object{IndexObj}.PlotParam); %update the display of plotting parameters for the current object 169 % end 170 set(hhuvmat.edit_object,'BackgroundColor',[1 1 0]);% paint the edit text in yellow 171 set(hhuvmat.edit_object,'Value',1);% 172 set(hhuvmat.edit_object,'Enable','on');% 151 173 set(hhuvmat.MenuEditObject,'Enable','on');% 152 174 set(hhuvmat.MenuEdit,'Enable','on');% 153 UvData.MouseAction='edit_object'; % set the edit button to 'on'154 175 end 155 176 else … … 171 192 %open or update a new zoom figure if a rectangle has been drawn 172 193 if ishandle(currentaxes); 173 if isfield(AxeData,'CurrentRectZoom') & ishandle(AxeData.CurrentRectZoom)194 if isfield(AxeData,'CurrentRectZoom') && ~isempty(AxeData.CurrentRectZoom) && ishandle(AxeData.CurrentRectZoom) 174 195 PosRect=get(AxeData.CurrentRectZoom,'Position'); 175 if isfield(AxeData,'CurrentVec') & ishandle(AxeData.CurrentVec)196 if isfield(AxeData,'CurrentVec') && ~isempty(AxeData.CurrentVec) && ishandle(AxeData.CurrentVec) 176 197 delete(AxeData.CurrentVec) 177 198 end … … 182 203 map=colormap(currentaxes); 183 204 colormap(map);%transmit the current colormap to the zoom fig 184 get(handles.RootFile,'String')185 205 set(hfig2,'Position',[0.2 0.33 0.6 0.6]); 186 206 if test_replot==0 … … 288 308 289 309 %% editing calibration point 290 if ~test_zoom && strcmp(MouseAction,'calib') 291 h_geometry_calib=findobj(allchild(0),'Name','geometry_calib'); %find the geomterty_calib GUI 292 hh_geometry_calib=guidata(h_geometry_calib); 293 edit_test=get(hh_geometry_calib.edit_append,'Value'); 294 hh=findobj(currentaxes,'Tag','calib_points');%look for handle of calibration points 295 if ~isempty(hh) && edit_test 296 index_point=get(hh,'UserData'); 297 set(hh,'UserData',[])%remove edit mode 298 h_ListCoord=hh_geometry_calib.ListCoord; %handles of the coordinate list 299 Coord=get(h_ListCoord,'String'); 300 data=read_geometry_calib(Coord); 301 % val=get(h_ListCoord,'Value'); 302 xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates 303 data.Coord(index_point,4)=xy(1,1); 304 data.Coord(index_point,5)=xy(1,2); 305 for ipoint=1:size(data.Coord,1) 306 for jcoord=1:5 307 Coord_cell{ipoint,jcoord}=num2str(data.Coord(ipoint,jcoord),4);%display coordiantes with 4 digits 308 end 310 if ~test_zoom && isfield(AxeData,'Drawing') && isequal(AxeData.Drawing,'calibration') 311 h_geometry_calib=findobj(allchild(0),'tag','geometry_calib'); %find the geomterty_calib GUI 312 if ~isempty(h_geometry_calib) 313 hh_geometry_calib=guidata(h_geometry_calib); 314 edit_test=get(hh_geometry_calib.edit_append,'Value'); 315 hh=findobj(currentaxes,'tag','calib_points');%look for handle of calibration points 316 if ~isempty(hh) && edit_test 317 index_point=get(hh,'UserData'); 318 set(hh,'UserData',[])%remove edit mode 319 h_ListCoord=hh_geometry_calib.ListCoord; %handles of the coordinate list 320 Coord=get(h_ListCoord,'String'); 321 data=read_geometry_calib(Coord); 322 % val=get(h_ListCoord,'Value'); 323 xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates 324 data.Coord(index_point,4)=xy(1,1); 325 data.Coord(index_point,5)=xy(1,2); 326 for ipoint=1:size(data.Coord,1) 327 for jcoord=1:5 328 Coord_cell{ipoint,jcoord}=num2str(data.Coord(ipoint,jcoord),4);%display coordiantes with 4 digits 329 end 330 end 331 Tabchar=cell2tab(Coord_cell,' | '); 332 Tabchar=[Tabchar ;{'......'}]; 333 set(h_ListCoord,'String',Tabchar) 334 % coord_str=Coord{index_point}; %current line (string) 335 % k=findstr('|',coord_str);%find separator indices on the string 336 % blanks=blank 337 % xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates 338 % if numel(k)>=3 339 % coord_str=[coord_str(1:k(3)-1) ' | ' num2str(xy(1,1),4) ' | ' num2str(xy(1,2),4)]; %update the pixel information while preserving phys coord 340 % else 341 % coord_str=[ ' | ' ' | ' ' | ' num2str(xy(1,1),4) ' | ' num2str(xy(1,2),4)]; 342 % end 343 % Coord{index_point}=coord_str; 344 % set(h_ListCoord,'String',Coord) 345 % data=read_geometry_calib(Coord);%transform char cell to numbers 346 set(hh,'XData',data.Coord(:,4)) 347 set(hh,'YData',data.Coord(:,5)) 309 348 end 310 Tabchar=cell2tab(Coord_cell,' | ');311 Tabchar=[Tabchar ;{'......'}];312 set(h_ListCoord,'String',Tabchar)313 % coord_str=Coord{index_point}; %current line (string)314 % k=findstr('|',coord_str);%find separator indices on the string315 % blanks=blank316 % xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates317 % if numel(k)>=3318 % coord_str=[coord_str(1:k(3)-1) ' | ' num2str(xy(1,1),4) ' | ' num2str(xy(1,2),4)]; %update the pixel information while preserving phys coord319 % else320 % coord_str=[ ' | ' ' | ' ' | ' num2str(xy(1,1),4) ' | ' num2str(xy(1,2),4)];321 % end322 % Coord{index_point}=coord_str;323 % set(h_ListCoord,'String',Coord)324 % data=read_geometry_calib(Coord);%transform char cell to numbers325 set(hh,'XData',data.Coord(:,4))326 set(hh,'YData',data.Coord(:,5))327 349 end 328 350 end … … 330 352 331 353 %% finalising ruler 332 if strcmp(MouseAction,'ruler') 333 UvData.MouseAction='none'; 334 UvData=rmfield(UvData,'RulerHandle'); 335 xy=get(currentaxes,'CurrentPoint'); 336 RulerCoord=[UvData.RulerCoord ;xy(1,1:2)]; 337 set(huvmat,'UserData',UvData) 338 RulerCoord=diff(RulerCoord,1); 354 if test_ruler 355 set(hhuvmat.MenuRuler,'checked','off')%desable the ruler option in uvmat 356 xy=get(currentaxes,'CurrentPoint');% get the current mouse coordinates 357 RulerCoord=[AxeData.RulerCoord ;xy(1,1:2)];% append the recorded ruler origin to the current mouse coordinates 358 RulerCoord=diff(RulerCoord,1);% coordiante difference between segment end and beginning 339 359 RulerCoord=RulerCoord(1)+i*RulerCoord(2); 340 360 distance=abs(RulerCoord); 341 361 azimuth=(180/pi)*angle(RulerCoord); 342 362 msgbox_uvmat('RULER','',['length: ' num2str(distance,3) ', angle(degrees): ' num2str(azimuth,3)]) 343 hruler=findobj(currentaxes,'Tag','ruler');344 delete(hruler)345 AxeData.Drawing='off';% stop current drawing a363 delete(AxeData.RulerHandle)%delete the ruler graphic object 364 AxeData=rmfield(AxeData,'RulerHandle');%remove the ruler handle in AxeData 365 AxeData.Drawing='off';%exit the ruler drawing mode 346 366 end 347 367 -
trunk/src/msgbox_uvmat.m
r121 r156 51 51 icontype='quest';%default question icon (text input asked) 52 52 if exist('title','var') 53 set(hObject, 'Name', title); 54 if isequal (title,'CONFIRMATION') 55 icontype=''; 56 testCancel=0; %no cancel button 57 elseif isequal (title,'ERROR') 58 icontype='error'; 59 testCancel=0; %no cancel button 60 elseif isequal (title,'WARNING') 61 icontype='warn'; 62 testCancel=0; %no cancel button 63 elseif isequal (title,'INPUT_Y-N') 64 icontype='quest'; 65 testNo=1; % button No activated 66 else 67 testinputstring=1; 68 end 53 set(hObject, 'Name', title); 54 switch title 55 case {'CONFIRMATION'} 56 icontype=''; 57 testCancel=0; %no cancel button 58 case 'ERROR' 59 icontype='error'; 60 testCancel=0; %no cancel button 61 case 'WARNING' 62 icontype='warn'; 63 testCancel=0; %no cancel button 64 case 'INPUT_Y-N' 65 icontype='quest'; 66 testNo=1; % button No activated 67 case {'RULER'} 68 icontype=''; 69 testCancel=0; %no cancel button 70 testinputstring=1; 71 otherwise 72 testinputstring=1; 73 end 69 74 end 70 75 if exist('display','var') -
trunk/src/plot_field.m
r153 r156 144 144 if testnewfig% create a new figure and axes if the plotting axes does not exist 145 145 hfig=figure; 146 % if isfield(Data,'IndexObj') && isfield(Data,'Style') && isfield(Data,'ProjMode')147 % figname=[num2str(Data.IndexObj) '-' Data.Style];148 % set(hfig,'Name',figname)149 % end150 % testhandle=0;151 146 if isfield(PlotParam,'text_display_1') && ishandle(PlotParam.text_display_1) 152 147 set(hfig,'UserData',PlotParam) 153 % testhandle=1;154 148 end 155 149 set(hfig,'Units','normalized') 156 150 set(hfig,'WindowButtonDownFcn','mouse_down') 157 %set(hfig,'WindowButtonMotionFcn',{'mouse_motion',PlotParam})%set mouse action function158 151 set(hfig,'WindowButtonMotionFcn','mouse_motion')%set mouse action function 159 152 set(hfig,'WindowButtonUpFcn','mouse_up')%set mouse action function … … 204 197 if testzoomaxes && isempty(errormsg) 205 198 [AxeData,zoomaxes,PlotParamOut,xx,errormsg]=plot_plane(Data,CellVarIndex(ind_select),VarType(ind_select),zoomaxes,PlotParam,1,PosColorbar); 206 %AxeData.ZoomAxes=zoomaxes;207 199 Data.ZoomAxes=zoomaxes; 208 200 end -
trunk/src/plot_object.m
r38 r156 37 37 38 38 function [hh]=plot_object(ObjectDataIn,ProjObject,hplot,col) 39 %% default output 39 40 hh=[];%default output 40 41 if isequal(ProjObject,ObjectDataIn)% object representation does not appear in its own projection plot … … 48 49 return % no object representation yet available 49 50 end 50 if ~isfield(ObjectData,'Style')| isempty(ObjectData.Style)|~ischar(ObjectData.Style)51 if ~isfield(ObjectData,'Style')||isempty(ObjectData.Style)||~ischar(ObjectData.Style) 51 52 msgbox_uvmat('ERROR','undefined ObjectData.Style in plot_object.m') 52 53 return 53 54 end 54 if ~isfield(ObjectData,'Style')| isempty(ObjectData.Style)|~ischar(ObjectData.Style)55 if ~isfield(ObjectData,'Style')||isempty(ObjectData.Style)||~ischar(ObjectData.Style) 55 56 msgbox_uvmat('ERROR','undefined ObjectData.Style in plot_object.m') 56 57 return … … 63 64 ZMax=0; 64 65 65 % determine the plotting axes (with handle 'haxes')66 %% determine the plotting axes (with handle 'haxes') 66 67 test_newobj=1; 67 68 if ishandle(hplot) 68 if isequal(get(hplot,'Tag'),'proj_object') 69 if isequal(get(hplot,'Tag'),'proj_object')% hplot is the handle of an object representation 69 70 test_newobj=0; 70 71 haxes=get(hplot,'parent'); 71 elseif isequal(get(hplot,'Type'),'axes') 72 axes(hplot) 72 elseif isequal(get(hplot,'Type'),'axes')% hplot is the handle of an axis 73 currentfig=get(hplot,'parent'); 74 set(0,'CurrentFigure',currentfig) 73 75 haxes=hplot; 74 elseif isequal(get(hplot,'Type'),'figure') 75 figure(hplot);%set the input figure as the current one 76 set(currentfig,'CurrentAxes',haxes); 77 elseif isequal(get(hplot,'Type'),'figure')% hplot is the handle of a figure 78 set(0,'CurrentFigure',hplot);%set the input figure as the current one 76 79 haxes=findobj(hplot,'Type','axes');%look for axes in the figure 77 80 haxes=haxes(1); 78 axes(haxes);%set the first found axis as the current one81 set(hplot,'CurrentAxes',haxes);%set the first found axis as the current one 79 82 else 80 83 figure; %create new figure … … 88 91 end 89 92 90 % default input parameters93 %% default input parameters 91 94 if ~isfield(ObjectData,'ProjMode')|isempty(ObjectData.ProjMode) 92 95 ObjectData.ProjMode='projection';%default … … 148 151 sizcoord=size(ObjectData.Coord); 149 152 150 % determine the coordinates xline, yline,xsup,xinf, yinf,ysup determining the new object plot153 %% determine the coordinates xline, yline,xsup,xinf, yinf,ysup determining the new object plot 151 154 test_line= isequal(ObjectData.Style,'points')|isequal(ObjectData.Style,'line')|isequal(ObjectData.Style,'polyline')|... 152 155 isequal(ObjectData.Style,'polygon')| isequal(ObjectData.Style,'plane')| isequal(ObjectData.Style,'volume'); … … 206 209 end 207 210 208 % shading image211 %% shading image 209 212 if test_patch 210 213 npMx=512; … … 267 270 268 271 PlotData=[];%default 269 % MODIFY AN EXISTING OBJECT PLOT272 %% MODIFY AN EXISTING OBJECT PLOT 270 273 if test_newobj==0; 271 274 hh=hplot; … … 326 329 end 327 330 328 % create the object331 %% create the object 329 332 if test_newobj 330 333 axes(haxes) -
trunk/src/proj_field.m
r150 r156 1 1 %'proj_field': projects the field on a projection object 2 2 %-------------------------------------------------------------------------- 3 % function [ProjData,errormsg]=proj_field(FieldData,ObjectData ,IndexObj)3 % function [ProjData,errormsg]=proj_field(FieldData,ObjectData) 4 4 % 5 5 % OUTPUT: … … 80 80 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 81 81 82 function [ProjData,errormsg]=proj_field(FieldData,ObjectData ,IndexObj)82 function [ProjData,errormsg]=proj_field(FieldData,ObjectData) 83 83 errormsg=[];%default 84 84 if isfield(ObjectData,'ProjMode') && (isequal(ObjectData.ProjMode,'none')||isequal(ObjectData.ProjMode,'mask_inside')||isequal(ObjectData.ProjMode,'mask_outside')) … … 138 138 [ProjData,errormsg] = proj_volume(FieldData,ObjectData); 139 139 end 140 if exist('IndexObj','var')141 ProjData.IndexObj=IndexObj;%transfer object index142 end140 % if exist('IndexObj','var') 141 % ProjData.IndexObj=IndexObj;%transfer object index 142 % end 143 143 144 144 %----------------------------------------------------------------- -
trunk/src/read_civxdata.m
r140 r156 89 89 Field.ListVarName(end-2:end)=[]; 90 90 Field.ListVarName{end}='DjUi'; 91 Field.VarDim Index(end-2:end)=[];91 Field.VarDimName(end-2:end)=[]; 92 92 Field.VarAttribute(end-2:end)=[]; 93 93 end -
trunk/src/series.m
r147 r156 61 61 guidata(hObject, handles); 62 62 %default initial parameters 63 drawnow 63 64 64 65 %load the list of previously browsed files in menus Open and Open_1 … … 656 657 if isequal(ext_imadoc,'.xml') 657 658 [XmlData,warntext]=imadoc2struct([FileBase '.xml']); 658 if isfield(XmlData,'Heading') && isfield(XmlData.Heading,'ImageName') 659 if isfield(XmlData,'Heading') && isfield(XmlData.Heading,'ImageName') && ischar(XmlData.Heading.ImageName) 659 660 [PP,FF,ext_ima_read]=fileparts(XmlData.Heading.ImageName); 660 661 end -
trunk/src/set_object.m
r153 r156 721 721 function PLOT_Callback(hObject, eventdata, handles) 722 722 723 %% reading the object parameters on the GUI uvmat 723 724 huvmat=findobj('tag','uvmat');%find the current uvmat interface handle 724 725 UvData=get(huvmat,'UserData');%Data associated to the GUI uvmat … … 728 729 IndexObj_1=get(hhuvmat.list_object_1,'Value'); 729 730 IndexObj_2=get(hhuvmat.list_object_2,'Value'); 730 ObjectData=read_set_object(handles);%read the input parameters defining the object in the GUI set_object731 731 testnew=0; 732 732 PlotHandles=get_plot_handles(hhuvmat); 733 projview=' ';733 projview='view_field';%default 734 734 if strcmp(ListObject{IndexObj_1},ObjectName)% we are editing the object whose projection is viewed in the uvmat frame 735 ObjectData.HandlesDisplay=hhuvmat.axes3; 735 % ObjectData.HandlesDisplay=hhuvmat.axes3; 736 % Object_set{iobj}.DisplayHandle_view_field 736 737 IndexObj=IndexObj_1; 737 738 projview='uvmat'; 739 plotaxes=hhuvmat.axes3;%handle of axes3 in view_field 738 740 elseif IndexObj_2<=numel(ListObject)&& strcmp(ListObject{IndexObj_2},ObjectName)% we are editing the object whose projection is viewed in view_field 741 742 IndexObj=IndexObj_2; 743 % projview='view_field'; 744 else %new object 745 testnew=1; 746 IndexObj=numel(ListObject)+1; 739 747 hview_field=findobj(allchild(0),'tag','view_field'); 740 748 if ~isempty(hview_field) 741 749 PlotHandles=guidata(hview_field); 742 ObjectData.HandlesDisplay=PlotHandles.axes3;%handle of axes3 in view_field 743 end 744 IndexObj=IndexObj_2; 745 projview='view_field'; 746 else %new object 747 testnew=1; 748 IndexObj=numel(ListObject)+1; 749 end 750 plotaxes=PlotHandles.axes3;%handle of axes3 in view_field 751 % ObjectData.HandlesDisplay=PlotHandles.axes3;%handle of axes3 in view_field 752 end 753 end 754 if strcmp(projview,'view_field') 755 hview_field=findobj(allchild(0),'tag','view_field') 756 if isempty(hview_field) 757 hview_field=view_field 758 end 759 PlotHandles=guidata(hview_field); 760 plotaxes=PlotHandles.axes3;%handle of axes3 in view_field 761 end 762 ObjectData=read_set_object(handles);%read the input parameters defining the object in the GUI set_object 763 764 %% naming the object 750 765 if length(ObjectName)<1% name of object not defined in set_object 751 766 ObjectName=[num2str(IndexObj) '-' ObjectData.Style];%default name 752 elseif ~get(hhuvmat.edit ,'Value')%not in edit mode (new object created)767 elseif ~get(hhuvmat.edit_object,'Value')%not in edit mode (new object created) 753 768 detectname=1; 754 769 ObjectNameNew=ObjectName; 755 770 vers=0; 756 while detectname==1 %create a new subdir if the netcdf files already exist757 detectname=find(strcmp(ObjectNameNew,ListObject),1) %test the existence of the proposed name in the list758 if detectname% if athe object name already exists759 indstr=regexp(ObjectNameNew,'\D') 771 while detectname==1 772 detectname=find(strcmp(ObjectNameNew,ListObject),1);%test the existence of the proposed name in the list 773 if detectname% if the object name already exists 774 indstr=regexp(ObjectNameNew,'\D'); 760 775 if indstr(end)<length(ObjectNameNew) %object name ends by a number 761 776 vers=str2double(ObjectNameNew(indstr(end)+1:end))+1; 762 777 ObjectNameNew=[ObjectNameNew(1:indstr(end)) num2str(vers)]; 763 778 else 764 vers=vers+1 765 ObjectNameNew=[ObjectNameNew(1:indstr(end)) '_' num2str(vers)] 779 vers=vers+1; 780 ObjectNameNew=[ObjectNameNew(1:indstr(end)) '_' num2str(vers)]; 766 781 end 767 782 end … … 772 787 set(hhuvmat.list_object_1,'String',ListObject) 773 788 set(hhuvmat.list_object_2,'String',[ListObject;{'...'}]) 789 790 %% update the object plot and projection field 774 791 if testnew 775 792 set(hhuvmat.list_object_2,'Value',IndexObj) 776 end 777 778 % update the object plot and projection field 779 UvData.Object{IndexObj}=update_obj(UvData,IndexObj,ObjectData,PlotHandles); 793 ObjectData.DisplayHandle_uvmat=hhuvmat.axes3; 794 ObjectData.DisplayHandle_view_field=[]; 795 else % save the previous object graph handles 796 ObjectData.DisplayHandle_uvmat=UvData.Object{IndexObj}.DisplayHandle_uvmat; 797 ObjectData.DisplayHandle_view_field=UvData.Object{IndexObj}.DisplayHandle_view_field; 798 end 799 UvData.Object{IndexObj}=ObjectData;%update the current object properties 800 IndexObj 801 ObjectData 802 UvData.Object=update_obj(UvData,IndexObj_1,IndexObj_2); 803 804 %% plot the field projected on the object and store it the corresponding figue 805 get(plotaxes,'tag') 806 ProjData= proj_field(UvData.Field,ObjectData)%project the current interface field on ObjectData 807 [PlotType,Object_out{IndexObj}.PlotParam,plotaxes]=plot_field(ProjData,plotaxes,PlotHandles);%update an existing field plot 780 808 if strcmp(projview,'view_field') 781 809 ViewFieldData=get(hview_field,'UserData'); … … 786 814 end 787 815 788 % set uvmat to object edit mode to allow further object update816 %% update the GUI uvmat 789 817 hhuvmat=guidata(huvmat);%handles of elements in the uvmat GUI 790 818 set(hhuvmat.MenuEditObject,'enable','on') 791 set(hhuvmat.edit ,'Value',1)792 set(hhuvmat.edit ,'BackgroundColor',[1 1 0]);% paint the edit text in yellow793 UvData.MouseAction='edit_object'; % set the edit button to 'on'819 set(hhuvmat.edit_object,'Value',1) % set uvmat to object edit mode to allow further object update 820 set(hhuvmat.edit_object,'BackgroundColor',[1 1 0]);% paint the edit text in yellow 821 %UvData.MouseAction='edit_object'; % set the edit button to 'on' 794 822 set(huvmat,'UserData',UvData) 795 823 %------------------------------------------------------------------------ -
trunk/src/update_imadoc.m
r114 r156 8 8 %------------------------------------------------------------- 9 9 function errormsg=update_imadoc(GeometryCalib,outputfile) 10 tic 10 11 errormsg=''; 11 12 testappend=0; … … 21 22 [success,message]=copyfile(outputfile,backupfile);%make backup 22 23 if success==0 23 errormsg=message 24 errormsg=message; 24 25 end 25 26 uid=find(t,'ImaDoc'); … … 56 57 [t,uid_camera]=add(t,1,'element','Camera'); 57 58 Camera.TimeUnit='s'; 58 % Camera.BurstTiming.FrameFrequency=info.FramesPerSecond;59 59 Camera.BurstTiming.Time=0; 60 60 Camera.BurstTiming.Dti=1/info.FramesPerSecond; 61 61 Camera.BurstTiming.NbDti=info.NumFrames-1; 62 t=struct2xml(Camera,t,uid_camera) 62 t=struct2xml(Camera,t,uid_camera); 63 63 end 64 64 [t,uid_calib]=add(t,1,'element','GeometryCalib'); … … 66 66 t=struct2xml(GeometryCalib,t,uid_calib); 67 67 save(t,outputfile); 68 toc -
trunk/src/update_obj.m
r102 r156 1 1 %'update_obj': update the object graph representation and its projection field, record it in the uvmat interface 2 2 %------------------------------------------------------------------- 3 %Object =update_obj(UvData,IndexObj,ObjectData,PlotHandles);4 % 3 %Object_out=update_obj(UvData,IndexObj,ObjectData,PlotHandles); 4 5 5 %OUTPUT: 6 %UvData: data to be stored as 'Userdata' on the uvmat interface 7 %IndexObj: object index for a new object added to the list in UvData 8 % the function updates UvData.Object{IndexObj}, and possibly adds a new plot (UvData.Plane or Line) in the list atached to the interface 6 % Object_out= cell array of structures containing the properties of the existing objects . 9 7 % 10 8 %INPUT: 11 %UvData: structure stored as 'Userdata' on the uvmat interface, it contains 9 %UvData: structure stored as 'Userdata' on the uvmat interface, it contains: 12 10 % .Object{1},{2}... description of all the projection objects 13 % .Object{iview}.plotaxes: axes for the plot of the field projected on this object 14 % .Object{iview}.HandlesDisplay(ih): array of handles for plots representing the object #iview in the field #ih 15 %IndexObjIn: object index for an existing objects stored in UvData 16 %ObjectData: structure containing the input object properties 11 % .Field , the current input field to be projected on the object 12 % .Object{IndexObj}.DisplayHandle_uvmat: handles of the object plot on uvmat, =[] if it does not exist 13 % .Object{IndexObj}.DisplayHandle_view_field: handles of the object plot on view_field, =[] if it does not exist 14 %IndexObj: object index of UvData.Object correspopnding to the updated object 15 %ObjectData: structure containing the input object properties to be attributed to the object #IndexObj 17 16 % .Style: style of the object: 'line', 'rectangle'... 18 17 %PlotHandles: structure containing the handles of the plotting parameter buttons on the uvmat or view_field interface 19 18 %------------------------------------- 20 19 21 function Object_out=update_obj(UvData,IndexObj ,ObjectData,PlotHandles)20 function Object_out=update_obj(UvData,IndexObj_1,IndexObj_2) 22 21 23 %default input and output 24 Object_out=ObjectData;%default 25 if isfield(UvData,'Object') 26 Object_set=UvData.Object; 27 else 28 Object_set={};%create the object 29 end 22 %% default input and output 23 % Object_out{IndexObj}=ObjectData;%default 24 % if isfield(UvData,'Object') 25 % Object_set=UvData.Object; 26 % else 27 % Object_set={};%create the object 28 % end 29 Object_out=UvData.Object; 30 30 31 % object representation in the different projected field plots 32 for iview=1:length(Object_set) %loop on projection planes iview 33 if isfield(Object_set{iview},'plotaxes') 34 haxes=Object_set{iview}.plotaxes% axes for the field plot 35 if ishandle(haxes) & isequal(get(haxes,'Type'),'axes')% update the representation of the object IndexObj on this axes if it exists 36 testupdate=0; 37 HandlesDisplay=[];%default 38 if length(Object_set)>= IndexObj && isfield(Object_set{IndexObj},'HandlesDisplay') 39 HandlesDisplay=Object_set{IndexObj}.HandlesDisplay;%list of handles of object representations 40 end 41 hplot_list=findobj(haxes,'Tag','proj_object');%list of projection objects on the axes 42 for ih=1:length(HandlesDisplay) 43 plot_detect=find(hplot_list==HandlesDisplay(ih)); 44 if ~isempty(plot_detect) 45 Object_out.HandlesDisplay(ih)=plot_object(ObjectData,Object_set{iview},HandlesDisplay(ih),'m');%update the the object representation 46 testupdate=1; 47 break 48 end 49 end 50 if ~testupdate% draw new object plot 51 hh=plot_object(ObjectData,Object_set{iview},haxes,'m');%draw the object with the new object data 52 if isfield(Object_out,'HandlesDisplay') 53 Object_out.HandlesDisplay=[Object_out.HandlesDisplay hh]; 54 else 55 Object_out.HandlesDisplay=hh; 56 end 57 PlotData=get(hh,'UserData'); 58 PlotData.IndexObj=IndexObj; 59 set(hh,'UserData',PlotData); %record the object index in the graph 60 end 61 end 62 end 63 end 31 %% plot the field projected on the object 32 % ProjData= proj_field(UvData.Field,ObjectData,IndexObj);%project the current interface field on ObjectData 33 % if ~isempty(ProjData) 34 % plotaxes=[];%default 35 % if length(Object_set)>= IndexObj && isfield(Object_set{IndexObj},'plotaxes') 36 % plotaxes=Object_set{IndexObj}.plotaxes; 37 % [PlotType,Object_out{IndexObj}.PlotParam,plotaxes]=plot_field(ProjData,plotaxes,PlotHandles);%update an existing field plot 38 % plotfig=get(plotaxes,'parent'); 39 % ViewData=get(plotfig,'UserData'); 40 % eval( 41 % else 42 % hview_field=view_field(ProjData);%create a new field plot with view_field 43 % hhview_field=guidata(hview_field); 44 % plotaxes=hhview_field.axes3; 45 % end 46 % Object_out{IndexObj}.plotaxes=plotaxes; 47 % end 64 48 65 % plot the field projected on the object 66 ProjData= proj_field(UvData.Field,ObjectData,IndexObj);%project the current interface field on ObjectData 67 if ~isempty(ProjData) 68 plotaxes=[];%default 69 if length(Object_set)>= IndexObj && isfield(Object_set{IndexObj},'plotaxes') 70 plotaxes=Object_set{IndexObj}.plotaxes; 71 [PlotType,Object_out.PlotParam,plotaxes]=plot_field(ProjData,plotaxes,PlotHandles); 72 else 73 [plotaxes]=view_field(ProjData); 49 %% representation of the different objects in the plots uvmat and view_field 50 %hfig=get(plotaxes,'parent'); 51 %tagfig=get(hfig,'tag'); 52 % if length(Object_set)<IndexObj 53 %Object_set{IndexObj}=ObjectData; 54 % end 55 % plot the updated object in uvmat 56 % hobject=[]; 57 % if isfield(Object_set{IndexObj},'DisplayHandle_uvmat') && ~isempty(Object_set{IndexObj}.DisplayHandle_uvmat) && ishandle(Object_set{IndexObj}.DisplayHandle_uvmat) 58 % hobject=Object_set{IndexObj}.DisplayHandle_uvmat; 59 % % else 60 % % hobject=plotaxes; 61 % end 62 % Object_out{IndexObj}.DisplayHandle_uvmat=plot_object(Object_set{IndexObj},Object_set{1},hobject,'m');%update the object representation 63 64 % if strcmp(tagfig,'uvmat')%plot uvmat 65 for iobj=1:length(Object_out) %change the view of all existing objects on the updated current object #IndexObj_1 66 hobject=[]; 67 if isfield(Object_out{iobj},'DisplayHandle_uvmat') && ~isempty(Object_out{iobj}.DisplayHandle_uvmat) && ishandle(Object_out{iobj}.DisplayHandle_uvmat) 68 hobject=Object_out{iobj}.DisplayHandle_uvmat; 69 % else 70 % hobject=plotaxes; 71 end 72 Object_out{iobj}.DisplayHandle_uvmat=plot_object(Object_out{iobj},Object_out{IndexObj_1},hobject,'m');%update the object representation 74 73 end 75 Object_out.plotaxes=plotaxes; 76 end 74 % else%plot view_field 75 for iobj=1:length(Object_out) %change the view of all existing objects on the updated current object #IndexObj_2 76 hobject=[]; 77 if isfield(Object_out{iobj},'DisplayHandle_view_field') && ~isempty(Object_out{iobj}.DisplayHandle_view_field) && ishandle(Object_out{iobj}.DisplayHandle_view_field) 78 hobject=Object_out{iobj}.DisplayHandle_view_field; 79 % else 80 % hobject=plotaxes; 81 end 82 Object_out{iobj}.DisplayHandle_view_field=plot_object(Object_out{iobj},Object_out{IndexObj_2},hobject,'m');%update the object representation 83 end 84 % end 85 86 % if isfield(Object_set{iobj},'plotaxes') 87 % haxes=Object_set{iobj}.plotaxes;% axes for the field plot 88 % if ishandle(haxes) && isequal(get(haxes,'Type'),'axes')% update the representation of the object IndexObj on this axes if it exists 89 % testupdate=0; 90 % HandlesDisplay=[];%default 91 % if length(Object_set)>= IndexObj && isfield(Object_set{IndexObj},'HandlesDisplay') 92 % HandlesDisplay=Object_set{IndexObj}.HandlesDisplay;%list of handles of object representations 93 % end 94 % hplot_list=findobj(haxes,'Tag','proj_object');%list of projection objects on the axes 95 % for ih=1:length(HandlesDisplay) 96 % plot_detect=find(hplot_list==HandlesDisplay(ih)); 97 % if ~isempty(plot_detect) 98 % Object_out.HandlesDisplay(ih)=plot_object(ObjectData,Object_set{iobj},HandlesDisplay(ih),'m');%update the the object representation 99 % testupdate=1; 100 % break 101 % end 102 % end 103 % if ~testupdate% draw new object plot 104 % hh=plot_object(ObjectData,Object_set{iobj},haxes,'m');%draw the object with the new object data 105 % if isfield(Object_out,'HandlesDisplay') 106 % Object_out.HandlesDisplay=[Object_out.HandlesDisplay hh]; 107 % else 108 % Object_out.HandlesDisplay=hh; 109 % end 110 % PlotData=get(hh,'UserData'); 111 % PlotData.IndexObj=IndexObj; 112 % set(hh,'UserData',PlotData); %record the object index in the graph 113 % end 114 % end 115 % end 116 % end 77 117 78 118 79 119 120 -
trunk/src/view_field.m
r150 r156 75 75 set(hhuvmat.list_object_2,'Visible','on') 76 76 % handles_mouse.create=hhuvmat.create; 77 handles_mouse.edit=hhuvmat.edit ;77 handles_mouse.edit=hhuvmat.edit_object; 78 78 pos_uvmat=get(huvmat,'Position'); 79 79 pos_view_field(1)=pos_uvmat(1)+pos_uvmat(3)/2; … … 89 89 set(hObject,'WindowButtonUpFcn',{'mouse_up',handles_mouse}) 90 90 set(hObject,'CloseRequestFcn',{@closefcn})% 91 if ~exist('Field','var') 92 return 93 end 91 94 92 95 [PlotType,PlotParamOut]= plot_field(Field,handles.axes3);%,PlotParam,KeepLim,PosColorbar) 93 96 ViewFieldData.axes3=Field; 94 97 set(handles.view_field,'UserData',ViewFieldData);%store the current field 95 get(handles.view_field)96 98 if isfield(PlotParamOut,'Vectors') 97 99 set(handles.VECT_title,'Visible','on')
Note: See TracChangeset
for help on using the changeset viewer.