Changeset 657 for trunk/src


Ignore:
Timestamp:
Jul 3, 2013, 12:07:26 PM (11 years ago)
Author:
sommeria
Message:

a few bugs corrected

Location:
trunk/src
Files:
1 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/geometry_calib.m

    r655 r657  
    5050% Edit the above text to modify the response to help geometry_calib
    5151
    52 % Last Modified by GUIDE v2.5 29-Jun-2013 23:52:36
     52% Last Modified by GUIDE v2.5 03-Jul-2013 09:23:35
    5353
    5454% Begin initialization code - DO NOT edit
     
    6060                   'gui_LayoutFcn',  [] , ...
    6161                   'gui_Callback',   []);
    62 if nargin && ischar(varargin{1}) && ~isempty(regexp(varargin{1},'_Callback','once'))
     62if nargin && ischar(varargin{1}) %&& ~isempty(regexp(varargin{1},'_Callback','once'))
    6363    gui_State.gui_Callback = str2func(varargin{1});
    6464end
     
    7878% parameters on the uvmat interface (obtained by 'get_plot_handle.m')
    7979%------------------------------------------------------------------------
    80 function geometry_calib_OpeningFcn(hObject, eventdata, handles,inputfile,pos)
     80function geometry_calib_OpeningFcn(hObject, eventdata, handles,inputfile)
    8181%------------------------------------------------------------------------
    8282% Choose default command line output for geometry_calib
     
    8787guidata(hObject, handles);
    8888set(hObject,'DeleteFcn',{@closefcn})%
    89 set(hObject,'WindowButtonDownFcn',{'mouse_alt_gui',handles}) % allows mouse action with right button (zoom for uicontrol display)
     89%set(hObject,'WindowButtonDownFcn',{'mouse_alt_gui',handles}) % allows mouse action with right button (zoom for uicontrol display)
    9090
    9191%% position
    92 set(0,'Unit','points')
     92set(0,'Unit','pixels')
    9393ScreenSize=get(0,'ScreenSize');% get the size of the screen, to put the fig on the upper right
    94 Width=350;% fig width in points (1/72 inch)
    95 Height=min(0.9*ScreenSize(4),700);
     94FigSize=get(handles.geometry_calib,'Position');
     95
     96Width=FigSize(3);% fig width in points (1/72 inch)
     97Height=FigSize(4);
    9698Left=ScreenSize(3)- Width-40; %right edge close to the right, with margin=40
    9799Bottom=ScreenSize(4)-Height-40; %put fig at top right
    98 set(handles.geometry_calib,'Unit','points')
    99100set(handles.geometry_calib,'Position',[Left Bottom Width Height])
    100101
     
    121122        end
    122123    end
    123     set(handles.ListCoord,'String',{'......'})
     124    set(handles.ListCoord,'Data',[])
     125   % set(handles.ListCoord,'Data',{[] [] [] [] [] []})
    124126    if exist(inputfile,'file')
    125127        Heading=loadfile(handles,inputfile);% load data from the xml file
     
    136138%------------------------------------------------------------------------
    137139% --- Outputs from this function are returned to the command line.
    138 function varargout = geometry_calib_OutputFcn(hObject, eventdata, handles)
     140function varargout = geometry_calib_OutputFcn(~, eventdata, handles)
    139141%------------------------------------------------------------------------
    140142% Get default command line output from handles structure
     
    209211uvmat('RootPath_Callback',hObject,eventdata,hhuvmat); %file input with xml reading  in uvmat, show the image in phys coordinates
    210212PLOT_Callback(hObject, eventdata, handles)
    211 set(handles.ListCoord,'Value',index)% indicate in the list the point with max deviation (possible mistake)
    212 ListCoord_Callback(hObject, eventdata, handles)
     213Data=get(handles.ListCoord,'Data');
     214Data(:,6)=zeros(size(Data,1),1);
     215Data(index,6)=1;% indicate in the list the point with max deviation (possible mistake)
     216set(handles.ListCoord,'Data',Data)% indicate in the list the point with max deviation (possible mistake)
     217%ListCoord_Callback(hObject, eventdata, handles)
    213218figure(handles.geometry_calib)
    214219
     
    259264%------------------------------------------------------------------------
    260265%% read the current calibration points
    261 Coord_cell=get(handles.ListCoord,'String');
    262 Object=read_geometry_calib(Coord_cell);
    263 Coord=Object.Coord;
     266%Coord_cell=get(handles.ListCoord,'Data');
     267%Object=read_geometry_calib(Coord_cell);
     268Coord=get(handles.ListCoord,'Data');
     269Coord(:,6)=[];
    264270% apply the calibration, whose type is selected in  handles.calib_type
    265271if ~isempty(Coord)
     
    708714% --- Executes on button press in STORE.
    709715function STORE_Callback(hObject, eventdata, handles)
    710 Coord_cell=get(handles.ListCoord,'String');
    711 Object=read_geometry_calib(Coord_cell);
     716Coord=get(handles.ListCoord,'Data');
     717%Object=read_geometry_calib(Coord_cell);
    712718unitlist=get(handles.CoordUnit,'String');
    713719unit=unitlist{get(handles.CoordUnit,'value')};
    714720GeometryCalib.CoordUnit=unit;
    715 GeometryCalib.SourceCalib.PointCoord=Object.Coord;
     721GeometryCalib.SourceCalib.PointCoord=Coord(:,1:5);
    716722huvmat=findobj(allchild(0),'Name','uvmat');
    717723hhuvmat=guidata(huvmat);%handles of elements in the GUI uvmat
     
    739745    set(handles.coord_files,'string',listfile);
    740746end
    741 set(handles.ListCoord,'Value',1)% refresh the display of coordinates
    742 set(handles.ListCoord,'String',{'......'})
     747% set(handles.ListCoord,'Value',1)% refresh the display of coordinates
     748set(handles.ListCoord,'Data',[])
    743749
    744750% --------------------------------------------------------------------
     
    746752function CLEAR_PTS_Callback(hObject, eventdata, handles)
    747753% --------------------------------------------------------------------
    748 set(handles.ListCoord,'Value',1)% refresh the display of coordinates
    749 set(handles.ListCoord,'String',{'......'})
     754% set(handles.ListCoord,'Value',1)% refresh the display of coordinates
     755% set(handles.ListCoord,'String',{'......'})
     756set(handles.ListCoord,'Data',[])
    750757PLOT_Callback(hObject, eventdata, handles)
    751758
     
    804811
    805812%------------------------------------------------------------------------
    806 % --- Executes on selection change in ListCoord.
    807 function ListCoord_Callback(hObject, eventdata, handles)
    808 %------------------------------------------------------------------------
    809 huvmat=findobj(allchild(0),'Name','uvmat');%find the current uvmat interface handle
    810 hplot=findobj(huvmat,'Tag','PlotAxes');%main plotting axis of uvmat
    811 hhh=findobj(hplot,'Tag','calib_marker');
    812 Coord_cell=get(handles.ListCoord,'String');
    813 val=get(handles.ListCoord,'Value');
    814 if numel(val)>1
    815     return %no action if several lines have been selected
    816 end
    817 coord_str=Coord_cell{val};
    818 k=findstr(' | ',coord_str);
    819 if isempty(k)%last line '.....' selected
    820     if ~isempty(hhh)
    821         delete(hhh)%delete the circle marker
    822     end
    823     return
    824 end
    825 %fill the edit boxe
    826 set(handles.XObject,'String',coord_str(1:k(1)-1))
    827 set(handles.YObject,'String',coord_str(k(1)+3:k(2)-1))
    828 set(handles.ZObject,'String',coord_str(k(2)+3:k(3)-1))
    829 set(handles.XImage,'String',coord_str(k(3)+3:k(4)-1))
    830 set(handles.YImage,'String',coord_str(k(4)+3:end))
    831 h_menu_coord=findobj(huvmat,'Tag','TransformName');
    832 menu=get(h_menu_coord,'String');
    833 choice=get(h_menu_coord,'Value');
    834 if iscell(menu)
    835     option=menu{choice};
    836 else
    837     option='px'; %default
    838 end
    839 if isequal(option,'phys')
    840     XCoord=str2double(coord_str(1:k(1)-1));
    841     YCoord=str2double(coord_str(k(1)+3:k(2)-1));
    842 elseif isequal(option,'px')|| isequal(option,'')
    843     XCoord=str2double(coord_str(k(3)+3:k(4)-1));
    844     YCoord=str2double(coord_str(k(4)+3:end));
    845 else
    846     msgbox_uvmat('ERROR','the choice in menu_coord of uvmat must be px or phys ')
    847 end
    848 if isempty(XCoord)||isempty(YCoord)
    849      if ~isempty(hhh)
    850         delete(hhh)%delete the circle marker
    851     end
    852     return
    853 end
    854 xlim=get(hplot,'XLim');
    855 ylim=get(hplot,'YLim');
    856 ind_range=max(abs(xlim(2)-xlim(1)),abs(ylim(end)-ylim(1)))/20;%defines the size of the circle marker
    857 if isempty(hhh)
    858     set(0,'CurrentFig',huvmat)
    859     set(huvmat,'CurrentAxes',hplot)
    860     rectangle('Curvature',[1 1],...
    861               'Position',[XCoord-ind_range/2 YCoord-ind_range/2 ind_range ind_range],'EdgeColor','m',...
    862               'LineStyle','-','Tag','calib_marker');
    863 else
    864     set(hhh,'Position',[XCoord-ind_range/2 YCoord-ind_range/2 ind_range ind_range])
    865 end
    866 
    867 %------------------------------------------------------------------------
    868813% --- Executes on selection change in edit_append.
    869814function edit_append_Callback(hObject, eventdata, handles)
     
    875820    if ishandle(huvmat)
    876821        hhuvmat=guidata(huvmat);
    877         set(hhuvmat.edit_object,'Value',0)
    878         set(hhuvmat.edit_object,'BackgroundColor',[0.7 0.7 0.7])
     822        if get(hhuvmat.CheckEditObject,'Value')
     823        set(hhuvmat.CheckEditObject,'Value',0)
     824        uvmat('CheckEditObject_Callback',hhuvmat.CheckEditObject,[],hhuvmat)
     825        end
    879826    end
    880827else
     
    945892x=Xima/str2num(answer);
    946893y=Yima/str2num(answer);
    947 Coord={num2str(x(1)) num2str(y(1)) '0' num2str(Xima(1)) num2str(Yima(1));...
    948     num2str(x(2)) num2str(y(2)) '0' num2str(Xima(2)) num2str(Yima(2));...
    949     num2str(x(3)) num2str(y(3)) '0' num2str(Xima(3)) num2str(Yima(3));...
    950     num2str(x(4)) num2str(y(4)) '0' num2str(Xima(4)) num2str(Yima(4))};
    951 Tabchar=cell2tab(Coord,' | ');
    952 Tabchar=[Tabchar ;{'......'}];
    953 set(handles.ListCoord,'String',Tabchar)
     894Coord=[x y zeros(4,1) Xima Yima zeros(4,1)];
     895set(handles.ListCoord,'Data',Coord)
     896% Tabchar=cell2tab(Coord,' | ');
     897% Tabchar=[Tabchar ;{'......'}];
     898% set(handles.ListCoord,'String',Tabchar)
     899% Coord={num2str(x(1)) num2str(y(1)) '0' num2str(Xima(1)) num2str(Yima(1));...
     900%     num2str(x(2)) num2str(y(2)) '0' num2str(Xima(2)) num2str(Yima(2));...
     901%     num2str(x(3)) num2str(y(3)) '0' num2str(Xima(3)) num2str(Yima(3));...
     902%     num2str(x(4)) num2str(y(4)) '0' num2str(Xima(4)) num2str(Yima(4))};
     903% Tabchar=cell2tab(Coord,' | ');
     904% Tabchar=[Tabchar ;{'......'}];
     905% set(handles.ListCoord,'String',Tabchar)
    954906
    955907%------------------------------------------------------------------------
     
    12071159GeometryCalib=s.GeometryCalib;
    12081160%GeometryCalib=load_calib(hObject, eventdata, handles)
    1209 calib=reshape(GeometryCalib.SourceCalib.PointCoord,[],1);
    1210 for ilist=1:numel(calib)
    1211     CoordCell{ilist}=num2str(calib(ilist));
    1212 end
    1213 CoordCell=reshape(CoordCell,[],5);
    1214 Tabchar=cell2tab(CoordCell,' | ');%transform cells into table ready for display
    1215 Tabchar=[Tabchar;{'......'}];
    1216 set(handles.ListCoord,'Value',1)
    1217 set(handles.ListCoord,'String',Tabchar)
     1161% calib=reshape(GeometryCalib.SourceCalib.PointCoord,[],1);
     1162% for ilist=1:numel(calib)
     1163%     CoordCell{ilist}=num2str(calib(ilist));
     1164% end
     1165% CoordCell=reshape(CoordCell,[],5);
     1166% Tabchar=cell2tab(CoordCell,' | ');%transform cells into table ready for display
     1167% Tabchar=[Tabchar;{'......'}];
     1168% set(handles.ListCoord,'Value',1)
     1169% set(handles.ListCoord,'String',Tabchar)
     1170Coord=GeometryCalib.SourceCalib.PointCoord;
     1171Coord=[Coord zeros(size(Coord,1),1)]
     1172set(handles.ListCoord,'Data',Coord)
    12181173PLOT_Callback(handles.geometry_calib, [], handles)
    12191174
     
    12551210%------------------------------------------------------------------------
    12561211xx=double(get(handles.geometry_calib,'CurrentCharacter')); %get the keyboard character
    1257 if ismember(xx,[8 127])%backspace or delete
    1258     Coord_cell=get(handles.ListCoord,'String');
    1259     val=get(handles.ListCoord,'Value');
    1260      if max(val)<numel(Coord_cell) % the last element '...' has not been selected
    1261         Coord_cell(val)=[];%remove the selected line
    1262         set(handles.ListCoord,'Value',min(val))
    1263         set(handles.ListCoord,'String',Coord_cell)         
    1264         ListCoord_Callback(hObject, eventdata, handles)
    1265         PLOT_Callback(hObject,eventdata,handles)
    1266      end
    1267 end
     1212%if ismember(xx,[8 127])%backspace or delete
     1213if ismember(xx,[30 31 8 127])
     1214    Coord=get(handles.ListCoord,'Data');
     1215    ind=find(Coord(:,6));
     1216    Coord(:,6)=zeros(size(Coord,1),1);% desactivate the current line mark
     1217    switch xx
     1218        case 30 % arrow upward
     1219            Coord(ind-1,6)=1;
     1220        case 31% arrow downward
     1221            Coord(ind+1,6)=1;
     1222        case {8 127}% remove line
     1223            Coord(ind,:)=[];
     1224    end
     1225    set(handles.ListCoord,'Data',Coord);
     1226    PLOT_Callback(hObject,eventdata,handles)
     1227end
     1228
     1229
    12681230
    12691231%------------------------------------------------------------------------
     
    13341296        set(handles.Psi,'String',num2str(GeometryCalib.omc(3),4))
    13351297    end
    1336     calib=reshape(GeometryCalib.SourceCalib.PointCoord,[],1);
    1337     for ilist=1:numel(calib)
    1338         CoordCell{ilist}=num2str(calib(ilist));
    1339     end
    1340     CoordCell=reshape(CoordCell,[],5);
    1341     Tabchar=cell2tab(CoordCell,' | ');%transform cells into table ready for display
     1298    calib=GeometryCalib.SourceCalib.PointCoord;
     1299    Coord=[calib zeros(size(calib,1),1)];
     1300    set(handles.ListCoord,'Data',Coord)
     1301%     CoordCell=reshape(CoordCell,[],5);
     1302%     Tabchar=cell2tab(CoordCell,' | ');%transform cells into table ready for display
    13421303    PLOT_Callback(handles.geometry_calib, [], handles)
    13431304end
    13441305set(handles.calib_type,'Value',val_cal)
    1345 Tabchar=[Tabchar;{'......'}];
    1346 set(handles.ListCoord,'Value',1)
    1347 set(handles.ListCoord,'String',Tabchar)
     1306% Tabchar=[Tabchar;{'......'}];
     1307% set(handles.ListCoord,'Value',1)
    13481308
    13491309if isempty(CoordCell)% allow mouse action by default in the absence of input points
     
    13931353%------------------------------------------------------------------------
    13941354function PLOT_Callback(hObject, eventdata, handles)
    1395 
     1355global Coord
    13961356huvmat=findobj(allchild(0),'Name','uvmat');%find the current uvmat interface handle
    1397 %UvData=get(huvmat,'UserData');%Data associated to the current uvmat interface
    13981357hhuvmat=guidata(huvmat); %handles of GUI elements in uvmat
    1399 %hplot=findobj(huvmat,'Tag','axes3');%main plotting axis of uvmat
    14001358h_menu_coord=findobj(huvmat,'Tag','TransformName');
    14011359menu=get(h_menu_coord,'String');
     
    14061364    option='px'; %default
    14071365end
    1408 Coord_cell=get(handles.ListCoord,'String');
    1409 ObjectData=read_geometry_calib(Coord_cell);
     1366%ObjectData=read_geometry_calib(Coord_cell);
    14101367%ObjectData=read_geometry_calib(handles);%read the interface input parameters defining the object
    1411 if ~isempty(ObjectData.Coord)
     1368Coord=get(handles.ListCoord,'Data');
     1369% Coord(:,6)=[];
     1370if ~isempty(Coord)
    14121371    if isequal(option,'phys')
    1413         ObjectData.Coord=ObjectData.Coord(:,1:3);
     1372        Coord_plot=Coord(:,1:3);
    14141373    elseif isequal(option,'px')||isequal(option,'')
    1415         ObjectData.Coord=ObjectData.Coord(:,4:5);
     1374        Coord_plot=Coord(:,4:5);
    14161375    else
    1417         msgbox_uvmat('ERROR','the choice in menu_coord of uvmat must be '''', px or phys ')
     1376        msgbox_uvmat('ERROR','the choice in menu_coord of uvmat must be blank, px or phys ')
    14181377    end
    14191378end
     
    14221381set(huvmat,'CurrentAxes',hhuvmat.PlotAxes)
    14231382hh=findobj('Tag','calib_points');
    1424 if  ~isempty(ObjectData.Coord) && isempty(hh)
    1425     hh=line(ObjectData.Coord(:,1),ObjectData.Coord(:,2),'Color','m','Tag','calib_points','LineStyle','.','Marker','+');
    1426 elseif isempty(ObjectData.Coord)%empty list of points, suppress the plot
     1383if  ~isempty(Coord) && isempty(hh)
     1384    hh=line(Coord_plot(:,1),Coord_plot(:,2),'Color','m','Tag','calib_points','LineStyle','.','Marker','+');
     1385elseif isempty(Coord)%empty list of points, suppress the plot
    14271386    delete(hh)
    14281387else
    1429     set(hh,'XData',ObjectData.Coord(:,1))
    1430     set(hh,'YData',ObjectData.Coord(:,2))
    1431 end
     1388    set(hh,'XData',Coord_plot(:,1))
     1389    set(hh,'YData',Coord_plot(:,2))
     1390end
     1391
     1392% get data on the matlab work space
     1393
     1394evalin('base','global Coord')%make CurData global in the workspace
     1395display('coordinates of calibration points (phys,px,marker) :')
     1396evalin('base','Coord') %display CurData in the workspace
     1397commandwindow; %brings the Matlab command window to the front
    14321398pause(.1)
    14331399figure(handles.geometry_calib)
    14341400
    1435 
    14361401 
     1402
     1403
     1404% --- Executes when selected cell(s) is changed in ListCoord.
     1405function ListCoord_CellSelectionCallback(hObject, eventdata, handles)
     1406if ~isempty(eventdata.Indices)
     1407iline=eventdata.Indices(1);% selected line number
     1408Data=get(handles.ListCoord,'Data');
     1409Data(:,6)=zeros(size(Data,1),1);
     1410Data(iline,6)=1;% mark the selected line
     1411% if size(Data,1)<iline+numel(Input)
     1412%     Data=[Data ; zeros(iline+numel(Input)-size(Data,1),6)];% append zeros to fit the new column
     1413% end
     1414% Data(iline:iline+numel(Input)-1,eventdata.Indices(2))=Input';
     1415set(handles.ListCoord,'Data',Data)
     1416update_calib_marker(Data(iline,:))
     1417end
     1418
     1419% if length(eventdata.Modifier) == 1 && strcmp(eventdata.Modifier{:},'control') && ...
     1420% eventdata.Key == 'v'
     1421%     import = importdata('-pastespecial');
     1422%    %data treatment and checking
     1423%     set(handles.uitable1,'Data',import);
     1424% end
     1425
     1426% --- Executes when entered data in editable cell(s) in ListCoord.
     1427function ListCoord_CellEditCallback(hObject, eventdata, handles)
     1428
     1429Input=str2num(eventdata.EditData);%pasted input
     1430Coord=get(handles.ListCoord,'Data');
     1431iline=eventdata.Indices(1);% selected line number
     1432if size(Coord,1)<iline+numel(Input)
     1433    Coord=[Coord ; zeros(iline+numel(Input)-size(Coord,1),6)];% append zeros to fit the new column
     1434end
     1435Coord(iline:iline+numel(Input)-1,eventdata.Indices(2))=Input';
     1436set(handles.ListCoord,'Data',Coord)
     1437PLOT_Callback(hObject, eventdata, handles)
     1438
     1439function update_calib_marker(Coord)
     1440%% update the plot on uvmat
     1441huvmat=findobj(allchild(0),'Name','uvmat');%find the current uvmat interface handle
     1442hplot=findobj(huvmat,'Tag','PlotAxes');%main plotting axis of uvmat
     1443hhh=findobj(hplot,'Tag','calib_marker');
     1444
     1445h_menu_coord=findobj(huvmat,'Tag','TransformName');
     1446menu=get(h_menu_coord,'String');
     1447choice=get(h_menu_coord,'Value');
     1448if iscell(menu)
     1449    option=menu{choice};
     1450else
     1451    option='px'; %default
     1452end
     1453if isequal(option,'phys')
     1454    XCoord=Coord(1);
     1455    YCoord=Coord(2);
     1456elseif isequal(option,'px')|| isequal(option,'')
     1457    XCoord=Coord(4);
     1458    YCoord=Coord(5);
     1459else
     1460    msgbox_uvmat('ERROR','the choice in menu_coord of uvmat must be blank, px or phys ')
     1461end
     1462if isempty(XCoord)||isempty(YCoord)
     1463     if ~isempty(hhh)
     1464        delete(hhh)%delete the circle marker
     1465    end
     1466    return
     1467end
     1468xlim=get(hplot,'XLim');
     1469ylim=get(hplot,'YLim');
     1470ind_range=max(abs(xlim(2)-xlim(1)),abs(ylim(end)-ylim(1)))/20;%defines the size of the circle marker
     1471if isempty(hhh)
     1472    set(0,'CurrentFig',huvmat)
     1473    set(huvmat,'CurrentAxes',hplot)
     1474    rectangle('Curvature',[1 1],...
     1475              'Position',[XCoord-ind_range/2 YCoord-ind_range/2 ind_range ind_range],'EdgeColor','m',...
     1476              'LineStyle','-','Tag','calib_marker');
     1477else
     1478    set(hhh,'Position',[XCoord-ind_range/2 YCoord-ind_range/2 ind_range ind_range])
     1479end
  • trunk/src/mouse_down.m

    r650 r657  
    400400
    401401%% create calibration points if the GUI geometry_calib is opened, if the main axes PlotAxes of uvmat has ben selected
    402 if  test_cal && ~isempty(haxes) && strcmp(get(haxes,'tag'),'PlotAxes') 
     402if  test_cal && ~isempty(haxes) && strcmp(get(haxes,'tag'),'PlotAxes')
    403403    h_geometry_calib=findobj(allchild(0),'Name','geometry_calib'); %find the geomterty_calib GUI
    404404    hh_geometry_calib=guidata(h_geometry_calib);
    405405    h_edit_append=hh_geometry_calib.edit_append;%findobj(h_geometry_calib,'Tag','edit_append');
    406406    if isequal(get(h_edit_append,'Value'),1) && ~isempty(haxes)
    407         h_ListCoord=hh_geometry_calib.ListCoord; %findobj(h_geometry_calib,'Tag','ListCoord');
    408         coord_value=get(hhuvmat.TransformName,'Value');% set uvmat to pixel coordinates, run it again if not
    409         if ~(isequal(coord_value,1)||isequal(coord_value,3)); %active only with no transform or px (no phys)
     407        if ~isequal(get(hhuvmat.TransformName,'Value'),1); %active only with no transform (px coordinates)
    410408            set(hhuvmat.TransformName,'Value',1)
    411409            uvmat('TransformName_Callback',hObject,eventdata,hhuvmat); %file input with xml reading  in uvmat
    412             set(hhuvmat.CheckFixedLimits,'Value',0)% put FixedLimits option to 'off'
    413             set(hhuvmat.CheckFixedLimits,'BackgroundColor',[0.7 0.7 0.7])
     410            set(hhuvmat.CheckFixLimits,'Value',0)% put FixedLimits option to 'off' (to sse the whole field)
    414411            return
    415412        end
    416         Coord=get(h_ListCoord,'String');
    417         data=read_geometry_calib(Coord);%transform char cell to numbers
     413        h_ListCoord=hh_geometry_calib.ListCoord; %findobj(h_geometry_calib,'Tag','ListCoord');
     414        Coord=get(h_ListCoord,'Data');
     415        %data=read_geometry_calib(Coord);%transform char cell to numbers
    418416        xlim=get(haxes,'XLim');
    419417        ind_range_x=abs((xlim(2)-xlim(1))/50);
     
    422420        ind_range=sqrt(ind_range_x*ind_range_y);
    423421        test_newpoint=1;
    424         if size(data.Coord,2)>=5 %if calibration points already exist
    425             XCoord=(data.Coord(:,4));
    426             YCoord=(data.Coord(:,5));
    427             index_point=find((XCoord<xy(1,1)+ind_range) & (XCoord>xy(1,1)-ind_range) & ...%flagx=1 for the vectors with x position selected by the mouse
    428                           (YCoord<xy(1,2)+ind_range) & (YCoord>xy(1,2)-ind_range),1);%find the first calibration point in the neighborhood of the mouse
    429             test_newpoint=isempty(index_point);%test for no existing calibration point near the mouse position
    430         end
    431         val=get(h_ListCoord,'Value');
     422        %if size(data.Coord,2)>=5 %if calibration points already exist
     423        if ~isempty(Coord)
     424        XCoord=(Coord(:,4));
     425        YCoord=(Coord(:,5));
     426        index_point=find((XCoord<xy(1,1)+ind_range) & (XCoord>xy(1,1)-ind_range) & ...%flagx=1 for the vectors with x position selected by the mouse
     427            (YCoord<xy(1,2)+ind_range) & (YCoord>xy(1,2)-ind_range),1);%find the first calibration point in the neighborhood of the mouse
     428        test_newpoint=isempty(index_point);%test for no existing calibration point near the mouse position
     429        end
     430        %end
     431        %val=find(Data.Coord(:,6));
     432       
    432433        %create a new calib point if we are not close to an existing one
    433         if test_newpoint                 
    434              strline=[ '    |    '  '    |    '  '    |    ' num2str(xy(1,1),4) '    |    ' num2str(xy(1,2),4)];
    435            
    436              if length(Coord)>=val
    437                  Coord(val+1:length(Coord)+1)=Coord(val:length(Coord));% push the list forward beyond the current point
    438              end
    439              Coord{val}=strline;
    440              set(h_ListCoord,'String',Coord)
    441              data=read_geometry_calib(Coord);%transform char cell to numbers
    442              XCoord=data.Coord(:,4);
    443              YCoord=data.Coord(:,5);
    444         end
    445         hh=findobj('Tag','calib_points');%look for handle of calibration points           
     434        hh=findobj('Tag','calib_points');%look for handle of calibration points
     435        if test_newpoint
     436            Coord=[Coord;[0 0 0 xy(1,1) xy(1,2) 0]];
     437            set(h_ListCoord,'Data',Coord)
     438        end
    446439        if isempty(hh)
    447             hh=line(XCoord,YCoord,'Color','m','Tag','calib_points','LineStyle','.','Marker','+');
     440            hh=line(Coord(:,4),Coord(:,5),'Color','m','Tag','calib_points','LineStyle','.','Marker','+');
    448441        else
    449             set(hh,'XData',XCoord)
    450             set(hh,'YData',YCoord)
    451         end
    452         set(hh,'UserData',val)% flag the points to edit mode
     442            set(hh,'XData',Coord(:,4))
     443            set(hh,'YData',Coord(:,5))
     444        end
     445         if test_newpoint
     446             set(hh,'UserData',size(Coord,1))% flag the points to edit mode
     447         else
     448             set(hh,'UserData',index_point)% mark the selected point index for future mouse motion
     449         end
    453450        hhh=findobj('Tag','calib_marker');%look for handle of point marker (circle)
    454451        if ~isempty(hhh)
     
    456453        else
    457454            rectangle('Curvature',[1 1],...
    458                   'Position',[xy(1,1)-ind_range/2 xy(1,2)-ind_range/2 ind_range ind_range],'EdgeColor','m',...
    459                   'LineStyle','-','Tag','calib_marker');
    460            % line([xy(1,1) xy(1,1)],[xy(1,2) xy(1,2)],'Color','m','Tag','calib_marker','LineStyle','.','Marker','o','MarkerSize',ind_range);
     455                'Position',[xy(1,1)-ind_range/2 xy(1,2)-ind_range/2 ind_range ind_range],'EdgeColor','m',...
     456                'LineStyle','-','Tag','calib_marker');
    461457        end
    462458        AxeData.Drawing='calibration';
  • trunk/src/mouse_motion.m

    r650 r657  
    378378    if  ~isempty(xy) && isfield(hh_geometry_calib,'ListCoord')
    379379        h_ListCoord=hh_geometry_calib.ListCoord; %findobj(h_geometry_calib,'Tag','ListCoord');
    380         Coord=get(h_ListCoord,'String');
    381         data=read_geometry_calib(Coord);%transform char cell to numbers
    382         if size(data.Coord,2)>=5
     380        data.Coord=get(h_ListCoord,'Data');
     381%         data.Coord(:,6)=[];
     382       % data=read_geometry_calib(Coord);%transform char cell to numbers
     383        if isnumeric(data.Coord)&&~isempty(data.Coord)
    383384            XCoord=(data.Coord(:,4));
    384385            YCoord=(data.Coord(:,5));
     
    397398                hh=findobj('Tag','calib_points');%look for handle of calibration points
    398399               if ~isempty(hh) && ~isempty(get(hh,'UserData')) && get(hh_geometry_calib.edit_append,'Value')
     400                   %set(hh,'UserData',index_point)
    399401                    index_point=get(hh,'UserData');
    400402                    XCoord(index_point)=xy(1,1);
     
    404406               end
    405407                if ~isempty(index_point)
    406                     set(h_ListCoord,'Value',index_point)%mrk the point on the GUI geometry_calib
     408                    Data=get(h_ListCoord,'Data');
     409                    Data(:,6)=zeros(size(Data,1),1);
     410                    Data(index_point,6)=1;%mrk the point on the GUI geometry_calib
     411                    set(h_ListCoord,'Data',Data);
     412                   % set(h_ListCoord,'Value',index_point)%mrk the point on the GUI geometry_calib
    407413                    hhh=findobj('Tag','calib_marker');%look for handle of point marker (circle)
    408414                    if ~isempty(hhh)
    409415                        set(hhh,'Position',[XCoord(index_point)-ind_range/2 YCoord(index_point)-ind_range/2 ind_range ind_range])
     416                    else
     417                                    rectangle('Curvature',[1 1],...
     418                'Position',[xy(1,1)-ind_range/2 xy(1,2)-ind_range/2 ind_range ind_range],'EdgeColor','m',...
     419                'LineStyle','-','Tag','calib_marker');
    410420                    end
    411421                end
  • trunk/src/mouse_up.m

    r650 r657  
    339339            set(hh,'UserData',[])%remove edit mode
    340340            h_ListCoord=hh_geometry_calib.ListCoord; %handles of the coordinate list
    341             Coord=get(h_ListCoord,'String');
    342             data=read_geometry_calib(Coord);
     341            Coord=get(h_ListCoord,'Data');
     342           % data=read_geometry_calib(Coord);
    343343            %         val=get(h_ListCoord,'Value');
    344344          %  xy=get(hcurrentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
    345             data.Coord(index_point,4)=xy(1,1);
    346             data.Coord(index_point,5)=xy(1,2);
    347             for ipoint=1:size(data.Coord,1)
    348                 for jcoord=1:5
    349                     Coord_cell{ipoint,jcoord}=num2str(data.Coord(ipoint,jcoord),4);%display coordiantes with 4 digits
    350                 end
    351             end
    352             Tabchar=cell2tab(Coord_cell,' | ');
    353             Tabchar=[Tabchar ;{'......'}];
    354             set(h_ListCoord,'String',Tabchar)
    355             set(hh,'XData',data.Coord(:,4))
    356             set(hh,'YData',data.Coord(:,5))
     345            Coord(index_point,4)=xy(1,1);
     346            Coord(index_point,5)=xy(1,2);
     347            set(h_ListCoord,'Data',Coord)
     348%             for ipoint=1:size(Coord,1)
     349%                 for jcoord=1:5
     350%                     Coord_cell{ipoint,jcoord}=num2str(data.Coord(ipoint,jcoord),4);%display coordiantes with 4 digits
     351%                 end
     352%             end
     353%             Tabchar=cell2tab(Coord_cell,' | ');
     354%             Tabchar=[Tabchar ;{'......'}];
     355%             set(h_ListCoord,'String',Tabchar)
     356            set(hh,'XData',Coord(:,4))
     357            set(hh,'YData',Coord(:,5))
    357358        end
    358359    end
  • trunk/src/set_object.m

    r650 r657  
    8080
    8181%% position
    82 set(0,'Unit','points')
     82set(0,'Unit','pixels')
    8383ScreenSize=get(0,'ScreenSize');% get the size of the screen, to put the fig on the upper right
    84 Width=300;% fig width in points (1/72 inch)
    85 Height=min(0.8*ScreenSize(4),500);
     84Width=300;% fig width in pixels
     85Height=600;
    8686Left=ScreenSize(3)- Width-40; %right edge close to the right, with margin=40
    8787Bottom=ScreenSize(4)-Height-40; %put fig at top right
    88 set(handles.set_object,'Unit','points')
     88set(handles.set_object,'Unit','pixels')
    8989set(handles.set_object,'Position',[Left Bottom Width Height])
    9090
  • trunk/src/uvmat.m

    r654 r657  
    25472547%         UvData.Field.CoordMesh=ord;
    25482548%     end
     2549if ~isfield(UvData.Field,'NbDim')
     2550    UvData.Field.NbDim=1;
     2551end
    25492552if UvData.Field.NbDim>1
    25502553    UvData.Field=find_field_bounds(UvData.Field);
     
    49064909FileName=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt];
    49074910set(handles.view_xml,'Backgroundcolor',[1 1 0])%indicate the reading of the current xml file by geometry_calib
    4908 pos_uvmat=get(handles.uvmat,'Position');
    4909 pos_cal(1)=pos_uvmat(1)+UvData.OpenParam.PosGeometryCalib(1)*pos_uvmat(3);
    4910 pos_cal(2)=pos_uvmat(2)+UvData.OpenParam.PosGeometryCalib(2)*pos_uvmat(4);
    4911 pos_cal(3:4)=UvData.OpenParam.PosGeometryCalib(3:4).* pos_uvmat(3:4);
    4912 geometry_calib(FileName,pos_cal);% call the geometry_calib interface   
     4911% pos_uvmat=get(handles.uvmat,'Position');
     4912% pos_cal(1)=pos_uvmat(1)+UvData.OpenParam.PosGeometryCalib(1)*pos_uvmat(3);
     4913% pos_cal(2)=pos_uvmat(2)+UvData.OpenParam.PosGeometryCalib(2)*pos_uvmat(4);
     4914% pos_cal(3:4)=UvData.OpenParam.PosGeometryCalib(3:4).* pos_uvmat(3:4);
     4915geometry_calib(FileName);% call the geometry_calib interface   
    49134916set(handles.view_xml,'Backgroundcolor',[1 1 1])%indicate the end of reading of the current xml file by geometry_calib
    49144917set(handles.MenuCalib,'checked','on')% indicate that MenuCalib is activated, test used by mouse action
Note: See TracChangeset for help on using the changeset viewer.