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