[SciPy-user] Alternative to NumTut's view() function?

Fernando Perez scipy-user@scipy.net
Fri, 14 Feb 2003 19:51:46 -0700 (MST)


Hi Travis,

> If you have the PIL installed and a recent version of scipy you can use
> 
> imshow(array)  
> 
> which will convert the image to a PIL object and show it through the PIL
> external viewer.

thanks for the suggestion, but with today's PIL and cvs scipy, this does 
exactly nothing on my system.

> 
> This works for both RGB and grayscale images.
> 
> 
> For grayscale images I personally use
> 
> xplt.imagesc  
> 
> quite a bit  but you have to have a Unix environment.

Thanks! That does work quite well for plain numerical arrays, which is what I 
need most.  

It doesn't seem to be the tool for images such as NumTut's 'greece', this
gives a pygist window which is empty, and the following traceback:

In [6]: scipy.xplt.imagesc(greece)
---------------------------------------------------------------------------
MemoryError                               Traceback (most recent call last)

?

/usr/lib/python2.2/site-packages/scipy/xplt/Mplot.py in imagesc(z, cmin, cmax, 
xryr, _style, palette, color)
    694     byteimage = gist.bytscl(z,cmin=cmin,cmax=cmax)
    695     change_palette(palette)
--> 696     gist.pli(byteimage,xryr[0],xryr[1],xryr[2],xryr[3])
    697     return
    698


But that's ok, I can always use the modified 'view' I posted for images, which 
I need rarely.  For numerical 2d arrays your solution seems great.

I can't wait for the whole Chaco framework to stabilize so that scipy can grow 
an integrated, single data plotting system.  That will be really great.

Thanks again for all the help,

F.