Ignore:
Timestamp:
Jun 30, 2013, 11:16:45 PM (12 years ago)
Author:
sommeria
Message:

various bugs corrected

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/geometry_calib.m

    r630 r654  
    5050% Edit the above text to modify the response to help geometry_calib
    5151
    52 % Last Modified by GUIDE v2.5 29-Jul-2012 08:46:09
     52% Last Modified by GUIDE v2.5 29-Jun-2013 23:52:36
    5353
    5454% Begin initialization code - DO NOT edit
     
    208208set(handles.geometry_calib,'UserData',UserData)
    209209uvmat('RootPath_Callback',hObject,eventdata,hhuvmat); %file input with xml reading  in uvmat, show the image in phys coordinates
    210 MenuPlot_Callback(hObject, eventdata, handles)
     210PLOT_Callback(hObject, eventdata, handles)
    211211set(handles.ListCoord,'Value',index)% indicate in the list the point with max deviation (possible mistake)
    212212ListCoord_Callback(hObject, eventdata, handles)
     
    748748set(handles.ListCoord,'Value',1)% refresh the display of coordinates
    749749set(handles.ListCoord,'String',{'......'})
    750 MenuPlot_Callback(hObject, eventdata, handles)
     750PLOT_Callback(hObject, eventdata, handles)
     751
    751752
    752753%------------------------------------------------------------------------
     
    800801%update the plot
    801802ListCoord_Callback(hObject, eventdata, handles)
    802 MenuPlot_Callback(hObject, eventdata, handles)
     803PLOT_Callback(hObject, eventdata, handles)
    803804
    804805%------------------------------------------------------------------------
     
    917918plot_field(Data)
    918919
    919 %------------------------------------------------------------------------
    920 function MenuPlot_Callback(hObject, eventdata, handles)
    921 %------------------------------------------------------------------------
    922 huvmat=findobj(allchild(0),'Name','uvmat');%find the current uvmat interface handle
    923 %UvData=get(huvmat,'UserData');%Data associated to the current uvmat interface
    924 hhuvmat=guidata(huvmat); %handles of GUI elements in uvmat
    925 %hplot=findobj(huvmat,'Tag','axes3');%main plotting axis of uvmat
    926 h_menu_coord=findobj(huvmat,'Tag','TransformName');
    927 menu=get(h_menu_coord,'String');
    928 choice=get(h_menu_coord,'Value');
    929 if iscell(menu)
    930     option=menu{choice};
    931 else
    932     option='px'; %default
    933 end
    934 Coord_cell=get(handles.ListCoord,'String');
    935 ObjectData=read_geometry_calib(Coord_cell);
    936 %ObjectData=read_geometry_calib(handles);%read the interface input parameters defining the object
    937 if ~isempty(ObjectData.Coord)
    938     if isequal(option,'phys')
    939         ObjectData.Coord=ObjectData.Coord(:,1:3);
    940     elseif isequal(option,'px')||isequal(option,'')
    941         ObjectData.Coord=ObjectData.Coord(:,4:5);
    942     else
    943         msgbox_uvmat('ERROR','the choice in menu_coord of uvmat must be '''', px or phys ')
    944     end
    945 end
    946 
    947 set(0,'CurrentFigure',huvmat)
    948 set(huvmat,'CurrentAxes',hhuvmat.PlotAxes)
    949 hh=findobj('Tag','calib_points');
    950 if  ~isempty(ObjectData.Coord) && isempty(hh)
    951     hh=line(ObjectData.Coord(:,1),ObjectData.Coord(:,2),'Color','m','Tag','calib_points','LineStyle','.','Marker','+');
    952 elseif isempty(ObjectData.Coord)%empty list of points, suppress the plot
    953     delete(hh)
    954 else
    955     set(hh,'XData',ObjectData.Coord(:,1))
    956     set(hh,'YData',ObjectData.Coord(:,2))
    957 end
    958 pause(.1)
    959 figure(handles.geometry_calib)
    960920
    961921% --------------------------------------------------------------------
     
    969929   web([helpfile '#geometry_calib'])
    970930end
     931
     932% --------------------------------------------------------------------
     933function MenuSetScale_Callback(hObject, eventdata, handles)
     934% hObject    handle to MenuSetScale (see GCBO)
     935% eventdata  reserved - to be defined in a future version of MATLAB
     936% handles    structure with handles and user data (see GUIDATA)
     937 answer=msgbox_uvmat('INPUT_TXT','scale pixel/cm?','')
     938 %create test points
     939 huvmat=findobj(allchild(0),'Name','uvmat');%find the current uvmat interface handle
     940UvData=get(huvmat,'UserData');%Data associated to the current uvmat interface
     941Xima=0.8*[UvData.Field.XMin UvData.Field.XMax UvData.Field.XMax UvData.Field.XMin]';
     942Yima=0.8*[UvData.Field.YMin UvData.Field.YMax UvData.Field.YMax UvData.Field.YMin]';
     943x=Xima/str2num(answer);
     944y=Yima/str2num(answer);
     945for j=1:4
     946    for i=1:5
     947          Coord{j,1}=num2str(x);%
     948          Coord{j,2}=num2str(y);%
     949          Coord{j,3}='0';%
     950          Coord{j,4}=num2str(Xima);%
     951          Coord{j,5}=num2str(Yima);%
     952    end
     953end
     954
     955Tabchar=cell2tab(Coord,' | ');
     956Tabchar=[Tabchar ;{'......'}];
     957set(handles.ListCoord,'String',Tabchar)
    971958
    972959%------------------------------------------------------------------------
     
    11401127set(handles.ListCoord,'Value',1)
    11411128set(handles.ListCoord,'String',Tabchar)
    1142 MenuPlot_Callback(hObject, eventdata, handles)
     1129PLOT_Callback(hObject, eventdata, handles)
    11431130
    11441131%-----------------------------------------------------------------------
     
    12331220set(handles.ListCoord,'Value',1)
    12341221set(handles.ListCoord,'String',Tabchar)
    1235 MenuPlot_Callback(handles.geometry_calib, [], handles)
     1222PLOT_Callback(handles.geometry_calib, [], handles)
    12361223
    12371224% -----------------------------------------------------------------------
     
    12801267        set(handles.ListCoord,'String',Coord_cell)         
    12811268        ListCoord_Callback(hObject, eventdata, handles)
    1282         MenuPlot_Callback(hObject,eventdata,handles)
     1269        PLOT_Callback(hObject,eventdata,handles)
    12831270     end
    12841271end
     
    13571344    CoordCell=reshape(CoordCell,[],5);
    13581345    Tabchar=cell2tab(CoordCell,' | ');%transform cells into table ready for display
    1359     MenuPlot_Callback(handles.geometry_calib, [], handles)
     1346    PLOT_Callback(handles.geometry_calib, [], handles)
    13601347end
    13611348set(handles.calib_type,'Value',val_cal)
     
    14051392% Hint: delete(hObject) closes the figure
    14061393delete(hObject);
     1394
     1395%------------------------------------------------------------------------
     1396% --- Executes on button press in PLOT.
     1397%------------------------------------------------------------------------
     1398function PLOT_Callback(hObject, eventdata, handles)
     1399
     1400huvmat=findobj(allchild(0),'Name','uvmat');%find the current uvmat interface handle
     1401%UvData=get(huvmat,'UserData');%Data associated to the current uvmat interface
     1402hhuvmat=guidata(huvmat); %handles of GUI elements in uvmat
     1403%hplot=findobj(huvmat,'Tag','axes3');%main plotting axis of uvmat
     1404h_menu_coord=findobj(huvmat,'Tag','TransformName');
     1405menu=get(h_menu_coord,'String');
     1406choice=get(h_menu_coord,'Value');
     1407if iscell(menu)
     1408    option=menu{choice};
     1409else
     1410    option='px'; %default
     1411end
     1412Coord_cell=get(handles.ListCoord,'String');
     1413ObjectData=read_geometry_calib(Coord_cell);
     1414%ObjectData=read_geometry_calib(handles);%read the interface input parameters defining the object
     1415if ~isempty(ObjectData.Coord)
     1416    if isequal(option,'phys')
     1417        ObjectData.Coord=ObjectData.Coord(:,1:3);
     1418    elseif isequal(option,'px')||isequal(option,'')
     1419        ObjectData.Coord=ObjectData.Coord(:,4:5);
     1420    else
     1421        msgbox_uvmat('ERROR','the choice in menu_coord of uvmat must be '''', px or phys ')
     1422    end
     1423end
     1424
     1425set(0,'CurrentFigure',huvmat)
     1426set(huvmat,'CurrentAxes',hhuvmat.PlotAxes)
     1427hh=findobj('Tag','calib_points');
     1428if  ~isempty(ObjectData.Coord) && isempty(hh)
     1429    hh=line(ObjectData.Coord(:,1),ObjectData.Coord(:,2),'Color','m','Tag','calib_points','LineStyle','.','Marker','+');
     1430elseif isempty(ObjectData.Coord)%empty list of points, suppress the plot
     1431    delete(hh)
     1432else
     1433    set(hh,'XData',ObjectData.Coord(:,1))
     1434    set(hh,'YData',ObjectData.Coord(:,2))
     1435end
     1436pause(.1)
     1437figure(handles.geometry_calib)
     1438
     1439
     1440 
Note: See TracChangeset for help on using the changeset viewer.