From 7a22340fb2b80ab695d7a4476959082ee53d13d6 Mon Sep 17 00:00:00 2001 From: Antonino Ingargiola Date: Sat, 27 Oct 2007 12:12:23 +0200 Subject: [PATCH] IA: Improved image properties dialog --- pyplotsuite/imageanalyzer/image_analyzer.glade | 1126 +++++++++++++++++------- pyplotsuite/imageanalyzer2.py | 39 +- 2 files changed, 849 insertions(+), 316 deletions(-) diff --git a/pyplotsuite/imageanalyzer/image_analyzer.glade b/pyplotsuite/imageanalyzer/image_analyzer.glade index df8d83e..5b16cd1 100644 --- a/pyplotsuite/imageanalyzer/image_analyzer.glade +++ b/pyplotsuite/imageanalyzer/image_analyzer.glade @@ -125,7 +125,7 @@ - + True gtk-media-stop 1 @@ -147,7 +147,7 @@ - + True gtk-media-record 1 @@ -168,7 +168,7 @@ - + True gtk-leave-fullscreen 1 @@ -196,7 +196,7 @@ - + True gtk-delete 1 @@ -218,7 +218,7 @@ - + True gtk-undo 1 @@ -245,7 +245,7 @@ - + True gtk-select-color 1 @@ -266,7 +266,7 @@ - + True gtk-edit 1 @@ -290,7 +290,7 @@ True - + True gtk-print-preview 1 @@ -358,7 +358,7 @@ - + True gtk-justify-fill 1 @@ -392,7 +392,7 @@ True - + True gtk-execute 1 @@ -414,7 +414,7 @@ - + True gtk-color-picker 1 @@ -430,7 +430,7 @@ True - All... + Image properties... True @@ -751,7 +751,7 @@ Winter GTK_UPDATE_ALWAYS False False - 0 0 100000 1 10 10 + 0 -64000 100000 1 10 10 0 @@ -1882,6 +1882,7 @@ POSSIBILITY OF SUCH DAMAGES. + 5 True False 0 @@ -1905,7 +1906,7 @@ POSSIBILITY OF SUCH DAMAGES. 0 - 10 + 5 False False @@ -1926,7 +1927,7 @@ POSSIBILITY OF SUCH DAMAGES. GTK_JUSTIFY_LEFT False False - 0.5 + 0 0.5 10 0 @@ -1983,7 +1984,7 @@ POSSIBILITY OF SUCH DAMAGES. GTK_JUSTIFY_RIGHT False False - 0.5 + 0 0.5 10 0 @@ -2040,7 +2041,7 @@ POSSIBILITY OF SUCH DAMAGES. GTK_JUSTIFY_RIGHT False False - 0.5 + 0 0.5 10 0 @@ -2325,6 +2326,7 @@ POSSIBILITY OF SUCH DAMAGES. + 10 True False 0 @@ -2357,7 +2359,7 @@ POSSIBILITY OF SUCH DAMAGES. True - True + False 0 @@ -2369,7 +2371,7 @@ POSSIBILITY OF SUCH DAMAGES. GTK_JUSTIFY_RIGHT False False - 0.5 + 0 0.5 10 0 @@ -2381,7 +2383,7 @@ POSSIBILITY OF SUCH DAMAGES. 0 True - False + True @@ -2400,12 +2402,37 @@ POSSIBILITY OF SUCH DAMAGES. 10 True + True + + + + + + True + A.U. + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False False - 10 + 5 True True @@ -2414,7 +2441,7 @@ POSSIBILITY OF SUCH DAMAGES. True - True + False 0 @@ -2426,7 +2453,7 @@ POSSIBILITY OF SUCH DAMAGES. GTK_JUSTIFY_LEFT False False - 0.5 + 0 0.5 10 0 @@ -2438,7 +2465,7 @@ POSSIBILITY OF SUCH DAMAGES. 0 True - False + True @@ -2457,12 +2484,37 @@ POSSIBILITY OF SUCH DAMAGES. 10 True + True + + + + + + True + A.U. + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False False - 10 + 5 True True @@ -2477,13 +2529,13 @@ POSSIBILITY OF SUCH DAMAGES. True - Visualized aspect ratio: + Pixel aspect ratio: False False GTK_JUSTIFY_LEFT False False - 0.5 + 0 0.5 10 0 @@ -2495,13 +2547,14 @@ POSSIBILITY OF SUCH DAMAGES. 0 True - False + True True + Visualized pixel aspect ratio True 10 2 @@ -2514,12 +2567,12 @@ POSSIBILITY OF SUCH DAMAGES. 10 True - False + True - 10 + 5 True True @@ -3685,7 +3738,7 @@ POSSIBILITY OF SUCH DAMAGES. - + True Image Properties GTK_WINDOW_TOPLEVEL @@ -3703,18 +3756,18 @@ POSSIBILITY OF SUCH DAMAGES. True - + True False 0 - + True GTK_BUTTONBOX_END - + True True True @@ -3723,7 +3776,6 @@ POSSIBILITY OF SUCH DAMAGES. GTK_RELIEF_NORMAL True -7 - @@ -3736,84 +3788,201 @@ POSSIBILITY OF SUCH DAMAGES. - + + 10 True - True - 5 + False + 10 - + True - True - 0 + 0 + 0.5 + GTK_SHADOW_NONE - + True - Min: - False - False - GTK_JUSTIFY_LEFT - False - False - 0 + 0.20000000298 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 10 - True - True - - + 1 + 1 + 0 + 0 + 12 + 0 - - - True - True - True - True - 0 - - True - - False + + + True + 3 + 2 + False + 5 + 10 + + + + True + File name: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 0 + 1 + fill + + + + + + + True + Path: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 1 + 2 + fill + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 0 + 1 + expand + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 1 + 2 + expand + + + + + + True + Size: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 2 + 3 + fill + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 2 + 3 + + + + + - - 10 - True - True - - - - 0 - True - True - - - - - - True - True - 0 - + True - Max: + <b>File</b> False - False + True GTK_JUSTIFY_LEFT False False - 0 + 0.5 0.5 0 0 @@ -3823,225 +3992,591 @@ POSSIBILITY OF SUCH DAMAGES. 0 - 10 - True - True - - - - - - True - True - True - True - 0 - - True - - False - - - 10 - True - True + label_item 0 - False + True True - + True - True - 0 + 0 + 0.5 + GTK_SHADOW_NONE - + True - Variance: - False - False - GTK_JUSTIFY_LEFT - False - False - 0 + 0.5 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 10 - True - True - - + 1 + 1 + 0 + 0 + 12 + 0 - - - True - True - True - True - 0 - - True - - False - - - 10 - True - True - - - - - 0 - True - True - - + + + True + 9 + 3 + False + 5 + 10 - - - True - True - 0 + + + True + Max: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 1 + 2 + fill + + + - - - True - Standard deviation: - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 10 - True - True - - + + + True + True + @ 341x256 + False + False + GTK_JUSTIFY_LEFT + False + True + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 2 + 3 + 1 + 2 + fill + + + - - - True - True - True - True - 0 - - True - - False - - - 10 - True - True - - - - - 0 - True - True - - + + + True + Number of pixels: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 0 + 1 + fill + + + - - - True - True - 0 + + + True + True + 512 x 512 + False + False + GTK_JUSTIFY_LEFT + False + True + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 2 + 3 + 0 + 1 + fill + + + - - - True - Mean: - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 10 - True - True - - + + + True + Mode: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 8 + 9 + fill + + + - - - True - True - True - True - 0 - - True - - False + + + True + Median + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 7 + 8 + fill + + + + + + + True + Mean: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 6 + 7 + fill + + + + + + + True + Sum: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 5 + 6 + fill + + + + + + + True + Standard deviation: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 4 + 5 + fill + + + + + + + True + Variance: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 3 + 4 + fill + + + + + + + True + Min: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 2 + 3 + fill + + + + + + + True + True + @ 112x437 + False + False + GTK_JUSTIFY_LEFT + False + True + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 2 + 3 + 2 + 3 + fill + + + + + + + True + Statistical mode, the more frequent value + True + True + True + 0 + + True + * + False + + + 1 + 3 + 8 + 9 + expand + + + + + + True + Mean between max and min value + True + True + True + 0 + + True + * + False + + + 1 + 3 + 7 + 8 + expand + + + + + + True + Mean of the pixels values + True + True + True + 0 + + True + + False + + + 1 + 3 + 6 + 7 + expand + + + + + + True + Sum of the pixels values + True + True + True + 0 + + True + + False + + + 1 + 3 + 5 + 6 + expand + + + + + + True + True + True + True + 0 + + True + + False + + + 1 + 3 + 4 + 5 + expand + + + + + + True + True + True + True + 0 + + True + + False + + + 1 + 3 + 3 + 4 + expand + + + + + + True + True + True + True + 0 + + True + + False + + + 1 + 2 + 2 + 3 + expand + + + + + + True + True + True + True + 0 + + True + + False + + + 1 + 2 + 1 + 2 + expand + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 0 + 1 + expand + + + + - - 10 - True - True - - - - 0 - True - True - - - - - - True - True - 0 - + True - Sum: + <b>Data</b> False - False + True GTK_JUSTIFY_LEFT False False - 0 + 0.5 0.5 0 0 @@ -4051,28 +4586,7 @@ POSSIBILITY OF SUCH DAMAGES. 0 - 10 - True - True - - - - - - True - True - True - True - 0 - - True - - False - - - 10 - True - True + label_item @@ -4084,7 +4598,7 @@ POSSIBILITY OF SUCH DAMAGES. - 10 + 0 True True diff --git a/pyplotsuite/imageanalyzer2.py b/pyplotsuite/imageanalyzer2.py index 4b225f6..75cac13 100644 --- a/pyplotsuite/imageanalyzer2.py +++ b/pyplotsuite/imageanalyzer2.py @@ -13,6 +13,7 @@ # (at your option) any later version. import sys +import os import os.path import imp rootdir = os.path.abspath(imp.find_module('pyplotsuite')[1]) + '/' @@ -886,23 +887,41 @@ class ImagePropertiesDialog(ChildWindow): Dialog to calculate image properties. """ def __init__(self, callerApp): - ChildWindow.__init__(self, 'ImageParametersDialog', gladefile, + ChildWindow.__init__(self, 'ImagePropertiesDialog', gladefile, callerApp) - self.minEntry = self.widgetTree.get_widget('minEntry') + + self.widgetTree.get_widget('fnameEntry').set_text( + os.path.basename(self.callerApp.filename)) + self.widgetTree.get_widget('pathEntry').set_text( + os.path.dirname(self.callerApp.filename)) + self.widgetTree.get_widget('sizeEntry').set_text("%3.1f KB" %\ + (os.stat(self.callerApp.filename).st_size/1024.,)) + + self.nPixelsEntry = self.widgetTree.get_widget('nPixelsEntry') + self.shapeLabel = self.widgetTree.get_widget('shapeLabel') self.maxEntry = self.widgetTree.get_widget('maxEntry') + self.maxPosLabel = self.widgetTree.get_widget('maxPosLabel') + self.minEntry = self.widgetTree.get_widget('minEntry') + self.minPosLabel = self.widgetTree.get_widget('minPosLabel') self.varEntry = self.widgetTree.get_widget('varEntry') self.stdEntry = self.widgetTree.get_widget('stdEntry') - self.meanEntry = self.widgetTree.get_widget('meanEntry') self.sumEntry = self.widgetTree.get_widget('sumEntry') - + self.meanEntry = self.widgetTree.get_widget('meanEntry') + self.medianEntry = self.widgetTree.get_widget('medianEntry') + self.modeEntry = self.widgetTree.get_widget('modeEntry') im = self.callerApp.image_array - - self.minEntry.set_text(str(im.min())) + self.nPixelsEntry.set_text(str(im.size)) + self.shapeLabel.set_text("%d x %d" % im.shape[::-1]) self.maxEntry.set_text(str(im.max())) - self.varEntry.set_text(str(im.var())) - self.stdEntry.set_text(str(im.std())) - self.meanEntry.set_text(str(im.mean())) - self.sumEntry.set_text(str(im.sum())) + self.maxPosLabel.set_text("@ %d x %d" % M.maximum_position(im)[::-1]) + self.minEntry.set_text(str(im.min())) + self.minPosLabel.set_text("@ %d x %d" % M.minimum_position(im)[::-1]) + self.varEntry.set_text("%8.3f" % im.var()) + self.stdEntry.set_text("%8.3f" % im.std()) + self.sumEntry.set_text("%d" % im.sum()) + self.meanEntry.set_text("%8.3f" % im.mean()) + self.medianEntry.set_text("%8.2f" %(im.min() + (im.max()-im.min())*0.5)) + #self.modeEntry.set_text(str(im.mode())) def on_closeButton_clicked(self, widget, *args): self.window.destroy() -- 2.11.4.GIT