PyDis
Python Image Displaying Application
PyDis is a Python image displaying application based on PyDVT package. It intends to implement the functionality provided today by "dis", but with the advantages of presenting a Qt interface, new PyDVT features, and the possibility to create custom extension. It has a "mdi" windows style that resembles any normal Windows application (but, of course, runs on all supported platforms: linux, solaris, hp-ux, and windows).
The focus of this application is displaying 2d images, but lots of functionality provided by PyDVT package is used here as mesh and contour drawings, 1d graphics, table representation of data, graphical selection on images and multiple image formats handling for saving and printing.
PyDis is extendable through plugins, implemented to add new file formats for reading and saving, customize printing, and implement new operations on image and data. Some of the standards functions are implemented as plugins and new ones can be created to customize the application. The basic functions are:
The standard plugins include:
These functions are executed:
To launch the application in a beamline, once it has been installed with its dependencies, just type "PyDis" followed by the initialization options, if any.
The application can be launched with these initialization parameters:
-f <filename> |
Sets a file to be open on startup window. |
-e <format> |
Sets the file format (edf,jpg,png,bmp). If omitted uses extension of filename. |
-s <specname> |
Spec session to be open on startup window (requires -a option). |
-a <arrayname> |
If -s used, indicates the name of the array to be open. |
-M |
Starts PyDis maximized. |
-m |
Opens startup window (if exists) maximized. |
-d <dir name> |
Sets work directory. |
-r |
If set, windows are repaint while resizing. |
-S <style> |
Sets application style (Windows, Motif, MotifPlus, CDE, SGI, Platinum). If omitted uses qt's default. |
-F <font> <size> <weight> <italic> |
Sets application font. If ommited uses qt's default. <font>: helvetica, times, ... <size>: font size, default=12 <weight>: 0 to 100. Normal=50, Bold=100 <italic>: 0 or 1 |
-p <plugin> |
Sets additional directory to read plugins from (customized plugins in addiction to standard ones). |
-qwt |
Sets QwtBinding. This affects 1D plots, which use PyQwt, and not Plplot libraries (default).. |
-o <opt> |
Sets optimization option. This parameter sets if and how data is buffered in memory. Each option can be better according to the machine, the memory the objective, the size of file, and whether the application is being executed locally or through a remote x server. Values for <opt>:
|
Plugins are loaded first from the standard plugin directory (./Plugins subdirectory where PyDis.py is located, usually set at installation time) and then from the directories set as initialization parameters. To add a custom plugin just copy it into the standard plugin directory. If PyDis is supposed to have different behavior each execution time (load different plugins) create executable scripts with different "-p" initialization options, pointing to the directories with the plugins to be loaded.
A plugin is coded in a python module. In there a class derived from "Plugin" (defined in PyDisWindow.py module) should be created and a global variable of this derived class declared as "plugin". Plugin" class defines an interface that allows derived classes to implement the following functions:
As an example of how to code a plugin see DemoPyDisPlugin.py. This (useless) plugin adds support to text files, and implements all plugin interface methods. In a real plugin there's no need to code all interface methods, but just the ones needed to implement the functionality. See the standard plugins as examples.
You can download PyDis from here.