[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....)
|
---|
[809] | 13 |
|
---|
| 14 | %=======================================================================
|
---|
| 15 | % Copyright 2008-2014, LEGI UMR 5519 / CNRS UJF G-INP, Grenoble, France
|
---|
| 16 | % http://www.legi.grenoble-inp.fr
|
---|
| 17 | % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
|
---|
[198] | 18 | %
|
---|
[809] | 19 | % This file is part of the toolbox UVMAT.
|
---|
| 20 | %
|
---|
| 21 | % UVMAT is free software; you can redistribute it and/or modify
|
---|
| 22 | % it under the terms of the GNU General Public License as published
|
---|
| 23 | % by the Free Software Foundation; either version 2 of the license,
|
---|
| 24 | % or (at your option) any later version.
|
---|
| 25 | %
|
---|
| 26 | % UVMAT is distributed in the hope that it will be useful,
|
---|
[198] | 27 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 28 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
[809] | 29 | % GNU General Public License (see LICENSE.txt) for more details.
|
---|
| 30 | %=======================================================================
|
---|
[198] | 31 |
|
---|
| 32 | %-------------------------------------------------------------------
|
---|
| 33 | % I - MAIN FUNCTION VIEW_FIELD (DO NOT MODIFY)
|
---|
| 34 | %-------------------------------------------------------------------
|
---|
| 35 | %-------------------------------------------------------------------
|
---|
| 36 | function varargout = view_field(varargin)
|
---|
| 37 |
|
---|
| 38 | % Begin initialization code - DO NOT EDIT
|
---|
| 39 | gui_Singleton = 1;
|
---|
| 40 | gui_State = struct('gui_Name', mfilename, ...
|
---|
| 41 | 'gui_Singleton', gui_Singleton, ...
|
---|
| 42 | 'gui_OpeningFcn', @view_field_OpeningFcn, ...
|
---|
| 43 | 'gui_OutputFcn', @view_field_OutputFcn, ...
|
---|
| 44 | 'gui_LayoutFcn', [], ...
|
---|
| 45 | 'gui_Callback', []);
|
---|
| 46 | if nargin && ischar(varargin{1})
|
---|
| 47 | gui_State.gui_Callback = str2func(varargin{1});
|
---|
| 48 | end
|
---|
| 49 |
|
---|
| 50 | if nargout
|
---|
| 51 | varargout{1:nargout} = gui_mainfcn(gui_State, varargin{:});
|
---|
| 52 | else
|
---|
| 53 | gui_mainfcn(gui_State, varargin{:});
|
---|
| 54 | end
|
---|
| 55 | % End initialization code - DO NOT EDIT
|
---|
| 56 |
|
---|
| 57 | %-------------------------------------------------------------------
|
---|
| 58 | % --- Executes just before view_field is made visible.
|
---|
| 59 | function view_field_OpeningFcn(hObject, eventdata, handles, Field )
|
---|
| 60 | %-------------------------------------------------------------------
|
---|
| 61 |
|
---|
| 62 | % Choose default command menuline output for view_field
|
---|
| 63 | handles.output = handles.view_field;
|
---|
| 64 |
|
---|
| 65 | % Update handles structure
|
---|
| 66 | guidata(hObject, handles);
|
---|
| 67 |
|
---|
| 68 | %functions for the mouse and keyboard
|
---|
[681] | 69 | set(hObject,'WindowKeyPressFcn',{'keyboard_callback',handles})%set keyboard action function
|
---|
[432] | 70 | set(hObject,'WindowButtonMotionFcn',{'mouse_motion',handles})%set mouse action functio
|
---|
[198] | 71 | set(hObject,'WindowButtonDownFcn',{'mouse_down'})%set mouse click action function
|
---|
[432] | 72 | set(hObject,'WindowButtonUpFcn',{'mouse_up',handles})
|
---|
[406] | 73 | set(hObject,'DeleteFcn',{@closefcn})%
|
---|
[429] | 74 | set(hObject,'ResizeFcn',{@ResizeFcn,handles})%
|
---|
[544] | 75 | ViewFieldData.PlotAxes=[];%initiates the record of the current field (will be updated by plot_field)
|
---|
[429] | 76 | set(handles.view_field,'Units','pixels')
|
---|
| 77 | ViewFieldData.GUISize=get(handles.view_field,'Position');
|
---|
| 78 | set(handles.view_field,'UserData',ViewFieldData);%store the initial fig size in UserData
|
---|
[198] | 79 | AxeData.LimEditBox=1; %initialise AxeData, the parent figure sets plot parameters
|
---|
[511] | 80 | set(handles.PlotAxes,'UserData',AxeData)
|
---|
[413] | 81 | if exist('Field','var')
|
---|
[511] | 82 | [PlotType,PlotParamOut]= plot_field(Field,handles.PlotAxes);%,PlotParam,KeepLim,PosColorbar)
|
---|
[748] | 83 | set(handles.Axes,'Visible','on')
|
---|
[413] | 84 | if isfield(PlotParamOut,'Vectors')
|
---|
| 85 | set(handles.Vectors,'Visible','on')
|
---|
[599] | 86 | else
|
---|
| 87 | set(handles.Vectors,'Visible','off')
|
---|
[413] | 88 | end
|
---|
[599] | 89 | if isfield(PlotParamOut,'Scalar')
|
---|
| 90 | set(handles.Scalar,'Visible','on')
|
---|
| 91 | else
|
---|
| 92 | set(handles.Scalar,'Visible','off')
|
---|
| 93 | end
|
---|
[625] | 94 |
|
---|
[591] | 95 | errormsg=fill_GUI(PlotParamOut,hObject);
|
---|
[569] | 96 | if ~isempty(errormsg)
|
---|
| 97 | msgbox_uvmat('ERROR',errormsg)
|
---|
| 98 | return
|
---|
| 99 | end
|
---|
| 100 | %write_plot_param(handles,PlotParamOut);% update the display of the plotting parameters
|
---|
[198] | 101 | end
|
---|
[429] | 102 |
|
---|
[432] | 103 | %put the GUI on the lower right of the sceen
|
---|
| 104 | pos_view_field=get(hObject,'Position');
|
---|
[644] | 105 | set(0,'Unit','pixel')
|
---|
[432] | 106 | ScreenSize=get(0,'ScreenSize');
|
---|
| 107 | pos_view_field(1)=ScreenSize(1)+ScreenSize(3)-pos_view_field(3);
|
---|
| 108 | pos_view_field(2)=ScreenSize(2);
|
---|
| 109 | set(hObject,'Position',pos_view_field)
|
---|
| 110 |
|
---|
[402] | 111 | %------------------------------------------------------------------------
|
---|
[429] | 112 | %--- activated when resizing the GUI view_field
|
---|
| 113 | function ResizeFcn(gcbo,eventdata,handles)
|
---|
| 114 | %------------------------------------------------------------------------
|
---|
| 115 | set(handles.view_field,'Units','pixels')
|
---|
| 116 | size_fig=get(handles.view_field,'Position');
|
---|
| 117 | Data=get(handles.view_field,'UserData');
|
---|
| 118 | Data.GUISize=size_fig;
|
---|
| 119 | set(handles.view_field,'UserData',Data)
|
---|
| 120 |
|
---|
[690] | 121 | %% reset position of text_display and TableDisplay
|
---|
| 122 | % reset position of text_display
|
---|
[726] | 123 | set(handles.text_display,'Units','pixels');
|
---|
[717] | 124 | pos_1=get(handles.text_display,'Position');% [lower x lower y width height] for text_display
|
---|
| 125 | pos_1(1)=size_fig(3)-pos_1(3); % set text display to the right of the fig
|
---|
| 126 | pos_1(2)=size_fig(4)-pos_1(4); % set text display to the top of the fig
|
---|
| 127 | set(handles.text_display,'Position',pos_1)
|
---|
| 128 | % reset position of TableDisplay
|
---|
[873] | 129 | pos_TableDisplay=[pos_1(1) 2 pos_1(3) 2.2*pos_1(4)];
|
---|
| 130 | set(handles.TableDisplay,'Position',pos_TableDisplay)
|
---|
| 131 |
|
---|
[690] | 132 | % reset position of CheckTable
|
---|
| 133 | pos_CheckTable=get(handles.CheckTable,'Position');% [lower x lower y width height] for CheckHold
|
---|
[873] | 134 | pos_CheckTable(1)=pos_1(1);%-pos_CheckTable(3); % set 'CheckHold' to the right of the fig
|
---|
| 135 | pos_CheckTable(2)=pos_TableDisplay(2)+pos_TableDisplay(4);%size_fig(4)-pos_CheckTable(4); % set 'CheckHold' to the lower edge of text display
|
---|
[690] | 136 | set(handles.CheckTable,'Position',pos_CheckTable)
|
---|
[429] | 137 |
|
---|
[644] | 138 | %% reset position of CheckHold
|
---|
| 139 | pos_CheckHold=get(handles.CheckHold,'Position');% [lower x lower y width height] for CheckHold
|
---|
| 140 | pos_CheckHold(1)=size_fig(3)-pos_CheckHold(3); % set 'CheckHold' to the right of the fig
|
---|
| 141 | pos_CheckHold(2)=pos_1(2)-pos_CheckHold(4); % set 'CheckHold' to the lower edge of text display
|
---|
| 142 | set(handles.CheckHold,'Position',pos_CheckHold)
|
---|
| 143 |
|
---|
[748] | 144 | %% reset position of Axes
|
---|
| 145 | pos_2=get(handles.Axes,'Position');% [lower x lower y width height] for frame 'Coordinates'
|
---|
[644] | 146 | pos_2(1)=size_fig(3)-pos_2(3); % set 'Coordinates' to the right of the fig
|
---|
| 147 | pos_2(2)=pos_CheckHold(2)-pos_2(4); % set 'Coordinates' to the lower edge of text display, allowing a margin for CheckHold
|
---|
[748] | 148 | set(handles.Axes,'Position',pos_2)
|
---|
[429] | 149 |
|
---|
| 150 | %% reset position of Scalar
|
---|
[644] | 151 | pos_3=get(handles.Scalar,'Position'); % [lower x lower y width height] for frame 'Scalar'
|
---|
| 152 | pos_3(1)=size_fig(3)-pos_3(3); % set 'Scalar' to the right of the fig
|
---|
[429] | 153 | if strcmp(get(handles.Scalar,'visible'),'on')
|
---|
[644] | 154 | pos_3(2)=pos_2(2)-pos_3(4); % set 'Scalar' to the lower edge of frame 'Coordinates' if visible
|
---|
[429] | 155 | else
|
---|
[644] | 156 | pos_3(2)=pos_2(2);% set 'Scalar' to the lower edge of frame 'text display' if unvisible
|
---|
[429] | 157 | end
|
---|
| 158 | set(handles.Scalar,'Position',pos_3)
|
---|
| 159 |
|
---|
| 160 | %% reset position of Vectors
|
---|
| 161 | pos_4=get(handles.Vectors,'Position');
|
---|
| 162 | pos_4(1)=size_fig(3)-pos_4(3);
|
---|
| 163 | if strcmp(get(handles.Vectors,'visible'),'on')
|
---|
| 164 | pos_4(2)=pos_3(2)-pos_4(4);
|
---|
| 165 | else
|
---|
| 166 | pos_4(2)=pos_3(2);
|
---|
| 167 | end
|
---|
| 168 | set(handles.Vectors,'Position',pos_4)
|
---|
| 169 |
|
---|
| 170 | %% reset position and scale of axis
|
---|
[717] | 171 | set(handles.PlotAxes,'Units','pixels')
|
---|
[429] | 172 | bord=[50 40 30 60]; %bordure left,inf, right,sup
|
---|
| 173 | pos(1)=bord(1);
|
---|
| 174 | pos(2)=bord(2);
|
---|
| 175 | pos(3)=max(1,pos_1(1)-pos(1)-bord(3));
|
---|
| 176 | pos(4)=max(1,size_fig(4)-bord(4));
|
---|
[511] | 177 | set(handles.PlotAxes,'Position',pos)
|
---|
[717] | 178 | set(handles.PlotAxes,'Units','normalized')
|
---|
[429] | 179 |
|
---|
| 180 | %------------------------------------------------------------------------
|
---|
| 181 | %------------------------------------------------------------------------
|
---|
[198] | 182 | % --- Outputs from this function are returned to the command menuline.
|
---|
| 183 | function varargout = view_field_OutputFcn(hObject, eventdata, handles)
|
---|
[402] | 184 | %------------------------------------------------------------------------
|
---|
[198] | 185 | varargout{1} = handles.output;% the only output argument is the handle to the GUI figure
|
---|
[511] | 186 | varargout{2} = strcmp(get(handles.PlotAxes,'Visible'),'on');% check active plot axis
|
---|
[198] | 187 |
|
---|
[402] | 188 | %------------------------------------------------------------------------
|
---|
| 189 | %--- activated when closing the GUI view_field
|
---|
| 190 | function closefcn(gcbo,eventdata)
|
---|
| 191 | %------------------------------------------------------------------------
|
---|
| 192 | huvmat=findobj(allchild(0),'Tag','uvmat');%find the current uvmat interface handle
|
---|
| 193 | if ~isempty(huvmat)
|
---|
| 194 | hhuvmat=guidata(huvmat);
|
---|
[650] | 195 | set(hhuvmat.CheckViewField,'Value',0)
|
---|
[402] | 196 | % deselect the object in ListObject when view_field is closed
|
---|
| 197 | if isempty(findobj(allchild(0),'Tag','set_object'))
|
---|
| 198 | ObjIndex=get(hhuvmat.ListObject,'Value');
|
---|
| 199 | ObjIndex=ObjIndex(1);%keep only the first object selected
|
---|
| 200 | set(hhuvmat.ListObject,'Value',ObjIndex)
|
---|
| 201 | % draw all object colors in blue (unselected) in uvmat
|
---|
[544] | 202 | hother=[findobj(hhuvmat.PlotAxes,'Tag','proj_object');findobj(hhuvmat.PlotAxes,'Tag','DeformPoint')];%find all the proj object and deform point representations
|
---|
[402] | 203 | for iobj=1:length(hother)
|
---|
| 204 | if isequal(get(hother(iobj),'Type'),'rectangle')||isequal(get(hother(iobj),'Type'),'patch')
|
---|
| 205 | set(hother(iobj),'EdgeColor','b')
|
---|
| 206 | if isequal(get(hother(iobj),'FaceColor'),'m')
|
---|
| 207 | set(hother(iobj),'FaceColor','b')
|
---|
| 208 | end
|
---|
| 209 | elseif isequal(get(hother(iobj),'Type'),'image')
|
---|
| 210 | Acolor=get(hother(iobj),'CData');
|
---|
| 211 | Acolor(:,:,1)=zeros(size(Acolor,1),size(Acolor,2));
|
---|
| 212 | set(hother(iobj),'CData',Acolor);
|
---|
| 213 | else
|
---|
| 214 | set(hother(iobj),'Color','b')
|
---|
| 215 | end
|
---|
| 216 | set(hother(iobj),'Selected','off')
|
---|
| 217 | end
|
---|
| 218 | end
|
---|
| 219 | end
|
---|
[772] | 220 | hciv=findobj(allchild(0),'Tag','civ_input');%find the current civ GUI
|
---|
[413] | 221 | if ~isempty(hciv)
|
---|
| 222 | hhciv=guidata(hciv);
|
---|
| 223 | set(hhciv.TestCiv1,'Value',0)% desactivate TestCiv1 if on
|
---|
[772] | 224 | set(hhciv.TestCiv1,'BackgroundColor',[0 1 0])%
|
---|
[413] | 225 | end
|
---|
| 226 | corrfig=findobj(allchild(0),'tag','corrfig');% look for a civ correlation window used with TesCiv1
|
---|
| 227 | if ~isempty(corrfig)
|
---|
| 228 | delete(corrfig)
|
---|
| 229 | end
|
---|
[198] | 230 |
|
---|
| 231 | %-------------------------------------------------------------------
|
---|
| 232 | %-------------------------------------------------------------------
|
---|
| 233 | % II - FUNCTIONS FOR INTRODUCING THE INPUT FILES
|
---|
| 234 | % automatically sets the global properties when the rootfile name is introduced
|
---|
| 235 | % then activate the view-field action if selected
|
---|
| 236 | % it is activated either by clicking on the RootPath window or by the
|
---|
| 237 | % browser
|
---|
| 238 | %------------------------------------------------------------------
|
---|
| 239 | %------------------------------------------------------------------
|
---|
| 240 |
|
---|
| 241 | %-------------------------------------------------------------------
|
---|
| 242 | function update_mask(handles,num_i1,num_j1)
|
---|
| 243 | %-------------------------------------------------------------------
|
---|
| 244 |
|
---|
| 245 | MaskData=get(handles.mask_test,'UserData');
|
---|
| 246 | if isfield(MaskData,'maskhandle')&& ishandle(MaskData.maskhandle)
|
---|
| 247 | uistack(MaskData.maskhandle,'top');
|
---|
| 248 | end
|
---|
| 249 | num_i1_mask=mod(num_i1-1,MaskData.NbSlice)+1;
|
---|
[356] | 250 | [RootPath,RootFile]=fullfile(MaskData.Base);
|
---|
| 251 | MaskName=fullfile_uvmat(RootPath,'',RootFile,'.png',MaskData.NomType,num_i1_mask,[],num_j1);
|
---|
| 252 | %[MaskName,mdetect]=name_generator(MaskData.Base,num_i1_mask,num_j1,'.png',MaskData.NomType);
|
---|
[198] | 253 | huvmat=get(handles.mask_test,'parent');
|
---|
| 254 | UvData=get(huvmat,'UserData');
|
---|
| 255 |
|
---|
| 256 | %update mask image if the mask is new
|
---|
| 257 | if ~ (isfield(UvData,'MaskName') && isequal(UvData.MaskName,MaskName))
|
---|
| 258 | UvData.MaskName=MaskName; %update the recorded name on UvData
|
---|
| 259 | set(huvmat,'UserData',UvData);
|
---|
| 260 | if mdetect==0
|
---|
| 261 | if isfield(MaskData,'maskhandle')&& ishandle(MaskData.maskhandle)
|
---|
| 262 | delete(MaskData.maskhandle)
|
---|
| 263 | end
|
---|
| 264 | else
|
---|
| 265 | %read mask image
|
---|
| 266 | Mask.AName='image';
|
---|
| 267 | Mask.A=imread(MaskName);
|
---|
| 268 | npxy=size(Mask.A);
|
---|
| 269 | Mask.AX=[0.5 npxy(2)-0.5];
|
---|
| 270 | Mask.AY=[npxy(1)-0.5 0.5 ];
|
---|
| 271 | Mask.CoordUnit='pixel';
|
---|
| 272 | if isequal(get(handles.slices,'Value'),1)
|
---|
| 273 | NbSlice=str2num(get(handles.nb_slice,'String'));
|
---|
| 274 | num_i1=str2num(get(handles.i1,'String'));
|
---|
| 275 | Mask.ZIndex=mod(num_i1-1,NbSlice)+1;
|
---|
| 276 | end
|
---|
| 277 | %px to phys or other transform on field
|
---|
| 278 | menu_transform=get(handles.transform_fct,'String');
|
---|
| 279 | choice_value=get(handles.transform_fct,'Value');
|
---|
| 280 | transform_name=menu_transform{choice_value};%name of the transform fct given by the menu 'transform_fct'
|
---|
| 281 | transform_list=get(handles.transform_fct,'UserData');
|
---|
| 282 | transform=transform_list{choice_value};
|
---|
| 283 | if ~isequal(transform_name,'') && ~isequal(transform_name,'px')
|
---|
| 284 | if isfield(UvData,'XmlData') && isfield(UvData.XmlData,'GeometryCalib')%use geometry calib recorded from the ImaDoc xml file as first priority
|
---|
| 285 | Calib=UvData.XmlData.GeometryCalib;
|
---|
| 286 | Mask=transform(Mask,UvData.XmlData);
|
---|
| 287 | end
|
---|
| 288 | end
|
---|
| 289 | flagmask=Mask.A < 200;
|
---|
| 290 |
|
---|
| 291 | %make brown color image
|
---|
| 292 | imflag(:,:,1)=0.9*flagmask;
|
---|
| 293 | imflag(:,:,2)=0.7*flagmask;
|
---|
| 294 | imflag(:,:,3)=zeros(size(flagmask));
|
---|
| 295 |
|
---|
| 296 | %update mask image
|
---|
| 297 | hmask=[]; %default
|
---|
| 298 | if isfield(MaskData,'maskhandle')&& ishandle(MaskData.maskhandle)
|
---|
| 299 | hmask=MaskData.maskhandle;
|
---|
| 300 | end
|
---|
| 301 | if ~isempty(hmask)
|
---|
| 302 | set(hmask,'CData',imflag)
|
---|
| 303 | set(hmask,'AlphaData',flagmask*0.6)
|
---|
| 304 | set(hmask,'XData',Mask.AX);
|
---|
| 305 | set(hmask,'YData',Mask.AY);
|
---|
| 306 | % uistack(hmask,'top')
|
---|
| 307 | else
|
---|
[511] | 308 | axes(handles.PlotAxes)
|
---|
[198] | 309 | hold on
|
---|
| 310 | MaskData.maskhandle=image(Mask.AX,Mask.AY,imflag,'Tag','mask','HitTest','off','AlphaData',0.6*flagmask);
|
---|
| 311 | % set(MaskData.maskhandle,'AlphaData',0.6*flagmask)
|
---|
| 312 | set(handles.mask_test,'UserData',MaskData)
|
---|
| 313 | end
|
---|
| 314 | end
|
---|
| 315 | end
|
---|
| 316 |
|
---|
| 317 |
|
---|
| 318 | %-------------------------------------------------------------------
|
---|
| 319 | function MenuExportFigure_Callback(hObject, eventdata, handles)
|
---|
| 320 | %-------------------------------------------------------------------
|
---|
| 321 | hfig=figure;
|
---|
[752] | 322 | hc=copyobj(handles.PlotAxes,hfig);
|
---|
| 323 | set(hc,'Position',[0.1 0.1 0.8 0.8])
|
---|
| 324 | h=findobj(handles.PlotAxes,'tag','ima'); %look for image in the plot
|
---|
[717] | 325 | if ~isempty(h)
|
---|
| 326 | h=findobj(handles.PlotAxes,'tag','ima'); %look for image in the plot
|
---|
| 327 | map=colormap(handles.PlotAxes);
|
---|
| 328 | colormap(map);%transmit the current colormap to the zoom fig
|
---|
| 329 | colorbar
|
---|
| 330 | end
|
---|
[198] | 331 |
|
---|
[717] | 332 | % --------------------------------------------------------------------
|
---|
| 333 | function MenuExportAxis_Callback(hObject, eventdata, handles)
|
---|
| 334 | ListFig=findobj(allchild(0),'Type','figure');
|
---|
| 335 | nb_option=0;
|
---|
| 336 | menu={};
|
---|
| 337 | for ilist=1:numel(ListFig)
|
---|
| 338 | FigName=get(ListFig(ilist),'name');
|
---|
| 339 | if isempty(FigName)
|
---|
| 340 | FigName=['figure ' num2str(ListFig(ilist))];
|
---|
| 341 | end
|
---|
| 342 | if ~strcmp(FigName,'uvmat')
|
---|
| 343 | ListAxes=findobj(ListFig(ilist),'Type','axes');
|
---|
| 344 | ListTags=get(ListAxes,'Tag');
|
---|
| 345 | if ~isempty(ListTags) && ~isempty(find(~strcmp('Colorbar',ListTags), 1))
|
---|
| 346 | ListAxes=ListAxes(~strcmp('Colorbar',ListTags));
|
---|
| 347 | if numel(ListAxes)==1
|
---|
| 348 | nb_option=nb_option+1;
|
---|
| 349 | menu{nb_option}=FigName ;
|
---|
| 350 | AxesHandle(nb_option)=ListAxes;
|
---|
| 351 | else
|
---|
| 352 | nb_axis=0;
|
---|
| 353 | for iaxes=1:numel(ListAxes)
|
---|
| 354 | nb_axis=nb_axis+1;
|
---|
| 355 | nb_option=nb_option+1;
|
---|
| 356 | menu{nb_option}=[FigName '_' num2str(nb_axis)];
|
---|
| 357 | AxesHandle(nb_option)=ListAxes(nb_axis);
|
---|
| 358 | end
|
---|
| 359 | end
|
---|
| 360 | end
|
---|
| 361 | end
|
---|
| 362 | end
|
---|
| 363 | if isempty(menu)
|
---|
| 364 | answer=msgbox_uvmat('INPUT_Y-N','no existing plotting axes available, create new figure?');
|
---|
| 365 | if strcmp(answer,'Yes')
|
---|
| 366 | hfig=figure;
|
---|
| 367 | copyobj(handles.PlotAxes,hfig);
|
---|
| 368 | else
|
---|
| 369 | return
|
---|
| 370 | end
|
---|
| 371 | map=colormap(handles.PlotAxes);
|
---|
| 372 | colormap(map);%transmit the current colormap to the zoom fig
|
---|
| 373 | colorbar
|
---|
| 374 | else
|
---|
| 375 | answer=msgbox_uvmat('INPUT_MENU','select a figure/axis on which the current uvmat plot will be exported',menu);
|
---|
| 376 | if isempty(answer)
|
---|
| 377 | return
|
---|
| 378 | else
|
---|
| 379 | axes(AxesHandle(answer))
|
---|
| 380 | hold on
|
---|
| 381 | hchild=get(handles.PlotAxes,'children');
|
---|
| 382 | copyobj(hchild,gca);
|
---|
| 383 | end
|
---|
| 384 | end
|
---|
| 385 |
|
---|
[198] | 386 | %-------------------------------------------------------------------
|
---|
| 387 | %-------------------------------------------------------------------
|
---|
| 388 | % III - MAIN REFRESH FUNCTIONS : 'FRAME PLOT'
|
---|
| 389 | %-------------------------------------------------------------------
|
---|
| 390 | %-------------------------------------------------------------------
|
---|
| 391 |
|
---|
| 392 | %Executes on button press in runplus: make one step forward and call
|
---|
| 393 | %run0. The step forward is along the fields series 1 or 2 depending on
|
---|
| 394 | %the scan_i and scan_j check box (exclusive each other)
|
---|
| 395 | %-------------------------------------------------------------------
|
---|
| 396 | function runplus_Callback(hObject, eventdata, handles)
|
---|
| 397 | increment=str2num(get(handles.increment_scan,'String')); %get the field increment d
|
---|
| 398 | runpm(hObject,eventdata,handles,increment)
|
---|
| 399 |
|
---|
| 400 | %-------------------------------------------------------------------
|
---|
| 401 | %Executes on button press in runmin: make one step backward and call
|
---|
| 402 | %run0. The step backward is along the fields series 1 or 2 depending on
|
---|
| 403 | %the scan_i and scan_j check box (exclusive each other)
|
---|
| 404 | %-------------------------------------------------------------------
|
---|
| 405 | function runmin_Callback(hObject, eventdata, handles)
|
---|
| 406 | increment=-str2num(get(handles.increment_scan,'String')); %get the field increment d
|
---|
| 407 | runpm(hObject,eventdata,handles,increment)
|
---|
| 408 |
|
---|
[622] | 409 | %------------------------------------------------------------------------
|
---|
[198] | 410 | % --- translate coordinate to matrix index
|
---|
[622] | 411 | %------------------------------------------------------------------------
|
---|
[198] | 412 | function [indx,indy]=pos2ind(x0,rangx0,nxy)
|
---|
| 413 | indx=1+round((nxy(2)-1)*(x0-rangx0(1))/(rangx0(2)-rangx0(1)));% index x of pixel
|
---|
| 414 | indy=1+round((nxy(1)-1)*(y12-rangy0(1))/(rangy0(2)-rangy0(1)));% index y of pixel
|
---|
| 415 |
|
---|
[622] | 416 | %------------------------------------------------------------------------
|
---|
| 417 | % --- Executes on button press in 'CheckZoom'.
|
---|
| 418 | %------------------------------------------------------------------------
|
---|
[428] | 419 | function CheckZoom_Callback(hObject, eventdata, handles)
|
---|
[622] | 420 |
|
---|
| 421 | if get(handles.CheckZoom,'Value')
|
---|
[428] | 422 | set(handles.CheckFixLimits,'Value',1)% propose by default fixed limits for the plotting axes
|
---|
[622] | 423 | set(handles.CheckZoomFig,'Value',0)%desactivate zoom fig
|
---|
[428] | 424 | end
|
---|
| 425 |
|
---|
[622] | 426 | %------------------------------------------------------------------------
|
---|
| 427 | % --- Executes on button press in CheckZoomFig.
|
---|
| 428 | %------------------------------------------------------------------------
|
---|
| 429 | function CheckZoomFig_Callback(hObject, eventdata, handles)
|
---|
| 430 | if get(handles.CheckZoomFig,'Value')
|
---|
| 431 | set(handles.CheckZoom,'value',0)
|
---|
| 432 | end
|
---|
| 433 |
|
---|
[726] | 434 | %------------------------------------------------------------------------
|
---|
[198] | 435 | % --- Executes on button press in 'FixLimits'.
|
---|
[726] | 436 | %------------------------------------------------------------------------
|
---|
[295] | 437 | function CheckFixLimits_Callback(hObject, eventdata, handles)
|
---|
| 438 | test=get(handles.CheckFixLimits,'Value');
|
---|
| 439 | update_plot(handles)
|
---|
[428] | 440 |
|
---|
[726] | 441 | %------------------------------------------------------------------------
|
---|
[428] | 442 | % --- Executes on button press in CheckFixAspectRatio.
|
---|
[726] | 443 | %------------------------------------------------------------------------
|
---|
[428] | 444 | function CheckFixAspectRatio_Callback(hObject, eventdata, handles)
|
---|
| 445 | if get(handles.CheckFixAspectRatio,'Value')
|
---|
| 446 | update_plot(handles);
|
---|
[198] | 447 | else
|
---|
[428] | 448 | update_plot(handles);
|
---|
[198] | 449 | end
|
---|
| 450 |
|
---|
[726] | 451 | %------------------------------------------------------------------------
|
---|
[428] | 452 | function num_AspectRatio_Callback(hObject, eventdata, handles)
|
---|
[726] | 453 | %------------------------------------------------------------------------
|
---|
[428] | 454 | set(handles.CheckFixAspectRatio,'Value',1)% select the fixed aspect ratio button
|
---|
| 455 | update_plot(handles);
|
---|
[198] | 456 |
|
---|
| 457 | %-------------------------------------------------------------------
|
---|
| 458 | %-------------------------------------------------------------------
|
---|
| 459 | % - FUNCTIONS FOR SETTING PLOTTING PARAMETERS
|
---|
| 460 |
|
---|
| 461 | %------------------------------------------------------------------
|
---|
| 462 |
|
---|
| 463 |
|
---|
| 464 | %------------------------------------------------------------------
|
---|
| 465 | % --- Executes on selection change in col_vec: choice of the color code.
|
---|
| 466 | %
|
---|
| 467 | function col_vec_Callback(hObject, eventdata, handles)
|
---|
| 468 | %------------------------------------------------------------------
|
---|
| 469 | % edit the choice for color code
|
---|
| 470 | list_code=get(handles.col_vec,'String');% list menu fields
|
---|
| 471 | index_code=get(handles.col_vec,'Value');% selected string index
|
---|
| 472 | col_code= list_code{index_code(1)}; % selected field
|
---|
| 473 | if isequal(col_code,'black') | isequal(col_code,'white')
|
---|
| 474 | set(handles.slider1,'Visible','off')
|
---|
| 475 | set(handles.slider2,'Visible','off')
|
---|
| 476 | set(handles.colcode1,'Visible','off')
|
---|
| 477 | set(handles.colcode2,'Visible','off')
|
---|
| 478 | set(handles.AutoVecColor,'Visible','off')
|
---|
| 479 | set_vec_col_bar(handles)
|
---|
| 480 | else
|
---|
| 481 | set(handles.slider1,'Visible','on')
|
---|
| 482 | set(handles.slider2,'Visible','on')
|
---|
| 483 | set(handles.colcode1,'Visible','on')
|
---|
| 484 | set(handles.colcode2,'Visible','on')
|
---|
| 485 | set(handles.AutoVecColor,'Visible','on')
|
---|
| 486 | if isequal(col_code,'ima_cor')
|
---|
| 487 | set(handles.AutoVecColor,'Value',0)%fixed scale by default
|
---|
| 488 | set(handles.vec_col_bar,'Value',0)% 3 colors r,g,b by default
|
---|
| 489 | set(handles.slider1,'Min',0);
|
---|
| 490 | set(handles.slider1,'Max',1);
|
---|
| 491 | set(handles.slider2,'Min',0);
|
---|
| 492 | set(handles.slider2,'Max',1);
|
---|
| 493 | % set(handles.min_C_title_vec,'String','0')
|
---|
| 494 | set(handles.max_vec,'String','1')
|
---|
| 495 | set(handles.colcode1,'String','0.333')
|
---|
| 496 | colcode1_Callback(hObject, eventdata, handles)
|
---|
| 497 | set(handles.colcode2,'String','0.666')
|
---|
| 498 | colcode2_Callback(hObject, eventdata, handles)
|
---|
| 499 | else
|
---|
| 500 | set(handles.AutoVecColor,'Value',1)%auto scale between min,max by default
|
---|
| 501 | set(handles.vec_col_bar,'Value',1)% colormap 'jet' by default
|
---|
| 502 | minval=get(handles.slider1,'Min');
|
---|
| 503 | maxval=get(handles.slider1,'Max');
|
---|
| 504 | set(handles.slider1,'Value',minval)
|
---|
| 505 | set(handles.slider2,'Value',maxval)
|
---|
| 506 | set_vec_col_bar(handles)
|
---|
| 507 | end
|
---|
| 508 | % slider_update(handles)
|
---|
| 509 | end
|
---|
| 510 | %replot the current graph
|
---|
| 511 | run0_Callback(hObject, eventdata, handles)
|
---|
| 512 |
|
---|
| 513 |
|
---|
| 514 | %----------------------------------------------------------------
|
---|
| 515 | % -- Executes on slider movement to set the color code
|
---|
| 516 | %
|
---|
| 517 | function slider1_Callback(hObject, eventdata, handles)
|
---|
| 518 | %------------------------------------------------------------------
|
---|
| 519 | slider1=get(handles.slider1,'Value');
|
---|
| 520 | min_val=str2num(get(handles.min_vec,'String'));
|
---|
| 521 | max_val=str2num(get(handles.max_vec,'String'));
|
---|
| 522 | col=min_val+(max_val-min_val)*slider1;
|
---|
| 523 | set(handles.colcode1,'String',num2str(col))
|
---|
| 524 | if(get(handles.slider2,'Value') < col)%move also the second slider at the same value if needed
|
---|
| 525 | set(handles.slider2,'Value',col)
|
---|
| 526 | set(handles.colcode2,'String',num2str(col))
|
---|
| 527 | end
|
---|
| 528 | colcode1_Callback(hObject, eventdata, handles)
|
---|
| 529 |
|
---|
| 530 | %----------------------------------------------------------------
|
---|
| 531 | % Executes on slider movement to set the color code
|
---|
| 532 | %----------------------------------------------------------------
|
---|
| 533 | function slider2_Callback(hObject, eventdata, handles)
|
---|
| 534 | slider2=get(handles.slider2,'Value');
|
---|
| 535 | min_val=str2num(get(handles.min_vec,'String'));
|
---|
| 536 | max_val=str2num(get(handles.max_vec,'String'));
|
---|
| 537 | col=min_val+(max_val-min_val)*slider2;
|
---|
| 538 | set(handles.colcode2,'String',num2str(col))
|
---|
| 539 | if(get(handles.slider1,'Value') > col)%move also the first slider at the same value if needed
|
---|
| 540 | set(handles.slider1,'Value',col)
|
---|
| 541 | set(handles.colcode1,'String',num2str(col))
|
---|
| 542 | end
|
---|
| 543 | colcode2_Callback(hObject, eventdata, handles)
|
---|
| 544 |
|
---|
| 545 | %----------------------------------------------------------------
|
---|
| 546 | %execute on return carriage on the edit box corresponding to slider 1
|
---|
| 547 | %----------------------------------------------------------------
|
---|
| 548 | function colcode1_Callback(hObject, eventdata, handles)
|
---|
| 549 | % col=str2num(get(handles.colcode1,'String'));
|
---|
| 550 | % set(handles.slider1,'Value',col)
|
---|
| 551 | set_vec_col_bar(handles)
|
---|
| 552 | update_plot(handles)
|
---|
| 553 |
|
---|
| 554 | %----------------------------------------------------------------
|
---|
| 555 | %execute on return carriage on the edit box corresponding to slider 2
|
---|
| 556 | %----------------------------------------------------------------
|
---|
| 557 | function colcode2_Callback(hObject, eventdata, handles)
|
---|
| 558 | % col=str2num(get(handles.colcode2,'String'));
|
---|
| 559 | % set(handles.slider2,'Value',col)
|
---|
| 560 | % slider2_Callback(hObject, eventdata, handles)
|
---|
| 561 | set_vec_col_bar(handles)
|
---|
| 562 | update_plot(handles)
|
---|
| 563 |
|
---|
| 564 | %-------------------------------------------------------
|
---|
| 565 | % --- Executes on button press in AutoVecColor.
|
---|
| 566 | %-------------------------------------------------------
|
---|
| 567 | function vec_col_bar_Callback(hObject, eventdata, handles)
|
---|
| 568 | set_vec_col_bar(handles)
|
---|
| 569 |
|
---|
| 570 | %------------------------------------------------
|
---|
| 571 | %CALLBACKS FOR PLOTTING PARAMETERS
|
---|
| 572 | %-------------------------------------------------
|
---|
| 573 |
|
---|
| 574 | %------------------------------------------------------------------------
|
---|
[295] | 575 | function num_MinX_Callback(hObject, eventdata, handles)
|
---|
[198] | 576 | %------------------------------------------------------------------------
|
---|
[295] | 577 | set(handles.CheckFixLimits,'Value',1) %suppress auto mode
|
---|
[625] | 578 | % set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])
|
---|
[198] | 579 | update_plot(handles);
|
---|
| 580 |
|
---|
| 581 | %------------------------------------------------------------------------
|
---|
[295] | 582 | function num_MaxX_Callback(hObject, eventdata, handles)
|
---|
[198] | 583 | %------------------------------------------------------------------------
|
---|
[295] | 584 | set(handles.CheckFixLimits,'Value',1) %suppress auto mode
|
---|
[625] | 585 | % set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])
|
---|
[198] | 586 | update_plot(handles);
|
---|
| 587 |
|
---|
| 588 | %------------------------------------------------------------------------
|
---|
[295] | 589 | function num_MinY_Callback(hObject, eventdata, handles)
|
---|
[198] | 590 | %------------------------------------------
|
---|
[295] | 591 | set(handles.CheckFixLimits,'Value',1) %suppress auto mode
|
---|
[625] | 592 | % set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])
|
---|
[198] | 593 | update_plot(handles);
|
---|
| 594 |
|
---|
| 595 | %------------------------------------------------------------------------
|
---|
[295] | 596 | function num_MaxY_Callback(hObject, eventdata, handles)
|
---|
[198] | 597 | %------------------------------------------------------------------------
|
---|
[295] | 598 | set(handles.CheckFixLimits,'Value',1) %suppress auto mode
|
---|
[625] | 599 | % set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])
|
---|
[198] | 600 | update_plot(handles);
|
---|
| 601 |
|
---|
| 602 | %-----------------------------------------------------------------
|
---|
[295] | 603 | function num_MinA_Callback(hObject, eventdata, handles)
|
---|
[198] | 604 | %------------------------------------------
|
---|
[295] | 605 | set(handles.CheckFixScalar,'Value',1) %suppress auto mode
|
---|
| 606 | set(handles.CheckFixScalar,'BackgroundColor',[1 1 0])
|
---|
[198] | 607 | update_plot(handles)
|
---|
| 608 |
|
---|
| 609 | %-----------------------------------------------------------------
|
---|
[295] | 610 | function num_MaxA_Callback(hObject, eventdata, handles)
|
---|
[198] | 611 | %--------------------------------------------
|
---|
[295] | 612 | set(handles.CheckFixScalar,'Value',1) %suppress auto mode
|
---|
[625] | 613 | % set(handles.CheckFixScalar,'BackgroundColor',[1 1 0])
|
---|
[198] | 614 | update_plot(handles)
|
---|
| 615 |
|
---|
| 616 | %-----------------------------------------------
|
---|
[295] | 617 | function CheckFixScalar_Callback(hObject, eventdata, handles)
|
---|
[198] | 618 | %--------------------------------------------
|
---|
[295] | 619 | test=get(handles.CheckFixScalar,'Value');
|
---|
[625] | 620 | % if test
|
---|
| 621 | % set(handles.CheckFixScalar,'BackgroundColor',[1 1 0])
|
---|
| 622 | % else
|
---|
| 623 | % set(handles.CheckFixScalar,'BackgroundColor',[0.7 0.7 0.7])
|
---|
| 624 | % update_plot(handles);
|
---|
| 625 | % % set(handles.MinA,'String',num2str(ScalOut.MinA,3))
|
---|
| 626 | % % set(handles.MaxA,'String',num2str(ScalOut.MaxA,3))
|
---|
| 627 | % end
|
---|
[198] | 628 |
|
---|
| 629 | %-------------------------------------------------------------------
|
---|
[295] | 630 | function CheckBW_Callback(hObject, eventdata, handles)
|
---|
[198] | 631 | %-------------------------------------------------------------------
|
---|
| 632 | update_plot(handles)
|
---|
| 633 |
|
---|
| 634 | %-------------------------------------------------------------------
|
---|
[295] | 635 | function ListContour_Callback(hObject, eventdata, handles)
|
---|
[198] | 636 | %-------------------------------------------------------------------
|
---|
| 637 | val=get(handles.Contours,'Value');
|
---|
| 638 | if val==2
|
---|
| 639 | set(handles.interval_txt,'Visible','on')
|
---|
| 640 | set(handles.IncrA,'Visible','on')
|
---|
| 641 | else
|
---|
| 642 | set(handles.interval_txt,'Visible','off')
|
---|
| 643 | set(handles.IncrA,'Visible','off')
|
---|
| 644 | end
|
---|
| 645 | update_plot(handles)
|
---|
| 646 |
|
---|
| 647 | %-------------------------------------------------------------------
|
---|
| 648 | function IncrA_Callback(hObject, eventdata, handles)
|
---|
| 649 | %-------------------------------------------------------------------
|
---|
| 650 | update_plot(handles)
|
---|
| 651 |
|
---|
| 652 | %-------------------------------------------------------------------
|
---|
| 653 | function HideWarning_Callback(hObject, eventdata, handles)
|
---|
| 654 | %-------------------------------------------------------------------
|
---|
| 655 | update_plot(handles)
|
---|
| 656 |
|
---|
| 657 | %-------------------------------------------------------------------
|
---|
| 658 | function HideFalse_Callback(hObject, eventdata, handles)
|
---|
| 659 | %-------------------------------------------------------------------
|
---|
| 660 | update_plot(handles)
|
---|
| 661 |
|
---|
| 662 | %-------------------------------------------------------------------
|
---|
[612] | 663 | function num_VecScale_Callback(hObject, eventdata, handles)
|
---|
[198] | 664 | %-------------------------------------------------------------------
|
---|
[612] | 665 | set(handles.CheckFixVectors,'Value',1);
|
---|
[198] | 666 | update_plot(handles)
|
---|
| 667 |
|
---|
| 668 | %-------------------------------------------------------------------
|
---|
| 669 | function FixVec_Callback(hObject, eventdata, handles)
|
---|
| 670 | %-------------------------------------------------------------------
|
---|
| 671 | test=get(handles.FixVec,'Value');
|
---|
| 672 | if test
|
---|
| 673 | set(handles.FixVec,'BackgroundColor',[1 1 0])
|
---|
| 674 | else
|
---|
| 675 | update_plot(handles);
|
---|
| 676 | %set(handles.VecScale,'String',num2str(ScalOut.VecScale,3))
|
---|
[625] | 677 | % set(handles.FixVec,'BackgroundColor',[0.7 0.7 0.7])
|
---|
[198] | 678 | end
|
---|
| 679 |
|
---|
| 680 | %-------------------------------------------------------
|
---|
| 681 | % --- Executes on selection change in decimate4 (nb_vec/4).
|
---|
| 682 | %-------------------------------------------------------
|
---|
[295] | 683 | function CheckDecimate4_Callback(hObject, eventdata, handles)
|
---|
[198] | 684 | update_plot(handles)
|
---|
| 685 |
|
---|
| 686 |
|
---|
| 687 | %-------------------------------------------------------
|
---|
| 688 | % --- Executes on selection change in color_code menu
|
---|
| 689 | %-------------------------------------------------------
|
---|
| 690 | function color_code_Callback(hObject, eventdata, handles)
|
---|
| 691 | set_vec_col_bar(handles)
|
---|
| 692 | update_plot(handles);
|
---|
| 693 |
|
---|
| 694 | %-------------------------------------------------------
|
---|
| 695 | % --- Executes on button press in AutoVecColor.
|
---|
| 696 | %-------------------------------------------------------
|
---|
| 697 | function AutoVecColor_Callback(hObject, eventdata, handles)
|
---|
| 698 | test=get(handles.AutoVecColor,'Value');
|
---|
| 699 | if test
|
---|
| 700 | set(handles.AutoVecColor,'BackgroundColor',[1 1 0])
|
---|
| 701 | else
|
---|
| 702 | update_plot(handles);
|
---|
| 703 | %set(handles.VecScale,'String',num2str(ScalOut.VecScale,3))
|
---|
| 704 | set(handles.AutoVecColor,'BackgroundColor',[0.7 0.7 0.7])
|
---|
| 705 | end
|
---|
| 706 | %set_vec_col_bar(handles)
|
---|
| 707 |
|
---|
| 708 | %-------------------------------------------------------
|
---|
| 709 | % --- Executes on selection change in max_vec.
|
---|
| 710 | %-------------------------------------------------------
|
---|
| 711 | function min_vec_Callback(hObject, eventdata, handles)
|
---|
| 712 | max_vec_Callback(hObject, eventdata, handles)
|
---|
| 713 |
|
---|
| 714 | % --- Executes on selection change in max_vec.
|
---|
| 715 | function max_vec_Callback(hObject, eventdata, handles)
|
---|
| 716 | set(handles.AutoVecColor,'Value',1)
|
---|
| 717 | AutoVecColor_Callback(hObject, eventdata, handles)
|
---|
| 718 | min_val=str2num(get(handles.min_vec,'String'));
|
---|
| 719 | max_val=str2num(get(handles.max_vec,'String'));
|
---|
| 720 | slider1=get(handles.slider1,'Value');
|
---|
| 721 | slider2=get(handles.slider2,'Value');
|
---|
| 722 | colcode1=min_val+(max_val-min_val)*slider1;
|
---|
| 723 | colcode2=min_val+(max_val-min_val)*slider2;
|
---|
| 724 | set(handles.colcode1,'String',num2str(colcode1))
|
---|
| 725 | set(handles.colcode2,'String',num2str(colcode2))
|
---|
| 726 | update_plot(handles);
|
---|
| 727 |
|
---|
| 728 | %-------------------------------------------------------------------
|
---|
| 729 | %update the display of color code for vectors
|
---|
| 730 | function set_vec_col_bar(handles)
|
---|
| 731 | %-------------------------------------------------------------------
|
---|
| 732 | %get the image of the color display button 'vec_col_bar' in pixels
|
---|
| 733 | set(handles.vec_col_bar,'Unit','pixel');
|
---|
| 734 | pos_vert=get(handles.vec_col_bar,'Position');
|
---|
| 735 | set(handles.vec_col_bar,'Unit','Normalized');
|
---|
| 736 | width=ceil(pos_vert(3));
|
---|
| 737 | height=ceil(pos_vert(4));
|
---|
| 738 |
|
---|
| 739 | %get slider indications
|
---|
| 740 | list=get(handles.color_code,'String');
|
---|
| 741 | ichoice=get(handles.color_code,'Value');
|
---|
| 742 | colcode.ColorCode=list{ichoice};
|
---|
| 743 | colcode.MinC=str2num(get(handles.min_vec,'String'));
|
---|
| 744 | colcode.MaxC=str2num(get(handles.max_vec,'String'));
|
---|
| 745 | test3color=strcmp(colcode.ColorCode,'rgb') || strcmp(colcode.ColorCode,'bgr');
|
---|
| 746 | if test3color
|
---|
| 747 | colcode.colcode1=str2num(get(handles.colcode1,'String'));
|
---|
| 748 | colcode.colcode2=str2num(get(handles.colcode2,'String'));
|
---|
| 749 | end
|
---|
| 750 | colcode.FixedCbounds=0;
|
---|
| 751 | colcode.FixedCbounds=1;
|
---|
| 752 | vec_C=colcode.MinC+(colcode.MaxC-colcode.MinC)*[0.5:width-0.5]/width;%sample of vec_C values from min to max
|
---|
| 753 | [colorlist,col_vec]=set_col_vec(colcode,vec_C);
|
---|
| 754 | oneheight=ones(1,height);
|
---|
| 755 | A1=colorlist(col_vec,1)*oneheight;
|
---|
| 756 | A2=colorlist(col_vec,2)*oneheight;
|
---|
| 757 | A3=colorlist(col_vec,3)*oneheight;
|
---|
| 758 | A(:,:,1)=A1';
|
---|
| 759 | A(:,:,2)=A2';
|
---|
| 760 | A(:,:,3)=A3';
|
---|
| 761 | set(handles.vec_col_bar,'Cdata',A)
|
---|
| 762 |
|
---|
[295] | 763 | %-------------------------------------------------------------------
|
---|
| 764 | function update_plot(handles)
|
---|
| 765 | %-------------------------------------------------------------------
|
---|
| 766 | Data=get(handles.view_field,'UserData');
|
---|
[544] | 767 | AxeData=Data.PlotAxes;% retrieve the current plotted data
|
---|
[292] | 768 | PlotParam=read_GUI(handles.view_field);
|
---|
[511] | 769 | [PP,PlotParamOut]= plot_field(AxeData,handles.PlotAxes,PlotParam);
|
---|
[591] | 770 | errormsg=fill_GUI(PlotParamOut,handles.view_field);
|
---|
[726] | 771 | if ~isempty(errormsg)
|
---|
| 772 | msgbox_uvmat('ERROR',errormsg)
|
---|
| 773 | return
|
---|
| 774 | end
|
---|
| 775 | hedit=findobj(handles.view_field,'Style','edit');
|
---|
| 776 | set(hedit,'BackgroundColor',[1 1 1])
|
---|
[198] | 777 |
|
---|
[220] | 778 | %------------------------------------------------------------------------
|
---|
[198] | 779 | % --- Executes on button press in Menu/Export/field in workspace.
|
---|
| 780 | function MenuExportField_Callback(hObject, eventdata, handles)
|
---|
[220] | 781 | %------------------------------------------------------------------------
|
---|
[198] | 782 | global Data_view_field
|
---|
| 783 | % huvmat=findobj(allchild(0),'Name','uvmat');
|
---|
| 784 | Data_view_field=get(handles.view_field,'UserData');
|
---|
[544] | 785 | Data_view_field=Data_view_field.PlotAxes;
|
---|
[198] | 786 | % Data_view_field=UvData.ProjField_2;
|
---|
| 787 | evalin('base','global Data_view_field')%make CurData global in the workspace
|
---|
| 788 | display(['UserData of view_field :'])
|
---|
| 789 | evalin('base','Data_view_field') %display CurData in the workspace
|
---|
| 790 | commandwindow;
|
---|
| 791 |
|
---|
[220] | 792 | %------------------------------------------------------------------------
|
---|
[198] | 793 | % --- Executes on button press in Menu/Export/extract figure.
|
---|
| 794 | function MenuExport_plot_Callback(hObject, eventdata, handles)
|
---|
[220] | 795 | %------------------------------------------------------------------------
|
---|
[198] | 796 | huvmat=get(handles.MenuExport_plot,'parent');
|
---|
| 797 | UvData=get(huvmat,'UserData');
|
---|
| 798 | hfig=figure;
|
---|
[511] | 799 | newaxes=copyobj(handles.PlotAxes,hfig);
|
---|
| 800 | map=colormap(handles.PlotAxes);
|
---|
[198] | 801 | colormap(map);%transmit the current colormap to the zoom fig
|
---|
| 802 | colorbar
|
---|
| 803 |
|
---|
| 804 |
|
---|
[406] | 805 | % --- Executes on selection change in ColorCode.
|
---|
| 806 | function ColorCode_Callback(hObject, eventdata, handles)
|
---|
| 807 |
|
---|
| 808 |
|
---|
| 809 | % --- Executes on selection change in ColorScalar.
|
---|
| 810 | function ColorScalar_Callback(hObject, eventdata, handles)
|
---|
| 811 |
|
---|
[413] | 812 |
|
---|
[428] | 813 | function num_ColCode2_Callback(hObject, eventdata, handles)
|
---|
[413] | 814 |
|
---|
[690] | 815 |
|
---|
| 816 |
|
---|
| 817 | % --- Executes on button press in CheckTable.
|
---|
| 818 | function CheckTable_Callback(hObject, eventdata, handles)
|
---|
| 819 | if get(handles.CheckTable,'Value')
|
---|
| 820 | set(handles.TableDisplay,'Visible','on')
|
---|
| 821 | else
|
---|
| 822 | set(handles.TableDisplay,'Visible','off')
|
---|
| 823 | end
|
---|
| 824 |
|
---|