Ignore:
Timestamp:
Aug 23, 2013, 2:56:17 PM (11 years ago)
Author:
sommeria
Message:

various bugs repaired, in particula timing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/geometry_calib.m

    r672 r674  
    9797ScreenSize=get(0,'ScreenSize');% get the size of the screen, to put the fig on the upper right
    9898Left=ScreenSize(3)- 460; %right edge close to the right, with margin=40 (GUI width=420 px)
    99 if ScreenSize(4)>880
     99if ScreenSize(4)>920
    100100    Height=840;%default height of the GUI
    101101    Bottom=ScreenSize(4)-Height-40; %put fig at top right
    102102else
    103     Height=ScreenSize(4)-40;
    104     Bottom=0; % GUI lies o the screen bottom
    105 end
    106 set(handles.calib_type,'Position',[1 Height-30 194 30])%  rank 1
    107 set(handles.APPLY,'Position',[197 Height-30 110 30])%  rank 1
    108 set(handles.REPLICATE,'Position',[309 Height-30 110 30])%  rank 1
    109 set(handles.Intrinsic,'Position',[1 Height-30-2-92 418 92])%  rank 2
    110 set(handles.Extrinsic,'Position',[1 Height-30-4-92-75 418 75])%  rank 3
    111 set(handles.PointLists,'Position',[1 Height-30-6-92-75-117 418 117]) %  rank 4
    112 set(handles.CheckEnableMouse,'Position',[3 Height-30-8-92-75-117-30 203 30])%  rank 5
    113 set(handles.PLOT,'Position',[3 Height-384 120 30])%  rank 6
    114 set(handles.Copy,'Position',[151 Height-384 120 30])%  rank 6
    115 set(handles.CLEAR_PTS,'Position',[297 Height-384 120 30])%  rank 6
    116 set(handles.phys_title,'Position',[38 Height-416 125 20])%  rank 7
    117 set(handles.CoordUnit,'Position',[151 Height-416 120 30])%  rank 7
    118 set(handles.px_title,'Position',[272 Height-416 125 20])%  rank 7
    119 set(handles.ListCoord,'Position',[1 20 418 Height-436])% rank 8
     103    Height=ScreenSize(4)-80;
     104    Bottom=40; % GUI lies o the screen bottom (with margin =40)
     105end
     106set(handles.calib_type,'Position',[1 Height-40 194 30])%  rank 1
     107set(handles.APPLY,'Position',[197 Height-40 110 30])%  rank 1
     108set(handles.REPLICATE,'Position',[309 Height-40 110 30])%  rank 1
     109set(handles.Intrinsic,'Position',[1 Height-40-2-92 418 92])%  rank 2
     110set(handles.Extrinsic,'Position',[1 Height-40-4-92-75 418 75])%  rank 3
     111set(handles.PointLists,'Position',[1 Height-40-6-92-75-117 418 117]) %  rank 4
     112set(handles.CheckEnableMouse,'Position',[3 Height-40-8-92-75-117-30 203 30])%  rank 5
     113set(handles.PLOT,'Position',[3 Height-394 120 30])%  rank 6
     114set(handles.Copy,'Position',[151 Height-394 120 30])%  rank 6
     115set(handles.CLEAR_PTS,'Position',[297 Height-394 120 30])%  rank 6
     116set(handles.phys_title,'Position',[38 Height-426 125 20])%  rank 7
     117set(handles.CoordUnit,'Position',[151 Height-426 120 30])%  rank 7
     118set(handles.px_title,'Position',[272 Height-426 125 20])%  rank 7
     119set(handles.ListCoord,'Position',[1 20 418 Height-446])% rank 8
    120120set(handles.geometry_calib,'Position',[Left Bottom 420 Height])
    121121
     
    11491149set(handles.ListCoordFiles,'string',listfile);
    11501150
    1151 %------------------------------------------------------------------------
    1152 % --- 'key_press_fcn:' function activated when a key is pressed on the keyboard
    1153 function key_press_fcn(hObject,eventdata,handles)
    1154 %------------------------------------------------------------------------
    1155 xx=double(get(handles.geometry_calib,'CurrentCharacter')); %get the keyboard character
    1156 %if ismember(xx,[8 127])%backspace or delete
    1157 if ismember(xx,[30 31 8 127])
    1158     Coord=get(handles.ListCoord,'Data');
    1159     ind=find(Coord(:,6));
    1160     Coord(:,6)=zeros(size(Coord,1),1);% desactivate the current line mark
    1161     switch xx
    1162         case 30 % arrow upward
    1163             Coord(ind-1,6)=1;
    1164         case 31% arrow downward
    1165             Coord(ind+1,6)=1;
    1166         case {8 127}% remove line
    1167             Coord(ind,:)=[];
    1168     end
    1169     set(handles.ListCoord,'Data',Coord);
    1170     PLOT_Callback(hObject,eventdata,handles)
    1171 end
    1172 
    1173 
    11741151
    11751152%------------------------------------------------------------------------
     
    12401217        set(handles.Psi,'String',num2str(GeometryCalib.omc(3),4))
    12411218    end
     1219    if isfield(GeometryCalib,'SourceCalib')
    12421220    calib=GeometryCalib.SourceCalib.PointCoord;
    12431221    Coord=[calib zeros(size(calib,1),1)];
    12441222    set(handles.ListCoord,'Data',Coord)
     1223    end
    12451224%     CoordCell=reshape(CoordCell,[],5);
    12461225%     Tabchar=cell2tab(CoordCell,' | ');%transform cells into table ready for display
     
    12841263% --- Executes when user attempts to close geometry_calib.
    12851264function geometry_calib_CloseRequestFcn(hObject, eventdata, handles)
    1286 % hObject    handle to geometry_calib (see GCBO)
    1287 % eventdata  reserved - to be defined in a future version of MATLAB
    1288 % handles    structure with handles and user data (see GUIDATA)
    1289 
    1290 % Hint: delete(hObject) closes the figure
    1291 delete(hObject);
     1265
     1266delete(hObject); % closes the figure
    12921267
    12931268%------------------------------------------------------------------------
     
    13311306
    13321307%------------------------------------------------------------------------
    1333 % --- Executes on button press in Copy.
     1308% --- Executes on button press in Copy: display Coord on the Matlab work space
    13341309%------------------------------------------------------------------------
    13351310function Copy_Callback(hObject, eventdata, handles)
     
    13411316commandwindow; %brings the Matlab command window to the front
    13421317
    1343 
     1318%------------------------------------------------------------------------
    13441319% --- Executes when selected cell(s) is changed in ListCoord.
     1320%------------------------------------------------------------------------
    13451321function ListCoord_CellSelectionCallback(hObject, eventdata, handles)
     1322
    13461323if ~isempty(eventdata.Indices)
    1347 iline=eventdata.Indices(1);% selected line number
    1348 Data=get(handles.ListCoord,'Data');
    1349 Data(:,6)=zeros(size(Data,1),1);
    1350 Data(iline,6)=1;% mark the selected line
    1351 set(handles.ListCoord,'Data',Data)
    1352 update_calib_marker(Data(iline,:))
    1353 end
    1354 
     1324    iline=eventdata.Indices(1);% selected line number
     1325    Data=get(handles.ListCoord,'Data');
     1326    Data(:,6)=zeros(size(Data,1),1);
     1327    Data(iline,6)=1;% mark the selected line
     1328    set(handles.ListCoord,'Data',Data)
     1329    update_calib_marker(Data(iline,:))
     1330end
     1331
     1332%------------------------------------------------------------------------
    13551333% --- Executes when entered data in editable cell(s) in ListCoord.
     1334%------------------------------------------------------------------------
    13561335function ListCoord_CellEditCallback(hObject, eventdata, handles)
    13571336
     
    13661345PLOT_Callback(hObject, eventdata, handles)
    13671346
     1347%------------------------------------------------------------------------
     1348% --- 'key_press_fcn:' function activated when a key is pressed on the keyboard
     1349%------------------------------------------------------------------------
     1350function key_press_fcn(hObject,eventdata,handles)
     1351
     1352xx=double(get(handles.geometry_calib,'CurrentCharacter')); %get the keyboard character
     1353%if ismember(xx,[8 127])%backspace or delete
     1354if ismember(xx,[30 31 8 127])% arrow upward, downward, backspace or delete
     1355    Coord=get(handles.ListCoord,'Data');
     1356    ind=find(Coord(:,6));
     1357    Coord(:,6)=zeros(size(Coord,1),1);% desactivate the current line mark
     1358    switch xx
     1359        case 30 % arrow upward
     1360            Coord(ind-1,6)=1;
     1361        case 31% arrow downward
     1362            Coord(ind+1,6)=1;
     1363        case {8 127}% remove line
     1364            Coord(ind,:)=[];
     1365    end
     1366    set(handles.ListCoord,'Data',Coord);
     1367    PLOT_Callback(hObject,eventdata,handles)
     1368end
     1369
     1370
     1371
     1372%------------------------------------------------------------------------
     1373% --- update the plot of calibration points
     1374%------------------------------------------------------------------------
    13681375function update_calib_marker(Coord)
    13691376%% update the plot on uvmat
Note: See TracChangeset for help on using the changeset viewer.