Changeset 748 for trunk/src/uvmat.m


Ignore:
Timestamp:
Apr 23, 2014, 4:57:58 PM (10 years ago)
Author:
sommeria
Message:

update for 3D plots, panel Coordiantes introduces, while coordiantes now called Axes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r747 r748  
    8383% velocity vectors. The scalar values in the first case is represented by
    8484% UvData.Field.A, and by UvData.Field.C in the second case. The corresponding set of X
    85 % and Y coordinates are represented by UvData.Field.AX and UvData.Field.AY, and .X and
     85% and Y axes are represented by UvData.Field.AX and UvData.Field.AY, and .X and
    8686% .Y for C (the same as velocity vectors). If A is a nxxny matrix (scalar
    8787% on a regtular grid), then .AX andf.AY contains only two elements, represneting the
    88 % coordinates of the four image corners. The scalar name is represented by
     88% axes of the four image corners. The scalar name is represented by
    8989% the strings .AName and/or .CName.
    9090% If the scalar exists in an input open (image or scalar stored under its
     
    9595% Properties attached to plotting figures (standard Matlab properties):
    9696%    'CurrentAxes'= gca or get(gcf,'CurrentAxes');
    97 %    'CurrentPoint'=get(gcf,'CurrentPoint'): figure coordinates of the point over which the mouse is positioned
     97%    'CurrentPoint'=get(gcf,'CurrentPoint'): figure axes of the point over which the mouse is positioned
    9898%    'CurrentCharacter'=get(gcf,'CurrentCharacter'): last character typed  over the figure where the mouse is positioned
    9999%    'WindowButtonMotionFcn': function permanently called by mouse motion over the figure
     
    103103
    104104% Properties attached to plotting axes:
    105 %    'CurrentPoint'=get(gca,'CurrentPoint'); (standard Matlab) same as for the figure, but position in plot coordinates.
     105%    'CurrentPoint'=get(gca,'CurrentPoint'); (standard Matlab) same as for the figure, but position in plot axes.
    106106%     AxeData:=get(gca,'UserData');
    107107%     AxeData.Drawing  = create: create a new object
     
    120120%    ObjectData.Type=...: style of projection object:
    121121%              .ProjMode
    122 %              .Coord: defines the position of the object
     122%              .Coordinates: defines the position of the object
    123123%              .XMin,YMin....
    124124%              .XMax,YMax....
     
    191191set(hObject,'Position',[LeftX LowY Width Height])
    192192UvData.OpenParam.PosColorbar=[0.80 0.02 0.018 0.445];
    193 % UvData.OpenParam.PosGeometryCalib=[0.95 -0.03 0.28 1 ];%position for geometry_calib
    194193AxeData.LimEditBox=1; %initialise AxeData
    195194set(handles.PlotAxes,'UserData',AxeData)
     
    396395% set(handles.CheckHold,'Position',pos_CheckHold)
    397396
    398 %% reset position of Coordinates
     397%% reset position of Coordinates panel
    399398set(handles.Coordinates,'Units','pixels')
    400399pos_2=get(handles.Coordinates,'Position');% [lower x lower y width height] for frame 'Coordinates'
     
    404403set(handles.Coordinates,'Position',pos_2)
    405404
     405%% reset position of Axes panel
     406set(handles.Axes,'Units','pixels')
     407pos_3=get(handles.Axes,'Position');% [lower x lower y width height] for frame 'Coordinates'
     408pos_3(3)=ColumnWidth;
     409pos_3(1)=size_fig(3)-pos_3(3);       % set 'Coordinates' to the right of the fig
     410pos_3(2)=pos_2(2)-pos_3(4);          % set 'Coordinates' to the lower edge of text display, allowing a margin for CheckHold
     411set(handles.Axes,'Position',pos_3)
     412
    406413%% reset position of  Scalar
    407414set(handles.Scalar,'Units','pixels')
    408 pos_3=get(handles.Scalar,'Position'); % [lower x lower y width height] for frame 'Scalar'
    409 pos_3(3)=ColumnWidth;
    410 pos_3(1)=size_fig(3)-pos_3(3);         % set 'Scalar' to the right of the fig
     415pos_4=get(handles.Scalar,'Position'); % [lower x lower y width height] for frame 'Scalar'
     416pos_4(3)=ColumnWidth;
     417pos_4(1)=size_fig(3)-pos_4(3);         % set 'Scalar' to the right of the fig
    411418if strcmp(get(handles.Scalar,'Visible'),'on')
    412     pos_3(2)=pos_2(2)-pos_3(4); % set 'Scalar' to the lower edge of frame 'Coordinates' if visible
    413 else
    414     pos_3(2)=pos_2(2);% set 'Scalar' to the lower edge of frame 'text display' if  unvisible
    415 end
    416 set(handles.Scalar,'Position',pos_3)
     419    pos_4(2)=pos_3(2)-pos_4(4); % set 'Scalar' to the lower edge of frame 'Coordinates' if visible
     420else
     421    pos_4(2)=pos_3(2);% set 'Scalar' to the lower edge of frame 'text display' if  unvisible
     422end
     423set(handles.Scalar,'Position',pos_4)
    417424
    418425%% reset position of  Vectors
    419426set(handles.Vectors,'Units','pixels')
    420 pos_4=get(handles.Vectors,'Position');
    421 pos_4(3)=ColumnWidth;
    422 pos_4(1)=size_fig(3)-pos_4(3);
     427pos_5=get(handles.Vectors,'Position');
     428pos_5(3)=ColumnWidth;
     429pos_5(1)=size_fig(3)-pos_5(3);
    423430if strcmp(get(handles.Vectors,'visible'),'on')
    424     pos_4(2)=pos_3(2)-pos_4(4);
    425 else
    426     pos_4(2)=pos_3(2);
    427 end
    428 set(handles.Vectors,'Position',pos_4)
     431    pos_5(2)=pos_4(2)-pos_5(4);
     432else
     433    pos_5(2)=pos_4(2);
     434end
     435set(handles.Vectors,'Position',pos_5)
    429436
    430437%% reset position and scale of axis
     
    26262633            break
    26272634        end
    2628         if UvData.Field.NbDim==3% TO GENERALISE
     2635        if UvData.Field.NbDim==3
    26292636            UvData.ProjObject{iobj}.NbDim=3;%test for 3D objects
     2637            if ~isfield(UvData.ProjObject{iobj},'RangeZ')
    26302638            UvData.ProjObject{iobj}.RangeZ=UvData.Field.CoordMesh;%main plotting plane
    2631             UvData.ProjObject{iobj}.Coord(1,3)=(UvData.Field.ZMin+UvData.Field.ZMax)/2;%section at a middle plane chosen
    2632             UvData.ProjObject{iobj}.Angle=[0 0 0];
     2639            end
     2640            if ~(isfield(UvData.ProjObject{iobj},'Coord') && UvData.ProjObject{iobj}.Coord(1,3)<UvData.Field.ZMax && UvData.ProjObject{iobj}.Coord(1,3)>UvData.Field.ZMin)
     2641                 UvData.ProjObject{iobj}.Coord(1,3)=(UvData.Field.ZMin+UvData.Field.ZMax)/2;%section at a middle plane chosen
     2642            end         
    26332643        end
    26342644        [ObjectData,errormsg]=proj_field(UvData.Field,UvData.ProjObject{iobj});% project field on the object
     
    26392649            PlotParam{imap}.Scalar.CheckBW=[]; %B/W option depends on the input field (image or scalar)
    26402650            if isfield(ObjectData,'CoordUnit')
    2641                 PlotParam{imap}.Coordinates.CheckFixAspectRatio=1;% set x and y scaling equal if CoordUnit is defined (common unit for x and y)
    2642                 PlotParam{imap}.Coordinates.AspectRatio=1; %set aspect ratio to 1
     2651                PlotParam{imap}.Axes.CheckFixAspectRatio=1;% set x and y scaling equal if CoordUnit is defined (common unit for x and y)
     2652                PlotParam{imap}.Axes.AspectRatio=1; %set aspect ratio to 1
    26432653            end
    26442654        end
     
    27062716    Ustring='';
    27072717    Vstring='';
    2708     % suppress coordinates from the histogram menu
     2718    % suppress axes from the histogram menu
    27092719    for ivar=1:numel(menu_histo)%l loop on field variables:
    27102720        if isfield(UvData.Field,'VarAttribute') && numel(UvData.Field.VarAttribute)>=ivar && isfield(UvData.Field.VarAttribute{ivar},'Role')
     
    27482758
    27492759if UvData.Field.NbDim==3
     2760    set(handles.CheckEditObject,'Value',1)
    27502761    CheckEditObject_Callback(handles.uvmat, [], handles)
    27512762end   
     
    28092820else
    28102821    nxy=size(FieldHisto);
    2811     Amin=double(min(min(min(FieldHisto))));%min of field value
    2812     Amax=double(max(max(max(FieldHisto))));%max of field value
     2822    Amin=double(min(min(min(min(FieldHisto)))));%min of field value
     2823    Amax=double(max(max(max(max(FieldHisto)))));%max of field value
    28132824    if isequal(Amin,Amax)
    28142825        cla(handles.HistoAxes)
     
    31103121switch field 
    31113122    case 'get_field...'
    3112         %% fill the coordinates and variables from selections in get_field
     3123        %% fill the axes and variables from selections in get_field
    31133124        ParamIn=[];
    31143125        % in case of civ data, we use the civ choice as default input for the GUI get_field
     
    32743285switch field_1
    32753286    case 'get_field...'
    3276          %% fill the coordinates and variables from selections in get_field
     3287         %% fill the axes and variables from selections in get_field
    32773288        ParamIn=[];
    32783289        % in case of civ data, we use the civ choice as default input for the GUI get_field
     
    38673878%-------------------------------------------------
    38683879%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    3869 % Plot coordinates
     3880% Plot axes
    38703881%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    38713882%------------------------------------------------------------------------
     
    43034314    haxes=findobj(hview_field,'tag','axes3');
    43044315    pos=get(hview_field,'Position'); 
    4305     if strcmp(get(haxes,'Visible'),'off')%sempty(PlotParam.Coordinates)% case of no plot display (pure text table)
     4316    if strcmp(get(haxes,'Visible'),'off')%sempty(PlotParam.Axes)% case of no plot display (pure text table)
    43064317        h_TableDisplay=findobj(hview_field,'tag','TableDisplay');
    43074318        pos_table=get(h_TableDisplay,'Position');
     
    44804491    haxes=findobj(hview_field,'tag','axes3');
    44814492    pos=get(hview_field,'Position');
    4482     if strcmp(get(haxes,'Visible'),'off')%sempty(PlotParam.Coordinates)% case of no plot display (pure text table)
     4493    if strcmp(get(haxes,'Visible'),'off')%sempty(PlotParam.Axes)% case of no plot display (pure text table)
    44834494        h_TableDisplay=findobj(hview_field,'tag','TableDisplay');
    44844495        pos_table=get(h_TableDisplay,'Position');
     
    52325243XmlData.PolarCentre=[x0 y0];
    52335244
    5234 %% display the current image in polar coordinates with origin at the  illumination source
     5245%% display the current image in polar axes with origin at the  illumination source
    52355246currentdir=pwd; 
    52365247uvmatpath=fileparts(which('uvmat'));
     
    55585569%'write_plot_param': update the plotting parameters on the uvmat or view_field interface after a plotting operation
    55595570function write_plot_param(handles,PlotParam)
    5560 %% coordinates
    5561 if isempty(PlotParam.Coordinates)
    5562     set(handles.Coordinates,'Visible','off')
     5571%% axes
     5572if isempty(PlotParam.Axes)
     5573    set(handles.Axes,'Visible','off')
    55635574    set(handles.PlotAxes,'Visible','off')
    55645575    set(handles.text_display,'Visible','off')
    55655576    set(handles.TableDisplay,'Visible','on')
    55665577else
    5567     set(handles.Coordinates,'Visible','on')
     5578    set(handles.Axes,'Visible','on')
    55685579    set(handles.PlotAxes,'Visible','on')
    55695580    set(handles.text_display,'Visible','on')
     
    55715582    set(handles.TableDisplay,'Visible','off')
    55725583    end
    5573     Coordinates=PlotParam.Coordinates;
     5584    Coordinates=PlotParam.Axes;
    55745585    if isfield(Coordinates,'CheckFixAspectRatio')
    55755586        if Coordinates.CheckFixAspectRatio
     
    56665677
    56675678
    5668 
    5669 function Coord_z_Callback(hObject, eventdata, handles)
    5670 % hObject    handle to Coord_z (see GCBO)
     5679% --- Executes on selection change in SwitchCoordIndex.
     5680function SwitchCoordIndex_Callback(hObject, eventdata, handles)
     5681% hObject    handle to SwitchCoordIndex (see GCBO)
    56715682% eventdata  reserved - to be defined in a future version of MATLAB
    56725683% handles    structure with handles and user data (see GUIDATA)
    56735684
    5674 % Hints: get(hObject,'String') returns contents of Coord_z as text
    5675 %        str2double(get(hObject,'String')) returns contents of Coord_z as a double
    5676 
    5677 
    5678 % --- Executes during object creation, after setting all properties.
    5679 function Coord_z_CreateFcn(hObject, eventdata, handles)
    5680 % hObject    handle to Coord_z (see GCBO)
    5681 % eventdata  reserved - to be defined in a future version of MATLAB
    5682 % handles    empty - handles not created until after all CreateFcns called
    5683 
    5684 % Hint: edit controls usually have a white background on Windows.
    5685 %       See ISPC and COMPUTER.
    5686 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    5687     set(hObject,'BackgroundColor','white');
    5688 end
     5685% Hints: contents = cellstr(get(hObject,'String')) returns SwitchCoordIndex contents as cell array
     5686%        contents{get(hObject,'Value')} returns selected item from SwitchCoordIndex
Note: See TracChangeset for help on using the changeset viewer.