~ubuntu-branches/ubuntu/trusty/guiqwt/trusty

« back to all changes in this revision

Viewing changes to guiqwt/tests/image_rgb.py

  • Committer: Bazaar Package Importer
  • Author(s): Picca Frédéric-Emmanuel
  • Date: 2011-04-07 22:41:50 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20110407224150-kkhppnq7rp2c8b3c
Tags: 2.1.0-1
* Imported Upstream version 2.1.0
* debian/patches/
  - 0001-features-01_bts614083.patch (delete)
  - 0001-feature-fix-the-documentation-build.patch (new)
* add and install the sift desktop file
* recommends python-dicom (Closes: #621421)
  thanks Junqian Gordon Xu for the report

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
#
 
3
# Copyright © 2009-2010 CEA
 
4
# Pierre Raybaut
 
5
# Licensed under the terms of the CECILL License
 
6
# (see guidata/__init__.py for details)
 
7
 
 
8
"""RGB Image test, creating the RGBImageItem object via make.rgbimage"""
 
9
 
 
10
SHOW = True # Show test in GUI-based test launcher
 
11
 
 
12
import numpy as np
 
13
 
 
14
from guiqwt.plot import ImageDialog
 
15
from guiqwt.builder import make
 
16
import os.path as osp
 
17
 
 
18
SHOW = True # Show test in GUI-based test launcher
 
19
 
 
20
TESTDIR = osp.abspath(osp.dirname(__file__))
 
21
IMGFILE = osp.join(TESTDIR, "..", "images", "items", "image.png")
 
22
 
 
23
def imshow( data ):
 
24
    win = ImageDialog(edit=False, toolbar=True, wintitle="RGB image item test")
 
25
    item = make.rgbimage(data, xdata=[-1, 1], ydata=[-1, 1])
 
26
    plot = win.get_plot()
 
27
    plot.add_item(item)
 
28
    win.show()
 
29
    win.exec_()
 
30
 
 
31
def test():
 
32
    """Test"""
 
33
    # -- Create QApplication
 
34
    import guidata
 
35
    _app = guidata.qapplication()
 
36
    # --
 
37
    from PIL.Image import open
 
38
    img = np.array(open(IMGFILE))
 
39
    print img.shape
 
40
    imshow(img)
 
41
 
 
42
if __name__ == "__main__":
 
43
    test()