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