def iselect_bbox(ibs, gid, fnum=1, figtitle='Image View - Select ANNOTATION (click two points)', **kwargs): #from matplotlib.backend_bases import mplDeprecation print('[*interact] select_bbox(gid=%r, fnum=%r)' % (gid, fnum)) print('[*interact] Define a Rectanglular ANNOTATION by clicking two points.') # Show the image fig = ih.begin_interaction('select_bbox', fnum) fig_presenter.bring_to_front(fig) viz.show_image(ibs, gid, **kwargs) try: viz.draw() fig = df2.gcf() pts = fig.ginput(2) print('[*guitools] ginput(2) = %r' % (pts,)) [(x1, y1), (x2, y2)] = pts xm = min(x1, x2) xM = max(x1, x2) ym = min(y1, y2) yM = max(y1, y2) bbox = tuple(map(int, map(round, (xm, ym, xM - xm, yM - ym)))) # Reconnect the old button press events print('[*interact] bbox = %r ' % (bbox,)) return bbox except Exception as ex: print('<!!!>') print('[*interact] Caught: %s %s' % (type(ex), ex)) print('[*interact] ANNOTATION selection Failed:') print('</!!!>') raise
def show_match_at(qres_wgt, qtindex): print('interact') model = qtindex.model() aid = model.get_header_data('aid', qtindex) qaid = model.get_header_data('qaid', qtindex) fig = interact.ishow_matches(qres_wgt.ibs, qres_wgt.qaid2_qres[qaid], aid, mode=1) fig_presenter.bring_to_front(fig)
def show_match_at_qtindex(qres_wgt, qtindex): print('interact') qaid, daid = qres_wgt.get_aidpair_from_qtindex(qtindex) cm = qres_wgt.qaid2_cm[qaid] match_interaction = cm.ishow_single_annotmatch(qres_wgt.qreq_, daid, mode=0) fig = match_interaction.fig fig_presenter.bring_to_front(fig)
def bring_to_front(self): fig_presenter.bring_to_front(self.fig)