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