Changeset 78


Ignore:
Timestamp:
Apr 2, 2010, 9:01:21 PM (14 years ago)
Author:
sommeria
Message:

debugging of geometry_calib and mouse operations
merge_proj: call to read_image replaced. Still problems to solve to merge images

Location:
trunk/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/geometry_calib.m

    r71 r78  
    216216set(handles.ListCoord,'String',Tabchar)
    217217MenuPlot_Callback(handles.geometry_calib, [], handles)
    218 
     218if isempty(Coord)
     219    set(handles.edit_append,'Value',1)
     220    set(handles.edit_append,'BackgroundColor',[1 1 0])
     221else
     222    set(handles.edit_append,'Value',0)
     223    set(handles.edit_append,'BackgroundColor',[0.7 0.7 0.7])
     224end
    219225%
    220226%------------------------------------------------------------------------
     
    441447path_uvmat=which('uvmat');% check the path detected for source file uvmat
    442448path_UVMAT=fileparts(path_uvmat); %path to UVMAT
    443 
     449huvmat=findobj(allchild(0),'Tag','uvmat');
     450hhuvmat=guidata(huvmat);
    444451x_1=Coord(:,4:5)';
    445452X_1=Coord(:,1:3)';
    446453n_ima=1;
    447454% check_cond=0;
    448 nx=1024;ny=1024;
     455
     456
     457nx=str2num(get(hhuvmat.npx,'String'));
     458ny=str2num(get(hhuvmat.npy,'String'));
     459
     460
    449461% est_kc=[1;0;0;0;0];
    450 est_dist=[1;0;0;0;0];
     462est_dist=[0;0;0;0;0];
    451463run(fullfile(path_UVMAT,'TOOLBOX_calib','go_calib_optim'));
    452464
     
    652664Coord_cell=get(handles.ListCoord,'String');
    653665val=get(handles.ListCoord,'Value');
     666if numel(val)>1
     667    return %no action if several lines have been selected
     668end
    654669coord_str=Coord_cell{val};
    655670k=findstr('|',coord_str);
     
    706721%------------------------------------------------------------------------
    707722choice=get(handles.edit_append,'Value');
    708 if choice==1
    709        Coord=get(handles.ListCoord,'String');
    710        val=length(Coord);
    711        if val>=1 & isequal(Coord{val},'')
    712             val=val-1; %do not take into account blank
    713        end
    714        Coord{val+1}='';
    715        set(handles.ListCoord,'String',Coord)
    716        set(handles.ListCoord,'Value',val+1)
    717 end
    718 
    719 
     723% if choice==1
     724%        Coord=get(handles.ListCoord,'String');
     725%        val=length(Coord);
     726%        if val>=1 & isequal(Coord{val},'')
     727%             val=val-1; %do not take into account blank
     728%        end
     729%        Coord{val+1}='';
     730%        set(handles.ListCoord,'String',Coord)
     731%        set(handles.ListCoord,'Value',val+1)
     732% end
     733if choice
     734    set(handles.edit_append,'BackgroundColor',[1 1 0])
     735else
     736    set(handles.edit_append,'BackgroundColor',[0.7 0.7 0.7])
     737end
    720738   
    721739function NEW_Callback(hObject, eventdata, handles)
     
    763781    Coord_cell=get(handles.ListCoord,'String');
    764782    val=get(handles.ListCoord,'Value');
    765     if val<numel(Coord_cell) % the last element '...' has not been selected
     783     if max(val)<numel(Coord_cell) % the last element '...' has not been selected
    766784        Coord_cell(val)=[];%remove the selected line
     785        set(handles.ListCoord,'Value',min(val))
    767786        set(handles.ListCoord,'String',Coord_cell)         
    768787        ListCoord_Callback(hObject, eventdata, handles)
    769788        MenuPlot_Callback(hObject,eventdata,handles)
    770     end
     789     end
    771790end
    772791
  • trunk/src/mouse_down.m

    r71 r78  
    6363        %if the mouse is over an axis, look at the data
    6464        if isequal(htype,'axes')
     65            y_lim=get(hchild(ichild),'YLim');
     66            x_lim=get(hchild(ichild),'XLim');
    6567            haxes=hchild(ichild);
    6668            xy=get(haxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
    67             AxeData=get(haxes,'UserData');% data attached to the axis
    68             AxeData.CurrentOrigin=[xy(1,1) xy(1,2)];% The current point set by the mouse becomes the current origin
    69             if ~isequal(tag_obj,'proj_object') & ~test_create
    70                 x_mouse=xy(1,1);%default
    71                 y_mouse=xy(1,2);%default
    72                 u_mouse=[];
    73                 v_mouse=[];
    74                 w_mouse=[];
    75                 A_mouse=[];
    76                 c_text=[];
    77                 f_text=[];
    78                 ff_text=[];     
    79                 ivec=[];   
    80                 if isfield(AxeData,'X') & isfield(AxeData,'Y') & isfield(AxeData,'Mesh')% test on the existence of a vector field in the current axis
    81                     flag_vec=(AxeData.X<(xy(1,1)+AxeData.Mesh/4) & AxeData.X>(xy(1,1)-AxeData.Mesh/4)) & ...%flagx=1 for the vectors with x position selected by the mouse
    82                       (AxeData.Y<(xy(1,2)+AxeData.Mesh/4) & AxeData.Y>(xy(1,2)-AxeData.Mesh/4));%f
    83                     ivec=find(flag_vec,1);% search the (first) selected vector index ivec
     69            if xy(1,1)>x_lim(1) && xy(1,1)<x_lim(2) && xy(1,2)>y_lim(1) && xy(1,2)<y_lim(2)
     70                AxeData=get(haxes,'UserData');% data attached to the axis
     71                AxeData.CurrentOrigin=[xy(1,1) xy(1,2)];% The current point set by the mouse becomes the current origin
     72                if ~isequal(tag_obj,'proj_object') & ~test_create
     73                    x_mouse=xy(1,1);%default
     74                    y_mouse=xy(1,2);%default
     75                    u_mouse=[];
     76                    v_mouse=[];
     77                    w_mouse=[];
     78                    A_mouse=[];
     79                    c_text=[];
     80                    f_text=[];
     81                    ff_text=[];     
     82                    ivec=[];   
     83                    if isfield(AxeData,'X') & isfield(AxeData,'Y') & isfield(AxeData,'Mesh')% test on the existence of a vector field in the current axis
     84                        flag_vec=(AxeData.X<(xy(1,1)+AxeData.Mesh/4) & AxeData.X>(xy(1,1)-AxeData.Mesh/4)) & ...%flagx=1 for the vectors with x position selected by the mouse
     85                          (AxeData.Y<(xy(1,2)+AxeData.Mesh/4) & AxeData.Y>(xy(1,2)-AxeData.Mesh/4));%f
     86                        ivec=find(flag_vec,1);% search the (first) selected vector index ivec
     87                    end
    8488                end
    85             end
    86 %         elseif isequal(get(hchild(ichild),'Visible'),'on')& ~isequal(get(hchild(ichild),'Style'),'frame')
    87 %            %FAIRE UNE OPTION D'AIDE AVEC BOUTON SOURIS DROIT (ALT)??
     89            else
     90                haxes=[];%mouse out of axes
     91            end
    8892        end
    8993    end
     
    240244
    241245% create calibration points if the GUI geometry_calib is opened, if the main axes axes3 of uvmat has ben selected
    242 if test_cal && ~isempty(haxes) && strcmp(get(haxes,'tag'),'axes3')
     246if ~testzoom && test_cal && ~isempty(haxes) && strcmp(get(haxes,'tag'),'axes3')
    243247    h_geometry_calib=findobj(allchild(0),'Name','geometry_calib'); %find the geomterty_calib GUI
    244248    hh_geometry_calib=guidata(h_geometry_calib);
    245249    h_ListCoord=hh_geometry_calib.ListCoord; %findobj(h_geometry_calib,'Tag','ListCoord');
    246250    h_edit_append=hh_geometry_calib.edit_append;%findobj(h_geometry_calib,'Tag','edit_append');
    247     if isequal(get(h_edit_append,'Value'),1)
     251    if isequal(get(h_edit_append,'Value'),1) && ~isempty(haxes)
    248252        coord_value=get(hhuvmat.transform_fct,'Value');% set uvmat to pixel coordinates, run it again if not
    249253        if ~(isequal(coord_value,1)||isequal(coord_value,3)); %active only with no transform or px (no phys)
     
    256260        Coord=get(h_ListCoord,'String');
    257261        data=read_geometry_calib(Coord);%transform char cell to numbers
    258         ind_range=10;%range of research around each existing point
     262        xlim=get(haxes,'XLim');
     263        ind_range_x=abs((xlim(2)-xlim(1))/50);
     264        ylim=get(haxes,'YLim');
     265        ind_range_y=abs((ylim(2)-ylim(1))/50);
     266        ind_range=sqrt(ind_range_x*ind_range_y);
    259267        test_newpoint=1;
    260268        if size(data.Coord,2)>=5 %if calibration points already exist
     
    265273            test_newpoint=isempty(index_point);%test for no existing calibration point near the mouse position
    266274        end
     275        val=get(h_ListCoord,'Value');
    267276        %create a new calib point if we are not close to an existing one
    268277        if test_newpoint                 
    269278             strline=[ '    |    '  '    |    '  '    |    ' num2str(xy(1,1),4) '    |    ' num2str(xy(1,2),4)];
    270              val=get(h_ListCoord,'Value');
     279           
    271280             if length(Coord)>=val
    272281                 Coord(val+1:length(Coord)+1)=Coord(val:length(Coord));% push the list forward beyond the current point
     
    286295            set(hh,'YData',YCoord)
    287296        end
    288         set(hh,'UserData','edit_mode')% flag the points to edit mode
     297        set(hh,'UserData',val)% flag the points to edit mode
    289298        hhh=findobj('Tag','calib_marker');%look for handle of point marker (circle)
    290299        if ~isempty(hhh)
  • trunk/src/mouse_motion.m

    r71 r78  
    2424
    2525function mouse_motion(hObject,eventdata,handles)
     26
    2627if ~exist('handles','var')
    2728    return
     
    3435test_ruler=0;
    3536huvmat=findobj(allchild(0),'Name','uvmat');%find the uvmat interface handle
     37hhuvmat=guidata(huvmat);
     38test_zoom=get(hhuvmat.zoom,'Value');
    3639if ~isempty(huvmat)
    3740    UvData=get(huvmat,'UserData');
     
    207210set(handles.text_display_3,'String',text_displ_3);
    208211set(handles.text_display_4,'String',text_displ_4);
    209 if ~test_draw
    210     return
    211 end
     212% if ~test_draw
     213%     return
     214% end
    212215% At this stage  if no drawing  operation is done
    213216
     
    289292% detect calibration points if the GUI geometry_calib is opened
    290293h_geometry_calib=findobj(allchild(0),'Name','geometry_calib'); %find the geomterty_calib GUI
    291 if ~test_zoom_draw && ~isempty(h_geometry_calib)
     294if ~test_zoom && ~isempty(h_geometry_calib)
    292295    pointershape='crosshair';%default for geometry_calib: ready to create new points
    293296    hh_geometry_calib=guidata(h_geometry_calib);
    294     if get(hh_geometry_calib.edit_append,'Value')  && ~isempty(xy)
     297    if ~isempty(xy)
    295298        h_ListCoord=hh_geometry_calib.ListCoord; %findobj(h_geometry_calib,'Tag','ListCoord');
    296299        Coord=get(h_ListCoord,'String');
     
    301304            xy=get(haxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
    302305            if ~isempty(xy)
    303                 ind_range=10;
     306                xlim=get(haxes,'XLim');
     307                ind_range_x=abs((xlim(2)-xlim(1))/50);
     308                ylim=get(haxes,'YLim');
     309                ind_range_y=abs((ylim(2)-ylim(1))/50);
     310                ind_range=sqrt(ind_range_x*ind_range_y);
    304311                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
    305312                              (YCoord<xy(1,2)+ind_range) & (YCoord>xy(1,2)-ind_range),1);%find the first calibration point in the neighborhood of the mouse
    306313                if ~isempty(index_point)
    307314                    pointershape='arrow';% default pointer is an arrow
    308                     set(h_ListCoord,'Value',index_point)%mrk the point on the GUI geometry_calib
    309                     hh=findobj('Tag','calib_points');%look for handle of calibration points
    310                     if ~isempty(hh) && strcmp(get(hh,'UserData'),'edit_mode')
    311                         XCoord(index_point)=xy(1,1);
    312                         YCoord(index_point)=xy(1,2);
    313                         set(hh,'XData',XCoord)
    314                         set(hh,'YData',YCoord)
    315                     end
     315                end
     316                hh=findobj('Tag','calib_points');%look for handle of calibration points
     317               if ~isempty(hh) && ~isempty(get(hh,'UserData')) && get(hh_geometry_calib.edit_append,'Value')
     318                    index_point=get(hh,'UserData');
     319                    XCoord(index_point)=xy(1,1);
     320                    YCoord(index_point)=xy(1,2);
     321                    set(hh,'XData',XCoord)
     322                    set(hh,'YData',YCoord)
     323               end
     324                if ~isempty(index_point)
     325                    set(h_ListCoord,'Value',index_point)%mrk the point on the GUI geometry_calib
    316326                    hhh=findobj('Tag','calib_marker');%look for handle of point marker (circle)
    317327                    if ~isempty(hhh)
    318328                        set(hhh,'Position',[XCoord(index_point)-ind_range/2 YCoord(index_point)-ind_range/2 ind_range ind_range])
    319 %                         set(hhh,'XData',XCoord(index_point))
    320 %                         set(hhh,'YData',YCoord(index_point))
    321                     end
    322                 end         
     329                    end
     330                end
    323331            end
    324332        end
  • trunk/src/mouse_up.m

    r71 r78  
    262262
    263263% editing calibration point
    264 if strcmp(MouseAction,'calib')
    265     hh=findobj(currentaxes,'Tag','calib_points')%look for handle of calibration points           
    266     if ~isempty(hh)
     264if ~zoomstate strcmp(MouseAction,'calib')
     265    h_geometry_calib=findobj(allchild(0),'Name','geometry_calib'); %find the geomterty_calib GUI
     266    hh_geometry_calib=guidata(h_geometry_calib);
     267    edit_test=get(hh_geometry_calib.edit_append,'Value');
     268    hh=findobj(currentaxes,'Tag','calib_points');%look for handle of calibration points           
     269    if ~isempty(hh) && edit_test
     270        index_point=get(hh,'UserData');
    267271        set(hh,'UserData',[])%remove edit mode
    268         h_geometry_calib=findobj(allchild(0),'Name','geometry_calib'); %find the geomterty_calib GUI
    269         hh_geometry_calib=guidata(h_geometry_calib);
    270272        h_ListCoord=hh_geometry_calib.ListCoord; %handles of the coordinate list
    271273        Coord=get(h_ListCoord,'String');
    272         val=get(h_ListCoord,'Value');
    273         coord_str=Coord{val}; %current line (string)
     274%         val=get(h_ListCoord,'Value');
     275        coord_str=Coord{index_point}; %current line (string)
    274276        k=findstr('|',coord_str);%find separator indices on the string
    275277        xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
     
    279281            coord_str=[ '    |    '  '    |    '  '    |    ' num2str(xy(1,1),4) '    |    ' num2str(xy(1,2),4)];
    280282        end
    281         Coord{val}=coord_str;       
     283        Coord{index_point}=coord_str;       
    282284        set(h_ListCoord,'String',Coord)
     285        data=read_geometry_calib(Coord);%transform char cell to numbers
     286        set(hh,'XData',data.Coord(:,4))
     287        set(hh,'YData',data.Coord(:,5))
    283288    end
    284289end
  • trunk/src/series/merge_proj.m

    r76 r78  
    259259                    Field{iview}.A=read(MovieObject{iview},num_i1{iview}(ifile));
    260260                else
    261                     Field{iview}.A=read_image(filename,Series.NomType{iview},num_i1{iview}(ifile));
     261                    Field{iview}.A=imread(filename);
    262262                end % TODO: introduce ListVarName
    263263                npxy=size(Field{iview}.A);
Note: See TracChangeset for help on using the changeset viewer.