Changeset 387 for trunk/src/set_object.m


Ignore:
Timestamp:
Apr 4, 2012, 3:31:30 PM (12 years ago)
Author:
sommeria
Message:

several bugs corrected: mask, color image...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/set_object.m

    r379 r387  
    9797        set(handles.z_slider,'Visible','off')
    9898    end
     99    if isfield(data,'TypeMenu')
     100        set(handles.Type,'String',data.TypeMenu)
     101    end
     102    if isfield(data,'ProjModeMenu')
     103%         set(handles.ProjMode,'String',data.ProjModeMenu) % data.ProjModeMenu as projMode menu
     104        set(handles.ProjMode,'UserData',data.ProjModeMenu)% data.ProjModeMenu as default menu (used in Type_Callback)
     105    end
    99106    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
     107    Type_Callback(hObject, eventdata, handles)% update the GUI set_object depending on the object type   
     108
    170109    if isfield(data,'RangeZ') && length(ZBounds) >= 2
    171110        set(handles.num_RangeZ_2,'String',num2str(max(data.RangeZ),3))
     
    209148         set(handles.num_Angle_3,'String',num2str(data.Angle(3)))
    210149    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
    220150end
    221151if enable_plot
     
    234164end
    235165
    236 
    237166%------------------------------------------------------------------------
    238167% --- Outputs from this function are returned to the command line.
     
    252181% make correspondance between different object styles
    253182Coord=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
    304183
    305184%% set the number of lines in the Coord table depending on object type
     
    321200
    322201%% set the projection menu and the corresponding options
    323 switch Type
    324     case {'points','line','polyline','plane'}
    325         menu_proj={'projection';'interp';'filter';'none'};
    326     case {'polygon','rectangle','ellipse'}
    327         menu_proj={'inside';'outside';'mask_inside';'mask_outside'};
    328     case 'volume'
    329         menu_proj={'interp';'none'};
    330     otherwise
    331         menu_proj={'projection';'interp';'filter';'none'};%default
    332 end   
     202if isempty(get(handles.ProjMode,'UserData'))
     203    switch Type
     204        case {'points','line','polyline','plane'}
     205            menu_proj={'projection';'interp';'filter';'none'};
     206        case {'polygon','rectangle','ellipse'}
     207            menu_proj={'inside';'outside';'mask_inside';'mask_outside'};
     208        case 'volume'
     209            menu_proj={'interp';'none'};
     210        otherwise
     211            menu_proj={'projection';'interp';'filter';'none'};%default
     212    end
     213else
     214    menu_proj=get(handles.ProjMode,'UserData');
     215end
    333216proj_index=get(handles.ProjMode,'Value');
    334 if proj_index<numel(menu_proj)
     217if proj_index>numel(menu_proj)
    335218    set(handles.ProjMode,'Value',1);% value index must not exceed the menu length
    336219end
Note: See TracChangeset for help on using the changeset viewer.