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