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