Changeset 379


Ignore:
Timestamp:
Jan 27, 2012, 1:59:18 AM (12 years ago)
Author:
sommeria
Message:

several bugs corrected
set_object.fig rationalized so that read_set_object is replaced by the rgeneral fct read_GUI.

Location:
trunk/src
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r378 r379  
    2323%TODO: search range
    2424
    25 % Last Modified by GUIDE v2.5 14-Jan-2012 00:46:29
     25% Last Modified by GUIDE v2.5 27-Jan-2012 00:32:33
    2626% Begin initialization code - DO NOT EDIT
    2727gui_Singleton = 1;
     
    44164416
    44174417function RootFile_Callback(hObject, eventdata, handles)
    4418 
    4419 
    4420 
  • trunk/src/fileparts_uvmat.m

    r353 r379  
    104104            end
    105105            NomType=[get_type(num2) delim1 get_type(num1)];
    106             RootFile=regexprep(FileName,[num2 delim1 num1],'');
     106            RootFile=regexprep(FileName,[num2 delim1 num1 '$'],'');
    107107        end
    108108        NomType=regexprep(NomType,'-1','-2'); %set 1-2 instead of 1-1
  • trunk/src/fill_GUI.m

    r368 r379  
    33function errormsg=fill_GUI(Param,handles)
    44%------------------------------------------------------------------------
    5 
    65errormsg='';
    76fields=fieldnames(Param);
     
    1918        hh=[];
    2019        input_data=Param.(fields{ifield});
     20        check_done=0;
    2121        if isfield(handles,fields{ifield})
    2222            hh=handles.(fields{ifield});
    2323            if strcmp(get(hh,'Type'),'uitable')
     24                set(hh,'Visible','on')
    2425                set(hh,'Data',input_data)
    25                 break
     26                check_done=1;
    2627            end
    2728        elseif isnumeric(input_data) && isfield(handles,['num_' fields{ifield}])
    2829            hh=handles.(['num_' fields{ifield}]);
    2930        end
    30         if ~isempty(hh)
     31        if ~isempty(hh)&& ~check_done
    3132            set(hh,'Visible','on')
    3233%             input_data
    33             switch get(hh,'style')
     34            switch get(hh,'Style')
    3435                case {'checkbox','radiobutton','togglebutton'}
    3536                    if isnumeric(input_data)
  • trunk/src/find_file_series.m

    r376 r379  
    5454if strcmp( FileType,'multimage')||strcmp( FileType,'video')
    5555        NomType='*';
    56         i1_series=(1:FileInfo.NbFrame)'
     56        i1_series=(1:FileInfo.NbFrame)';
    5757end
    5858
  • trunk/src/geometry_calib.m

    r356 r379  
    149149function APPLY_Callback(hObject, eventdata, handles)
    150150%------------------------------------------------------------------------
    151 %read the current calibration points
     151%% look for the GUI uvmat and check for an image as input
     152huvmat=findobj(allchild(0),'Name','uvmat');
     153hhuvmat=guidata(huvmat);%handles of elements in the GUI uvmat
     154FileExt=get(hhuvmat.FileExt,'String');
     155check_input=0;
     156if ~isempty(FileExt)
     157    if ~isempty(imformats(FileExt(2:end))) ||strcmpi(FileExt,'.avi')
     158        check_input=1;
     159    end
     160end
     161if ~check_input
     162    msgbox_uvmat('ERROR','open an image with uvmat to perform calibration')
     163    return
     164end
     165
     166%% read the current calibration points
    152167Coord_cell=get(handles.ListCoord,'String');
    153168Object=read_geometry_calib(Coord_cell);
     
    200215set(handles.Psi,'String',num2str(GeometryCalib.omc(3),4))
    201216
    202 % store the calibration data, by default in the xml file of the currently displayed image
    203 huvmat=findobj(allchild(0),'Name','uvmat');
     217%% store the calibration data, by default in the xml file of the currently displayed image
    204218UvData=get(huvmat,'UserData');
    205219NbSlice_j=1;%default
     
    208222volume_scan='n';
    209223if isfield(UvData,'XmlData')
    210     UvData.XmlData
    211224    if isfield(UvData.XmlData,'TranslationMotor')
    212225        NbSlice_j=UvData.XmlData.TranslationMotor.Nbslice;
     
    216229    end
    217230end
    218 hhuvmat=guidata(huvmat);%handles of elements in the GUI uvmat
    219231RootPath='';
    220232% RootFile='';
  • trunk/src/mouse_down.m

    r342 r379  
    9090    if xy_fig(1) >=obj_pos(1) & xy_fig(2) >= obj_pos(2)& xy_fig(1) <=obj_pos(1)+obj_pos(3) & xy_fig(2) <= obj_pos(2)+obj_pos(4);
    9191        htype=get(hchild,'Type');%type of object child of the current figure
    92 
    9392        switch htype
    9493            %if the mouse is over an axis, look at the data
     
    169168
    170169%% delete the current zoom rectangle
    171 if isfield(AxeData,'CurrentRectZoom') & ishandle(AxeData.CurrentRectZoom)
     170if isfield(AxeData,'CurrentRectZoom') && ishandle(AxeData.CurrentRectZoom)
    172171    delete(AxeData.CurrentRectZoom)
    173172    AxeData.CurrentRectZoom=[];
     
    294293        hset_object=findobj(allchild(0),'tag','set_object');
    295294        if ~isempty(hset_object)
    296             sethandles=guidata(hset_object);
    297             ObjectData=read_set_object(sethandles); %read object features in the GUI set_object
     295            %ObjectData=read_set_object(sethandles); %read object features in the GUI set_object
     296            ObjectData=read_GUI(hset_object);
    298297            ObjectData.Coord=[]; %reset previous object coordinates
    299298            ObjectData.Coord(1,1)=xy(1,1);
    300299            ObjectData.Coord(1,2)=xy(1,2);
    301             ObjectData.Coord(1,3)=0;
     300%             ObjectData.Coord(1,3)=0;
    302301            if isfield(AxeData,'ObjectCoord') & size(AxeData.ObjectCoord,2)==3
    303302                 ObjectData.Coord(1,3)=AxeData.ObjectCoord(1,3); %generaliser au cas avec angle
     
    314313            set(hhuvmat.ListObject,'Value',[IndexObj_old(1) IndexObj] );
    315314            UvData.Object{IndexObj}.DisplayHandle_uvmat=AxeData.CurrentObject;
    316             object_name=get(sethandles.TITLE,'String');
    317             if isempty(object_name)|| strcmp(object_name,'')
    318                 list_str{IndexObj}=[num2str(IndexObj) '-' ObjectData.Style];
    319                 set(sethandles.TITLE,'String',list_str{IndexObj})
     315            object_name=ObjectData.Name;
     316            sethandles=guidata(hset_object);
     317            if isempty(object_name)
     318                list_str{IndexObj}=[num2str(IndexObj) '-' ObjectData.Type];
     319                set(sethandles.Name,'String',list_str{IndexObj})
    320320            else
    321321               list_str{IndexObj}=object_name;
  • trunk/src/mouse_motion.m

    r315 r379  
    4242test_zoom_draw=0; % test for zoom drawing
    4343test_ruler=0;%test for active ruler
    44 test_piv=0;% test for PIV correlation display
     44% test_piv=0;% test for PIV correlation display
    4545huvmat=findobj(allchild(0),'tag','uvmat');%find the uvmat interface handle
    4646if ~isempty(huvmat)
     
    5858    test_piv=1;
    5959end
    60 % hciv=findobj(allchild(0),'tag','civ');%find the civ interface handle
    61 % if ~isempty(hciv) && strcmp(get(currentfig,'tag'),'view_field')
    62 %     hhciv=guidata(hciv);
    63 %     test_piv =get(hhciv.TestCiv1,'Value');
    64 % end
    6560
    6661%find the current axe 'haxes' and display the current mouse position or uicontrol tag
     
    327322        XYData=AxeData.CurrentOrigin;
    328323        if isequal(AxeData.Drawing,'create') && isfield(AxeData,'CurrentOrigin') && ~isempty(AxeData.CurrentOrigin)
    329            if strcmp(ObjectData.Style,'line')||strcmp(ObjectData.Style,'polyline')||strcmp(ObjectData.Style,'polygon')||strcmp(ObjectData.Style,'points')
    330               xy(1,3)=0;
    331               ObjectData.Coord=[ObjectData.Coord ;xy(1,:)];
     324           if strcmp(ObjectData.Type,'line')||strcmp(ObjectData.Type,'polyline')||strcmp(ObjectData.Type,'polygon')||strcmp(ObjectData.Type,'points')
     325              ObjectData.Coord=[ObjectData.Coord ;xy(1,1:2)];
    332326             % ObjectData.Coord(end,:)=xy(1,:);
    333            elseif strcmp(ObjectData.Style,'rectangle')||strcmp(ObjectData.Style,'ellipse')||strcmp(ObjectData.Style,'volume')
     327           elseif strcmp(ObjectData.Type,'rectangle')||strcmp(ObjectData.Type,'ellipse')||strcmp(ObjectData.Type,'volume')
    334328              ObjectData.Coord(1,1)=(xy(1,1)+XYData(1))/2;%origin rectangle, x coordinate
    335329              ObjectData.Coord(1,2)=(xy(1,2)+XYData(2))/2;
    336330              ObjectData.RangeX=abs(xy(1,1)-XYData(1))/2;%rectangle width
    337331              ObjectData.RangeY=abs(xy(1,2)-XYData(2))/2;%rectangle height
    338            elseif isequal(ObjectData.Style,'plane') %case of 'plane'
     332           elseif isequal(ObjectData.Type,'plane') %case of 'plane'
    339333                DX=(xy(1,1)-ObjectData.Coord(1,1));
    340334                DY=(xy(1,2)-ObjectData.Coord(1,2));
  • trunk/src/mouse_up.m

    r302 r379  
    7878    %creating object   
    7979    else   
    80         if strcmp(ObjectData.Style,'line')||strcmp(ObjectData.Style,'polyline')||...
    81                 strcmp(ObjectData.Style,'polygon')||strcmp(ObjectData.Style,'points')
     80        if strcmp(ObjectData.Type,'line')||strcmp(ObjectData.Type,'polyline')||...
     81                strcmp(ObjectData.Type,'polygon')||strcmp(ObjectData.Type,'points')
    8282            if isfield(AxeData,'ObjectCoord') && size(AxeData.ObjectCoord,2)==3
    8383              xy(1,3)=AxeData.ObjectCoord(1,3); % z coordinate of the mouse: to generalise ...
     
    8686            end
    8787            if ~isequal(ObjectData.Coord,xy(1,:))
    88                 ObjectData.Coord=[ObjectData.Coord ;xy(1,:)];% append the coordiantes marked by the mouse to the eobject
    89             end
    90         elseif isequal(ObjectData.Style,'rectangle')||isequal(ObjectData.Style,'ellipse')||isequal(ObjectData.Style,'volume')
     88                ObjectData.Coord=[ObjectData.Coord ;xy(1,1:2)];% append the coordiantes marked by the mouse to the eobject
     89            end
     90        elseif isequal(ObjectData.Type,'rectangle')||isequal(ObjectData.Type,'ellipse')||isequal(ObjectData.Type,'volume')
    9191            XYData=AxeData.CurrentOrigin;
    9292            ObjectData.Coord(1,1)=(xy(1,1)+XYData(1))/2;%origin rectangle, x coordinate
     
    9494            ObjectData.RangeX=abs(xy(1,1)-XYData(1))/2;%rectangle width
    9595            ObjectData.RangeY=abs(xy(1,2)-XYData(2))/2;%rectangle height
    96         elseif isequal(ObjectData.Style,'plane') %case of 'plane'
     96        elseif isequal(ObjectData.Type,'plane') %case of 'plane'
    9797            DX=(xy(1,1)-ObjectData.Coord(1,1));
    9898            DY=(xy(1,2)-ObjectData.Coord(1,2));
     
    106106        end
    107107    end
    108     if strcmp(ObjectData.Style,'rectangle')||strcmp(ObjectData.Style,'ellipse')
     108    if strcmp(ObjectData.Type,'rectangle')||strcmp(ObjectData.Type,'ellipse')
    109109        NbDefPoint=1; 
    110     elseif strcmp(ObjectData.Style,'line')|| strcmp(ObjectData.Style,'plane');
     110    elseif strcmp(ObjectData.Type,'line')|| strcmp(ObjectData.Type,'plane');
    111111        NbDefPoint=2;
    112112    else
     
    117117    h_set_object=findobj(allchild(0),'Tag','set_object');
    118118    hh_set_object=guidata(h_set_object);
    119     set(hh_set_object.XObject,'String',num2str(ObjectData.Coord(:,1),4));
    120     set(hh_set_object.YObject,'String',num2str(ObjectData.Coord(:,2),4));
    121     set(hh_set_object.ZObject,'String',num2str(ObjectData.Coord(:,3),4));
    122     if strcmp(ObjectData.Style,'rectangle')||strcmp(ObjectData.Style,'ellipse')
     119    set(hh_set_object.Coord,'Data',ObjectData.Coord);
     120%     set(hh_set_object.XObject,'String',num2str(ObjectData.Coord(:,1),4));
     121%     set(hh_set_object.YObject,'String',num2str(ObjectData.Coord(:,2),4));
     122%     set(hh_set_object.ZObject,'String',num2str(ObjectData.Coord(:,3),4));
     123    if strcmp(ObjectData.Type,'rectangle')||strcmp(ObjectData.Type,'ellipse')
    123124        set(hh_set_object.XMax,'String',num2str(ObjectData.RangeX,4));
    124125        set(hh_set_object.YMax,'String',num2str(ObjectData.RangeY,4));
     
    127128              strcmp(AxeData.Drawing,'translate') || strcmp(AxeData.Drawing,'deform');%stop drawing
    128129        AxeData.CurrentOrigin=[]; %suppress the current origin
    129        if isequal(ObjectData.Style,'line') && size(ObjectData.Coord,1)<=1
     130       if isequal(ObjectData.Type,'line') && size(ObjectData.Coord,1)<=1
    130131           AxeData.Drawing='off';
    131132           set(currentaxes,'UserData',AxeData);
  • trunk/src/plot_field.m

    r364 r379  
    4141%                   default=0, no error. Different non zero values can represent different criteria of elimination.
    4242%
    43 %
    44 %         additional elements characterizing the projection object (should not be necessary)--
    45 %            Data.Style : style of projection object
    46 %            Data.XObject,.YObject: set of coordinates defining the object position;
    47 %            Data.ProjMode=type of projection ;
    48 %            Data.ProjAngle=angle of projection;
    49 %            Data.DX,.DY,.DZ=increments;
    50 %            Data.MaxY,MinY: min and max Y
    51 
    5243%   haxes: handle of the plotting axes to update with the new plot. If this input is absent or not a valid axes handle, a new figure is created.
    5344%
  • trunk/src/plot_object.m

    r307 r379  
    99%
    1010% ObjectDataIn: structure representing the object properties:
    11 %        .Style : style of projection object
     11%        .Type : style of projection object
    1212%        .Coord: set of coordinates defining the object position;
    1313%        .ProjMode=type of projection ;
     
    3939%% default output
    4040hh=[];%default output
    41 if ~isfield(ObjectDataIn,'Style')|| isequal(ProjObject,ObjectDataIn)% object representation does not appear in its own projection plot
     41if ~isfield(ObjectDataIn,'Type')|| isequal(ProjObject,ObjectDataIn)% object representation does not appear in its own projection plot
    4242    return
    4343end
    44 if ~isfield(ProjObject,'Style')
     44if ~isfield(ProjObject,'Type')
    4545    ObjectData=ObjectDataIn;
    46 elseif isequal(ProjObject.Style,'plane')
     46elseif isequal(ProjObject.Type,'plane')
    4747    ObjectData=ObjectDataIn;% TODO: modify take into account rotation of axis
    4848else
    4949    return % object representation only  available in a plane
    5050end
    51 if ~isfield(ObjectData,'Style')||isempty(ObjectData.Style)||~ischar(ObjectData.Style)
    52     msgbox_uvmat('ERROR','undefined ObjectData.Style in plot_object.m')
     51if ~isfield(ObjectData,'Type')||isempty(ObjectData.Type)||~ischar(ObjectData.Type)
     52    msgbox_uvmat('ERROR','undefined ObjectData.Type in plot_object.m')
    5353    return
    5454end
    55 if ~isfield(ObjectData,'Style')||isempty(ObjectData.Style)||~ischar(ObjectData.Style)
    56     msgbox_uvmat('ERROR','undefined ObjectData.Style in plot_object.m')
     55if ~isfield(ObjectData,'Type')||isempty(ObjectData.Type)||~ischar(ObjectData.Type)
     56    msgbox_uvmat('ERROR','undefined ObjectData.Type in plot_object.m')
    5757    return
    5858end
     
    103103     ObjectData.Coord=[0 0 0];%default
    104104end
    105 if ~isfield(ObjectData,'Phi')||isempty(ObjectData.Phi)
    106      ObjectData.Phi=0;%default
    107 end
    108 if ~isfield(ObjectData,'Range')
    109     ObjectData.Range(1,1)=0; %edfault
    110 end
    111 if size(ObjectData.Range,2)>=2
    112     YMax=ObjectData.Range(1,2);%default
    113 end
    114 if size(ObjectData.Range,2)>=2 & size(ObjectData.Range,1)>=2
    115     YMin=ObjectData.Range(2,2);
    116 else
    117     YMin=0;
    118 end
    119 XMax=ObjectData.Range(1,1);
    120 if size(ObjectData.Range,1)>=2
    121     XMin=ObjectData.Range(2,1);
    122 end
    123 if isfield(ObjectData,'RangeX')
    124    XMax=max(ObjectData.RangeX);
    125    XMin=min(ObjectData.RangeX);
    126 end
    127 if isfield(ObjectData,'RangeY')
    128    YMax=max(ObjectData.RangeY);
    129    YMin=min(ObjectData.RangeY);
    130 end
    131 if isfield(ObjectData,'RangeZ')
    132    ZMax=max(ObjectData.RangeZ);
    133    ZMin=min(ObjectData.RangeZ);
    134 end
    135 if isequal(ObjectData.Style,'points')&isequal(ObjectData.ProjMode,'projection')
    136     YMax=max(XMax,YMax);
    137     YMax=max(YMax,ZMax);
    138 elseif isequal(ObjectData.Style,'rectangle')||isequal(ObjectData.Style,'ellipse')||isequal(ObjectData.Style,'volume')
    139     if  isequal(YMax,0)
    140         ylim=get(haxes,'YLim');
    141         YMax=(ylim(2)-ylim(1))/100;
    142     end
    143     if isequal(XMax,0)
    144         XMax=YMax;%default
    145     end
    146 elseif isequal(ObjectData.Style,'plane')
    147    if  isequal(XMax,0)
    148         xlim=get(haxes,'XLim');
    149         XMax=xlim(2);
    150    end
    151    if  isequal(YMax,0)
    152         ylim=get(haxes,'YLim');
    153         YMax=ylim(2);
    154    end
     105% if ~isfield(ObjectData,'Phi')||isempty(ObjectData.Phi)
     106%      ObjectData.Phi=0;%default
     107% end
     108% if ~isfield(ObjectData,'Range')
     109%     ObjectData.Range(1,1)=0; %edfault
     110% end
     111% if size(ObjectData.Range,2)>=2
     112%     YMax=ObjectData.Range(1,2);%default
     113% end
     114% if size(ObjectData.Range,2)>=2 & size(ObjectData.Range,1)>=2
     115%     YMin=ObjectData.Range(2,2);
     116% else
     117%     YMin=0;
     118% end
     119if isfield(ObjectData,'RangeX') && ~isempty(ObjectData.RangeX)
     120    XMax=max(ObjectData.RangeX);
     121    XMin=min(ObjectData.RangeX);
     122end
     123if isfield(ObjectData,'RangeY')&&~isempty(ObjectData.RangeY)
     124    YMax=max(ObjectData.RangeY);
     125    YMin=min(ObjectData.RangeY);
     126end
     127if isfield(ObjectData,'RangeZ')&&~isempty(ObjectData.RangeZ)
     128    ZMax=max(ObjectData.RangeZ);
     129    ZMin=min(ObjectData.RangeZ);
     130end
     131switch ObjectData.Type
     132    case 'points'
     133        if strcmp(ObjectData.ProjMode,'projection')
     134            YMax=max(XMax,YMax);
     135            YMax=max(YMax,ZMax);
     136        end
     137    case {'rectangle','ellipse','volume'}
     138        if  isequal(YMax,0)
     139            ylim=get(haxes,'YLim');
     140            YMax=(ylim(2)-ylim(1))/100;
     141        end
     142        if isequal(XMax,0)
     143            XMax=YMax;%default
     144        end
     145    case 'plane'
     146        if  isequal(XMax,0)
     147            xlim=get(haxes,'XLim');
     148            XMax=xlim(2);
     149        end
     150        if  isequal(YMax,0)
     151            ylim=get(haxes,'YLim');
     152            YMax=ylim(2);
     153        end
    155154end
    156155sizcoord=size(ObjectData.Coord);
    157156
    158157%% determine the coordinates xline, yline,xsup,xinf, yinf,ysup determining the new object plot
    159 test_line= isequal(ObjectData.Style,'points')|isequal(ObjectData.Style,'line')|isequal(ObjectData.Style,'polyline')|...
    160     isequal(ObjectData.Style,'polygon')| isequal(ObjectData.Style,'plane')| isequal(ObjectData.Style,'volume');
    161 test_patch=isequal(ObjectData.ProjMode,'inside')||isequal(ObjectData.ProjMode,'outside')||isequal(ObjectData.Style,'volume')...
     158test_line= isequal(ObjectData.Type,'points')|isequal(ObjectData.Type,'line')|isequal(ObjectData.Type,'polyline')|...
     159    isequal(ObjectData.Type,'polygon')| isequal(ObjectData.Type,'plane')| isequal(ObjectData.Type,'volume');
     160test_patch=isequal(ObjectData.ProjMode,'inside')||isequal(ObjectData.ProjMode,'outside')||isequal(ObjectData.Type,'volume')...
    162161    ||isequal(ObjectData.ProjMode,'mask_inside')||isequal(ObjectData.ProjMode,'mask_outside');
    163162if test_line
     
    165164    yline=ObjectData.Coord(:,2);
    166165    nbpoints=numel(xline);
    167     if isequal(ObjectData.Style,'polygon')
     166    if isequal(ObjectData.Type,'polygon')
    168167        xline=[xline; ObjectData.Coord(1,1)];%closing the line
    169168        yline=[yline; ObjectData.Coord(1,2)];
    170     elseif isequal(ObjectData.Style,'plane')|| isequal(ObjectData.Style,'volume')
     169    elseif isequal(ObjectData.Type,'plane')|| isequal(ObjectData.Type,'volume')
    171170        phi=ObjectData.Phi*pi/180;%angle in radians
    172171        Xend_x=xline(1)+XMax*cos(phi);
     
    195194        end
    196195    end
    197     if isequal(ObjectData.Style,'line')||isequal(ObjectData.Style,'polyline')||isequal(ObjectData.Style,'polygon')
     196    if isequal(ObjectData.Type,'line')||isequal(ObjectData.Type,'polyline')||isequal(ObjectData.Type,'polygon')
    198197        if length(xline)<2
    199198            theta=0;
     
    220219    npMy=512; 
    221220    flag=zeros(npMy,npMx);
    222     if isequal(ObjectData.Style,'ellipse')
     221    if isequal(ObjectData.Type,'ellipse')
    223222        XimaMin=ObjectData.Coord(1,1)-XMax;
    224223        XimaMax=ObjectData.Coord(1,1)+XMax;
     
    237236        distY=(Yi-ObjectData.Coord(1,2));
    238237        flag=(distX.*distX/X2Max+distY.*distY/Y2Max)<1;
    239     elseif isequal(ObjectData.Style,'rectangle')||isequal(ObjectData.Style,'volume')
     238    elseif isequal(ObjectData.Type,'rectangle')||isequal(ObjectData.Type,'volume')
    240239        XimaMin=ObjectData.Coord(1,1)-XMax;
    241240        XimaMax=ObjectData.Coord(1,1)+XMax;
     
    252251        distY=abs(Yi-ObjectData.Coord(1,2));
    253252        flag=distX<XMax & distY< YMax;
    254     elseif isequal(ObjectData.Style,'polygon')
     253    elseif isequal(ObjectData.Type,'polygon')
    255254        XimaMin=min(ObjectData.Coord(:,1));
    256255        XimaMax=max(ObjectData.Coord(:,1));
     
    286285    %modify subobjects
    287286        if isfield(PlotData,'SubObject')
    288            if length(PlotData.SubObject)==2 && ~isequal(ObjectData.Style,'points')&& ~isequal(ObjectData.Style,'plane');
     287           if length(PlotData.SubObject)==2 && ~isequal(ObjectData.Type,'points')&& ~isequal(ObjectData.Type,'plane');
    289288                set(PlotData.SubObject(1),'XData',xinf);
    290289                set(PlotData.SubObject(1),'YData',yinf);
    291290                set(PlotData.SubObject(2),'XData',xsup);
    292291                set(PlotData.SubObject(2),'YData',ysup);
    293            elseif isequal(ObjectData.Style,'points')&& ~isequal(YMax,0)
     292           elseif isequal(ObjectData.Type,'points')&& ~isequal(YMax,0)
    294293               for ipt=1:min(length(PlotData.SubObject),size(ObjectData.Coord,1))
    295294                    set(PlotData.SubObject(ipt),'Position',[ObjectData.Coord(ipt,1)-YMax ObjectData.Coord(ipt,2)-YMax 2*YMax 2*YMax])
     
    321320           end
    322321        end
    323     elseif isequal(ObjectData.Style,'rectangle')||isequal(ObjectData.Style,'ellipse')
     322    elseif isequal(ObjectData.Type,'rectangle')||isequal(ObjectData.Type,'ellipse')
    324323        set(hplot,'Position',[ObjectData.Coord(1,1)-XMax ObjectData.Coord(1,2)-YMax 2*XMax 2*YMax])         
    325324    end
     
    358357    set(hother,'Color','b');
    359358    set(hother,'Selected','off') 
    360     if isequal(ObjectData.Style,'points')
     359    if isequal(ObjectData.Type,'points')
    361360        hh=line(ObjectData.Coord(:,1),ObjectData.Coord(:,2),'Color',col,'LineStyle','.','Marker','+');
    362361        for ipt=1:length(xline)
     
    370369              end
    371370        end
    372     elseif  strcmp(ObjectData.Style,'line')||strcmp(ObjectData.Style,'polyline')||...       
    373           strcmp(ObjectData.Style,'polygon') ||strcmp(ObjectData.Style,'plane')||strcmp(ObjectData.Style,'volume')%  (isequal(ObjectData.Style,'polygon') & ~test_patch) |isequal(ObjectData.Style,'plane')
     371    elseif  strcmp(ObjectData.Type,'line')||strcmp(ObjectData.Type,'polyline')||...       
     372          strcmp(ObjectData.Type,'polygon') ||strcmp(ObjectData.Type,'plane')||strcmp(ObjectData.Type,'volume')%  (isequal(ObjectData.Type,'polygon') & ~test_patch) |isequal(ObjectData.Type,'plane')
    374373        hh=line(xline,yline,'Color',col);
    375         if ~strcmp(ObjectData.Style,'plane') && ~strcmp(ObjectData.Style,'volume')
     374        if ~strcmp(ObjectData.Type,'plane') && ~strcmp(ObjectData.Type,'volume')
    376375            PlotData.SubObject(1)=line(xinf,yinf,'Color',col,'LineStyle',SubLineStyle,'Tag','proj_object');%draw sub-lines
    377376            PlotData.SubObject(2)=line(xsup,ysup,'Color',col,'LineStyle',SubLineStyle,'Tag','proj_object');
     
    382381        end
    383382   
    384     elseif strcmp(ObjectData.Style,'rectangle')
     383    elseif strcmp(ObjectData.Type,'rectangle')
    385384        hh=rectangle('Position',[ObjectData.Coord(1,1)-XMax ObjectData.Coord(1,2)-YMax 2*XMax 2*YMax],'EdgeColor',col);   
    386     elseif strcmp(ObjectData.Style,'ellipse')
     385    elseif strcmp(ObjectData.Type,'ellipse')
    387386        hh=rectangle('Curvature',[1 1],'Position',[ObjectData.Coord(1,1)-XMax ObjectData.Coord(1,2)-YMax 2*XMax 2*YMax],'EdgeColor',col);
    388387    else
    389         msgbox_uvmat('ERROR','unknown ObjectData.Style in plot_object.m')
     388        msgbox_uvmat('ERROR','unknown ObjectData.Type in plot_object.m')
    390389        return
    391390    end
  • trunk/src/proj_field.m

    r372 r379  
    1717%INPUT
    1818% ObjectData: structure characterizing the projection object
    19 %    .Style : style of projection object
    20 %    .ProjMode=type of projection ;
    21 %    .CoordType: 'px' or 'phys' type of coordinates defining the object position
     19%    .Type : type of projection object
     20%    .ProjMode=mode of projection ;
     21%    .CoordUnit: 'px', 'cm' units for the coordinates defining the object
    2222%    .Phi  angle of rotation (=0 by default)
    2323%    .ProjAngle=angle of projection;
     
    8888end
    8989
    90 %% in the absence of object Style or projection mode, or object coordinaes, the input field is just tranfered without change
    91 if ~isfield(ObjectData,'Style')||~isfield(ObjectData,'ProjMode')
     90%% in the absence of object Type or projection mode, or object coordinaes, the input field is just tranfered without change
     91if ~isfield(ObjectData,'Type')||~isfield(ObjectData,'ProjMode')
    9292    ProjData=FieldData;
    9393    return
    9494end
    9595if ~isfield(ObjectData,'Coord')
    96     if strcmp(ObjectData.Style,'plane')
     96    if strcmp(ObjectData.Type,'plane')
    9797        ObjectData.Coord=[0 0 0];%default
    9898    else
     
    124124
    125125%% apply projection depending on the object style
    126 switch ObjectData.Style
     126switch ObjectData.Type
    127127    case 'points'
    128128    [ProjData,errormsg]=proj_points(FieldData,ObjectData);
     
    480480%select the indices in the range of action
    481481    testin=[];%default
    482     if isequal(ObjectData.Style,'rectangle')
     482    if isequal(ObjectData.Type,'rectangle')
    483483%            if ~isfield(ObjectData,'RangeX')|~isfield(ObjectData,'RangeY')
    484484%                 errormsg='rectangle half sides RangeX and RangeY needed'
     
    494494           testin=distX<widthx & distY<widthy;
    495495       end
    496     elseif isequal(ObjectData.Style,'polygon')
     496    elseif isequal(ObjectData.Type,'polygon')
    497497        if testX
    498498            testin=inpolygon(coord_x,coord_y,ObjectData.Coord(:,1),ObjectData.Coord(:,2));
     
    502502           testin=[]; %A REVOIR
    503503       end
    504     elseif isequal(ObjectData.Style,'ellipse')
     504    elseif isequal(ObjectData.Type,'ellipse')
    505505       X2Max=widthx*widthx;
    506506       Y2Max=(widthy)*(widthy);
     
    567567ProjMode='projection';%direct projection on the line by default
    568568if isfield(ObjectData,'ProjMode'),ProjMode=ObjectData.ProjMode; end;
    569 ProjAngle=90; %90 degrees projection by default
    570 if isfield(FieldData,'ProjAngle'),ProjAngle=ObjectData.ProjAngle; end;
     569% ProjAngle=90; %90 degrees projection by default
     570% if isfield(FieldData,'ProjAngle'),ProjAngle=ObjectData.ProjAngle; end;
    571571width=0;%default width of the projection band
    572 if isfield(ObjectData,'Range')&size(ObjectData.Range,2)>=2
     572if isfield(ObjectData,'Range')&&size(ObjectData.Range,2)>=2
    573573    width=abs(ObjectData.Range(1,2));
    574574end
     
    777777    %case of structured coordinates
    778778    elseif  numel(VarType.coord)>=2 & VarType.coord(1:2) > 0;
    779         if ~isequal(ObjectData.Style,'line')% exclude polyline
    780             errormsg=['no  projection available on ' ObjectData.Style 'for structured coordinates']; %
     779        if ~isequal(ObjectData.Type,'line')% exclude polyline
     780            errormsg=['no  projection available on ' ObjectData.Type 'for structured coordinates']; %
    781781        else
    782782            test_Amat=1;%image or 2D matrix
     
    949949testangle=~isequal(PlaneAngle,[0 0 0]);% && ~test90y && ~test90x;%=1 for slanted plane
    950950
    951 % Phi=0;%default
    952 % Theta=0;
    953 % Psi=0;
    954 % if isfield(ObjectData,'Phi')&& ~isempty(ObjectData.Phi)
    955 %     Phi=(pi/180)*ObjectData.Phi;%first Euler angle in radian
    956 % end
    957 % if isfield(ObjectData,'Theta')&& ~isempty(ObjectData.Theta)
    958 %     Theta=(pi/180)*ObjectData.Theta;%second Euler angle in radian
    959 % end
    960 % if isfield(ObjectData,'Psi')&& ~isempty(ObjectData.Psi)
    961 %     Psi=(pi/180)*ObjectData.Psi;%third Euler angle in radian
    962 % end
    963 
    964 %components of the unity vector normal to the projection plane
    965 % NormVec_X=-sin(Phi)*sin(Theta);
    966 % NormVec_Y=cos(Phi)*sin(Theta);
    967 % NormVec_Z=cos(Theta);
    968 
    969951%mesh sizes DX and DY
    970952DX=0;
    971953DY=0; %default
    972 if isfield(ObjectData,'DX')&~isempty(ObjectData.DX)
     954if isfield(ObjectData,'DX') && ~isempty(ObjectData.DX)
    973955     DX=abs(ObjectData.DX);%mesh of interpolation points
    974956end
    975 if isfield(ObjectData,'DY')&~isempty(ObjectData.DY)
     957if isfield(ObjectData,'DY') && ~isempty(ObjectData.DY)
    976958     DY=abs(ObjectData.DY);%mesh of interpolation points
    977959end
     
    21872169%% transfer coordinate unit
    21882170if isfield(FieldData,'CoordUnit')
    2189     if isfield(ObjectData,'CoordUnit')&~isequal(FieldData.CoordUnit,ObjectData.CoordUnit)
    2190         errormsg=[ObjectData.Style ' in ' ObjectData.CoordUnit ' coordinates, while field in ' FieldData.CoordUnit ];
     2171    if isfield(ObjectData,'CoordUnit') && ~strcmp(FieldData.CoordUnit,ObjectData.CoordUnit)
     2172        errormsg=[ObjectData.Type ' in ' ObjectData.CoordUnit ' coordinates, while field in ' FieldData.CoordUnit ];
    21912173        return
    21922174    else
     
    21962178
    21972179%% store the properties of the projection object
    2198 ListObject={'Style','ProjMode','RangeX','RangeY','RangeZ','Phi','Theta','Psi','Coord'};
     2180ListObject={'Type','ProjMode','RangeX','RangeY','RangeZ','Phi','Theta','Psi','Coord'};
    21992181for ilist=1:length(ListObject)
    22002182    if isfield(ObjectData,ListObject{ilist})
  • trunk/src/read_GUI.m

    r363 r379  
    55struct=[];%default
    66hchild=get(handle,'children');
     7hchild=flipdim(hchild,1);% reverse the order to respect the tab order in the GUI
    78for ichild=1:numel(hchild)
    89    if strcmp(get(hchild(ichild),'Visible'),'on')
     
    1516                object_style=get(hchild(ichild),'Style');
    1617                check_input=1;%default
     18                index=0;
    1719                switch object_style
    1820                    case {'checkbox','radiobutton','togglebutton'}
    1921                        input=get(hchild(ichild),'Value');
    2022                    case 'edit'
    21                         separator=regexp(tag,'^num_');
     23                        separator=regexp(tag,'^num_','once');%look for the prefix 'num_'
    2224                        if isempty(separator)
    2325                            input=get(hchild(ichild),'String');
    24                         else
    25                             input=str2double(get(hchild(ichild),'String'));
     26                        else  %transform into numeric if the edit box begins by the prefix 'num_'                                           
     27                            input=str2double(get(hchild(ichild),'String'));                       
    2628                            tag=regexprep(tag,'^num_','');
     29                            % detect tag name ending by an index: then interpret the input as array(index)
     30                            r=regexp(tag,'_(?<index>\d+)$','names');% detect tag name ending by an index
     31                            if ~isempty(r)
     32                                tag=regexprep(tag,['_' r.index '$'],'');
     33                                index=str2double(r.index);
     34                            end
    2735                            %deal with undefined input: retrieve the default value stored as UserData
    2836                            if isnan(input)
     
    3947                            check_input=0;
    4048                        end
    41                         separator=regexp(tag,'^num_');
     49                        separator=regexp(tag,'^num_','once');
    4250                        if ~isempty(separator)
    4351                            input=str2double(input);% transform to numerical values if the uicontrol tag begins with 'num_'
     
    4856                end
    4957                if check_input
    50                     struct.(tag)=input;
     58                    if index==0
     59                       struct.(tag)=input;
     60                    else
     61                       struct.(tag)(index)=input;
     62                    end
    5163                end
    5264            case 'uitable'
  • trunk/src/read_civdata.m

    r372 r379  
    7272end
    7373if vardetect(1)==0
    74      errormsg=[ 'requested field not available in ' filename '/' VelType];
     74     errormsg=[ 'requested field not available in ' filename '/' VelType ': need to run patch'];
    7575     return
    7676end
  • trunk/src/read_field.m

    r354 r379  
     1
    12%'read_field': read input fields in different formats
    23%--------------------------------------------------------------------------
     
    6162                    ParamOut.ColorVar='ima_cor';
    6263                    InputField=[{ParamOut.FieldName} {ParamOut.ColorVar}];
    63                     [Field,ParamOut.VelType]=read_civdata(ObjectName,InputField,ParamIn.VelType);
     64                    [Field,ParamOut.VelType,errormsg]=read_civdata(ObjectName,InputField,ParamIn.VelType);
    6465                    test_civx=Field.CivStage;
    6566                    %case of old civx conventions
  • trunk/src/read_set_object.m

    r206 r379  
    1515function data=read_set_object(handles)
    1616%menus
    17 if isfield(handles,'ObjectStyle')%case of the set_object interface
    18         menu=get(handles.ObjectStyle,'String');
    19         value=get(handles.ObjectStyle,'Value');
    20         data.Style=menu{value};
    21         menu=get(handles.ProjMode,'String');
    22         value=get(handles.ProjMode,'Value');
    23         data.ProjMode=menu{value};
    24         data.CoordUnit=get(handles.CoordUnit,'String');
    25     testcalib=0;
    26 else %default
    27     data.Style='points';
    28     testcalib=1;
    29 end
     17data=read_GUI(handles);
    3018
    31 %Euler angles and projection ranges
    32 if ~testcalib
    33     if isequal(get(handles.Phi,'Visible'),'on')
    34         data.Angle(1)=str2double(get(handles.Phi,'String'));
    35     end
    36     if isequal(get(handles.Theta,'Visible'),'on')
    37         data.Angle(2)=str2double(get(handles.Theta,'String'));
    38     end
    39     if isequal(get(handles.Psi,'Visible'),'on')
    40         data.Angle(3)=str2double(get(handles.Psi,'String'));
    41     end
    42     if isequal(get(handles.DX,'Visible'),'on')
    43         data.DX=str2num(get(handles.DX,'String'));
    44     end
    45     if isequal(get(handles.DY,'Visible'),'on')
    46         data.DY=str2num(get(handles.DY,'String'));
    47     end
    48     if isequal(get(handles.DZ,'Visible'),'on')
    49         data.DZ=str2num(get(handles.DZ,'String'));
    50     end
    51     dimrange=[1 1];%default
    52     if isequal(get(handles.ZMin,'Visible'),'on')
    53         ZMin=str2num(get(handles.ZMin,'String'));
    54         if ~isempty(ZMin)
    55             data.RangeZ(1)=ZMin;
    56             dimrange=[2 3];
    57         end
    58     end
    59     if isequal(get(handles.ZMax,'Visible'),'on')
    60         ZMax=str2double(get(handles.ZMax,'String'));
    61         if isnan(ZMax)
    62             if dimrange(1)>1
    63                 data.RangeZ(1)=ZMax;
    64             end
    65         else
    66             data.RangeZ(2)=ZMax;
    67             dimrange=[dimrange(1) 3];
    68         end
    69     end
    70     if isequal(get(handles.YMin,'Visible'),'on')
    71         YMin=str2double(get(handles.YMin,'String'));
    72         if ~isnan(YMin)
    73             data.RangeY(2)=YMin;
    74             dimrange=[2 max(dimrange(2),2)];
    75         end
    76     end
    77     if isequal(get(handles.YMax,'Visible'),'on')
    78         YMax=str2double(get(handles.YMax,'String'));
    79         if ~isnan(YMax)
    80             data.RangeY(1)=YMax;
    81             dimrange=[dimrange(1) max(dimrange(2),2)];
    82         end
    83     end
    84     if isequal(get(handles.XMin,'Visible'),'on')
    85         XMin=str2double(get(handles.XMin,'String'));
    86         if ~isnan(XMin)
    87             data.RangeX(2)=XMin;
    88         end
    89     end
    90     if isequal(get(handles.XMax,'Visible'),'on')
    91         XMax=str2double(get(handles.XMax,'String'));
    92         if ~isnan(XMax)
    93             data.RangeX(1)=XMax;
    94         end
    95     end
    96 end
    97 
    98 
    99 %positions x,y,z
    100 Xcolumn=get(handles.XObject,'String');
    101 Ycolumn=get(handles.YObject,'String');
    102 if ischar(Xcolumn)
    103     sizchar=size(Xcolumn);
    104     for icol=1:sizchar(1)
    105         Xcolumn_cell{icol}=Xcolumn(icol,:);
    106     end
    107     Xcolumn=Xcolumn_cell;
    108 end
    109 if ischar(Ycolumn)
    110     sizchar=size(Ycolumn);
    111     for icol=1:sizchar(1)
    112         Ycolumn_cell{icol}=Ycolumn(icol,:);
    113     end
    114     Ycolumn=Ycolumn_cell;
    115 end
    116 Zcolumn={};%default
    117 if isequal(get(handles.ZObject,'Visible'),'on')
    118     data.NbDim=3; %test 3D object
    119     Zcolumn=get(handles.ZObject,'String');
    120     if ischar(Zcolumn)
    121         Zcolumn={Zcolumn};
    122     end
    123 end
    124 nb_points=min(length(Xcolumn),length(Ycolumn));%number of point positions needed to define the object position
    125 if isequal (data.Style,'line');
    126     nb_defining_points=2;
    127 elseif isequal(data.Style,'plane')|isequal(data.Style,'rectangle')|isequal(data.Style,'ellipse')
    128     nb_defining_points=1;
    129 else
    130     nb_defining_points=nb_points;
    131 end
    132 data_XObject=[];
    133 data_YObject=[];
    134 data_ZObject=[];
    135 for i=1:nb_points
    136     Xnumber=str2num(Xcolumn{i});
    137     Ynumber=str2num(Ycolumn{i});
    138     if isempty(Xnumber)|isempty(Ynumber)
    139         break
    140     else
    141         data_XObject=[data_XObject; Xnumber(1)];
    142         data_YObject=[data_YObject; Ynumber(1)];
    143     end
    144     if length(Zcolumn)<i | isempty(str2num(Zcolumn{i}))
    145         data_ZObject=[data_ZObject; 0];
    146     else
    147         data_ZObject=[data_ZObject; str2num(Zcolumn{i})];
    148     end
    149 end
    150 if nb_defining_points > nb_points
    151     for i=nb_points+1:nb_defining_points
    152         data_XObject=[0;data_XObject];
    153         data_YObject=[0;data_YObject];
    154         data_ZObject=[0;data_ZObject];
    155     end
    156 end
    157 if isempty(data_XObject)
    158     data_XObject=0;
    159 end
    160 if isempty(data_YObject)
    161     data_YObject=0;
    162 end
    163 if isempty(data_ZObject)
    164     data_ZObject=0;
    165 end
    166 data.Coord=[data_XObject data_YObject data_ZObject];
    167 
    168 set(handles.XObject,'String',mat2cell(data_XObject,length(data_XObject)))%correct the interface display
    169 set(handles.YObject,'String',mat2cell(data_YObject,length(data_XObject)))
    170 set(handles.ZObject,'String',mat2cell(data_ZObject,length(data_XObject)))
    171 
    172 
     19% %Euler angles and projection ranges
     20% if isfield(data,'Angle_x')
     21%     data.Angle(1)=data.Angle_x;
     22%     data=rmfield(data,'Angle_x');
     23% end
     24% if isfield(data,'Angle_y')
     25%     data.Angle(2)=data.Angle_y;
     26%     data=rmfield(data,'Angle_y');
     27% end
     28% if isfield(data,'Angle_z')
     29%     data.Angle(3)=data.Angle_z;
     30%     data=rmfield(data,'Angle_z');
     31% end
     32% % ranges of projection
     33% data.RangeZ=[];
     34% data.RangeY=[];
     35% data.RangeX=[];
     36% if isfield(data,'ZMin')&& ~isempty(data.ZMin)
     37%     data.RangeZ=data.ZMin;
     38%     data=rmfield(data,'ZMin');
     39% end
     40% if isfield(data,'ZMax')&& ~isempty(data.ZMax)
     41%     data.RangeZ=[data.RangeZ data.ZMax];
     42%     data=rmfield(data,'ZMax');
     43% end
     44% if isfield(data,'YMin')&& ~isempty(data.YMin)
     45%     data.RangeY=data.YMin;
     46%     data=rmfield(data,'YMin');
     47% end
     48% if isfield(data,'YMax')&& ~isempty(data.YMax)
     49%     data.RangeY=[data.RangeY data.YMax];
     50%     data=rmfield(data,'YMax');
     51% end
     52% if isfield(data,'XMin')&& ~isempty(data.XMin)
     53%     data.RangeX=data.XMin;
     54%     data=rmfield(data,'XMin');
     55% end
     56% if isfield(data,'XMax')&& ~isempty(data.XMax)
     57%     data.RangeX=[data.RangeX data.XMax];
     58%     data=rmfield(data,'XMax');
     59% end
     60%
     61%
     62%
     63%
  • trunk/src/set_object.m

    r342 r379  
    1212%    .ProjMode
    1313%    .CoordType: 'phys' or 'px'
    14 %    .DX,.DY,.DZ : mesh along each dirction
     14%    .num_DX,.num_DY,.num_DZ : mesh along each dirction
    1515%    .RangeX, RangeY
    1616%    .Coord(j,i), i=1, 2, 3,  components x, y, z of j=1...n position(s) characterizing the object components
     
    3636function varargout = set_object(varargin)
    3737
    38 % Last Modified by GUIDE v2.5 24-Nov-2008 14:29:06
     38% Last Modified by GUIDE v2.5 26-Jan-2012 22:00:47
    3939
    4040% Begin initialization code - DO NOT PLOT
     
    6565%        if=0; no associated object (used for series), the button 'PLOT' is  then unvisible
    6666%'data': read from an existing object selected in the interface
    67 %      .TITLE : class of object ('POINTS','LINE',....)
    68 %      .DX,DY,DZ; meshes for regular grids
     67%      .Name : class of object ('POINTS','LINE',....)
     68%      .num_DX,num_DY,num_DZ; meshes for regular grids
    6969%      .Coord: object position coordinates
    7070%      .ParentButton: handle of the uicontrol object calling the interface
     
    9292        enable_plot=data.enable_plot;%test to desable button PLOT (display mode)
    9393    end
    94     if isfield(data,'Name')
    95         set(handles.TITLE,'String',data.Name)
    96     end
    97     if ~isfield(data,'NbDim')||~isequal(data.NbDim,3)%2D case
    98         set(handles.ZObject,'Visible','off')
     94    if isfield(data,'Coord') &&size(data.Coord,2)==3
     95        set(handles.z_slider,'Visible','on')
     96    else
    9997        set(handles.z_slider,'Visible','off')
    100     else
    101         set(handles.ZObject,'Visible','on')
    102         set(handles.z_slider,'Visible','on')
    103         if isfield(data,'Coord') && size(data.Coord,2)==3
    104             set(handles.ZObject,'String',num2str(data.Coord(1,3),4))
    105         end
    106     end
    107     if isfield(data,'StyleMenu')
    108         set(handles.ObjectStyle,'String',data.StyleMenu);
    109     end
    110     if isfield(data,'Style')
    111         menu=get(handles.ObjectStyle,'String');
    112         for iline=1:length(menu)
    113             if isequal(menu{iline},data.Style)
    114                 set(handles.ObjectStyle,'Value',iline)
    115                 break
    116             end
    117         end
    118     end
    119     ObjectStyle_Callback(hObject, eventdata, handles)
    120     if isfield(data,'ProjMenu')
    121         set(handles.ProjMode,'String',data.ProjMenu);%overset the standard menu
    122     end
    123     if isfield(data,'ProjMode')
    124         menu=get(handles.ProjMode,'String');
    125         for iline=1:length(menu)
    126             if isequal(menu{iline},data.ProjMode)
    127                 set(handles.ProjMode,'Value',iline)
    128                 break
    129             end
    130         end
    131     end
    132     ProjMode_Callback(hObject, eventdata, handles)
    133     if isfield(data,'Coord')
    134         if ischar(data.Coord)
    135             data.Coord=str2num(data.Coord);
    136         elseif iscell(data.Coord)
    137             CoordCell=data.Coord;
    138             data.Coord=zeros(numel(CoordCell),3);
    139             data.Coord(:,3)=zeros(numel(CoordCell),1); % z component set to 0 by default
    140             for iline=1:numel(CoordCell)
    141                 line_vec=str2num(CoordCell{iline});
    142                 if numel(line_vec)==2
    143                     data.Coord(iline,1:2)=str2num(CoordCell{iline});
    144                 else
    145                     data.Coord(iline,:)=str2num(CoordCell{iline});
    146                 end
    147             end
    148         end
    149         if size(data.Coord,2)>=2
    150             sizcoord=size(data.Coord);
    151             for i=1:sizcoord(1)
    152                 XObject{i}=num2str(data.Coord(i,1),4);
    153                 YObject{i}=num2str(data.Coord(i,2),4);
    154             end
    155             set(handles.XObject,'String',XObject)
    156             set(handles.YObject,'String',YObject)
    157             if sizcoord(2)>3
    158                 for i=1:sizcoord(1)
    159                     ZObject{i}=num2str(data.Coord(i,3),4);
    160                 end
    161                 set(handles.ZObject,'String',ZObject)
    162             end
    163         end
    164     end
    165     if isfield(data,'DX')
    166         if ~ischar(handles.DX)
    167             data.DX=num2str(data.DX,3);
    168         end
    169         set(handles.DX,'String',data.DX)
    170     end
    171     if isfield(data,'DY')
    172         if ~ischar(handles.DY)
    173             data.DY=num2str(data.DY,3);
    174         end
    175         set(handles.DY,'String',data.DX)
    176     end
     98    end
     99    errormsg=fill_GUI(data,handles);
     100%     if isfield(data,'StyleMenu')
     101%         set(handles.Type,'String',data.StyleMenu);
     102%     end
     103%     if isfield(data,'Type')
     104%         menu=get(handles.Type,'String');
     105%         for iline=1:length(menu)
     106%             if isequal(menu{iline},data.Style)
     107%                 set(handles.Type,'Value',iline)
     108%                 break
     109%             end
     110%         end
     111%     end
     112    Type_Callback(hObject, eventdata, handles)
     113%     if isfield(data,'ProjMenu')
     114%         set(handles.ProjMode,'String',data.ProjMenu);%overset the standard menu
     115%     end
     116%     if isfield(data,'ProjMode')
     117%         menu=get(handles.ProjMode,'String');
     118%         for iline=1:length(menu)
     119%             if isequal(menu{iline},data.ProjMode)
     120%                 set(handles.ProjMode,'Value',iline)
     121%                 break
     122%             end
     123%         end
     124%     end
     125%    ProjMode_Callback(hObject, eventdata, handles)
     126%     if isfield(data,'Coord')
     127%         if ischar(data.Coord)
     128%             data.Coord=str2num(data.Coord);
     129%         elseif iscell(data.Coord)
     130%             CoordCell=data.Coord;
     131%             data.Coord=zeros(numel(CoordCell),3);
     132%             data.Coord(:,3)=zeros(numel(CoordCell),1); % z component set to 0 by default
     133%             for iline=1:numel(CoordCell)
     134%                 line_vec=str2num(CoordCell{iline});
     135%                 if numel(line_vec)==2
     136%                     data.Coord(iline,1:2)=str2num(CoordCell{iline});
     137%                 else
     138%                     data.Coord(iline,:)=str2num(CoordCell{iline});
     139%                 end
     140%             end
     141%         end
     142%         if size(data.Coord,2)>=2
     143%             sizcoord=size(data.Coord);
     144%             for i=1:sizcoord(1)
     145%                 XObject{i}=num2str(data.Coord(i,1),4);
     146%                 YObject{i}=num2str(data.Coord(i,2),4);
     147%             end
     148% %             set(handles.XObject,'String',XObject)
     149% %             set(handles.YObject,'String',YObject)
     150%             if sizcoord(2)>3
     151%                 for i=1:sizcoord(1)
     152%                     ZObject{i}=num2str(data.Coord(i,3),4);
     153%                 end
     154%                 set(handles.ZObject,'String',ZObject)
     155%             end
     156%         end
     157%     end
     158%     if isfield(data,'DX')
     159%         if ~ischar(handles.num_DX)
     160%             data.DX=num2str(data.DX,3);
     161%         end
     162%         set(handles.num_DX,'String',data.DX)
     163%     end
     164%     if isfield(data,'DY')
     165%         if ~ischar(handles.num_DY)
     166%             data.DY=num2str(data.DY,3);
     167%         end
     168%         set(handles.num_DY,'String',data.DX)
     169%     end
    177170    if isfield(data,'RangeZ') && length(ZBounds) >= 2
    178         set(handles.ZMax,'String',num2str(max(data.RangeZ),3))
     171        set(handles.num_RangeZ_2,'String',num2str(max(data.RangeZ),3))
    179172        DZ=max(data.RangeZ);%slider step
    180173        if ~isnan(ZBounds(1)) && ZBounds(2)~=ZBounds(1)
     
    192185            data.RangeX=str2num(data.RangeX);
    193186        end
    194         set(handles.XMax,'String',num2str(max(data.RangeX),3))
    195         set(handles.XMin,'String',num2str(min(data.RangeX),3))
     187        set(handles.num_RangeX_2,'String',num2str(max(data.RangeX),3))
     188        set(handles.num_RangeX_1,'String',num2str(min(data.RangeX),3))
    196189    end
    197190    if isfield(data,'RangeY')
     
    199192            data.RangeY=str2num(data.RangeY);
    200193        end
    201         set(handles.YMax,'String',num2str(max(data.RangeY),3))
    202         set(handles.YMin,'String',num2str(min(data.RangeY),3))
     194        set(handles.num_RangeY_2,'String',num2str(max(data.RangeY),3))
     195        set(handles.num_RangeY_1,'String',num2str(min(data.RangeY),3))
    203196    end
    204197    if isfield(data,'RangeZ')
     
    206199            data.RangeZ=str2num(data.RangeZ);
    207200        end
    208         set(handles.ZMax,'String',num2str(max(data.RangeZ),3))
     201        set(handles.num_RangeZ_2,'String',num2str(max(data.RangeZ),3))
    209202        if numel(data.RangeZ)>=2
    210             set(handles.ZMin,'String',num2str(min(data.RangeZ),3))
     203            set(handles.num_RangeZ_1,'String',num2str(min(data.RangeZ),3))
    211204        end
    212205    end 
    213206    if isfield(data,'Angle') && isequal(numel(data.Angle),3)
    214          set(handles.Phi,'String',num2str(data.Angle(1)))
    215          set(handles.Theta,'String',num2str(data.Angle(2)))
    216          set(handles.Psi,'String',num2str(data.Angle(3)))
    217     end
    218     if isfield(data,'DZ')
    219         if ~ischar(handles.DZ)
    220             data.DY=num2str(data.DZ,3);
    221         end
    222         set(handles.DZ,'String',data.DZ)
    223     end
    224     if isfield(data,'CoordUnit')
    225         set(handles.CoordUnit,'String',data.CoordUnit)
    226     end
     207         set(handles.num_Angle_1,'String',num2str(data.Angle(1)))
     208         set(handles.num_Angle_2,'String',num2str(data.Angle(2)))
     209         set(handles.num_Angle_3,'String',num2str(data.Angle(3)))
     210    end
     211%     if isfield(data,'DZ')
     212%         if ~ischar(handles.num_DZ)
     213%             data.DY=num2str(data.DZ,3);
     214%         end
     215%         set(handles.num_DZ,'String',data.DZ)
     216%     end
     217%     if isfield(data,'CoordUnit')
     218%         set(handles.CoordUnit,'String',data.CoordUnit)
     219%     end
    227220end
    228221if enable_plot
     
    241234end
    242235
     236
    243237%------------------------------------------------------------------------
    244238% --- Outputs from this function are returned to the command line.
     
    250244
    251245%------------------------------------------------------------------------
    252 % --- Executes on selection change in ObjectStyle.
    253 function ObjectStyle_Callback(hObject, eventdata, handles)
    254 %------------------------------------------------------------------------
    255 style_prev=get(handles.ObjectStyle,'UserData');%previous object style
    256 str=get(handles.ObjectStyle,'String');
    257 val=get(handles.ObjectStyle,'Value');
    258 style=str{val};
     246% --- Executes on selection change in Type.
     247function Type_Callback(hObject, eventdata, handles)
     248%------------------------------------------------------------------------
     249%style_prev=get(handles.Type,'UserData');%previous object style
     250ListType=get(handles.Type,'String');
     251Type=ListType{get(handles.Type,'Value')};
    259252% make correspondance between different object styles
    260 Xcolumn=get(handles.XObject,'String');
    261 Ycolumn=get(handles.YObject,'String');
    262 if ischar(Xcolumn)
    263     sizchar=size(Xcolumn);
    264     for icol=1:sizchar(1)
    265         Xcolumn_cell{icol}=Xcolumn(icol,:);
    266     end
    267     Xcolumn=Xcolumn_cell;
    268 end
    269 if ischar(Ycolumn)
    270     sizchar=size(Ycolumn);
    271     for icol=1:sizchar(1)
    272         Ycolumn_cell{icol}=Ycolumn(icol,:);
    273     end
    274     Ycolumn=Ycolumn_cell;
    275 end
    276 Zcolumn={};%default
    277 z_new={};
    278 if isequal(get(handles.ZObject,'Visible'),'on')
    279     %data.NbDim=3; %test 3D object
    280     Zcolumn=get(handles.ZObject,'String');
    281     if ischar(Zcolumn)
    282         Zcolumn={Zcolumn};
    283     end
    284 end
    285 x_new{1}=Xcolumn{1};
    286 y_new{1}=Ycolumn{1};
    287 if ~isempty(Zcolumn)
    288     z_new{1}=Zcolumn{1};
    289 end
    290 if isequal(style,'line')
    291     if strcmp(style_prev,'rectangle')||strcmp(style_prev,'ellipse')
    292         XMax=get(handles.XMax,'String');
    293         YMax=get(handles.YMax,'String');
    294         x_new{2}=num2str(XMax,4);
    295         y_new{2}=num2str(YMax,4);
    296         set(handles.XObject,'String',x_new)
    297         set(handles.YObject,'String',y_new)
    298         set(handles.ZObject,'String',z_new)
    299     end
    300 elseif isequal(style,'polyline')
    301 elseif strcmp(style,'rectangle')|| strcmp(style,'ellipse')
    302      set(handles.XObject,'String',x_new)
    303      set(handles.YObject,'String',y_new)
    304      set(handles.ZObject,'String',z_new)
    305 end
    306 
    307 switch style
     253Coord=get(handles.Coord,'Data');
     254%
     255% Xcolumn=get(handles.XObject,'String');
     256% Ycolumn=get(handles.YObject,'String');
     257% if ischar(Xcolumn)
     258%     sizchar=size(Xcolumn);
     259%     for icol=1:sizchar(1)
     260%         Xcolumn_cell{icol}=Xcolumn(icol,:);
     261%     end
     262%     Xcolumn=Xcolumn_cell;
     263% end
     264% if ischar(Ycolumn)
     265%     sizchar=size(Ycolumn);
     266%     for icol=1:sizchar(1)
     267%         Ycolumn_cell{icol}=Ycolumn(icol,:);
     268%     end
     269%     Ycolumn=Ycolumn_cell;
     270% end
     271% Zcolumn={};%default
     272% z_new={};
     273% if isequal(get(handles.ZObject,'Visible'),'on')
     274%     %data.NbDim=3; %test 3D object
     275%     Zcolumn=get(handles.ZObject,'String');
     276%     if ischar(Zcolumn)
     277%         Zcolumn={Zcolumn};
     278%     end
     279% end
     280% x_new{1}=Xcolumn{1};
     281% y_new{1}=Ycolumn{1};
     282% x_new{1}=Coord(1,1);
     283% y_new{1}=Coord(1,2);
     284% z_new{1}=Coord(1,3);
     285% if ~isempty(Zcolumn)
     286%     z_new{1}=Zcolumn{1};
     287% end
     288% if isequal(style,'line')
     289%     if strcmp(style_prev,'rectangle')||strcmp(style_prev,'ellipse')
     290%         num_RangeX_2=get(handles.num_RangeX_2,'String');
     291%         num_RangeY_2=get(handles.num_RangeY_2,'String');
     292%         x_new{2}=num2str(num_RangeX_2,4);
     293%         y_new{2}=num2str(num_RangeY_2,4);
     294%         set(handles.XObject,'String',x_new)
     295%         set(handles.YObject,'String',y_new)
     296%         set(handles.ZObject,'String',z_new)
     297%     end
     298% elseif isequal(style,'polyline')
     299% elseif strcmp(style,'rectangle')|| strcmp(style,'ellipse')
     300%      set(handles.XObject,'String',x_new)
     301%      set(handles.YObject,'String',y_new)
     302%      set(handles.ZObject,'String',z_new)
     303% end
     304
     305%% set the number of lines in the Coord table depending on object type
     306switch Type
     307    case{'line'}
     308        if size(Coord,1)<2
     309            if isequal(size(Coord,2),3)
     310                Coord=[Coord; 0 0 0];%add a line for edition (3D case)
     311            else
     312                Coord=[Coord; 0 0]; %add a line for edition (2D case)
     313            end
     314        else
     315            Coord=Coord(1:2,:);
     316        end
     317    case{'rectangle','ellipse','plane','volume'}
     318        Coord=Coord(1,:);
     319end
     320set(handles.Coord,'Data',Coord)
     321
     322%% set the projection menu and the corresponding options
     323switch Type
    308324    case {'points','line','polyline','plane'}
    309325        menu_proj={'projection';'interp';'filter';'none'};
     
    312328    case 'volume'
    313329        menu_proj={'interp';'none'};
     330    otherwise
     331        menu_proj={'projection';'interp';'filter';'none'};%default
    314332end   
    315333proj_index=get(handles.ProjMode,'Value');
     
    319337set(handles.ProjMode,'String',menu_proj)
    320338ProjMode_Callback(hObject, eventdata, handles)
     339
    321340%store the current option
    322 str=get(handles.ObjectStyle,'String');
    323 val=get(handles.ObjectStyle,'Value');
    324 set(handles.ObjectStyle,'UserData',style)
     341% str=get(handles.Type,'String');
     342% val=get(handles.Type,'Value');
     343% set(handles.Type,'UserData',style)
    325344
    326345%------------------------------------------------------------------------
     
    341360value=get(handles.ProjMode,'Value');
    342361ProjMode=menu{value};
    343 menu=get(handles.ObjectStyle,'String');
    344 value=get(handles.ObjectStyle,'Value');
     362menu=get(handles.Type,'String');
     363value=get(handles.Type,'Value');
    345364ObjectStyle=menu{value};
    346 test3D=isequal(get(handles.ZObject,'Visible'),'on');%3D case
    347 
     365%%%%%%%%% TODO
     366test3D=0; %TODO: update  test3D=isequal(get(handles.ZObject,'Visible'),'on');%3D case
     367%%%%%%%%%
    348368%default setting
    349 set(handles.Phi,'Visible','off')
    350 set(handles.Theta,'Visible','off')
    351 set(handles.Psi,'Visible','off')
    352 set(handles.XMin,'Visible','off')
    353 set(handles.XMax,'Visible','off')
    354 set(handles.YMin,'Visible','off')
     369set(handles.num_Angle_1,'Visible','off')
     370set(handles.num_Angle_2,'Visible','off')
     371set(handles.num_Angle_3,'Visible','off')
     372set(handles.num_RangeX_1,'Visible','off')
     373set(handles.num_RangeX_2,'Visible','off')
     374set(handles.num_RangeY_1,'Visible','off')
    355375if isequal(ProjMode,'interp')
    356     set(handles.YMax,'Visible','off')
    357 else
    358     set(handles.YMax,'Visible','on')
     376    set(handles.num_RangeY_2,'Visible','off')
     377else
     378    set(handles.num_RangeY_2,'Visible','on')
    359379end
    360380if strcmp(ObjectStyle,'rectangle')||strcmp(ObjectStyle,'ellipse')
    361     set(handles.XMax,'Visible','on')
    362 else
    363    set(handles.XMax,'Visible','off')
    364 end
    365 set(handles.ZMin,'Visible','off')
    366 set(handles.ZMax,'Visible','off')
    367 set(handles.DX,'Visible','off')
    368 set(handles.DY,'Visible','off')
    369 set(handles.DZ,'Visible','off')
     381    set(handles.num_RangeX_2,'Visible','on')
     382else
     383   set(handles.num_RangeX_2,'Visible','off')
     384end
     385set(handles.num_RangeZ_1,'Visible','off')
     386set(handles.num_RangeZ_2,'Visible','off')
     387set(handles.num_DX,'Visible','off')
     388set(handles.num_DY,'Visible','off')
     389set(handles.num_DZ,'Visible','off')
    370390
    371391switch ObjectStyle
    372392    case 'points'
    373         set(handles.YMax,'TooltipString','YMax: range of averaging around each point')
    374         set(handles.XObject,'TooltipString','XObject: set of x coordinates of the points')
    375         set(handles.YObject,'TooltipString','YObject: set of y coordinates of the points')
    376         set(handles.ZObject,'TooltipString','ZObject: set of z coordinates of the points')
     393        set(handles.num_RangeY_2,'TooltipString','num_YMax: range of projection around each point')
     394%         set(handles.XObject,'TooltipString','XObject: set of x coordinates of the points')
     395%         set(handles.YObject,'TooltipString','YObject: set of y coordinates of the points')
     396%         set(handles.ZObject,'TooltipString','ZObject: set of z coordinates of the points')
    377397    case {'line','polyline','polygon'}
    378         set(handles.YMax,'TooltipString','YMax: range of averaging around the line')
    379         set(handles.XObject,'TooltipString','XObject: set of x coordinates defining the line')
    380         set(handles.YObject,'TooltipString','YObject: set of y coordinates defining the line')
    381         set(handles.ZObject,'TooltipString','ZObject: set of z coordinates defining the line')
     398        set(handles.num_RangeY_2,'TooltipString','num_YMax: range of projection around the line')
     399         set(handles.Coord,'TooltipString','Coord: table of x,y, z coordinates defining the line')
     400%         set(handles.YObject,'TooltipString','YObject: set of y coordinates defining the line')
     401%         set(handles.ZObject,'TooltipString','ZObject: set of z coordinates defining the line')
    382402        if isequal(ProjMode,'interp')|| isequal(ProjMode,'filter')
    383             set(handles.DX,'Visible','on')
    384             set(handles.DX,'TooltipString','DX: mesh for the interpolated field along the line')
     403            set(handles.num_DX,'Visible','on')
     404            set(handles.num_DX,'TooltipString','num_DX: mesh for the interpolated field along the line')
    385405        end       
    386406    case {'rectangle','ellipse'}
    387         set(handles.XMax,'TooltipString',['XMax: half length of the ' ObjectStyle])
    388         set(handles.YMax,'TooltipString',['YMax: half width of the ' ObjectStyle])
    389         set(handles.XObject,'TooltipString',['XObject:  x coordinate of the ' ObjectStyle ' centre'])
    390         set(handles.YObject,'TooltipString',['YObject:  y coordinate of the ' ObjectStyle ' centre'])
     407        set(handles.num_RangeX_2,'TooltipString',['num_XMax: half length of the ' ObjectStyle])
     408        set(handles.num_RangeY_2,'TooltipString',['num_YMax: half width of the ' ObjectStyle])
     409%         set(handles.XObject,'TooltipString',['XObject:  x coordinate of the ' Type ' centre'])
     410%         set(handles.YObject,'TooltipString',['YObject:  y coordinate of the ' Type ' centre'])
    391411    case {'plane'} 
    392         set(handles.Psi,'Visible','on')
    393         set(handles.XMin,'Visible','on')
    394         set(handles.XMax,'Visible','on')
    395         set(handles.YMin,'Visible','on')
    396         set(handles.YMax,'Visible','on')
     412        set(handles.num_Angle_3,'Visible','on')
     413        set(handles.num_RangeX_1,'Visible','on')
     414        set(handles.num_RangeX_2,'Visible','on')
     415        set(handles.num_RangeY_1,'Visible','on')
     416        set(handles.num_RangeY_2,'Visible','on')
     417%         set(handles.XObject,'TooltipString',['XObject:  x coordinate of the axis origin for the ' Type])
     418%         set(handles.YObject,'TooltipString',['YObject:  y coordinate of the axis origin for the ' Type])
     419        set(handles.num_RangeZ_2,'TooltipString','num_ZMax: range of projection normal to the plane')
     420        if test3D
     421            set(handles.num_Angle_2,'Visible','on')
     422            set(handles.num_Angle_1,'Visible','on')
     423            set(handles.num_RangeZ_2,'Visible','on')
     424        end
     425        if isequal(ProjMode,'interp')|| isequal(ProjMode,'filter')
     426            set(handles.num_DX,'Visible','on')
     427            set(handles.num_DY,'Visible','on')
     428        else
     429            set(handles.num_DX,'Visible','off')
     430            set(handles.num_DY,'Visible','off')
     431        end
     432        if  isequal(ProjMode,'interp')
     433            set(handles.num_DZ,'Visible','on') 
     434        end
     435     case {'volume'} 
     436        set(handles.num_RangeX_1,'Visible','on')
     437        set(handles.num_RangeX_2,'Visible','on')
     438        set(handles.num_RangeY_1,'Visible','on')
     439        set(handles.num_RangeY_2,'Visible','on')
    397440        set(handles.XObject,'TooltipString',['XObject:  x coordinate of the axis origin for the ' ObjectStyle])
    398441        set(handles.YObject,'TooltipString',['YObject:  y coordinate of the axis origin for the ' ObjectStyle])
    399         set(handles.ZMax,'TooltipString','ZMax: range of projection normal to the plane')
    400         if test3D
    401             set(handles.Theta,'Visible','on')
    402             set(handles.Phi,'Visible','on')
    403             set(handles.ZMax,'Visible','on')
    404         end
     442        set(handles.num_Angle_1,'Visible','on')
     443        set(handles.num_Angle_2,'Visible','on')
     444        set(handles.num_Angle_3,'Visible','on')
     445        set(handles.num_RangeZ_1,'Visible','on')
     446        set(handles.num_RangeZ_2,'Visible','on')
    405447        if isequal(ProjMode,'interp')|| isequal(ProjMode,'filter')
    406             set(handles.DX,'Visible','on')
    407             set(handles.DY,'Visible','on')
     448            set(handles.num_DX,'Visible','on')
     449            set(handles.num_DY,'Visible','on')
     450            set(handles.num_DZ,'Visible','on')
    408451        else
    409             set(handles.DX,'Visible','off')
    410             set(handles.DY,'Visible','off')
    411         end
    412         if  isequal(ProjMode,'interp')
    413             set(handles.DZ,'Visible','on') 
    414         end
    415      case {'volume'} 
    416         set(handles.XMin,'Visible','on')
    417         set(handles.XMax,'Visible','on')
    418         set(handles.YMin,'Visible','on')
    419         set(handles.YMax,'Visible','on')
    420         set(handles.XObject,'TooltipString',['XObject:  x coordinate of the axis origin for the ' ObjectStyle])
    421         set(handles.YObject,'TooltipString',['YObject:  y coordinate of the axis origin for the ' ObjectStyle])
    422         set(handles.Phi,'Visible','on')
    423         set(handles.Theta,'Visible','on')
    424         set(handles.Psi,'Visible','on')
    425         set(handles.ZMin,'Visible','on')
    426         set(handles.ZMax,'Visible','on')
    427         if isequal(ProjMode,'interp')|| isequal(ProjMode,'filter')
    428             set(handles.DX,'Visible','on')
    429             set(handles.DY,'Visible','on')
    430             set(handles.DZ,'Visible','on')
    431         else
    432             set(handles.DX,'Visible','off')
    433             set(handles.DY,'Visible','off')
    434             set(handles.DZ,'Visible','off')
    435         end
    436 end
    437 %------------------------------------------------------------------------
    438 
    439 %------------------------------------------------------------------------
    440 function Phi_Callback(hObject, eventdata, handles)
     452            set(handles.num_DX,'Visible','off')
     453            set(handles.num_DY,'Visible','off')
     454            set(handles.num_DZ,'Visible','off')
     455        end
     456end
     457%------------------------------------------------------------------------
     458
     459%------------------------------------------------------------------------
     460function num_Angle_1_Callback(hObject, eventdata, handles)
    441461update_slider(hObject, eventdata,handles)
    442462%------------------------------------------------------------------------
    443463%------------------------------------------------------------------------
    444 function Theta_Callback(hObject, eventdata, handles)
     464function num_Angle_2_Callback(hObject, eventdata, handles)
    445465update_slider(hObject, eventdata,handles)
    446466%------------------------------------------------------------------------
    447467function update_slider(hObject, eventdata,handles)
    448468%rotation angles
    449 PlaneAngle(1)=str2num(get(handles.Phi,'String'));%first  angle in degrees
    450 PlaneAngle(2)=str2num(get(handles.Theta,'String'));%second  angle in degrees
    451 PlaneAngle(3)=str2num(get(handles.Psi,'String'));%second  angle in degrees
     469PlaneAngle(1)=str2num(get(handles.num_Angle_1,'String'));%first  angle in degrees
     470PlaneAngle(2)=str2num(get(handles.num_Angle_2,'String'));%second  angle in degrees
     471PlaneAngle(3)=str2num(get(handles.num_Angle_3,'String'));%second  angle in degrees
    452472om=norm(PlaneAngle);%norm of rotation angle in radians
    453473OmAxis=PlaneAngle/om; %unit vector marking the rotation axis
     
    468488end
    469489%------------------------------------------------------------------------
    470 function DX_Callback(hObject, eventdata, handles)
    471 %------------------------------------------------------------------------
    472 %------------------------------------------------------------------------
    473 function DY_Callback(hObject, eventdata, handles)
    474 %------------------------------------------------------------------------
    475 %------------------------------------------------------------------------
    476 function DZ_Callback(hObject, eventdata, handles)
    477 %------------------------------------------------------------------------
    478 
    479 %------------------------------------------------------------------------
    480 %-----------------------------------------------------
    481 % --- Executes on button press in OPEN: DESACTIVATED use uvmat browser
    482 function OPEN_Callback(hObject, eventdata, handles)
    483 %get the object file
    484 oldfile=' ';
    485 huvmat=findobj('Tag','uvmat');
    486 hchild=get(huvmat,'Children');
    487 hrootpath=findobj(hchild,'Tag','RootPath');
    488 if ~isempty(hrootpath)
    489     oldfile=get(hrootpath,'String');
    490     if iscell(oldfile)
    491         oldfile=oldfile{1};
    492     end
    493 end
    494 [FileName, PathName, filterindex] = uigetfile( ...
    495        {'*.xml;*.mat', ' (*.xml,*.mat)';
    496        '*.xml',  '.xml files '; ...
    497         '*.mat',  '.mat matlab files '}, ...
    498         'Pick a file',oldfile);
    499 fileinput=[PathName FileName];%complete file name
    500 testblank=findstr(fileinput,' ');%look for blanks
    501 if ~isempty(testblank)
    502     msgbox_uvmat('ERROR','forbidden input file name: contain blanks')
    503     return
    504 end
    505 sizf=size(fileinput);
    506 if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end
    507 
    508 %read the file
    509  t=xmltree(fileinput);
    510  s=convert(t);
    511  if ~isfield(s,'Style')
    512      s.Style='points';
    513  end
    514  if ~isfield(s,'ProjMode')
    515      s.ProjMode='none';
    516  end
    517 teststyle=0;
    518 
    519 switch s.Style
    520     case {'points','line','polyline','plane'}
    521         menu_proj={'projection';'interp';'filter';'none'};
    522     case {'polygon','rectangle','ellipse'}
    523         menu_proj={'inside';'outside';'mask_inside';'mask_outside'};
    524     case 'volume'
    525         menu_proj={'none'};
    526 end
    527 set(handles.ObjectStyle,'String',menu_proj)
    528 menu=get(handles.ObjectStyle,'String');
    529 for iline=1:length(menu)
    530     if isequal(menu{iline},s.Style)
    531         set(handles.ObjectStyle,'Value',iline)
    532         teststyle=1;
    533         break
    534     end
    535 end
    536 testmode=0;
    537 %menu=get(handles.ProjMode,'String');
    538 for iline=1:length(menu_proj)
    539     if isequal(menu_proj{iline},s.ProjMode)
    540         set(handles.ProjMode,'Value',iline)
    541         testmode=1;
    542         break
    543     end
    544 end
    545 
    546 ProjMode_Callback(hObject, eventdata, handles);%visualize the appropriate edit boxes
    547 if isfield(s,'XMax')
    548     set(handles.XMax,'String',s.XMax)
    549 end
    550 if isfield(s,'XMin')
    551     set(handles.XMin,'String',s.XMin)
    552 end
    553 if isfield(s,'YMax')
    554     set(handles.YMax,'String',s.YMax)
    555 end
    556 if isfield(s,'YMin')
    557     set(handles.YMin,'String',s.YMin)
    558 end
    559 Range=0;
    560 if isfield(s,'Range')
    561     if ischar(s.Range)
    562         Range=str2num(s.Range);
    563     else
    564         Range(1,:)=str2num(s.Range{1});
    565         Range(2,:)=str2num(s.Range{2});
    566     end
    567 end
    568 if size(Range,2)>=3
    569     if size(Range,1)>=2
    570        set(handles.ZMin,'String',num2str(Range(2,3),3))
    571     end
    572     if size(Range,1)>=2
    573        set(handles.ZMax,'String',num2str(Range(1,3),3))
    574     end
    575 end
    576 if size(Range,2)>=2
    577     if size(Range,1)>=2
    578        set(handles.YMin,'String',num2str(Range(2,2),3))
    579     end
    580     if size(Range,1)>=2
    581        set(handles.YMax,'String',num2str(Range(1,2),3))
    582     end
    583 end
    584 if size(Range,2)>=1
    585     if size(Range,1)>=2
    586        set(handles.XMin,'String',num2str(Range(2,1),3))
    587     end
    588     if size(Range,1)>=2
    589        set(handles.XMax,'String',num2str(Range(1,1),3))
    590     end
    591 end
    592 if isfield(s,'RangeX') & ischar(s.RangeX)
    593      RangeX=str2num(s.RangeX);
    594     set(handles.XMax,'String',num2str(max(RangeX),3))
    595     set(handles.XMin,'String',num2str(min(RangeX),3))
    596 end
    597 
    598 if isfield(s,'RangeY')
    599     if ischar(s.RangeY)
    600         RangeY=str2num(s.RangeY);
    601         set(handles.YMax,'String',num2str(max(RangeY),3))
    602         set(handles.YMin,'String',num2str(min(RangeY),3))
    603     end
    604 end
    605 if isfield(s,'RangeZ')
    606     if ischar(s.RangeZ)
    607         RangeZ=str2num(s.RangeZ);
    608         set(handles.ZMax,'String',num2str(max(RangeZ),3))
    609         set(handles.ZMin,'String',num2str(min(RangeZ),3))
    610     end
    611 end
    612 if isfield(s,'Phi')
    613     set(handles.Psi,'String',s.Phi)%old definition
    614 end
    615 if isfield(s,'Angle')&& isequal(numel(s.Angle),3)
    616     set(handles.Phi,'String',s.Angle(1))
    617     set(handles.Theta,'String',s.Angle(2))
    618     set(handles.Psi,'String',s.Angle(3))
    619 end
    620 % if isfield(s,'Psi')
    621 %     set(handles.Psi,'String',s.Psi)
    622 % end
    623 
    624 if isfield(s,'DX')
    625     set(handles.DX,'String',s.DX)
    626 end
    627 if isfield(s,'DY')
    628     set(handles.DY,'String',s.DY)
    629 end
    630 if ~isfield(s,'Coord')
    631     XObject='0';%default
    632     YObject='0';
    633 elseif ischar(s.Coord)
    634     line=str2num(s.Coord);
    635     XObject=num2str(line(1),4);
    636     YObject=num2str(line(2),4);
    637 else
    638     for i=1:length(s.Coord)
    639         line=str2num(s.Coord{i});
    640         XObject{i}=num2str(line(1),4);
    641         YObject{i}=num2str(line(2),4);
    642     end
    643 end
    644 set(handles.XObject,'String',XObject)
    645 set(handles.YObject,'String',YObject)
    646 
    647 %METTRA A JOUR ASPECT DE L'INTERFACE (COMME set_object_Opening
     490function num_DX_Callback(hObject, eventdata, handles)
     491%------------------------------------------------------------------------
     492%------------------------------------------------------------------------
     493function num_DY_Callback(hObject, eventdata, handles)
     494%------------------------------------------------------------------------
     495%------------------------------------------------------------------------
     496function num_DZ_Callback(hObject, eventdata, handles)
     497%------------------------------------------------------------------------
     498
     499%------------------------------------------------------------------------
    648500%------------------------------------------------------------------------
    649501%----------------------------------------------------
     
    675527
    676528%% read the object on the GUI set_object
    677 ObjectData=read_set_object(handles);%read the input parameters defining the object in the GUI set_object
    678 ObjectName=get(handles.TITLE,'String');%name of the current object defiend in set_object
     529%ObjectData=read_set_object(handles.set_object);%read the input parameters defining the object in the GUI set_object
     530ObjectData=read_GUI(handles.set_object);%read the input parameters defining the object in the GUI set_object
     531%ObjectData.Coord=cell2mat(ObjectData.Coord);
     532ObjectName=ObjectData.Name;%name of the current object defiend in set_object
    679533if isempty(ObjectName)
    680534    if get(hhuvmat.edit_object,'Value')% edit mode
    681535        ObjectName=ListObject{IndexObj(end)};%take the name of the last (second) selected item
    682536    else %new object
    683         StyleList=get(handles.ObjectStyle,'String');
    684         StyleVal=get(handles.ObjectStyle,'Value');
     537        StyleList=get(handles.Type,'String');
     538        StyleVal=get(handles.Type,'Value');
    685539        ObjectName=StyleList{StyleVal};
    686         %ObjectName=[num2str(numel(ListObject)+1) '-' StyleList{StyleVal}];% take the object style as default name
    687540    end
    688541end
     
    705558    end
    706559    ObjectName=ObjectNameNew;
    707 %     ObjectName=[num2str(IndexObj(end)) '-' ObjectData.Style];%default name
    708     set(handles.TITLE,'String',ObjectName)% display the default name in set_object
     560    set(handles.Name,'String',ObjectName)% display the default name in set_object
    709561    IndexObj(2)=numel(ListObject)+1;% append an object to the list in uvmat
    710562    set(hhuvmat.ListObject,'String',[ListObject;{ObjectName}]);%complement the object list
     
    712564    UvData.Object{IndexObj(2)}=[];%initiate a new object (empty yet)
    713565end
    714 % IndexObj_1=IndexObj(1);
    715 % % if isequal(get(hhuvmat.list_object_2,'Visible'),'on')
    716 % %     IndexObj_2=get(hhuvmat.list_object_2,'Value');
    717 % %     List2=get(hhuvmat.list_object_2,'String');
    718 % if numel(IndexObj)==2
    719 %     IndexObj_2=IndexObj(2);
    720 % else
    721 %     IndexObj_2=[];
    722 % end
    723566testnew=0;
    724 
    725567if numel(IndexObj)==1   % if only one object is selected, the projection is in uvmat
    726         PlotHandles=hhuvmat;
     568 %       PlotHandles=hhuvmat;
    727569    plotaxes=hhuvmat.axes3;%handle of axes3 in view_field
    728570else  % if a second object is selected, the projection is in view_field, and this second object is selected
     
    783625%------------------------------------------------------------------------
    784626%----------------------------------------------------
    785 function YMin_Callback(hObject, eventdata, handles)
    786 %------------------------------------------------------------------------
    787 
    788 function ZMin_Callback(hObject, eventdata, handles)
    789 %------------------------------------------------------------------------
    790 
    791 function ZMax_Callback(hObject, eventdata, handles)
    792 DZ=str2num(get(handles.ZMax,'String'));
     627function num_RangeY_1_Callback(hObject, eventdata, handles)
     628%------------------------------------------------------------------------
     629
     630function num_RangeZ_1_Callback(hObject, eventdata, handles)
     631%------------------------------------------------------------------------
     632
     633function num_RangeZ_2_Callback(hObject, eventdata, handles)
     634DZ=str2num(get(handles.num_RangeZ_2,'String'));
    793635ZMin=get(handles.z_slider,'Min');
    794636ZMax=get(handles.z_slider,'Max');
     
    799641end
    800642%------------------------------------------------------------------------
    801 function YMax_Callback(hObject, eventdata, handles)
    802 %------------------------------------------------------------------------
    803 
    804 function XMin_Callback(hObject, eventdata, handles)
    805 %------------------------------------------------------------------------
    806 
    807 function XMax_Callback(hObject, eventdata, handles)
     643function num_RangeY_2_Callback(hObject, eventdata, handles)
     644%------------------------------------------------------------------------
     645
     646function num_RangeX_1_Callback(hObject, eventdata, handles)
     647%------------------------------------------------------------------------
     648
     649function num_RangeX_2_Callback(hObject, eventdata, handles)
    808650%------------------------------------------------------------------------
    809651%------------------------------------------------------------------------
    810652function SAVE_Callback(hObject, eventdata, handles)
    811653% ------------------------------------------------------
    812 Object=read_set_object(handles);
     654%Object=read_set_object(handles);
     655Object=read_GUI(handles.set_object);
    813656huvmat=findobj('Tag','uvmat');
    814657% UvData=get(huvmat,'UserData');
     
    828671title={'object name'};
    829672dir_save=uigetdir(RootPath);
    830 ObjectName=get(handles.TITLE,'String');
     673ObjectName=get(handles.Name,'String');
    831674if ~isempty(ObjectName)&&~strcmp(ObjectName,'')
    832675    def={fullfile(dir_save,[ObjectName '.xml'])};
     
    859702sin_om=0;
    860703
    861 PlaneAngle(1)=str2double(get(handles.Phi,'String'));%first  angle in degrees
    862 PlaneAngle(2)=str2double(get(handles.Theta,'String'));%second  angle in degrees
    863 PlaneAngle(3)=str2double(get(handles.Psi,'String'));%second  angle in degrees
     704PlaneAngle(1)=str2double(get(handles.num_Angle_1,'String'));%first  angle in degrees
     705PlaneAngle(2)=str2double(get(handles.num_Angle_2,'String'));%second  angle in degrees
     706PlaneAngle(3)=str2double(get(handles.num_Angle_3,'String'));%second  angle in degrees
    864707PlaneAngle=(pi/180)*PlaneAngle;
    865708om=norm(PlaneAngle);%norm of rotation angle in radians
     
    878721
    879722%set new plane position and update graph
    880 set(handles.XObject,'String',num2str(norm_plane(1)*Z_value,4))
    881 set(handles.YObject,'String',num2str(norm_plane(2)*Z_value,4))
    882 set(handles.ZObject,'String',num2str(norm_plane(3)*Z_value,4))
     723% set(handles.XObject,'String',num2str(norm_plane(1)*Z_value,4))
     724% set(handles.YObject,'String',num2str(norm_plane(2)*Z_value,4))
     725% set(handles.ZObject,'String',num2str(norm_plane(3)*Z_value,4))
    883726PLOT_Callback(hObject, eventdata, handles)
    884727
     
    897740%------------------------------------------------------------------------
    898741
    899 
     742function Name_Callback(hObject, eventdata, handles)
     743% hObject    handle to Name (see GCBO)
     744% eventdata  reserved - to be defined in a future version of MATLAB
     745% handles    structure with handles and user data (see GUIDATA)
     746
     747% Hints: get(hObject,'String') returns contents of Name as text
     748%        str2double(get(hObject,'String')) returns contents of Name as a double
     749
     750%------------------------------------------------------------------------
     751% --- Executes when entered data in editable cell(s) in Coord.
     752function Coord_CellEditCallback(hObject, eventdata, handles)
     753%------------------------------------------------------------------------
     754ListType=get(handles.Type,'String');
     755Type=ListType{get(handles.Type,'Value')};
     756switch Type
     757    % add lines if multi line input needed
     758    case{'points','polyline','polygon'}
     759        Coord=get(handles.Coord,'Data');
     760        if isequal(size(Coord,2),3)
     761            Coord=[Coord;{[]} {[]} {[]}];%add a line for edition (3D case)
     762        else
     763            Coord=[Coord;{[]} {[]}]; %add a line for edition (2D case)
     764        end
     765        set(handles.Coord,'Data',Coord)
     766end
     767
     768
     769
     770function num_Angle_3_Callback(hObject, eventdata, handles)
     771% hObject    handle to num_Angle_3 (see GCBO)
     772% eventdata  reserved - to be defined in a future version of MATLAB
     773% handles    structure with handles and user data (see GUIDATA)
     774
     775% Hints: get(hObject,'String') returns contents of num_Angle_3 as text
     776%        str2double(get(hObject,'String')) returns contents of num_Angle_3 as a double
  • trunk/src/update_obj.m

    r302 r379  
    3030    end
    3131    Object_out{iobj}.DisplayHandle_uvmat=plot_object(Object_out{iobj},Object_out{IndexObj_1},hobject,'m');%update the object representation of Object_out{iobj} on Object_out{IndexObj_1}
    32     Object_out{iobj}.DisplayHandle_uvmat
    3332end
    3433% plot view_field
  • trunk/src/uvmat.m

    r371 r379  
    155155% Properties attached to projection objects (create, menuline, menuplane...):
    156156%    'Tag'='proj_object': for all projection objects
    157 %    ObjectData.Style=...: style of projection object:
     157%    ObjectData.Type=...: style of projection object:
    158158%              .ProjMode
    159159%              .Coord: defines the position of the object
     
    815815end
    816816if ~isempty(XmlData.Time)
    817     nbfield=size(XmlData.Time,1);
    818     nbfield_j=size(XmlData.Time,2);
     817%     nbfield=size(XmlData.Time,1);
     818%     nbfield_j=size(XmlData.Time,2);
    819819    %transform .Time to a column vector if it is a line vector the nomenclature uses a single index
    820820    if isequal(nbfield,1) && ~isequal(nbfield_j,1)% .Time is a line vector
     
    822822        if numel(NomType)>=2 &&(strcmp(NomType,'_i')||strcmp(NomType(1:2),'%0')||strcmp(NomType(1:2),'_%'))
    823823            XmlData.Time=(XmlData.Time)';
    824             nbfield=nbfield_j;
    825             nbfield_j=1;
     824%             nbfield=nbfield_j;
     825%             nbfield_j=1;
    826826        end
    827827    end
     
    21042104    set(handles.FixVelType,'Visible','on')
    21052105    menu=set_veltype_display(ParamOut.CivStage);
    2106     index_menu=strcmp(ParamOut.VelType,menu);
    2107     set(handles.VelType,'Value',find(index_menu,1))
     2106    index_menu=strcmp(ParamOut.VelType,menu);%look for VelType in  the menu
     2107    index_val=find(index_menu,1);
     2108    if isempty(index_val)
     2109        index_val=1;
     2110    end
     2111    set(handles.VelType,'Value',index_val)
    21082112    if ~get(handles.SubField,'value')
    2109     set(handles.VelType,'String',menu)
    2110      set(handles.VelType_1,'Value',1)
    2111      set(handles.VelType_1,'String',[{''};menu])
     2113        set(handles.VelType,'String',menu)
     2114        set(handles.VelType_1,'Value',1)
     2115        set(handles.VelType_1,'String',[{''};menu])
    21122116    end
    21132117else
     
    23322336    if test_set_object% reinitiate the GUI set_object
    23332337        delete_object(1);% delete the current projection object in the list UvData.Object, delete its graphic representations and update the list displayed in handles.ListObject and 2
    2334         UvData.Object{1}.Style='plane';%main plotting plane
     2338        UvData.Object{1}.Type='plane';%main plotting plane
    23352339        UvData.Object{1}.ProjMode='projection';%main plotting plane
    23362340        UvData.Object{1}.DisplayHandle_uvmat=[]; %plane not visible in uvmat
     
    31543158    edit_vect_Callback(hObject, eventdata, handles)
    31553159    %initiate set_object GUI
    3156     data.TITLE='VOLUME';
     3160    data.Name='VOLUME';
    31573161    if isfield(UvData,'CoordType')
    31583162        data.CoordType=UvData.CoordType;
     
    32403244            end
    32413245            if isfield(ObjectData,'Coord')& isfield(ObjectData,'Style')
    3242                 if isequal(ObjectData.Style,'polygon')
     3246                if isequal(ObjectData.Type,'polygon')
    32433247                    X=ObjectData.Coord(:,1);
    32443248                    Y=ObjectData.Coord(:,2);
     
    32473251                    end
    32483252                    flagobj=~inpolygon(Xi,Yi,X',Y');%=0 inside the polygon, 1 outside                 
    3249                 elseif isequal(ObjectData.Style,'ellipse')
     3253                elseif isequal(ObjectData.Type,'ellipse')
    32503254                    if testphys
    32513255                        %[X,Y]=px_XYZ(Calib,X,Y,0);% TODO:create a polygon boundary and transform to phys
     
    32583262                    distY=(Yi-ObjectData.Coord(1,2));
    32593263                    flagobj=(distX.*distX/X2Max+distY.*distY/Y2Max)>1;
    3260                 elseif isequal(ObjectData.Style,'rectangle')
     3264                elseif isequal(ObjectData.Type,'rectangle')
    32613265                    if testphys
    32623266                        %[X,Y]=px_XYZ(Calib,X,Y,0);% TODO:create a polygon boundary and transform to phys
     
    41784182                end
    41794183                if isfield(ObjectData,'Coord')&& isfield(ObjectData,'Style')
    4180                     if isequal(ObjectData.Style,'polygon')
     4184                    if isequal(ObjectData.Type,'polygon')
    41814185                        X=ObjectData.Coord(:,1);
    41824186                        Y=ObjectData.Coord(:,2);
     
    41854189                        end
    41864190                        flagobj=~inpolygon(Xi,Yi,X',Y');%=0 inside the polygon, 1 outside
    4187                     elseif isequal(ObjectData.Style,'ellipse')
     4191                    elseif isequal(ObjectData.Type,'ellipse')
    41884192                        if testphys
    41894193                            %[X,Y]=px_XYZ(Calib,X,Y,0);% TODO:create a polygon boundary and transform to phys
     
    41964200                        distY=(Yi-ObjectData.Coord(1,2));
    41974201                        flagobj=(distX.*distX/X2Max+distY.*distY/Y2Max)>1;
    4198                     elseif isequal(ObjectData.Style,'rectangle')
     4202                    elseif isequal(ObjectData.Type,'rectangle')
    41994203                        if testphys
    42004204                            %[X,Y]=px_XYZ(Calib,X,Y,0);% TODO:create a polygon boundary and transform to phys
     
    43504354function Menupoints_Callback(hObject, eventdata, handles)
    43514355%------------------------------------------------------------------------
    4352 data.Style='points';
     4356data.Type='points';
    43534357data.ProjMode='projection';%default
    43544358create_object(data,handles)
     
    43574361function Menuline_Callback(hObject, eventdata, handles)
    43584362%------------------------------------------------------------------------
    4359 data.Style='line';
     4363data.Type='line';
    43604364data.ProjMode='projection';%default
    43614365create_object(data,handles)
     
    43644368function Menupolyline_Callback(hObject, eventdata, handles)
    43654369%------------------------------------------------------------------------
    4366 data.Style='polyline';
     4370data.Type='polyline';
    43674371data.ProjMode='projection';%default
    43684372create_object(data,handles)
     
    43714375function Menupolygon_Callback(hObject, eventdata, handles)
    43724376%------------------------------------------------------------------------
    4373 data.Style='polygon';
     4377data.Type='polygon';
    43744378data.ProjMode='inside';%default
    43754379create_object(data,handles)
     
    43784382function Menurectangle_Callback(hObject, eventdata, handles)
    43794383%------------------------------------------------------------------------
    4380 data.Style='rectangle';
     4384data.Type='rectangle';
    43814385data.ProjMode='inside';%default
    43824386create_object(data,handles)
     
    43854389function Menuellipse_Callback(hObject, eventdata, handles)
    43864390%------------------------------------------------------------------------
    4387 data.Style='ellipse';
     4391data.Type='ellipse';
    43884392data.ProjMode='inside';%default
    43894393create_object(data,handles)
     
    43924396function MenuMaskObject_Callback(hObject, eventdata, handles)
    43934397%------------------------------------------------------------------------
    4394 data.Style='polygon';
    4395 data.StyleMenu={'polygon'};
     4398data.Type='polygon';
     4399data.TypeMenu={'polygon'};
    43964400data.ProjMode='mask_inside';%default
    43974401data.ProjMenu={'mask_inside';'mask_outside'};
     
    44014405function Menuplane_Callback(hObject, eventdata, handles)
    44024406%------------------------------------------------------------------------
    4403 data.Style='plane';
     4407data.Type='plane';
    44044408data.ProjMode='projection';%default
    44054409
     
    44094413function Menuvolume_Callback(hObject, eventdata, handles)
    44104414%------------------------------------------------------------------------
    4411 data.Style='volume';
     4415data.Type='volume';
    44124416data.ProjMode='interp';%default
    44134417% set(handles.create,'Visible','on')
     
    44304434
    44314435%read the file
    4432 t=xmltree(fileinput);
    4433 data=convert(t);
     4436% t=xmltree(fileinput);
     4437% data=convert(t);
     4438data=xml2struct(fileinput);
    44344439data.enable_plot=1;
    44354440[pp,data.Name]=fileparts(FileName);
     
    44664471val=get(handles.transform_fct,'Value');
    44674472%data.CoordType=transform_list{val};
     4473data.Coord=[0 0]; %default
    44684474if isfield(UvData,'Field')
    44694475    Field=UvData.Field;
     
    44814487        data.DX=max(meshx,meshy);
    44824488    end
    4483     if isfield(Field,'NbDim')
    4484         data.NbDim=Field.NbDim;
     4489    if isfield(Field,'NbDim')&& isequal(Field.NbDim,3)
     4490         data.Coord=[0 0 0]; %default
    44854491    end
    44864492    if isfield(Field,'CoordUnit')
     
    44884494    end
    44894495end
    4490 data.Coord=[0 0 0]; %default
    4491 if isfield(data,'Style') && isequal(data.Style,'line')
    4492     if isfield(data,'DX')
    4493         data.Coord=[[0 0 0];[data.DX 0 0]]; %default
    4494     else
    4495         data.Coord=[[0 0 0];[1 0 0]]; %default
    4496     end
    4497 end
     4496% if isfield(data,'Type') && isequal(data.Type,'line')
     4497%     if isfield(data,'DX')
     4498%         data.Coord=[[0 0 0];[data.DX 0 0]]; %default
     4499%     else
     4500%         data.Coord=[[0 0 0];[1 0 0]]; %default
     4501%     end
     4502% end
    44984503if ishandle(handles.UVMAT_title)
    44994504    delete(handles.UVMAT_title)%delete the initial display of uvmat if no field has been entered
  • trunk/src/xml2struct.m

    r369 r379  
    2323            out.(names{k})=convert_string(s.(names{k}));
    2424        end
    25     case 'char'
    26        
    27         if isempty(regexp(s,'^\d+\.*\d*$'))% if the string contains numerical characters and decimal . only
     25    case 'char'   
     26        if isempty(regexp(s,'^(-*\d+\.*\d*\ *)+$'))% if the string contains a set of numbers (with possible sign and decimal) separated by blanks
    2827            out=s;
    2928        else
    3029            out=str2num(s);
     30        end
     31    case 'cell'
     32        for ilist=1:numel(s)
     33            out(ilist,:)=str2num(s{ilist});
    3134        end
    3235    otherwise
Note: See TracChangeset for help on using the changeset viewer.