[198] | 1 | %'view_field': function associated with the GUI 'view_field.fig' for images and data field visualization
|
---|
| 2 | %------------------------------------------------------------------------
|
---|
| 3 | % function huvmat=view_field(input)
|
---|
| 4 | %
|
---|
| 5 | %OUTPUT
|
---|
| 6 | % huvmat=current handles of the GUI view_field.fig
|
---|
| 7 | %%
|
---|
| 8 | %
|
---|
| 9 | %INPUT:
|
---|
| 10 | % input: input file name (if character chain), or input image matrix to
|
---|
| 11 | % visualize, or Matlab structure representing netcdf fields (with fields
|
---|
| 12 | % ListVarName....)
|
---|
| 13 | %
|
---|
| 14 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
---|
| 15 | % Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, joel.sommeria@legi.grenoble-inp.fr.
|
---|
| 16 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
---|
| 17 | % This open is part of the toolbox VIEW_FIELD.
|
---|
| 18 | %
|
---|
| 19 | % VIEW_FIELD is free software; you can redistribute it and/or modify
|
---|
| 20 | % it under the terms of the GNU General Public License as published by
|
---|
| 21 | % the Free Software Foundation; either version 2 of the License, or
|
---|
| 22 | % (at your option) any later version.
|
---|
| 23 | %
|
---|
| 24 | % VIEW_FIELD is distributed in the hope that it will be useful,
|
---|
| 25 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 26 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 27 | % GNU General Public License (open VIEW_FIELD/COPYING.txt) for more details.
|
---|
| 28 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
---|
| 29 |
|
---|
| 30 | %-------------------------------------------------------------------
|
---|
| 31 | % I - MAIN FUNCTION VIEW_FIELD (DO NOT MODIFY)
|
---|
| 32 | %-------------------------------------------------------------------
|
---|
| 33 | %-------------------------------------------------------------------
|
---|
| 34 | function varargout = view_field(varargin)
|
---|
| 35 |
|
---|
| 36 | % Begin initialization code - DO NOT EDIT
|
---|
| 37 | gui_Singleton = 1;
|
---|
| 38 | gui_State = struct('gui_Name', mfilename, ...
|
---|
| 39 | 'gui_Singleton', gui_Singleton, ...
|
---|
| 40 | 'gui_OpeningFcn', @view_field_OpeningFcn, ...
|
---|
| 41 | 'gui_OutputFcn', @view_field_OutputFcn, ...
|
---|
| 42 | 'gui_LayoutFcn', [], ...
|
---|
| 43 | 'gui_Callback', []);
|
---|
| 44 | if nargin && ischar(varargin{1})
|
---|
| 45 | gui_State.gui_Callback = str2func(varargin{1});
|
---|
| 46 | end
|
---|
| 47 |
|
---|
| 48 | if nargout
|
---|
| 49 | varargout{1:nargout} = gui_mainfcn(gui_State, varargin{:});
|
---|
| 50 | else
|
---|
| 51 | gui_mainfcn(gui_State, varargin{:});
|
---|
| 52 | end
|
---|
| 53 | % End initialization code - DO NOT EDIT
|
---|
| 54 |
|
---|
| 55 | %-------------------------------------------------------------------
|
---|
| 56 | % --- Executes just before view_field is made visible.
|
---|
| 57 | function view_field_OpeningFcn(hObject, eventdata, handles, Field )
|
---|
| 58 | %-------------------------------------------------------------------
|
---|
| 59 |
|
---|
| 60 | % Choose default command menuline output for view_field
|
---|
| 61 | handles.output = handles.view_field;
|
---|
| 62 |
|
---|
| 63 | % Update handles structure
|
---|
| 64 | guidata(hObject, handles);
|
---|
| 65 |
|
---|
| 66 | %functions for the mouse and keyboard
|
---|
[432] | 67 | set(hObject,'KeyPressFcn',{'keyboard_callback',handles})%set keyboard action function
|
---|
| 68 | set(hObject,'WindowButtonMotionFcn',{'mouse_motion',handles})%set mouse action functio
|
---|
[198] | 69 | set(hObject,'WindowButtonDownFcn',{'mouse_down'})%set mouse click action function
|
---|
[432] | 70 | set(hObject,'WindowButtonUpFcn',{'mouse_up',handles})
|
---|
[406] | 71 | set(hObject,'DeleteFcn',{@closefcn})%
|
---|
[429] | 72 | set(hObject,'ResizeFcn',{@ResizeFcn,handles})%
|
---|
[198] | 73 | ViewFieldData.axes3=[];%initiates the record of the current field (will be updated by plot_field)
|
---|
[429] | 74 | set(handles.view_field,'Units','pixels')
|
---|
| 75 | ViewFieldData.GUISize=get(handles.view_field,'Position');
|
---|
| 76 | set(handles.view_field,'UserData',ViewFieldData);%store the initial fig size in UserData
|
---|
[198] | 77 | AxeData.LimEditBox=1; %initialise AxeData, the parent figure sets plot parameters
|
---|
| 78 | set(handles.axes3,'UserData',AxeData)
|
---|
[413] | 79 | if exist('Field','var')
|
---|
| 80 | [PlotType,PlotParamOut]= plot_field(Field,handles.axes3);%,PlotParam,KeepLim,PosColorbar)
|
---|
| 81 | set(handles.Coordinates,'Visible','on')
|
---|
| 82 | if isfield(PlotParamOut,'Vectors')
|
---|
| 83 | set(handles.Vectors,'Visible','on')
|
---|
| 84 | end
|
---|
| 85 | write_plot_param(handles,PlotParamOut);% update the display of the plotting parameters
|
---|
[198] | 86 | end
|
---|
[429] | 87 |
|
---|
[432] | 88 | %put the GUI on the lower right of the sceen
|
---|
| 89 | pos_view_field=get(hObject,'Position');
|
---|
| 90 | ScreenSize=get(0,'ScreenSize');
|
---|
| 91 | pos_view_field(1)=ScreenSize(1)+ScreenSize(3)-pos_view_field(3);
|
---|
| 92 | pos_view_field(2)=ScreenSize(2);
|
---|
| 93 | set(hObject,'Position',pos_view_field)
|
---|
| 94 |
|
---|
[402] | 95 | %------------------------------------------------------------------------
|
---|
[429] | 96 | %--- activated when resizing the GUI view_field
|
---|
| 97 | function ResizeFcn(gcbo,eventdata,handles)
|
---|
| 98 | %------------------------------------------------------------------------
|
---|
| 99 | set(handles.view_field,'Units','pixels')
|
---|
| 100 | size_fig=get(handles.view_field,'Position');
|
---|
| 101 | Data=get(handles.view_field,'UserData');
|
---|
| 102 | Data.GUISize=size_fig;
|
---|
| 103 | set(handles.view_field,'UserData',Data)
|
---|
| 104 |
|
---|
| 105 | %% reset position of text_display or TableDisplay
|
---|
| 106 | if strcmp(get(handles.TableDisplay,'Visible'),'off')
|
---|
| 107 | pos_1=get(handles.text_display,'Position');
|
---|
| 108 | pos_1(1)=size_fig(3)-pos_1(3);
|
---|
| 109 | pos_1(2)=size_fig(4)-pos_1(4);
|
---|
| 110 | set(handles.text_display,'Position',pos_1)
|
---|
| 111 | % reset position of TableDisplay
|
---|
| 112 | else
|
---|
| 113 | pos_1=get(handles.TableDisplay,'Position');
|
---|
| 114 | pos_1(1)=size_fig(3)-pos_1(3);
|
---|
| 115 | pos_1(2)=size_fig(4)-pos_1(4);
|
---|
| 116 | set(handles.TableDisplay,'Position',pos_1)
|
---|
| 117 | end
|
---|
| 118 |
|
---|
| 119 | %% reset position of Coordinates
|
---|
| 120 | pos_2=get(handles.Coordinates,'Position');
|
---|
| 121 | pos_2(1)=size_fig(3)-pos_1(3);
|
---|
| 122 | pos_2(2)=pos_1(2)-pos_2(4);
|
---|
| 123 | set(handles.Coordinates,'Position',pos_2)
|
---|
| 124 |
|
---|
| 125 | %% reset position of Scalar
|
---|
| 126 | pos_3=get(handles.Scalar,'Position');
|
---|
| 127 | pos_3(1)=size_fig(3)-pos_3(3);
|
---|
| 128 | if strcmp(get(handles.Scalar,'visible'),'on')
|
---|
| 129 | pos_3(2)=pos_2(2)-pos_3(4);
|
---|
| 130 | else
|
---|
| 131 | pos_3(2)=pos_2(2);
|
---|
| 132 | end
|
---|
| 133 | set(handles.Scalar,'Position',pos_3)
|
---|
| 134 |
|
---|
| 135 | %% reset position of Vectors
|
---|
| 136 | pos_4=get(handles.Vectors,'Position');
|
---|
| 137 | pos_4(1)=size_fig(3)-pos_4(3);
|
---|
| 138 | if strcmp(get(handles.Vectors,'visible'),'on')
|
---|
| 139 | pos_4(2)=pos_3(2)-pos_4(4);
|
---|
| 140 | else
|
---|
| 141 | pos_4(2)=pos_3(2);
|
---|
| 142 | end
|
---|
| 143 | set(handles.Vectors,'Position',pos_4)
|
---|
| 144 |
|
---|
| 145 | %% reset position and scale of axis
|
---|
| 146 | bord=[50 40 30 60]; %bordure left,inf, right,sup
|
---|
| 147 | pos(1)=bord(1);
|
---|
| 148 | pos(2)=bord(2);
|
---|
| 149 | pos(3)=max(1,pos_1(1)-pos(1)-bord(3));
|
---|
| 150 | pos(4)=max(1,size_fig(4)-bord(4));
|
---|
| 151 | set(handles.axes3,'Position',pos)
|
---|
| 152 |
|
---|
| 153 | %------------------------------------------------------------------------
|
---|
| 154 | %------------------------------------------------------------------------
|
---|
[198] | 155 | % --- Outputs from this function are returned to the command menuline.
|
---|
| 156 | function varargout = view_field_OutputFcn(hObject, eventdata, handles)
|
---|
[402] | 157 | %------------------------------------------------------------------------
|
---|
[198] | 158 | varargout{1} = handles.output;% the only output argument is the handle to the GUI figure
|
---|
[429] | 159 | varargout{2} = strcmp(get(handles.axes3,'Visible'),'on');% check active plot axis
|
---|
[198] | 160 |
|
---|
[402] | 161 | %------------------------------------------------------------------------
|
---|
| 162 | %--- activated when closing the GUI view_field
|
---|
| 163 | function closefcn(gcbo,eventdata)
|
---|
| 164 | %------------------------------------------------------------------------
|
---|
| 165 | huvmat=findobj(allchild(0),'Tag','uvmat');%find the current uvmat interface handle
|
---|
| 166 | if ~isempty(huvmat)
|
---|
| 167 | hhuvmat=guidata(huvmat);
|
---|
[425] | 168 | set(hhuvmat.ViewField,'Value',0)
|
---|
| 169 | %set(hhuvmat.edit_object,'BackgroundColor',[0.7 0.7 0.7])%put unactivated buttons to gree
|
---|
[402] | 170 | % deselect the object in ListObject when view_field is closed
|
---|
| 171 | if isempty(findobj(allchild(0),'Tag','set_object'))
|
---|
| 172 | ObjIndex=get(hhuvmat.ListObject,'Value');
|
---|
| 173 | ObjIndex=ObjIndex(1);%keep only the first object selected
|
---|
| 174 | set(hhuvmat.ListObject,'Value',ObjIndex)
|
---|
| 175 | % draw all object colors in blue (unselected) in uvmat
|
---|
| 176 | hother=[findobj(hhuvmat.axes3,'Tag','proj_object');findobj(hhuvmat.axes3,'Tag','DeformPoint')];%find all the proj object and deform point representations
|
---|
| 177 | for iobj=1:length(hother)
|
---|
| 178 | if isequal(get(hother(iobj),'Type'),'rectangle')||isequal(get(hother(iobj),'Type'),'patch')
|
---|
| 179 | set(hother(iobj),'EdgeColor','b')
|
---|
| 180 | if isequal(get(hother(iobj),'FaceColor'),'m')
|
---|
| 181 | set(hother(iobj),'FaceColor','b')
|
---|
| 182 | end
|
---|
| 183 | elseif isequal(get(hother(iobj),'Type'),'image')
|
---|
| 184 | Acolor=get(hother(iobj),'CData');
|
---|
| 185 | Acolor(:,:,1)=zeros(size(Acolor,1),size(Acolor,2));
|
---|
| 186 | set(hother(iobj),'CData',Acolor);
|
---|
| 187 | else
|
---|
| 188 | set(hother(iobj),'Color','b')
|
---|
| 189 | end
|
---|
| 190 | set(hother(iobj),'Selected','off')
|
---|
| 191 | end
|
---|
| 192 | end
|
---|
| 193 | end
|
---|
[413] | 194 | hciv=findobj(allchild(0),'Tag','civ');%find the current civ GUI
|
---|
| 195 | if ~isempty(hciv)
|
---|
| 196 | hhciv=guidata(hciv);
|
---|
| 197 | set(hhciv.TestCiv1,'Value',0)% desactivate TestCiv1 if on
|
---|
| 198 | set(hhciv.TestCiv1,'BackgroundColor',[1 0 0])%
|
---|
| 199 | end
|
---|
| 200 | corrfig=findobj(allchild(0),'tag','corrfig');% look for a civ correlation window used with TesCiv1
|
---|
| 201 | if ~isempty(corrfig)
|
---|
| 202 | delete(corrfig)
|
---|
| 203 | end
|
---|
[198] | 204 |
|
---|
| 205 | %-------------------------------------------------------------------
|
---|
| 206 | %-------------------------------------------------------------------
|
---|
| 207 | % II - FUNCTIONS FOR INTRODUCING THE INPUT FILES
|
---|
| 208 | % automatically sets the global properties when the rootfile name is introduced
|
---|
| 209 | % then activate the view-field action if selected
|
---|
| 210 | % it is activated either by clicking on the RootPath window or by the
|
---|
| 211 | % browser
|
---|
| 212 | %------------------------------------------------------------------
|
---|
| 213 | %------------------------------------------------------------------
|
---|
| 214 |
|
---|
| 215 | %-------------------------------------------------------------------
|
---|
| 216 | function update_mask(handles,num_i1,num_j1)
|
---|
| 217 | %-------------------------------------------------------------------
|
---|
| 218 |
|
---|
| 219 | MaskData=get(handles.mask_test,'UserData');
|
---|
| 220 | if isfield(MaskData,'maskhandle')&& ishandle(MaskData.maskhandle)
|
---|
| 221 | uistack(MaskData.maskhandle,'top');
|
---|
| 222 | end
|
---|
| 223 | num_i1_mask=mod(num_i1-1,MaskData.NbSlice)+1;
|
---|
[356] | 224 | [RootPath,RootFile]=fullfile(MaskData.Base);
|
---|
| 225 | MaskName=fullfile_uvmat(RootPath,'',RootFile,'.png',MaskData.NomType,num_i1_mask,[],num_j1);
|
---|
| 226 | %[MaskName,mdetect]=name_generator(MaskData.Base,num_i1_mask,num_j1,'.png',MaskData.NomType);
|
---|
[198] | 227 | huvmat=get(handles.mask_test,'parent');
|
---|
| 228 | UvData=get(huvmat,'UserData');
|
---|
| 229 |
|
---|
| 230 | %update mask image if the mask is new
|
---|
| 231 | if ~ (isfield(UvData,'MaskName') && isequal(UvData.MaskName,MaskName))
|
---|
| 232 | UvData.MaskName=MaskName; %update the recorded name on UvData
|
---|
| 233 | set(huvmat,'UserData',UvData);
|
---|
| 234 | if mdetect==0
|
---|
| 235 | if isfield(MaskData,'maskhandle')&& ishandle(MaskData.maskhandle)
|
---|
| 236 | delete(MaskData.maskhandle)
|
---|
| 237 | end
|
---|
| 238 | else
|
---|
| 239 | %read mask image
|
---|
| 240 | Mask.AName='image';
|
---|
| 241 | Mask.A=imread(MaskName);
|
---|
| 242 | npxy=size(Mask.A);
|
---|
| 243 | Mask.AX=[0.5 npxy(2)-0.5];
|
---|
| 244 | Mask.AY=[npxy(1)-0.5 0.5 ];
|
---|
| 245 | Mask.CoordUnit='pixel';
|
---|
| 246 | if isequal(get(handles.slices,'Value'),1)
|
---|
| 247 | NbSlice=str2num(get(handles.nb_slice,'String'));
|
---|
| 248 | num_i1=str2num(get(handles.i1,'String'));
|
---|
| 249 | Mask.ZIndex=mod(num_i1-1,NbSlice)+1;
|
---|
| 250 | end
|
---|
| 251 | %px to phys or other transform on field
|
---|
| 252 | menu_transform=get(handles.transform_fct,'String');
|
---|
| 253 | choice_value=get(handles.transform_fct,'Value');
|
---|
| 254 | transform_name=menu_transform{choice_value};%name of the transform fct given by the menu 'transform_fct'
|
---|
| 255 | transform_list=get(handles.transform_fct,'UserData');
|
---|
| 256 | transform=transform_list{choice_value};
|
---|
| 257 | if ~isequal(transform_name,'') && ~isequal(transform_name,'px')
|
---|
| 258 | if isfield(UvData,'XmlData') && isfield(UvData.XmlData,'GeometryCalib')%use geometry calib recorded from the ImaDoc xml file as first priority
|
---|
| 259 | Calib=UvData.XmlData.GeometryCalib;
|
---|
| 260 | Mask=transform(Mask,UvData.XmlData);
|
---|
| 261 | end
|
---|
| 262 | end
|
---|
| 263 | flagmask=Mask.A < 200;
|
---|
| 264 |
|
---|
| 265 | %make brown color image
|
---|
| 266 | imflag(:,:,1)=0.9*flagmask;
|
---|
| 267 | imflag(:,:,2)=0.7*flagmask;
|
---|
| 268 | imflag(:,:,3)=zeros(size(flagmask));
|
---|
| 269 |
|
---|
| 270 | %update mask image
|
---|
| 271 | hmask=[]; %default
|
---|
| 272 | if isfield(MaskData,'maskhandle')&& ishandle(MaskData.maskhandle)
|
---|
| 273 | hmask=MaskData.maskhandle;
|
---|
| 274 | end
|
---|
| 275 | if ~isempty(hmask)
|
---|
| 276 | set(hmask,'CData',imflag)
|
---|
| 277 | set(hmask,'AlphaData',flagmask*0.6)
|
---|
| 278 | set(hmask,'XData',Mask.AX);
|
---|
| 279 | set(hmask,'YData',Mask.AY);
|
---|
| 280 | % uistack(hmask,'top')
|
---|
| 281 | else
|
---|
| 282 | axes(handles.axes3)
|
---|
| 283 | hold on
|
---|
| 284 | MaskData.maskhandle=image(Mask.AX,Mask.AY,imflag,'Tag','mask','HitTest','off','AlphaData',0.6*flagmask);
|
---|
| 285 | % set(MaskData.maskhandle,'AlphaData',0.6*flagmask)
|
---|
| 286 | set(handles.mask_test,'UserData',MaskData)
|
---|
| 287 | end
|
---|
| 288 | end
|
---|
| 289 | end
|
---|
| 290 |
|
---|
| 291 |
|
---|
| 292 | %-------------------------------------------------------------------
|
---|
| 293 | function MenuExportFigure_Callback(hObject, eventdata, handles)
|
---|
| 294 | %-------------------------------------------------------------------
|
---|
| 295 | huvmat=get(handles.MenuExport,'parent');
|
---|
| 296 | UvData=get(huvmat,'UserData');
|
---|
| 297 | hfig=figure;
|
---|
| 298 | newaxes=copyobj(handles.axes3,hfig);
|
---|
| 299 | map=colormap(handles.axes3);
|
---|
| 300 | colormap(map);%transmit the current colormap to the zoom fig
|
---|
| 301 | colorbar
|
---|
| 302 |
|
---|
| 303 | %-------------------------------------------------------------------
|
---|
| 304 | %-------------------------------------------------------------------
|
---|
| 305 | % III - MAIN REFRESH FUNCTIONS : 'FRAME PLOT'
|
---|
| 306 | %-------------------------------------------------------------------
|
---|
| 307 | %-------------------------------------------------------------------
|
---|
| 308 |
|
---|
| 309 | %Executes on button press in runplus: make one step forward and call
|
---|
| 310 | %run0. The step forward is along the fields series 1 or 2 depending on
|
---|
| 311 | %the scan_i and scan_j check box (exclusive each other)
|
---|
| 312 | %-------------------------------------------------------------------
|
---|
| 313 | function runplus_Callback(hObject, eventdata, handles)
|
---|
| 314 | increment=str2num(get(handles.increment_scan,'String')); %get the field increment d
|
---|
| 315 | runpm(hObject,eventdata,handles,increment)
|
---|
| 316 |
|
---|
| 317 | %-------------------------------------------------------------------
|
---|
| 318 | %Executes on button press in runmin: make one step backward and call
|
---|
| 319 | %run0. The step backward is along the fields series 1 or 2 depending on
|
---|
| 320 | %the scan_i and scan_j check box (exclusive each other)
|
---|
| 321 | %-------------------------------------------------------------------
|
---|
| 322 | function runmin_Callback(hObject, eventdata, handles)
|
---|
| 323 | increment=-str2num(get(handles.increment_scan,'String')); %get the field increment d
|
---|
| 324 | runpm(hObject,eventdata,handles,increment)
|
---|
| 325 |
|
---|
[429] | 326 | % %-------------------------------------------------------------------
|
---|
| 327 | % %Executes on button press in runmin: make one step backward and call
|
---|
| 328 | % %run0. The step backward is along the fields series 1 or 2 depending on
|
---|
| 329 | % %the scan_i and scan_j check box (exclusive each other)
|
---|
| 330 | % %-------------------------------------------------------------------
|
---|
| 331 | % function RunMovie_Callback(hObject, eventdata, handles)
|
---|
| 332 | % %------------------------------------------------------------------
|
---|
| 333 | % set(handles.RunMovie,'BackgroundColor',[1 1 0])%paint the command button in yellow
|
---|
| 334 | % drawnow
|
---|
| 335 | % increment=str2num(get(handles.increment_scan,'String')); %get the field increment d
|
---|
| 336 | % set(handles.STOP,'Visible','on')
|
---|
| 337 | % set(handles.speed,'Visible','on')
|
---|
| 338 | % set(handles.speed_txt,'Visible','on')
|
---|
| 339 | % set(handles.RunMovie,'BusyAction','queue')
|
---|
| 340 | % testavi=0;
|
---|
| 341 | % UvData=get(handles.view_field,'UserData');
|
---|
| 342 | %
|
---|
| 343 | % while get(handles.speed,'Value')~=0 & isequal(get(handles.RunMovie,'BusyAction'),'queue') % enable STOP command
|
---|
| 344 | % runpm(hObject,eventdata,handles,increment)
|
---|
| 345 | % pause(1.02-get(handles.speed,'Value'))% wait for next image
|
---|
| 346 | % end
|
---|
| 347 | % if isfield(UvData,'aviobj') && ~isempty( UvData.aviobj),
|
---|
| 348 | % UvData.aviobj=close(UvData.aviobj);
|
---|
| 349 | % set(handles.view_field,'UserData',UvData);
|
---|
| 350 | % end
|
---|
| 351 | % set(handles.RunMovie,'BackgroundColor',[1 0 0])%paint the command buttonback to red
|
---|
[198] | 352 |
|
---|
| 353 |
|
---|
| 354 | %-------------------------------------------------------------------
|
---|
| 355 | % --- translate coordinate to matrix index
|
---|
| 356 | %-------------------------------------------------------------------
|
---|
| 357 | function [indx,indy]=pos2ind(x0,rangx0,nxy)
|
---|
| 358 | indx=1+round((nxy(2)-1)*(x0-rangx0(1))/(rangx0(2)-rangx0(1)));% index x of pixel
|
---|
| 359 | indy=1+round((nxy(1)-1)*(y12-rangy0(1))/(rangy0(2)-rangy0(1)));% index y of pixel
|
---|
| 360 |
|
---|
| 361 | %-------------------------------------------------------------------
|
---|
[428] | 362 | % --- Executes on button press in 'zoom'.
|
---|
| 363 | %-------------------------------------------------------------------
|
---|
| 364 | function CheckZoom_Callback(hObject, eventdata, handles)
|
---|
| 365 | if (get(handles.CheckZoom,'Value') == 1);
|
---|
| 366 | set(handles.CheckZoom,'BackgroundColor',[1 1 0])
|
---|
| 367 | set(handles.CheckFixLimits,'Value',1)% propose by default fixed limits for the plotting axes
|
---|
| 368 | set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])
|
---|
| 369 | else
|
---|
| 370 | set(handles.CheckZoom,'BackgroundColor',[0.7 0.7 0.7])
|
---|
| 371 | end
|
---|
| 372 |
|
---|
| 373 | %-------------------------------------------------------------------
|
---|
[198] | 374 | % --- Executes on button press in 'FixLimits'.
|
---|
| 375 | %-------------------------------------------------------------------
|
---|
[295] | 376 | function CheckFixLimits_Callback(hObject, eventdata, handles)
|
---|
| 377 | test=get(handles.CheckFixLimits,'Value');
|
---|
[198] | 378 | if test
|
---|
[295] | 379 | set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])
|
---|
[198] | 380 | else
|
---|
[295] | 381 | set(handles.CheckFixLimits,'BackgroundColor',[0.7 0.7 0.7])
|
---|
[198] | 382 | end
|
---|
[295] | 383 | update_plot(handles)
|
---|
[428] | 384 |
|
---|
| 385 | %-------------------------------------------------------------------
|
---|
| 386 | % --- Executes on button press in CheckFixAspectRatio.
|
---|
| 387 | function CheckFixAspectRatio_Callback(hObject, eventdata, handles)
|
---|
[198] | 388 | %-------------------------------------------------------------------
|
---|
[428] | 389 | if get(handles.CheckFixAspectRatio,'Value')
|
---|
| 390 | set(handles.CheckFixAspectRatio,'BackgroundColor',[1 1 0])
|
---|
| 391 | update_plot(handles);
|
---|
[198] | 392 | else
|
---|
[428] | 393 | set(handles.CheckFixAspectRatio,'BackgroundColor',[0.7 0.7 0.7])
|
---|
| 394 | update_plot(handles);
|
---|
[198] | 395 | end
|
---|
| 396 |
|
---|
| 397 | %-------------------------------------------------------------------
|
---|
[428] | 398 | function num_AspectRatio_Callback(hObject, eventdata, handles)
|
---|
| 399 | %-------------------------------------------------------------------
|
---|
| 400 | set(handles.CheckFixAspectRatio,'Value',1)% select the fixed aspect ratio button
|
---|
| 401 | set(handles.CheckFixAspectRatio,'BackgroundColor',[1 1 0])% mark in yellow
|
---|
| 402 | update_plot(handles);
|
---|
[198] | 403 |
|
---|
| 404 | %-------------------------------------------------------------------
|
---|
| 405 |
|
---|
[413] | 406 | % %-------------------------------------------------------------------
|
---|
| 407 | % %----Executes on button press in 'record': records the current flags of manual correction.
|
---|
| 408 | % %-------------------------------------------------------------------
|
---|
| 409 | % function record_Callback(hObject, eventdata, handles)
|
---|
| 410 | % % [filebase,num_i1,num_j1,num_i2,num_j2,Ext,NomType,SubDir]=read_input_file(handles);
|
---|
| 411 | % filename=read_file_boxes(handles);
|
---|
| 412 | % AxeData=get(gca,'UserData');
|
---|
| 413 | % [erread,message]=fileattrib(filename);
|
---|
| 414 | % if ~isempty(message) && ~isequal(message.UserWrite,1)
|
---|
| 415 | % msgbox_view_field('ERROR',['no writting access to ' filename])
|
---|
| 416 | % return
|
---|
| 417 | % end
|
---|
| 418 | % test_civ2=isequal(get(handles.civ2,'BackgroundColor'),[1 1 0]);
|
---|
| 419 | % test_civ1=isequal(get(handles.civ1,'BackgroundColor'),[1 1 0]);
|
---|
| 420 | % if ~test_civ2 && ~test_civ1
|
---|
| 421 | % msgbox_view_field('ERROR','manual correction only possible for CIV1 or CIV2 velocity fields')
|
---|
| 422 | % end
|
---|
| 423 | % if test_civ2
|
---|
| 424 | % nbname='nb_vectors2';
|
---|
| 425 | % flagname='vec2_FixFlag';
|
---|
| 426 | % attrname='fix2';
|
---|
| 427 | % end
|
---|
| 428 | % if test_civ1
|
---|
| 429 | % nbname='nb_vectors';
|
---|
| 430 | % flagname='vec_FixFlag';
|
---|
| 431 | % attrname='fix';
|
---|
| 432 | % end
|
---|
| 433 | % %write fix flags in the netcdf file
|
---|
| 434 | % hhh=which('netcdf.open');% look for built-in matlab netcdf library
|
---|
| 435 | % if ~isequal(hhh,'')% case of new builtin Matlab netcdf library
|
---|
| 436 | % nc=netcdf.open(filename,'NC_WRITE');
|
---|
| 437 | % netcdf.reDef(nc)
|
---|
| 438 | % netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),attrname,1)
|
---|
| 439 | % dimid = netcdf.inqDimID(nc,nbname);
|
---|
| 440 | % try
|
---|
| 441 | % varid = netcdf.inqVarID(nc,flagname);% look for already existing fixflag variable
|
---|
| 442 | % catch
|
---|
| 443 | % varid=netcdf.defVar(nc,flagname,'double',dimid);%create fixflag variable if it does not exist
|
---|
| 444 | % end
|
---|
| 445 | % netcdf.endDef(nc)
|
---|
| 446 | % netcdf.putVar(nc,varid,AxeData.FF);
|
---|
| 447 | % netcdf.close(nc)
|
---|
| 448 | % else %old netcdf library
|
---|
| 449 | % netcdf_toolbox(filename,AxeData,attrname,nbname,flagname)
|
---|
| 450 | % end
|
---|
| 451 | %
|
---|
| 452 | % function netcdf_toolbox(filename,AxeData,attrname,nbname,flagname)
|
---|
| 453 | % nc=netcdf(filename,'write'); %open netcdf file
|
---|
| 454 | % result=redef(nc);
|
---|
| 455 | % eval(['nc.' attrname '=1;']);
|
---|
| 456 | % theDim=nc(nbname) ;% get the number of velocity vectors
|
---|
| 457 | % nb_vectors=size(theDim);
|
---|
| 458 | % var_FixFlag=ncvar(flagname,nc);% var_FixFlag will be written as the netcdf variable vec_FixFlag
|
---|
| 459 | % var_FixFlag(1:nb_vectors)=AxeData.FF;%
|
---|
| 460 | % fin=close(nc);
|
---|
[198] | 461 |
|
---|
| 462 |
|
---|
| 463 | %-------------------------------------------------------------------
|
---|
| 464 | %-------------------------------------------------------------------
|
---|
| 465 | % - FUNCTIONS FOR SETTING PLOTTING PARAMETERS
|
---|
| 466 |
|
---|
| 467 | %------------------------------------------------------------------
|
---|
| 468 |
|
---|
| 469 |
|
---|
| 470 | %------------------------------------------------------------------
|
---|
| 471 | % --- Executes on selection change in col_vec: choice of the color code.
|
---|
| 472 | %
|
---|
| 473 | function col_vec_Callback(hObject, eventdata, handles)
|
---|
| 474 | %------------------------------------------------------------------
|
---|
| 475 | % edit the choice for color code
|
---|
| 476 | list_code=get(handles.col_vec,'String');% list menu fields
|
---|
| 477 | index_code=get(handles.col_vec,'Value');% selected string index
|
---|
| 478 | col_code= list_code{index_code(1)}; % selected field
|
---|
| 479 | if isequal(col_code,'black') | isequal(col_code,'white')
|
---|
| 480 | set(handles.slider1,'Visible','off')
|
---|
| 481 | set(handles.slider2,'Visible','off')
|
---|
| 482 | set(handles.colcode1,'Visible','off')
|
---|
| 483 | set(handles.colcode2,'Visible','off')
|
---|
| 484 | set(handles.AutoVecColor,'Visible','off')
|
---|
| 485 | set_vec_col_bar(handles)
|
---|
| 486 | else
|
---|
| 487 | set(handles.slider1,'Visible','on')
|
---|
| 488 | set(handles.slider2,'Visible','on')
|
---|
| 489 | set(handles.colcode1,'Visible','on')
|
---|
| 490 | set(handles.colcode2,'Visible','on')
|
---|
| 491 | set(handles.AutoVecColor,'Visible','on')
|
---|
| 492 | if isequal(col_code,'ima_cor')
|
---|
| 493 | set(handles.AutoVecColor,'Value',0)%fixed scale by default
|
---|
| 494 | set(handles.vec_col_bar,'Value',0)% 3 colors r,g,b by default
|
---|
| 495 | set(handles.slider1,'Min',0);
|
---|
| 496 | set(handles.slider1,'Max',1);
|
---|
| 497 | set(handles.slider2,'Min',0);
|
---|
| 498 | set(handles.slider2,'Max',1);
|
---|
| 499 | % set(handles.min_C_title_vec,'String','0')
|
---|
| 500 | set(handles.max_vec,'String','1')
|
---|
| 501 | set(handles.colcode1,'String','0.333')
|
---|
| 502 | colcode1_Callback(hObject, eventdata, handles)
|
---|
| 503 | set(handles.colcode2,'String','0.666')
|
---|
| 504 | colcode2_Callback(hObject, eventdata, handles)
|
---|
| 505 | else
|
---|
| 506 | set(handles.AutoVecColor,'Value',1)%auto scale between min,max by default
|
---|
| 507 | set(handles.vec_col_bar,'Value',1)% colormap 'jet' by default
|
---|
| 508 | minval=get(handles.slider1,'Min');
|
---|
| 509 | maxval=get(handles.slider1,'Max');
|
---|
| 510 | set(handles.slider1,'Value',minval)
|
---|
| 511 | set(handles.slider2,'Value',maxval)
|
---|
| 512 | set_vec_col_bar(handles)
|
---|
| 513 | end
|
---|
| 514 | % slider_update(handles)
|
---|
| 515 | end
|
---|
| 516 | %replot the current graph
|
---|
| 517 | run0_Callback(hObject, eventdata, handles)
|
---|
| 518 |
|
---|
| 519 |
|
---|
| 520 | %----------------------------------------------------------------
|
---|
| 521 | % -- Executes on slider movement to set the color code
|
---|
| 522 | %
|
---|
| 523 | function slider1_Callback(hObject, eventdata, handles)
|
---|
| 524 | %------------------------------------------------------------------
|
---|
| 525 | slider1=get(handles.slider1,'Value');
|
---|
| 526 | min_val=str2num(get(handles.min_vec,'String'));
|
---|
| 527 | max_val=str2num(get(handles.max_vec,'String'));
|
---|
| 528 | col=min_val+(max_val-min_val)*slider1;
|
---|
| 529 | set(handles.colcode1,'String',num2str(col))
|
---|
| 530 | if(get(handles.slider2,'Value') < col)%move also the second slider at the same value if needed
|
---|
| 531 | set(handles.slider2,'Value',col)
|
---|
| 532 | set(handles.colcode2,'String',num2str(col))
|
---|
| 533 | end
|
---|
| 534 | colcode1_Callback(hObject, eventdata, handles)
|
---|
| 535 |
|
---|
| 536 | %----------------------------------------------------------------
|
---|
| 537 | % Executes on slider movement to set the color code
|
---|
| 538 | %----------------------------------------------------------------
|
---|
| 539 | function slider2_Callback(hObject, eventdata, handles)
|
---|
| 540 | slider2=get(handles.slider2,'Value');
|
---|
| 541 | min_val=str2num(get(handles.min_vec,'String'));
|
---|
| 542 | max_val=str2num(get(handles.max_vec,'String'));
|
---|
| 543 | col=min_val+(max_val-min_val)*slider2;
|
---|
| 544 | set(handles.colcode2,'String',num2str(col))
|
---|
| 545 | if(get(handles.slider1,'Value') > col)%move also the first slider at the same value if needed
|
---|
| 546 | set(handles.slider1,'Value',col)
|
---|
| 547 | set(handles.colcode1,'String',num2str(col))
|
---|
| 548 | end
|
---|
| 549 | colcode2_Callback(hObject, eventdata, handles)
|
---|
| 550 |
|
---|
| 551 | %----------------------------------------------------------------
|
---|
| 552 | %execute on return carriage on the edit box corresponding to slider 1
|
---|
| 553 | %----------------------------------------------------------------
|
---|
| 554 | function colcode1_Callback(hObject, eventdata, handles)
|
---|
| 555 | % col=str2num(get(handles.colcode1,'String'));
|
---|
| 556 | % set(handles.slider1,'Value',col)
|
---|
| 557 | set_vec_col_bar(handles)
|
---|
| 558 | update_plot(handles)
|
---|
| 559 |
|
---|
| 560 | %----------------------------------------------------------------
|
---|
| 561 | %execute on return carriage on the edit box corresponding to slider 2
|
---|
| 562 | %----------------------------------------------------------------
|
---|
| 563 | function colcode2_Callback(hObject, eventdata, handles)
|
---|
| 564 | % col=str2num(get(handles.colcode2,'String'));
|
---|
| 565 | % set(handles.slider2,'Value',col)
|
---|
| 566 | % slider2_Callback(hObject, eventdata, handles)
|
---|
| 567 | set_vec_col_bar(handles)
|
---|
| 568 | update_plot(handles)
|
---|
| 569 |
|
---|
| 570 | %-------------------------------------------------------
|
---|
| 571 | % --- Executes on button press in AutoVecColor.
|
---|
| 572 | %-------------------------------------------------------
|
---|
| 573 | function vec_col_bar_Callback(hObject, eventdata, handles)
|
---|
| 574 | set_vec_col_bar(handles)
|
---|
| 575 |
|
---|
| 576 | %------------------------------------------------
|
---|
| 577 | %CALLBACKS FOR PLOTTING PARAMETERS
|
---|
| 578 | %-------------------------------------------------
|
---|
| 579 |
|
---|
| 580 | %------------------------------------------------------------------------
|
---|
[295] | 581 | function num_MinX_Callback(hObject, eventdata, handles)
|
---|
[198] | 582 | %------------------------------------------------------------------------
|
---|
[295] | 583 | set(handles.CheckFixLimits,'Value',1) %suppress auto mode
|
---|
| 584 | set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])
|
---|
[198] | 585 | update_plot(handles);
|
---|
| 586 |
|
---|
| 587 | %------------------------------------------------------------------------
|
---|
[295] | 588 | function num_MaxX_Callback(hObject, eventdata, handles)
|
---|
[198] | 589 | %------------------------------------------------------------------------
|
---|
[295] | 590 | set(handles.CheckFixLimits,'Value',1) %suppress auto mode
|
---|
| 591 | set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])
|
---|
[198] | 592 | update_plot(handles);
|
---|
| 593 |
|
---|
| 594 | %------------------------------------------------------------------------
|
---|
[295] | 595 | function num_MinY_Callback(hObject, eventdata, handles)
|
---|
[198] | 596 | %------------------------------------------
|
---|
[295] | 597 | set(handles.CheckFixLimits,'Value',1) %suppress auto mode
|
---|
| 598 | set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])
|
---|
[198] | 599 | update_plot(handles);
|
---|
| 600 |
|
---|
| 601 | %------------------------------------------------------------------------
|
---|
[295] | 602 | function num_MaxY_Callback(hObject, eventdata, handles)
|
---|
[198] | 603 | %------------------------------------------------------------------------
|
---|
[295] | 604 | set(handles.CheckFixLimits,'Value',1) %suppress auto mode
|
---|
| 605 | set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])
|
---|
[198] | 606 | update_plot(handles);
|
---|
| 607 |
|
---|
| 608 | %-----------------------------------------------------------------
|
---|
[295] | 609 | function num_MinA_Callback(hObject, eventdata, handles)
|
---|
[198] | 610 | %------------------------------------------
|
---|
[295] | 611 | set(handles.CheckFixScalar,'Value',1) %suppress auto mode
|
---|
| 612 | set(handles.CheckFixScalar,'BackgroundColor',[1 1 0])
|
---|
[198] | 613 | update_plot(handles)
|
---|
| 614 |
|
---|
| 615 | %-----------------------------------------------------------------
|
---|
[295] | 616 | function num_MaxA_Callback(hObject, eventdata, handles)
|
---|
[198] | 617 | %--------------------------------------------
|
---|
[295] | 618 | set(handles.CheckFixScalar,'Value',1) %suppress auto mode
|
---|
| 619 | set(handles.CheckFixScalar,'BackgroundColor',[1 1 0])
|
---|
[198] | 620 | update_plot(handles)
|
---|
| 621 |
|
---|
| 622 | %-----------------------------------------------
|
---|
[295] | 623 | function CheckFixScalar_Callback(hObject, eventdata, handles)
|
---|
[198] | 624 | %--------------------------------------------
|
---|
[295] | 625 | test=get(handles.CheckFixScalar,'Value');
|
---|
[198] | 626 | if test
|
---|
[295] | 627 | set(handles.CheckFixScalar,'BackgroundColor',[1 1 0])
|
---|
[198] | 628 | else
|
---|
[295] | 629 | set(handles.CheckFixScalar,'BackgroundColor',[0.7 0.7 0.7])
|
---|
[198] | 630 | update_plot(handles);
|
---|
| 631 | % set(handles.MinA,'String',num2str(ScalOut.MinA,3))
|
---|
| 632 | % set(handles.MaxA,'String',num2str(ScalOut.MaxA,3))
|
---|
| 633 | end
|
---|
| 634 |
|
---|
| 635 | %-------------------------------------------------------------------
|
---|
[295] | 636 | function CheckBW_Callback(hObject, eventdata, handles)
|
---|
[198] | 637 | %-------------------------------------------------------------------
|
---|
| 638 | update_plot(handles)
|
---|
| 639 |
|
---|
| 640 | %-------------------------------------------------------------------
|
---|
[295] | 641 | function ListContour_Callback(hObject, eventdata, handles)
|
---|
[198] | 642 | %-------------------------------------------------------------------
|
---|
| 643 | val=get(handles.Contours,'Value');
|
---|
| 644 | if val==2
|
---|
| 645 | set(handles.interval_txt,'Visible','on')
|
---|
| 646 | set(handles.IncrA,'Visible','on')
|
---|
| 647 | else
|
---|
| 648 | set(handles.interval_txt,'Visible','off')
|
---|
| 649 | set(handles.IncrA,'Visible','off')
|
---|
| 650 | end
|
---|
| 651 | update_plot(handles)
|
---|
| 652 |
|
---|
| 653 | %-------------------------------------------------------------------
|
---|
| 654 | function IncrA_Callback(hObject, eventdata, handles)
|
---|
| 655 | %-------------------------------------------------------------------
|
---|
| 656 | update_plot(handles)
|
---|
| 657 |
|
---|
| 658 | %-------------------------------------------------------------------
|
---|
| 659 | function HideWarning_Callback(hObject, eventdata, handles)
|
---|
| 660 | %-------------------------------------------------------------------
|
---|
| 661 | update_plot(handles)
|
---|
| 662 |
|
---|
| 663 | %-------------------------------------------------------------------
|
---|
| 664 | function HideFalse_Callback(hObject, eventdata, handles)
|
---|
| 665 | %-------------------------------------------------------------------
|
---|
| 666 | update_plot(handles)
|
---|
| 667 |
|
---|
| 668 | %-------------------------------------------------------------------
|
---|
| 669 | function VecScale_Callback(hObject, eventdata, handles)
|
---|
| 670 | %-------------------------------------------------------------------
|
---|
| 671 | set(handles.FixVec,'Value',1);
|
---|
| 672 | set(handles.FixVec,'BackgroundColor',[1 1 0])
|
---|
| 673 | update_plot(handles)
|
---|
| 674 |
|
---|
| 675 | %-------------------------------------------------------------------
|
---|
| 676 | function FixVec_Callback(hObject, eventdata, handles)
|
---|
| 677 | %-------------------------------------------------------------------
|
---|
| 678 | test=get(handles.FixVec,'Value');
|
---|
| 679 | if test
|
---|
| 680 | set(handles.FixVec,'BackgroundColor',[1 1 0])
|
---|
| 681 | else
|
---|
| 682 | update_plot(handles);
|
---|
| 683 | %set(handles.VecScale,'String',num2str(ScalOut.VecScale,3))
|
---|
| 684 | set(handles.FixVec,'BackgroundColor',[0.7 0.7 0.7])
|
---|
| 685 | end
|
---|
| 686 |
|
---|
| 687 | %-------------------------------------------------------
|
---|
| 688 | % --- Executes on selection change in decimate4 (nb_vec/4).
|
---|
| 689 | %-------------------------------------------------------
|
---|
[295] | 690 | function CheckDecimate4_Callback(hObject, eventdata, handles)
|
---|
[198] | 691 | update_plot(handles)
|
---|
| 692 |
|
---|
| 693 |
|
---|
| 694 | %-------------------------------------------------------
|
---|
| 695 | % --- Executes on selection change in color_code menu
|
---|
| 696 | %-------------------------------------------------------
|
---|
| 697 | function color_code_Callback(hObject, eventdata, handles)
|
---|
| 698 | set_vec_col_bar(handles)
|
---|
| 699 | update_plot(handles);
|
---|
| 700 |
|
---|
| 701 | %-------------------------------------------------------
|
---|
| 702 | % --- Executes on button press in AutoVecColor.
|
---|
| 703 | %-------------------------------------------------------
|
---|
| 704 | function AutoVecColor_Callback(hObject, eventdata, handles)
|
---|
| 705 | test=get(handles.AutoVecColor,'Value');
|
---|
| 706 | if test
|
---|
| 707 | set(handles.AutoVecColor,'BackgroundColor',[1 1 0])
|
---|
| 708 | else
|
---|
| 709 | update_plot(handles);
|
---|
| 710 | %set(handles.VecScale,'String',num2str(ScalOut.VecScale,3))
|
---|
| 711 | set(handles.AutoVecColor,'BackgroundColor',[0.7 0.7 0.7])
|
---|
| 712 | end
|
---|
| 713 | %set_vec_col_bar(handles)
|
---|
| 714 |
|
---|
| 715 | %-------------------------------------------------------
|
---|
| 716 | % --- Executes on selection change in max_vec.
|
---|
| 717 | %-------------------------------------------------------
|
---|
| 718 | function min_vec_Callback(hObject, eventdata, handles)
|
---|
| 719 | max_vec_Callback(hObject, eventdata, handles)
|
---|
| 720 |
|
---|
| 721 | % --- Executes on selection change in max_vec.
|
---|
| 722 | function max_vec_Callback(hObject, eventdata, handles)
|
---|
| 723 | set(handles.AutoVecColor,'Value',1)
|
---|
| 724 | AutoVecColor_Callback(hObject, eventdata, handles)
|
---|
| 725 | min_val=str2num(get(handles.min_vec,'String'));
|
---|
| 726 | max_val=str2num(get(handles.max_vec,'String'));
|
---|
| 727 | slider1=get(handles.slider1,'Value');
|
---|
| 728 | slider2=get(handles.slider2,'Value');
|
---|
| 729 | colcode1=min_val+(max_val-min_val)*slider1;
|
---|
| 730 | colcode2=min_val+(max_val-min_val)*slider2;
|
---|
| 731 | set(handles.colcode1,'String',num2str(colcode1))
|
---|
| 732 | set(handles.colcode2,'String',num2str(colcode2))
|
---|
| 733 | update_plot(handles);
|
---|
| 734 |
|
---|
| 735 | %-------------------------------------------------------------------
|
---|
| 736 | %update the display of color code for vectors
|
---|
| 737 | function set_vec_col_bar(handles)
|
---|
| 738 | %-------------------------------------------------------------------
|
---|
| 739 | %get the image of the color display button 'vec_col_bar' in pixels
|
---|
| 740 | set(handles.vec_col_bar,'Unit','pixel');
|
---|
| 741 | pos_vert=get(handles.vec_col_bar,'Position');
|
---|
| 742 | set(handles.vec_col_bar,'Unit','Normalized');
|
---|
| 743 | width=ceil(pos_vert(3));
|
---|
| 744 | height=ceil(pos_vert(4));
|
---|
| 745 |
|
---|
| 746 | %get slider indications
|
---|
| 747 | list=get(handles.color_code,'String');
|
---|
| 748 | ichoice=get(handles.color_code,'Value');
|
---|
| 749 | colcode.ColorCode=list{ichoice};
|
---|
| 750 | colcode.MinC=str2num(get(handles.min_vec,'String'));
|
---|
| 751 | colcode.MaxC=str2num(get(handles.max_vec,'String'));
|
---|
| 752 | test3color=strcmp(colcode.ColorCode,'rgb') || strcmp(colcode.ColorCode,'bgr');
|
---|
| 753 | if test3color
|
---|
| 754 | colcode.colcode1=str2num(get(handles.colcode1,'String'));
|
---|
| 755 | colcode.colcode2=str2num(get(handles.colcode2,'String'));
|
---|
| 756 | end
|
---|
| 757 | colcode.FixedCbounds=0;
|
---|
| 758 | colcode.FixedCbounds=1;
|
---|
| 759 | vec_C=colcode.MinC+(colcode.MaxC-colcode.MinC)*[0.5:width-0.5]/width;%sample of vec_C values from min to max
|
---|
| 760 | [colorlist,col_vec]=set_col_vec(colcode,vec_C);
|
---|
| 761 | oneheight=ones(1,height);
|
---|
| 762 | A1=colorlist(col_vec,1)*oneheight;
|
---|
| 763 | A2=colorlist(col_vec,2)*oneheight;
|
---|
| 764 | A3=colorlist(col_vec,3)*oneheight;
|
---|
| 765 | A(:,:,1)=A1';
|
---|
| 766 | A(:,:,2)=A2';
|
---|
| 767 | A(:,:,3)=A3';
|
---|
| 768 | set(handles.vec_col_bar,'Cdata',A)
|
---|
| 769 |
|
---|
[295] | 770 | %-------------------------------------------------------------------
|
---|
| 771 | function update_plot(handles)
|
---|
| 772 | %-------------------------------------------------------------------
|
---|
| 773 | Data=get(handles.view_field,'UserData');
|
---|
| 774 | AxeData=Data.axes3;% retrieve the current plotted data
|
---|
[292] | 775 | PlotParam=read_GUI(handles.view_field);
|
---|
[295] | 776 | [PP,PlotParamOut]= plot_field(AxeData,handles.axes3,PlotParam);
|
---|
[198] | 777 | write_plot_param(handles,PlotParamOut); %update the auto plot parameters
|
---|
| 778 |
|
---|
[220] | 779 | %------------------------------------------------------------------------
|
---|
[198] | 780 | % --- Executes on button press in Menu/Export/field in workspace.
|
---|
| 781 | function MenuExportField_Callback(hObject, eventdata, handles)
|
---|
[220] | 782 | %------------------------------------------------------------------------
|
---|
[198] | 783 | global Data_view_field
|
---|
| 784 | % huvmat=findobj(allchild(0),'Name','uvmat');
|
---|
| 785 | Data_view_field=get(handles.view_field,'UserData');
|
---|
| 786 | Data_view_field=Data_view_field.axes3;
|
---|
| 787 | % Data_view_field=UvData.ProjField_2;
|
---|
| 788 | evalin('base','global Data_view_field')%make CurData global in the workspace
|
---|
| 789 | display(['UserData of view_field :'])
|
---|
| 790 | evalin('base','Data_view_field') %display CurData in the workspace
|
---|
| 791 | commandwindow;
|
---|
| 792 |
|
---|
[220] | 793 | %------------------------------------------------------------------------
|
---|
[198] | 794 | % --- Executes on button press in Menu/Export/extract figure.
|
---|
| 795 | function MenuExport_plot_Callback(hObject, eventdata, handles)
|
---|
[220] | 796 | %------------------------------------------------------------------------
|
---|
[198] | 797 | huvmat=get(handles.MenuExport_plot,'parent');
|
---|
| 798 | UvData=get(huvmat,'UserData');
|
---|
| 799 | hfig=figure;
|
---|
| 800 | newaxes=copyobj(handles.axes3,hfig);
|
---|
| 801 | map=colormap(handles.axes3);
|
---|
| 802 | colormap(map);%transmit the current colormap to the zoom fig
|
---|
| 803 | colorbar
|
---|
| 804 |
|
---|
| 805 |
|
---|
[406] | 806 | % --- Executes on selection change in ColorCode.
|
---|
| 807 | function ColorCode_Callback(hObject, eventdata, handles)
|
---|
| 808 |
|
---|
| 809 |
|
---|
| 810 | % --- Executes on selection change in ColorScalar.
|
---|
| 811 | function ColorScalar_Callback(hObject, eventdata, handles)
|
---|
| 812 |
|
---|
[413] | 813 |
|
---|
[428] | 814 | function num_ColCode2_Callback(hObject, eventdata, handles)
|
---|
[413] | 815 |
|
---|
| 816 |
|
---|
| 817 |
|
---|
[432] | 818 | %
|
---|
| 819 | %
|
---|
| 820 | % % --- Executes when view_field is resized.
|
---|
| 821 | % function view_field_ResizeFcn(hObject, eventdata, handles)
|
---|
| 822 | % % hObject handle to view_field (see GCBO)
|
---|
| 823 | % % eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 824 | % % handles structure with handles and user data (see GUIDATA)
|
---|