EPICS Home

Experimental Physics and Industrial Control System


 
1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020 
<== Date ==> <== Thread ==>

Subject: Re: [Scopes] BMP image record??
From: Matt Newville <newville@cars.uchicago.edu>
To: Pavel Masloff <pavel.masloff@gmail.com>
Cc: EPICS Tech Talk <tech-talk@aps.anl.gov>
Date: Mon, 30 Apr 2012 09:59:28 -0500
Hi Pavel,

Since you mentioned pyepics and numpy, I'll jump in to recommend a
slightly different waveform -> Image conversion using these:

    import Image
    import epics

    waveform_pv = epics.PV('xx:waveform.VAL')
    waveform = waveform_pv.get()  # will be a numpy array of unsigned ints
    # to get a truncated waveform, pass in the length you'd like:
    #     waveform = waveform_pv.get(count=400)

    width = ??     # that is, you'll have to assert this here.
    height = len(waveform)/width

    image = Image.frombuffer('L', (width, height), waveform, 'raw', 'L', 0, 1)
    image.show()

where you'll have the know the image height and width somehow to
unravel the 1-d waveform.   The Image.frombuffer() call is slightly
cryptic, but documented ('L' means 8-bit greyscale -- if you're
waveform held RGB data from a color camera, you'd change that here to
get a color image), and is faster than converting to a string and then
using Image.open().

--Matt

Replies:
Re: [Scopes] BMP image record?? Pavel Masloff
References:
[Scopes] BMP image record?? Pavel Masloff
RE: [Scopes] BMP image record?? Mark Rivers
Re: [Scopes] BMP image record?? Pavel Masloff
RE: [Scopes] BMP image record?? Mark Rivers
Re: [Scopes] BMP image record?? Pavel Masloff
RE: [Scopes] BMP image record?? Mark Rivers
Re: [Scopes] BMP image record?? Pavel Masloff
RE: [Scopes] BMP image record?? Wang Xiaoqiang
Re: [Scopes] BMP image record?? Pavel Masloff

Navigate by Date:
Prev: 9th NOBUGS conference announcement - registration open Tobias.Richter
Next: AreaDetector Roper or PVCam IOC link problem giles.knap
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020 
Navigate by Thread:
Prev: Re: [Scopes] BMP image record?? Pavel Masloff
Next: Re: [Scopes] BMP image record?? Pavel Masloff
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020