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