def on_figure_clicked(self, event): """ Clicked a match between query annotation and result annotation: parses the type of click it was and execute the correct visualiztion """ print('[viz] clicked result') if ih.clicked_outside_axis(event): #self.toggle_fmatch() pass else: ax = event.inaxes viztype = ph.get_plotdat(ax, 'viztype', '') #printDBG(str(event.__dict__)) printDBG('viztype=%r' % viztype) # Clicked a specific matches if viztype == 'matches': aid1 = ph.get_plotdat(ax, 'aid1', None) aid2 = ph.get_plotdat(ax, 'aid2', None) # Ctrl-Click key = '' if event.key is None else event.key print('key = %r' % key) if key.find('control') == 0: print('[viz] result control clicked') self.on_ctrl_clicked_match(aid1, aid2) # Left-Click else: print('[viz] result clicked') self.on_clicked_match(aid1, aid2)
def _on_image_click(event): printDBG('[inter] clicked image') if ih.clicked_outside_axis(event): # Toggle draw lbls kwargs['draw_lbls'] = not kwargs.get('draw_lbls', True) _image_view(**kwargs) else: ax = event.inaxes viztype = vh.get_ibsdat(ax, 'viztype') annotation_centers = vh.get_ibsdat(ax, 'annotation_centers', default=[]) printDBG(' annotation_centers=%r' % annotation_centers) printDBG(' viztype=%r' % viztype) if len(annotation_centers) == 0: print(' ...no chips exist to click') return x, y = event.xdata, event.ydata # Find ANNOTATION center nearest to the clicked point aid_list = vh.get_ibsdat(ax, 'aid_list', default=[]) centx, _dist = ut.nearest_point(x, y, annotation_centers) aid = aid_list[centx] print(' ...clicked aid=%r' % aid) if select_callback is not None: # HACK, should just implement this correctly here select_callback(gid, sel_aids=[aid], fnum=self.fnum) else: _image_view(sel_aids=[aid]) viz.draw()
def on_single_match_clicked(event): from plottool import interact_helpers as ih from plottool import plot_helpers as ph """ result interaction mpl event callback slot """ print('[viz] clicked result') if ih.clicked_outside_axis(event): pass else: ax = event.inaxes viztype = ph.get_plotdat(ax, 'viztype', '') #printDBG(str(event.__dict__)) # Clicked a specific matches if viztype.startswith('matches'): #aid2 = ph.get_plotdat(ax, 'aid2', None) # Ctrl-Click evkey = '' if event.key is None else event.key simp = ph.get_plotdat(ax, 'simp', None) key = ph.get_plotdat(ax, 'key', None) print('evkey = %r' % evkey) if evkey.find('control') == 0: print('[viz] result control clicked') pass # Left-Click else: print(simp) print(key) print('[viz] result clicked') pass ph.draw()
def _on_image_click(event): printDBG('[inter] clicked image') if ih.clicked_outside_axis(event): # Toggle draw lbls kwargs['draw_lbls'] = not kwargs.get('draw_lbls', True) _image_view(**kwargs) else: ax = event.inaxes viztype = vh.get_ibsdat(ax, 'viztype') annotation_centers = vh.get_ibsdat(ax, 'annotation_centers', default=[]) printDBG(' annotation_centers=%r' % annotation_centers) printDBG(' viztype=%r' % viztype) if len(annotation_centers) == 0: print(' ...no chips exist to click') return x, y = event.xdata, event.ydata # Find ANNOTATION center nearest to the clicked point aid_list = vh.get_ibsdat(ax, 'aid_list', default=[]) centx, _dist = ut.nearest_point(x, y, annotation_centers) aid = aid_list[centx] print(' ...clicked aid=%r' % aid) if select_callback is not None: # HACK, should just implement this correctly here select_callback(gid, sel_aids=[aid], fnum=self.fnum) else: _image_view(sel_aids=[aid]) viz.draw()
def on_figure_clicked(self, event): """ Clicked a match between query annotation and result annotation: parses the type of click it was and execute the correct visualiztion """ print('[viz] clicked result') if ih.clicked_outside_axis(event): #self.toggle_fmatch() pass else: ax = event.inaxes viztype = ph.get_plotdat(ax, 'viztype', '') # Clicked a specific matches if viztype == 'matches': aid1 = ph.get_plotdat(ax, 'aid1', None) aid2 = ph.get_plotdat(ax, 'aid2', None) # Ctrl-Click key = '' if event.key is None else event.key print('key = %r' % key) if key.find('control') == 0: print('[viz] result control clicked') self.on_ctrl_clicked_match(aid1, aid2) # Left-Click else: print('[viz] result clicked') self.on_clicked_match(aid1, aid2)
def on_single_match_clicked(event): from plottool import interact_helpers as ih from plottool import plot_helpers as ph """ result interaction mpl event callback slot """ print('[viz] clicked result') if ih.clicked_outside_axis(event): pass else: ax = event.inaxes viztype = ph.get_plotdat(ax, 'viztype', '') #printDBG(str(event.__dict__)) # Clicked a specific matches if viztype.startswith('matches'): #aid2 = ph.get_plotdat(ax, 'aid2', None) # Ctrl-Click evkey = '' if event.key is None else event.key simp = ph.get_plotdat(ax, 'simp', None) key = ph.get_plotdat(ax, 'key', None) print('evkey = %r' % evkey) if evkey.find('control') == 0: print('[viz] result control clicked') pass # Left-Click else: print(simp) print(key) print('[viz] result clicked') pass ph.draw()
def _on_chip_click(event): print('[inter] clicked chip') ax, x, y = event.inaxes, event.xdata, event.ydata if ih.clicked_outside_axis(event): if not ischild: print('... out of axis') mode_ptr[0] = (mode_ptr[0] + 1) % 3 _chip_view(**kwargs) else: if event.button == 3: # right-click import guitool #from ibeis.viz.interact import interact_chip height = fig.canvas.geometry().height() qpoint = guitool.newQPoint(event.x, height - event.y) refresh_func = partial(_chip_view, **kwargs) callback_list = build_annot_context_options( ibs, aid, refresh_func=refresh_func, with_interact_chip=False, config2_=config2_) qwin = fig.canvas guitool.popup_menu(qwin, qpoint, callback_list) #interact_chip.show_annot_context_menu( # ibs, aid, fig.canvas, qpoint, refresh_func=refresh_func, # with_interact_chip=False, config2_=config2_) else: viztype = vh.get_ibsdat(ax, 'viztype') print('[ic] viztype=%r' % viztype) if viztype == 'chip' and event.key == 'shift': _chip_view(**kwargs) ih.disconnect_callback(fig, 'button_press_event') elif viztype == 'chip': kpts = ibs.get_annot_kpts(aid, config2_=config2_) if len(kpts) > 0: fx = vt.nearest_point( x, y, kpts, conflict_mode='next')[0] print('... clicked fx=%r' % fx) _select_fxth_kpt(fx) else: print('... len(kpts) == 0') elif viztype in ['warped', 'unwarped']: fx = vh.get_ibsdat(ax, 'fx') if fx is not None and viztype == 'warped': viz.show_keypoint_gradient_orientations( ibs, aid, fx, fnum=df2.next_fnum()) else: print('...Unknown viztype: %r' % viztype) viz.draw()
def _on_chip_click(event): print('[inter] clicked chip') ax, x, y = event.inaxes, event.xdata, event.ydata if ih.clicked_outside_axis(event): if not ischild: print('... out of axis') mode_ptr[0] = (mode_ptr[0] + 1) % 3 _chip_view(**kwargs) else: if event.button == 3: # right-click import guitool #from ibeis.viz.interact import interact_chip height = fig.canvas.geometry().height() qpoint = guitool.newQPoint(event.x, height - event.y) refresh_func = partial(_chip_view, **kwargs) callback_list = build_annot_context_options( ibs, aid, refresh_func=refresh_func, with_interact_chip=False, config2_=config2_) qwin = fig.canvas guitool.popup_menu(qwin, qpoint, callback_list) #interact_chip.show_annot_context_menu( # ibs, aid, fig.canvas, qpoint, refresh_func=refresh_func, # with_interact_chip=False, config2_=config2_) else: viztype = vh.get_ibsdat(ax, 'viztype') print('[ic] viztype=%r' % viztype) if viztype == 'chip' and event.key == 'shift': _chip_view(**kwargs) ih.disconnect_callback(fig, 'button_press_event') elif viztype == 'chip': kpts = ibs.get_annot_kpts(aid, config2_=config2_) if len(kpts) > 0: fx = vt.nearest_point( x, y, kpts, conflict_mode='next')[0] print('... clicked fx=%r' % fx) _select_fxth_kpt(fx) else: print('... len(kpts) == 0') elif viztype in ['warped', 'unwarped']: fx = vh.get_ibsdat(ax, 'fx') if fx is not None and viztype == 'warped': viz.show_keypoint_gradient_orientations( ibs, aid, fx, fnum=df2.next_fnum()) else: print('...Unknown viztype: %r' % viztype) viz.draw()
def _on_sv_click(event): ax = event.inaxes if ih.clicked_outside_axis(event): print('... out of axis') mode_ptr[0] = (mode_ptr[0] + 1) % 3 kwargs['show_kpts'] = mode_ptr[0] == 2 kwargs['show_lines'] = mode_ptr[0] >= 1 _sv_view(**kwargs) else: viztype = vh.get_ibsdat(ax, 'viztype') if viztype in ['homogblend', 'affblend', 'source', 'dest']: pass else: print('...Unknown viztype: %r' % viztype) viz.draw()
def _on_sv_click(event): print_('[inter] clicked sv') ax = event.inaxes if ih.clicked_outside_axis(event): print('... out of axis') mode_ptr[0] = (mode_ptr[0] + 1) % 3 kwargs['show_kpts'] = mode_ptr[0] == 2 kwargs['show_lines'] = mode_ptr[0] >= 1 _sv_view(**kwargs) else: viztype = vh.get_ibsdat(ax, 'viztype') print_('[ic] viztype=%r' % viztype) if viztype in ['homogblend', 'affblend', 'source', 'dest']: pass else: print('...Unknown viztype: %r' % viztype) viz.draw()