[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;
|
---|
[752] | 319 | hc=copyobj(handles.PlotAxes,hfig);
|
---|
| 320 | set(hc,'Position',[0.1 0.1 0.8 0.8])
|
---|
| 321 | h=findobj(handles.PlotAxes,'tag','ima'); %look for image in the plot
|
---|
[717] | 322 | if ~isempty(h)
|
---|
| 323 | h=findobj(handles.PlotAxes,'tag','ima'); %look for image in the plot
|
---|
| 324 | map=colormap(handles.PlotAxes);
|
---|
| 325 | colormap(map);%transmit the current colormap to the zoom fig
|
---|
| 326 | colorbar
|
---|
| 327 | end
|
---|
[198] | 328 |
|
---|
[717] | 329 | % --------------------------------------------------------------------
|
---|
| 330 | function MenuExportAxis_Callback(hObject, eventdata, handles)
|
---|
| 331 | ListFig=findobj(allchild(0),'Type','figure');
|
---|
| 332 | nb_option=0;
|
---|
| 333 | menu={};
|
---|
| 334 | for ilist=1:numel(ListFig)
|
---|
| 335 | FigName=get(ListFig(ilist),'name');
|
---|
| 336 | if isempty(FigName)
|
---|
| 337 | FigName=['figure ' num2str(ListFig(ilist))];
|
---|
| 338 | end
|
---|
| 339 | if ~strcmp(FigName,'uvmat')
|
---|
| 340 | ListAxes=findobj(ListFig(ilist),'Type','axes');
|
---|
| 341 | ListTags=get(ListAxes,'Tag');
|
---|
| 342 | if ~isempty(ListTags) && ~isempty(find(~strcmp('Colorbar',ListTags), 1))
|
---|
| 343 | ListAxes=ListAxes(~strcmp('Colorbar',ListTags));
|
---|
| 344 | if numel(ListAxes)==1
|
---|
| 345 | nb_option=nb_option+1;
|
---|
| 346 | menu{nb_option}=FigName ;
|
---|
| 347 | AxesHandle(nb_option)=ListAxes;
|
---|
| 348 | else
|
---|
| 349 | nb_axis=0;
|
---|
| 350 | for iaxes=1:numel(ListAxes)
|
---|
| 351 | nb_axis=nb_axis+1;
|
---|
| 352 | nb_option=nb_option+1;
|
---|
| 353 | menu{nb_option}=[FigName '_' num2str(nb_axis)];
|
---|
| 354 | AxesHandle(nb_option)=ListAxes(nb_axis);
|
---|
| 355 | end
|
---|
| 356 | end
|
---|
| 357 | end
|
---|
| 358 | end
|
---|
| 359 | end
|
---|
| 360 | if isempty(menu)
|
---|
| 361 | answer=msgbox_uvmat('INPUT_Y-N','no existing plotting axes available, create new figure?');
|
---|
| 362 | if strcmp(answer,'Yes')
|
---|
| 363 | hfig=figure;
|
---|
| 364 | copyobj(handles.PlotAxes,hfig);
|
---|
| 365 | else
|
---|
| 366 | return
|
---|
| 367 | end
|
---|
| 368 | map=colormap(handles.PlotAxes);
|
---|
| 369 | colormap(map);%transmit the current colormap to the zoom fig
|
---|
| 370 | colorbar
|
---|
| 371 | else
|
---|
| 372 | answer=msgbox_uvmat('INPUT_MENU','select a figure/axis on which the current uvmat plot will be exported',menu);
|
---|
| 373 | if isempty(answer)
|
---|
| 374 | return
|
---|
| 375 | else
|
---|
| 376 | axes(AxesHandle(answer))
|
---|
| 377 | hold on
|
---|
| 378 | hchild=get(handles.PlotAxes,'children');
|
---|
| 379 | copyobj(hchild,gca);
|
---|
| 380 | end
|
---|
| 381 | end
|
---|
| 382 |
|
---|
[198] | 383 | %-------------------------------------------------------------------
|
---|
| 384 | %-------------------------------------------------------------------
|
---|
| 385 | % III - MAIN REFRESH FUNCTIONS : 'FRAME PLOT'
|
---|
| 386 | %-------------------------------------------------------------------
|
---|
| 387 | %-------------------------------------------------------------------
|
---|
| 388 |
|
---|
| 389 | %Executes on button press in runplus: make one step forward and call
|
---|
| 390 | %run0. The step forward is along the fields series 1 or 2 depending on
|
---|
| 391 | %the scan_i and scan_j check box (exclusive each other)
|
---|
| 392 | %-------------------------------------------------------------------
|
---|
| 393 | function runplus_Callback(hObject, eventdata, handles)
|
---|
| 394 | increment=str2num(get(handles.increment_scan,'String')); %get the field increment d
|
---|
| 395 | runpm(hObject,eventdata,handles,increment)
|
---|
| 396 |
|
---|
| 397 | %-------------------------------------------------------------------
|
---|
| 398 | %Executes on button press in runmin: make one step backward and call
|
---|
| 399 | %run0. The step backward is along the fields series 1 or 2 depending on
|
---|
| 400 | %the scan_i and scan_j check box (exclusive each other)
|
---|
| 401 | %-------------------------------------------------------------------
|
---|
| 402 | function runmin_Callback(hObject, eventdata, handles)
|
---|
| 403 | increment=-str2num(get(handles.increment_scan,'String')); %get the field increment d
|
---|
| 404 | runpm(hObject,eventdata,handles,increment)
|
---|
| 405 |
|
---|
[622] | 406 | %------------------------------------------------------------------------
|
---|
[198] | 407 | % --- translate coordinate to matrix index
|
---|
[622] | 408 | %------------------------------------------------------------------------
|
---|
[198] | 409 | function [indx,indy]=pos2ind(x0,rangx0,nxy)
|
---|
| 410 | indx=1+round((nxy(2)-1)*(x0-rangx0(1))/(rangx0(2)-rangx0(1)));% index x of pixel
|
---|
| 411 | indy=1+round((nxy(1)-1)*(y12-rangy0(1))/(rangy0(2)-rangy0(1)));% index y of pixel
|
---|
| 412 |
|
---|
[622] | 413 | %------------------------------------------------------------------------
|
---|
| 414 | % --- Executes on button press in 'CheckZoom'.
|
---|
| 415 | %------------------------------------------------------------------------
|
---|
[428] | 416 | function CheckZoom_Callback(hObject, eventdata, handles)
|
---|
[622] | 417 |
|
---|
| 418 | if get(handles.CheckZoom,'Value')
|
---|
[428] | 419 | set(handles.CheckFixLimits,'Value',1)% propose by default fixed limits for the plotting axes
|
---|
[622] | 420 | set(handles.CheckZoomFig,'Value',0)%desactivate zoom fig
|
---|
[428] | 421 | end
|
---|
| 422 |
|
---|
[622] | 423 | %------------------------------------------------------------------------
|
---|
| 424 | % --- Executes on button press in CheckZoomFig.
|
---|
| 425 | %------------------------------------------------------------------------
|
---|
| 426 | function CheckZoomFig_Callback(hObject, eventdata, handles)
|
---|
| 427 | if get(handles.CheckZoomFig,'Value')
|
---|
| 428 | set(handles.CheckZoom,'value',0)
|
---|
| 429 | end
|
---|
| 430 |
|
---|
[726] | 431 | %------------------------------------------------------------------------
|
---|
[198] | 432 | % --- Executes on button press in 'FixLimits'.
|
---|
[726] | 433 | %------------------------------------------------------------------------
|
---|
[295] | 434 | function CheckFixLimits_Callback(hObject, eventdata, handles)
|
---|
| 435 | test=get(handles.CheckFixLimits,'Value');
|
---|
| 436 | update_plot(handles)
|
---|
[428] | 437 |
|
---|
[726] | 438 | %------------------------------------------------------------------------
|
---|
[428] | 439 | % --- Executes on button press in CheckFixAspectRatio.
|
---|
[726] | 440 | %------------------------------------------------------------------------
|
---|
[428] | 441 | function CheckFixAspectRatio_Callback(hObject, eventdata, handles)
|
---|
| 442 | if get(handles.CheckFixAspectRatio,'Value')
|
---|
| 443 | update_plot(handles);
|
---|
[198] | 444 | else
|
---|
[428] | 445 | update_plot(handles);
|
---|
[198] | 446 | end
|
---|
| 447 |
|
---|
[726] | 448 | %------------------------------------------------------------------------
|
---|
[428] | 449 | function num_AspectRatio_Callback(hObject, eventdata, handles)
|
---|
[726] | 450 | %------------------------------------------------------------------------
|
---|
[428] | 451 | set(handles.CheckFixAspectRatio,'Value',1)% select the fixed aspect ratio button
|
---|
| 452 | update_plot(handles);
|
---|
[198] | 453 |
|
---|
| 454 | %-------------------------------------------------------------------
|
---|
| 455 | %-------------------------------------------------------------------
|
---|
| 456 | % - FUNCTIONS FOR SETTING PLOTTING PARAMETERS
|
---|
| 457 |
|
---|
| 458 | %------------------------------------------------------------------
|
---|
| 459 |
|
---|
| 460 |
|
---|
| 461 | %------------------------------------------------------------------
|
---|
| 462 | % --- Executes on selection change in col_vec: choice of the color code.
|
---|
| 463 | %
|
---|
| 464 | function col_vec_Callback(hObject, eventdata, handles)
|
---|
| 465 | %------------------------------------------------------------------
|
---|
| 466 | % edit the choice for color code
|
---|
| 467 | list_code=get(handles.col_vec,'String');% list menu fields
|
---|
| 468 | index_code=get(handles.col_vec,'Value');% selected string index
|
---|
| 469 | col_code= list_code{index_code(1)}; % selected field
|
---|
| 470 | if isequal(col_code,'black') | isequal(col_code,'white')
|
---|
| 471 | set(handles.slider1,'Visible','off')
|
---|
| 472 | set(handles.slider2,'Visible','off')
|
---|
| 473 | set(handles.colcode1,'Visible','off')
|
---|
| 474 | set(handles.colcode2,'Visible','off')
|
---|
| 475 | set(handles.AutoVecColor,'Visible','off')
|
---|
| 476 | set_vec_col_bar(handles)
|
---|
| 477 | else
|
---|
| 478 | set(handles.slider1,'Visible','on')
|
---|
| 479 | set(handles.slider2,'Visible','on')
|
---|
| 480 | set(handles.colcode1,'Visible','on')
|
---|
| 481 | set(handles.colcode2,'Visible','on')
|
---|
| 482 | set(handles.AutoVecColor,'Visible','on')
|
---|
| 483 | if isequal(col_code,'ima_cor')
|
---|
| 484 | set(handles.AutoVecColor,'Value',0)%fixed scale by default
|
---|
| 485 | set(handles.vec_col_bar,'Value',0)% 3 colors r,g,b by default
|
---|
| 486 | set(handles.slider1,'Min',0);
|
---|
| 487 | set(handles.slider1,'Max',1);
|
---|
| 488 | set(handles.slider2,'Min',0);
|
---|
| 489 | set(handles.slider2,'Max',1);
|
---|
| 490 | % set(handles.min_C_title_vec,'String','0')
|
---|
| 491 | set(handles.max_vec,'String','1')
|
---|
| 492 | set(handles.colcode1,'String','0.333')
|
---|
| 493 | colcode1_Callback(hObject, eventdata, handles)
|
---|
| 494 | set(handles.colcode2,'String','0.666')
|
---|
| 495 | colcode2_Callback(hObject, eventdata, handles)
|
---|
| 496 | else
|
---|
| 497 | set(handles.AutoVecColor,'Value',1)%auto scale between min,max by default
|
---|
| 498 | set(handles.vec_col_bar,'Value',1)% colormap 'jet' by default
|
---|
| 499 | minval=get(handles.slider1,'Min');
|
---|
| 500 | maxval=get(handles.slider1,'Max');
|
---|
| 501 | set(handles.slider1,'Value',minval)
|
---|
| 502 | set(handles.slider2,'Value',maxval)
|
---|
| 503 | set_vec_col_bar(handles)
|
---|
| 504 | end
|
---|
| 505 | % slider_update(handles)
|
---|
| 506 | end
|
---|
| 507 | %replot the current graph
|
---|
| 508 | run0_Callback(hObject, eventdata, handles)
|
---|
| 509 |
|
---|
| 510 |
|
---|
| 511 | %----------------------------------------------------------------
|
---|
| 512 | % -- Executes on slider movement to set the color code
|
---|
| 513 | %
|
---|
| 514 | function slider1_Callback(hObject, eventdata, handles)
|
---|
| 515 | %------------------------------------------------------------------
|
---|
| 516 | slider1=get(handles.slider1,'Value');
|
---|
| 517 | min_val=str2num(get(handles.min_vec,'String'));
|
---|
| 518 | max_val=str2num(get(handles.max_vec,'String'));
|
---|
| 519 | col=min_val+(max_val-min_val)*slider1;
|
---|
| 520 | set(handles.colcode1,'String',num2str(col))
|
---|
| 521 | if(get(handles.slider2,'Value') < col)%move also the second slider at the same value if needed
|
---|
| 522 | set(handles.slider2,'Value',col)
|
---|
| 523 | set(handles.colcode2,'String',num2str(col))
|
---|
| 524 | end
|
---|
| 525 | colcode1_Callback(hObject, eventdata, handles)
|
---|
| 526 |
|
---|
| 527 | %----------------------------------------------------------------
|
---|
| 528 | % Executes on slider movement to set the color code
|
---|
| 529 | %----------------------------------------------------------------
|
---|
| 530 | function slider2_Callback(hObject, eventdata, handles)
|
---|
| 531 | slider2=get(handles.slider2,'Value');
|
---|
| 532 | min_val=str2num(get(handles.min_vec,'String'));
|
---|
| 533 | max_val=str2num(get(handles.max_vec,'String'));
|
---|
| 534 | col=min_val+(max_val-min_val)*slider2;
|
---|
| 535 | set(handles.colcode2,'String',num2str(col))
|
---|
| 536 | if(get(handles.slider1,'Value') > col)%move also the first slider at the same value if needed
|
---|
| 537 | set(handles.slider1,'Value',col)
|
---|
| 538 | set(handles.colcode1,'String',num2str(col))
|
---|
| 539 | end
|
---|
| 540 | colcode2_Callback(hObject, eventdata, handles)
|
---|
| 541 |
|
---|
| 542 | %----------------------------------------------------------------
|
---|
| 543 | %execute on return carriage on the edit box corresponding to slider 1
|
---|
| 544 | %----------------------------------------------------------------
|
---|
| 545 | function colcode1_Callback(hObject, eventdata, handles)
|
---|
| 546 | % col=str2num(get(handles.colcode1,'String'));
|
---|
| 547 | % set(handles.slider1,'Value',col)
|
---|
| 548 | set_vec_col_bar(handles)
|
---|
| 549 | update_plot(handles)
|
---|
| 550 |
|
---|
| 551 | %----------------------------------------------------------------
|
---|
| 552 | %execute on return carriage on the edit box corresponding to slider 2
|
---|
| 553 | %----------------------------------------------------------------
|
---|
| 554 | function colcode2_Callback(hObject, eventdata, handles)
|
---|
| 555 | % col=str2num(get(handles.colcode2,'String'));
|
---|
| 556 | % set(handles.slider2,'Value',col)
|
---|
| 557 | % slider2_Callback(hObject, eventdata, handles)
|
---|
| 558 | set_vec_col_bar(handles)
|
---|
| 559 | update_plot(handles)
|
---|
| 560 |
|
---|
| 561 | %-------------------------------------------------------
|
---|
| 562 | % --- Executes on button press in AutoVecColor.
|
---|
| 563 | %-------------------------------------------------------
|
---|
| 564 | function vec_col_bar_Callback(hObject, eventdata, handles)
|
---|
| 565 | set_vec_col_bar(handles)
|
---|
| 566 |
|
---|
| 567 | %------------------------------------------------
|
---|
| 568 | %CALLBACKS FOR PLOTTING PARAMETERS
|
---|
| 569 | %-------------------------------------------------
|
---|
| 570 |
|
---|
| 571 | %------------------------------------------------------------------------
|
---|
[295] | 572 | function num_MinX_Callback(hObject, eventdata, handles)
|
---|
[198] | 573 | %------------------------------------------------------------------------
|
---|
[295] | 574 | set(handles.CheckFixLimits,'Value',1) %suppress auto mode
|
---|
[625] | 575 | % set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])
|
---|
[198] | 576 | update_plot(handles);
|
---|
| 577 |
|
---|
| 578 | %------------------------------------------------------------------------
|
---|
[295] | 579 | function num_MaxX_Callback(hObject, eventdata, handles)
|
---|
[198] | 580 | %------------------------------------------------------------------------
|
---|
[295] | 581 | set(handles.CheckFixLimits,'Value',1) %suppress auto mode
|
---|
[625] | 582 | % set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])
|
---|
[198] | 583 | update_plot(handles);
|
---|
| 584 |
|
---|
| 585 | %------------------------------------------------------------------------
|
---|
[295] | 586 | function num_MinY_Callback(hObject, eventdata, handles)
|
---|
[198] | 587 | %------------------------------------------
|
---|
[295] | 588 | set(handles.CheckFixLimits,'Value',1) %suppress auto mode
|
---|
[625] | 589 | % set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])
|
---|
[198] | 590 | update_plot(handles);
|
---|
| 591 |
|
---|
| 592 | %------------------------------------------------------------------------
|
---|
[295] | 593 | function num_MaxY_Callback(hObject, eventdata, handles)
|
---|
[198] | 594 | %------------------------------------------------------------------------
|
---|
[295] | 595 | set(handles.CheckFixLimits,'Value',1) %suppress auto mode
|
---|
[625] | 596 | % set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])
|
---|
[198] | 597 | update_plot(handles);
|
---|
| 598 |
|
---|
| 599 | %-----------------------------------------------------------------
|
---|
[295] | 600 | function num_MinA_Callback(hObject, eventdata, handles)
|
---|
[198] | 601 | %------------------------------------------
|
---|
[295] | 602 | set(handles.CheckFixScalar,'Value',1) %suppress auto mode
|
---|
| 603 | set(handles.CheckFixScalar,'BackgroundColor',[1 1 0])
|
---|
[198] | 604 | update_plot(handles)
|
---|
| 605 |
|
---|
| 606 | %-----------------------------------------------------------------
|
---|
[295] | 607 | function num_MaxA_Callback(hObject, eventdata, handles)
|
---|
[198] | 608 | %--------------------------------------------
|
---|
[295] | 609 | set(handles.CheckFixScalar,'Value',1) %suppress auto mode
|
---|
[625] | 610 | % set(handles.CheckFixScalar,'BackgroundColor',[1 1 0])
|
---|
[198] | 611 | update_plot(handles)
|
---|
| 612 |
|
---|
| 613 | %-----------------------------------------------
|
---|
[295] | 614 | function CheckFixScalar_Callback(hObject, eventdata, handles)
|
---|
[198] | 615 | %--------------------------------------------
|
---|
[295] | 616 | test=get(handles.CheckFixScalar,'Value');
|
---|
[625] | 617 | % if test
|
---|
| 618 | % set(handles.CheckFixScalar,'BackgroundColor',[1 1 0])
|
---|
| 619 | % else
|
---|
| 620 | % set(handles.CheckFixScalar,'BackgroundColor',[0.7 0.7 0.7])
|
---|
| 621 | % update_plot(handles);
|
---|
| 622 | % % set(handles.MinA,'String',num2str(ScalOut.MinA,3))
|
---|
| 623 | % % set(handles.MaxA,'String',num2str(ScalOut.MaxA,3))
|
---|
| 624 | % end
|
---|
[198] | 625 |
|
---|
| 626 | %-------------------------------------------------------------------
|
---|
[295] | 627 | function CheckBW_Callback(hObject, eventdata, handles)
|
---|
[198] | 628 | %-------------------------------------------------------------------
|
---|
| 629 | update_plot(handles)
|
---|
| 630 |
|
---|
| 631 | %-------------------------------------------------------------------
|
---|
[295] | 632 | function ListContour_Callback(hObject, eventdata, handles)
|
---|
[198] | 633 | %-------------------------------------------------------------------
|
---|
| 634 | val=get(handles.Contours,'Value');
|
---|
| 635 | if val==2
|
---|
| 636 | set(handles.interval_txt,'Visible','on')
|
---|
| 637 | set(handles.IncrA,'Visible','on')
|
---|
| 638 | else
|
---|
| 639 | set(handles.interval_txt,'Visible','off')
|
---|
| 640 | set(handles.IncrA,'Visible','off')
|
---|
| 641 | end
|
---|
| 642 | update_plot(handles)
|
---|
| 643 |
|
---|
| 644 | %-------------------------------------------------------------------
|
---|
| 645 | function IncrA_Callback(hObject, eventdata, handles)
|
---|
| 646 | %-------------------------------------------------------------------
|
---|
| 647 | update_plot(handles)
|
---|
| 648 |
|
---|
| 649 | %-------------------------------------------------------------------
|
---|
| 650 | function HideWarning_Callback(hObject, eventdata, handles)
|
---|
| 651 | %-------------------------------------------------------------------
|
---|
| 652 | update_plot(handles)
|
---|
| 653 |
|
---|
| 654 | %-------------------------------------------------------------------
|
---|
| 655 | function HideFalse_Callback(hObject, eventdata, handles)
|
---|
| 656 | %-------------------------------------------------------------------
|
---|
| 657 | update_plot(handles)
|
---|
| 658 |
|
---|
| 659 | %-------------------------------------------------------------------
|
---|
[612] | 660 | function num_VecScale_Callback(hObject, eventdata, handles)
|
---|
[198] | 661 | %-------------------------------------------------------------------
|
---|
[612] | 662 | set(handles.CheckFixVectors,'Value',1);
|
---|
[198] | 663 | update_plot(handles)
|
---|
| 664 |
|
---|
| 665 | %-------------------------------------------------------------------
|
---|
| 666 | function FixVec_Callback(hObject, eventdata, handles)
|
---|
| 667 | %-------------------------------------------------------------------
|
---|
| 668 | test=get(handles.FixVec,'Value');
|
---|
| 669 | if test
|
---|
| 670 | set(handles.FixVec,'BackgroundColor',[1 1 0])
|
---|
| 671 | else
|
---|
| 672 | update_plot(handles);
|
---|
| 673 | %set(handles.VecScale,'String',num2str(ScalOut.VecScale,3))
|
---|
[625] | 674 | % set(handles.FixVec,'BackgroundColor',[0.7 0.7 0.7])
|
---|
[198] | 675 | end
|
---|
| 676 |
|
---|
| 677 | %-------------------------------------------------------
|
---|
| 678 | % --- Executes on selection change in decimate4 (nb_vec/4).
|
---|
| 679 | %-------------------------------------------------------
|
---|
[295] | 680 | function CheckDecimate4_Callback(hObject, eventdata, handles)
|
---|
[198] | 681 | update_plot(handles)
|
---|
| 682 |
|
---|
| 683 |
|
---|
| 684 | %-------------------------------------------------------
|
---|
| 685 | % --- Executes on selection change in color_code menu
|
---|
| 686 | %-------------------------------------------------------
|
---|
| 687 | function color_code_Callback(hObject, eventdata, handles)
|
---|
| 688 | set_vec_col_bar(handles)
|
---|
| 689 | update_plot(handles);
|
---|
| 690 |
|
---|
| 691 | %-------------------------------------------------------
|
---|
| 692 | % --- Executes on button press in AutoVecColor.
|
---|
| 693 | %-------------------------------------------------------
|
---|
| 694 | function AutoVecColor_Callback(hObject, eventdata, handles)
|
---|
| 695 | test=get(handles.AutoVecColor,'Value');
|
---|
| 696 | if test
|
---|
| 697 | set(handles.AutoVecColor,'BackgroundColor',[1 1 0])
|
---|
| 698 | else
|
---|
| 699 | update_plot(handles);
|
---|
| 700 | %set(handles.VecScale,'String',num2str(ScalOut.VecScale,3))
|
---|
| 701 | set(handles.AutoVecColor,'BackgroundColor',[0.7 0.7 0.7])
|
---|
| 702 | end
|
---|
| 703 | %set_vec_col_bar(handles)
|
---|
| 704 |
|
---|
| 705 | %-------------------------------------------------------
|
---|
| 706 | % --- Executes on selection change in max_vec.
|
---|
| 707 | %-------------------------------------------------------
|
---|
| 708 | function min_vec_Callback(hObject, eventdata, handles)
|
---|
| 709 | max_vec_Callback(hObject, eventdata, handles)
|
---|
| 710 |
|
---|
| 711 | % --- Executes on selection change in max_vec.
|
---|
| 712 | function max_vec_Callback(hObject, eventdata, handles)
|
---|
| 713 | set(handles.AutoVecColor,'Value',1)
|
---|
| 714 | AutoVecColor_Callback(hObject, eventdata, handles)
|
---|
| 715 | min_val=str2num(get(handles.min_vec,'String'));
|
---|
| 716 | max_val=str2num(get(handles.max_vec,'String'));
|
---|
| 717 | slider1=get(handles.slider1,'Value');
|
---|
| 718 | slider2=get(handles.slider2,'Value');
|
---|
| 719 | colcode1=min_val+(max_val-min_val)*slider1;
|
---|
| 720 | colcode2=min_val+(max_val-min_val)*slider2;
|
---|
| 721 | set(handles.colcode1,'String',num2str(colcode1))
|
---|
| 722 | set(handles.colcode2,'String',num2str(colcode2))
|
---|
| 723 | update_plot(handles);
|
---|
| 724 |
|
---|
| 725 | %-------------------------------------------------------------------
|
---|
| 726 | %update the display of color code for vectors
|
---|
| 727 | function set_vec_col_bar(handles)
|
---|
| 728 | %-------------------------------------------------------------------
|
---|
| 729 | %get the image of the color display button 'vec_col_bar' in pixels
|
---|
| 730 | set(handles.vec_col_bar,'Unit','pixel');
|
---|
| 731 | pos_vert=get(handles.vec_col_bar,'Position');
|
---|
| 732 | set(handles.vec_col_bar,'Unit','Normalized');
|
---|
| 733 | width=ceil(pos_vert(3));
|
---|
| 734 | height=ceil(pos_vert(4));
|
---|
| 735 |
|
---|
| 736 | %get slider indications
|
---|
| 737 | list=get(handles.color_code,'String');
|
---|
| 738 | ichoice=get(handles.color_code,'Value');
|
---|
| 739 | colcode.ColorCode=list{ichoice};
|
---|
| 740 | colcode.MinC=str2num(get(handles.min_vec,'String'));
|
---|
| 741 | colcode.MaxC=str2num(get(handles.max_vec,'String'));
|
---|
| 742 | test3color=strcmp(colcode.ColorCode,'rgb') || strcmp(colcode.ColorCode,'bgr');
|
---|
| 743 | if test3color
|
---|
| 744 | colcode.colcode1=str2num(get(handles.colcode1,'String'));
|
---|
| 745 | colcode.colcode2=str2num(get(handles.colcode2,'String'));
|
---|
| 746 | end
|
---|
| 747 | colcode.FixedCbounds=0;
|
---|
| 748 | colcode.FixedCbounds=1;
|
---|
| 749 | vec_C=colcode.MinC+(colcode.MaxC-colcode.MinC)*[0.5:width-0.5]/width;%sample of vec_C values from min to max
|
---|
| 750 | [colorlist,col_vec]=set_col_vec(colcode,vec_C);
|
---|
| 751 | oneheight=ones(1,height);
|
---|
| 752 | A1=colorlist(col_vec,1)*oneheight;
|
---|
| 753 | A2=colorlist(col_vec,2)*oneheight;
|
---|
| 754 | A3=colorlist(col_vec,3)*oneheight;
|
---|
| 755 | A(:,:,1)=A1';
|
---|
| 756 | A(:,:,2)=A2';
|
---|
| 757 | A(:,:,3)=A3';
|
---|
| 758 | set(handles.vec_col_bar,'Cdata',A)
|
---|
| 759 |
|
---|
[295] | 760 | %-------------------------------------------------------------------
|
---|
| 761 | function update_plot(handles)
|
---|
| 762 | %-------------------------------------------------------------------
|
---|
| 763 | Data=get(handles.view_field,'UserData');
|
---|
[544] | 764 | AxeData=Data.PlotAxes;% retrieve the current plotted data
|
---|
[292] | 765 | PlotParam=read_GUI(handles.view_field);
|
---|
[511] | 766 | [PP,PlotParamOut]= plot_field(AxeData,handles.PlotAxes,PlotParam);
|
---|
[591] | 767 | errormsg=fill_GUI(PlotParamOut,handles.view_field);
|
---|
[726] | 768 | if ~isempty(errormsg)
|
---|
| 769 | msgbox_uvmat('ERROR',errormsg)
|
---|
| 770 | return
|
---|
| 771 | end
|
---|
| 772 | hedit=findobj(handles.view_field,'Style','edit');
|
---|
| 773 | set(hedit,'BackgroundColor',[1 1 1])
|
---|
[198] | 774 |
|
---|
[220] | 775 | %------------------------------------------------------------------------
|
---|
[198] | 776 | % --- Executes on button press in Menu/Export/field in workspace.
|
---|
| 777 | function MenuExportField_Callback(hObject, eventdata, handles)
|
---|
[220] | 778 | %------------------------------------------------------------------------
|
---|
[198] | 779 | global Data_view_field
|
---|
| 780 | % huvmat=findobj(allchild(0),'Name','uvmat');
|
---|
| 781 | Data_view_field=get(handles.view_field,'UserData');
|
---|
[544] | 782 | Data_view_field=Data_view_field.PlotAxes;
|
---|
[198] | 783 | % Data_view_field=UvData.ProjField_2;
|
---|
| 784 | evalin('base','global Data_view_field')%make CurData global in the workspace
|
---|
| 785 | display(['UserData of view_field :'])
|
---|
| 786 | evalin('base','Data_view_field') %display CurData in the workspace
|
---|
| 787 | commandwindow;
|
---|
| 788 |
|
---|
[220] | 789 | %------------------------------------------------------------------------
|
---|
[198] | 790 | % --- Executes on button press in Menu/Export/extract figure.
|
---|
| 791 | function MenuExport_plot_Callback(hObject, eventdata, handles)
|
---|
[220] | 792 | %------------------------------------------------------------------------
|
---|
[198] | 793 | huvmat=get(handles.MenuExport_plot,'parent');
|
---|
| 794 | UvData=get(huvmat,'UserData');
|
---|
| 795 | hfig=figure;
|
---|
[511] | 796 | newaxes=copyobj(handles.PlotAxes,hfig);
|
---|
| 797 | map=colormap(handles.PlotAxes);
|
---|
[198] | 798 | colormap(map);%transmit the current colormap to the zoom fig
|
---|
| 799 | colorbar
|
---|
| 800 |
|
---|
| 801 |
|
---|
[406] | 802 | % --- Executes on selection change in ColorCode.
|
---|
| 803 | function ColorCode_Callback(hObject, eventdata, handles)
|
---|
| 804 |
|
---|
| 805 |
|
---|
| 806 | % --- Executes on selection change in ColorScalar.
|
---|
| 807 | function ColorScalar_Callback(hObject, eventdata, handles)
|
---|
| 808 |
|
---|
[413] | 809 |
|
---|
[428] | 810 | function num_ColCode2_Callback(hObject, eventdata, handles)
|
---|
[413] | 811 |
|
---|
[690] | 812 |
|
---|
| 813 |
|
---|
| 814 | % --- Executes on button press in CheckTable.
|
---|
| 815 | function CheckTable_Callback(hObject, eventdata, handles)
|
---|
| 816 | if get(handles.CheckTable,'Value')
|
---|
| 817 | set(handles.TableDisplay,'Visible','on')
|
---|
| 818 | else
|
---|
| 819 | set(handles.TableDisplay,'Visible','off')
|
---|
| 820 | end
|
---|
| 821 |
|
---|