Alright, folks
Everything is OK now. The image file is thoroughly sitting in the waveform record. The image, as Dirk pointed out is a compressed file (RLE). On the scope I can select between the following formats: BMP, PCX, TIFF, RLE, EPSIMAGE. But they all happen to be compressed, so the image data is not a color representing a pixel anymore (because if there are two or more consecutive pixels with the same color that's where compression comes into play).
So my choices are either wait until the CSS people (Xihui I fully rely on you :))) update the intensity widget to support RGB + compression (I am in need of the decompressor only). OR to write my own client (I am using a Python client at the moment - command line program + CSS for GUI).
Another option would be to run an HTTP server on the IOC machine. Horrible!
I am thinking of a true way of how to delegate responsibilities to the server (IOC) and to clients. CSS is very handy because you don't need to do much of installation. Just copy the folder and there you go. You don't even need the administrative rights.
Now I need to install Python on the client machine. And in CSS I hit a button to run the command line program (local Python script) and the CSS Console shows up which racks all my neat OPI GUI, I can close or minimize the console of course.
I know in CSS you can write scripts in Python (or better say Jython). Can I import true Python modules such as Image??? The Image module understands my formats (compressed BMP, RLE, TIFF etc) and can pick raw image data from it.
Thanks, everyone!! You have helped me A LOT!
On Mon, Apr 30, 2012 at 3:05 AM, Mark Rivers <[email protected]> wrote:
I didn't realize the HARDCOPY command would send the data over the serial port automatically, I assumed you have to transfer it with FTP or something.
In that case you should be able to use the waveform record with StreamDevice as Rod suggested. In addition to setting NELM you will need to set the environment variable EPICS_CA_MAX_ARRAY_BYTES to a value at least as large as the largest image, on both the IOC and client machines.
Sent: Sunday, April 29, 2012 11:18 AM
To: Mark Rivers
Cc: EPICS Tech Talk
Subject: Re: [Scopes] BMP image record??
Why can't I?
In Hyperterminal (as well as in Python) you simply send a command and receive bytes, which you forward to a binary file. Sth like this:
import sys
import os
import time
import serial
# create target file
print os.getcwd()
f = open('hardcopy.png', 'wb')
# configure the serial connection
ser = serial.Serial()
ser.port = 0
ser.timeout = 0
ser.baudrate = 9600
ser.open()
# configure the hardcopy settings
cmd = ':HARDCOPY:FORMAT PNG;PALETTE NORMAL;PORT RS232;LAYOUT PORTRAIT;\
PREVIEW 0;INKSAVER 0;COMPRESSION 0\n'
a = ser.write(cmd)
print "bytes sent: {:d}".format(a)
# start hardcopy
a = ser.write("HARDCOPY START\n")
print "bytes sent: {:d}".format(a)
# begin receiving data and writing to file
total_bytes = 0;
a = ser.inWaiting()
while a>0:
time.sleep(0.5)
data = "">
total_bytes += a
f.write(data)
time.sleep(0.5)
a = ser.inWaiting()
sys.stdout.write(".")
# close file and serial port
sys.stdout.write("\n")
f.close()
ser.close()
print "bytes read: {:d}".format(total_bytes)
print "script completed"
Are you sure StreamDevice won't write the input to a waveform record?
On Sun, Apr 29, 2012 at 7:47 PM, Mark Rivers < [email protected]<mailto: [email protected]>> wrote:
I don't think you can get the image into a waveform record from the scope with StreamDevice. You would have to write another driver that does what you were doing with Hyperterminal and Python. You could perhaps use an SNL program for this.
To display an image in BOY you use the Intensity Plot widget. The waveform record is 1-D, but you tell the BOY widget the actual X and Y dimensions of the array.
Mark
________________________________
From: Pavel Masloff [[email protected]<mailto:[email protected]>]
Sent: Sunday, April 29, 2012 9:22 AM
To: Mark Rivers
Cc: EPICS Tech Talk
Subject: Re: [Scopes] BMP image record??
Is there any working example on how to get the image into a waveform record using StreamDevice? I haven't used the waveform record yet, reading up on this in the db reference manual, not that comprehensible :(
Another question is how to read a waveform (image type) in BOY?
Pavel
On Sat, Apr 28, 2012 at 5:53 PM, Mark Rivers < [email protected]<mailto: [email protected]><mailto: [email protected]<mailto: [email protected]>>> wrote:
If you can get the image into a waveform record, using streamDevice for example, then you can display that waveform as in image in EDM, CSS BOY, ImageJ or other applications. You need to create a few other records that tell the client what the actual image dimensions are.
It may be just as easy to implement reading the actual waveforms into waveform records, and display those with Cartesian plot widgets in your display manager.
Mark
________________________________
From: [email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>> [[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>] on behalf of Pavel Masloff [[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>]
Sent: Saturday, April 28, 2012 2:17 AM
To: EPICS Tech Talk
Subject: [Scopes] BMP image record??
Hello again,
As I mentioned earlier we are running a series of experiments with our high current switches. I have written simple support ("...with a little help from my friend" Dirk Zimoch) for the Tektronix TPS2000 over RS232 using StreamDevice and ASYN, so now I can remotely arm the scopes, set its properties, save waveforms on to the CF card, etc. But...
In order to not run back and forth and see if everything went OK (which is rather tiresome and time consuming), we need a confirmation from the scopes. I don't want to deal with the implementation of the waveform records for now, all I have got so far is that I save them on the flash card.
As such a confirmation I see transferring the BMP (or PNG) image from the scope (sort of Print screen) on to the operator PC somehow.
There is a special SCPI command "Hardcopy start". Which mimics the Print button on the scope's front panel. I have tried to transfer a BMP file via Hyperterminal (and Python script) and it worked out well (more or less).
How could this be ported to the EPICS database from the IOC and client standpoint, so an operator could see the oscillogram on the screen and decide whether the experiment went well, so she will save the waveforms and move on to the next experiment?
The image file is maximum ~ 46Kb (20Kb on average).
Any thoughts?
--
Best regards,
Pavel Maslov, MS
Controls Engineer at Pulsed power Lab
Efremov Institute for Electro-Physical Apparatus
St. Petersburg, Russia
Mobile: +7 (951) 672 22 19
Landline: +7 (812) 461 01 01
--
Best regards,
Pavel Maslov, MS
Controls Engineer at Pulsed power Lab
Efremov Institute for Electro-Physical Apparatus
St. Petersburg, Russia
Mobile: +7 (951) 672 22 19
Landline: +7 (812) 461 01 01
--
Best regards,
Pavel Maslov, MS
Controls Engineer at Pulsed power Lab
Efremov Institute for Electro-Physical Apparatus
St. Petersburg, Russia
Mobile: +7 (951) 672 22 19
Landline: +7 (812) 461 01 01
-- Best regards,
Pavel Maslov, MS Controls Engineer at Pulsed power Lab Efremov Institute for Electro-Physical Apparatus
St. Petersburg, Russia
Mobile: +7 (951) 672 22 19
Landline: +7 (812) 461 01 01
- Replies:
- Re: [Scopes] BMP image record?? Dirk Zimoch
- RE: [Scopes] BMP image record?? Chen, Xihui
- 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
- Navigate by Date:
- Prev:
Trouble compiling areaDetector1-8beta1 Gessner, Spencer J.
- Next:
Re: [Scopes] BMP image record?? Dirk Zimoch
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
<2012>
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
RE: [Scopes] BMP image record?? Chen, Xihui
- Next:
Re: [Scopes] BMP image record?? Dirk Zimoch
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
<2012>
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|