You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Introduction

Package PlotsWithGUI is intended for interactive 2-d image analysis. It is written on python and uses the numpy library for fast manipulation with arrays, matplotlib library for graphics, and PyQt4 for GUI (Graphical User Interface). We assume that image is available in the form of 2-d numpy array. This array is passed as an input parameter at initialization of the ImgExplorer class object and can be updated later using a simple program interface. When image is drawn, one may select by mouse different regions of the image in order to plot spectra, profiles, x-y and r-theta projections, zoomed-in images etc. GUI allows easy manipulate with regions; add, move, select, and remove regions and associated derived plots for current event. All newly created plots are preserved for other events, when image array is updated. GUI is mainly based on intuitive mouse manipulations with very minor input from keyboard.

Features

Current version of the package produce the plot of the input image and allows to generate numerous derived plots, such as

  • Spectrum in the rectangular region
  • Image profile along the straight line
  • X-Y projections and spectrum in the rectangular region
  • R-Phi projections and spectrum in the wedge region
  • Zoomed-in image of the rectangular region

How to run it?

Use module Example.py from the PlotsWithGUI package in order to to run example and to see how it works:

psanaxxxx> python Example.py

This package has a simple program interface, which runs as a regular PyQt4 widget.

#-----------------------------
import sys
import ImgExplorer as ie
from PyQt4 import QtGui, QtCore
#-----------------------------

def main():

    app = QtGui.QApplication(sys.argv)

    w  = ie.ImgExplorer(None)
    w.move(QtCore.QPoint(10,10))
    w.set_image_array( w.get_array2d_with_ring_for_test() )
    w.show()

    app.exec_()        

#-----------------------------
if __name__ == "__main__" :
    main()
    sys.exit ('End of test')
#-----------------------------

Main window

When program starts the main graphical window appears at first. This window contains the image of the input 2-d array integrated with GUI.

In order to get any derived plot one has to click on mouse (left button) few times;
First, select the tab for type of the plot which you want;

  • Spectrum
  • Profile
  • Proj.X-Y
  • Proj.R-Phi
  • Zoom
  • Center
    then, choise the mode Add (default mode is Move)
    and, finally, click-and-drag the mouse on image in order to select the desired region. This operation slightly depends on what type of region do you want to select:
  • for line it is the 1st and last point of the line,
  • for rectangular box it is two opposite corners,
  • for center it is the coordinate of the center and the half size of the center sign along the x and y directions,
  • for wedge it is two opposite corners, assuming that the center is already defined.
    All click-release points can be indicated withoud any particular order. Later all regions can be adjusted in mode Move.

Derived plots

Spectrum

Profile

Projection X-Y

Projection R-Theta

Zoom

Configuration parameters

confpars.00N

  • No labels