From 53b8b5ace7e9617a9e0b854864d2b36ab252413f Mon Sep 17 00:00:00 2001 From: Antonino Ingargiola Date: Tue, 16 Oct 2007 00:30:29 +0200 Subject: [PATCH] IA: Added integral center selection via mouse click on image --- pyplotsuite/imageanalyzer/image_analyzer.glade | 4 ++-- pyplotsuite/imageanalyzer2.py | 29 +++++++++++++++++++------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/pyplotsuite/imageanalyzer/image_analyzer.glade b/pyplotsuite/imageanalyzer/image_analyzer.glade index 3095685..67713ad 100644 --- a/pyplotsuite/imageanalyzer/image_analyzer.glade +++ b/pyplotsuite/imageanalyzer/image_analyzer.glade @@ -3407,7 +3407,7 @@ POSSIBILITY OF SUCH DAMAGES. True - Max radious: + Max radius: False False GTK_JUSTIFY_LEFT @@ -3432,7 +3432,7 @@ POSSIBILITY OF SUCH DAMAGES. True - Radious of the circle inside which the integration take place + Radius of the circle inside which the integration take place True 10 0 diff --git a/pyplotsuite/imageanalyzer2.py b/pyplotsuite/imageanalyzer2.py index 18db8da..b326196 100644 --- a/pyplotsuite/imageanalyzer2.py +++ b/pyplotsuite/imageanalyzer2.py @@ -693,6 +693,10 @@ class PeakIntegralDialog(DialogWindowWithCancel): self.canvas = self.callerApp.canvas self.origin = self.callerApp.origin + + self.ax.figure.canvas.mpl_connect('button_release_event', + self.get_cursor_cb) + self.thresholdSpinButt = self.widgetTree.get_widget( 'thresholdSpinButt') self.maxRadiousSpinButt = self.widgetTree.get_widget( @@ -741,6 +745,15 @@ class PeakIntegralDialog(DialogWindowWithCancel): ## # Plotting methods # + def get_cursor_cb(self, event): + if event.inaxes: + dprint('setting new center') + self.allowReplot = False + self.xCircleSpinButt.set_value(event.xdata) + self.allowReplot = True + self.yCircleSpinButt.set_value(event.ydata) + self.canvas.draw() + def update_all(self): self.update_mask() self.update_circle() @@ -772,14 +785,14 @@ class PeakIntegralDialog(DialogWindowWithCancel): # self.yc = 512 - self.yc # self.changed = False - x, y = circle(self.xc, self.yc, self.r) - - if self.circle is None: - self.circle, = self.ax.plot(x, y, - lw=2, color='white', linestyle='--') - else: - self.circle.set_data(x,y) - #self.canvas.draw() + if self.allowReplot: + x, y = circle(self.xc, self.yc, self.r) + + if self.circle is None: + self.circle, = self.ax.plot(x, y, + lw=2, color='white', linestyle='--') + else: + self.circle.set_data(x,y) ## # GUI callbacks -- 2.11.4.GIT