EPICS, MATLAB, GigE CCD CAMERA BASED BEAM IMAGING
SYSTEM FOR THE IAC-RadiaBeam THz PROJECT
Chris Eckman∗
, Y. Kim, A. Andrews, T. Downer, and P. Buaphad
Idaho State University, Pocatello, ID 83209, USA
Abstract
At the Idaho Accelerator Center (IAC) of Idaho State
University (ISU), we have been operating an L-band RF
linear accelerator running at low energies (4 - 44 MeV) for
the IAC-RadiaBeam THz project [1]. We have designed
and implemented a beam image acquisition and analysis
system that can be used for real time observation of the
electron beam, tuning of THz radiation production, and
measurement of transverse beam emittance. In this paper,
we describe the components of the imaging system, the ac-
quisition of real time beam images, the remote acquisition
of single shot beam images, and the processing of the beam
images in MATLAB to measure beam size and transverse
beam emittance.
INTRODUCTION
Due to a 1.2 mm wide slit at the entrance of the THz
radiator, experiments for the IAC-RadiaBeam THz project
require the implementation of an optics system to control
the beam shape for obtaining optimal beam transmission.
To accomplish this, the ISU Advanced Accelerator and Ul-
trafast beam Lab (AAUL) has developed an advanced beam
imaging system that acquires real time beam images as
well as single shot beam images. Real time beam imag-
ing is achieved through use of the software application,
SampleViewer in conjunction with the beam imaging sys-
tem. Single shot beam images can be acquired remotely
using Experimental Physics and Industrial Control System
(EPICS), MATLAB, and the EPICS modules: areaDetector
and MATLAB Channel Access (MCA). The beam imaging
system, taking single shot beam images, allows for measur-
ing beam size as well as transverse beam emittance.
THE IMAGING SYSTEM
The components of the beam imaging system are as fol-
lows: an Yttrium Aluminium Garnet (YAG) screen on an
actuator, a Prosilica GC1290 GigE CCD camera with a
mounted adjustable Fujinon HF50SA-1 lens, a screen LED
illuminator, and optics table to mount the optics cage. The
optics cage is assembled with components, manufactured
by Thorlabs [2], listed in Table 1. The essentials compo-
nents of the beam imaging system can be seen in Fig. 1.
The light generated from the interaction of the beam on the
∗ cryptoscientia@gmail.com
YAG screen can be observed through a crystal window sit-
uated adjacent to the YAG screen.
Figure 1: Set-up of the beam imaging system.
A small brightness-adjustable LED was mounted on the
end of the optics cage to illuminate the YAG screen and
ease in the alignment and calibration of the camera. Light
picked up by the camera from sources anywhere other than
the YAG screen increases the background noise on each
image, thus a black covering was draped around the optics
cage to shield the camera from all other light. The proxim-
ity of the camera to the accelerator poses risk of radiation
damage to the camera sensor, thus the camera was placed
inside a lead tube, shielding it from the radiation. For extra
protection, the optics cage was practically surrounded by
lead bricks.
PROSILICA CAMERA
Beam parameter measurements rely heavily on image
quality. The quality of the image is affected by the dis-
tance between the camera and the YAG screen, electronic
interference, broken pixels in the camera sensor, and ex-
poser time. The Prosilica GC1290 GigE CCD camera was
chosen for the beam imaging system for its high resolution
Table 1: Main components purchased through Thorlabs for
the imaging cage set-up
Image Description Part Number QTY
Threaded cage plate LCP01T 4
Cage assembly rod ER18 4
Steel optical post TR4 2
Post holder PH4 2
Mounting base BA2T2 2
and image quality as summerised in Table 2. The Fujinon
HF50SA-1 lens is focused on the YAG screen for optimal
viewing and imaging, the camera and lens as shown in the
bottom right of Fig. 2. The Fujinon lens allows for efficient
focusing and adjusting of the equipment.
Table 2: Main specifications on the Prosilica GigE CCD
Camera and the Fujinon HF50SA-1 lens
Parameter Value or Type
Interface GigE
Resolution 1280 × 960
Sensor size Type 1/3
Cell size 3.75 µm
Max frame rate at full resolution 32 fps
Lens focal length 50 mm
Lens minimum field of view 38 mm × 28 mm
The Prosilica camera has a trigger input port that re-
ceives an external trigger signal from the timing system of
the accelerator. The external trigger signal was added to
the power cable and fed into the trigger input port of the
camera. The power cable for the camera had to be physi-
cally modified to add the triggering signal. Triggering the
camera off of the timing system of the accelerator allows
the synchronization of the camera and the beam so that the
images taken are accurate depictions of the actual beam.
The CCD camera features a Gigabit Ethernet interface used
for transmitting beam images on the local area network to
a dedicated Linux computer system running EPICS where
the data is stored and processed. The EPICS host allows for
remote control of the camera via the EPICS module areaD-
etector.
SAMPLEVIEWER
SampleViewer is a free software application for the GigE
CCD camera distributed by Prosilica. It has a user friendly
interface that incorporates the cameras internet connection
to run several diagnostics on the CCD camera as well as
acquire real time beam images as shown in Fig. 2. The di-
agnostics that can be performed include: checking image
quality, camera alignment, camera triggering, image gain,
and image exposure time. To put the CCD camera on the
network, the Ethernet adapter of the computer needed to
be configured to improve system performance when using
the GigE CCD camera [3]. The configurations included the
packet size (MTU of 8228), interrupt moderate rate, trans-
mit buffers, and receive buffers. The camera also uses a
companion program, IPConfig, to change the dynamically
allocated IP address of the camera to a static IP address
allowing it to be used in EPICS.
Figure 2: Contorl panels of SampleViewer, a beam image,
and the Prosilica GC1290 camera with Fujinon lens.
EPICS AND AREADETECTOR
To more precisely control the CCD camera and extract
data from the images, a programmable method was em-
ployed. EPICS provides a platform that allows for camera
control in an accelerator system [4]. EPICS also provides
a Graphic User Interface (GUI) for user interaction when
needed, such as the main areaDetector GUI as shown in
Fig. 3. Each button and input box on the GUI has an asso-
ciated Process Variable (PV). PVs are named pieces of data
associated with a machine, things like status, readback and
physical parameters. Images are taken by the CCD camera
using “Start” button in areaDetector GUI panel. The PV as-
sociated with that button is named “13PS1:cam1:Acquire”.
All PVs in areaDetector can be controlled in MATLAB
through MCA.
MATLAB CHANNEL ACCESS
MCA creates a channel from MATLAB to EPICS, this
link allows for communication between the two different
programs [5]. With MCA, we are able to send information
Figure 3: Main GUI screen of areaDetector.
in the form of PVs between EPICS and MATLAB by
means of the channel access, thus the accelerator can be
controlled with MATLAB directly. MCA is an extension
of EPICS that can be downloaded and installed in both
EPICS and MATLAB. When installed properly, code can
be entered into MATLAB to control equipment in EPICS.
The MCA code MCAOPEN, MCAGET, and MCAPUT
allow MATLAB to open a channel to EPICS, to read
information from EPICS, and to write information to PVs.
An example of the MCA and MATLAB code is as follows:
CameraAcquire=MCAOPEN(’13PS1:cam1:Acquire’);
AcquireData=MCAGET(CameraAcquire);
MCAPUT(CameraAcquire,1);
MCACLOSE(CameraAcquire);
MCAGET retrieves the status of the PV associated
with the camera shutter. If the CameraAcquire is 0, then
the camera shutter is closed. However if the CameraAc-
quire is 1, then the shutter is open, and the camera starts
taking images. MCAPUT writes values into the PV, such
as 1 or 0, and MCACLOSE closes the channel of the PVs.
These images are then transferred to the hard drive to be
saved in a designated file path, which is also a PV. These
MCA commands are used in MATLAB to control all
aspects of the camera as well as other equipment such as
power supplies [4]. Once an image is in MATLAB it can
be processed to remove background, plot projections, filter
the image, and extract data for parameter measurement.
Fig. 4 (left) shows a background subtracted and color
enhanced version of the image in Fig. 2. The image to
the right is used by an automatic emittance measurement
program running in MATLAB and shows the horizontal
and vertical projections on the image directly [6].
Figure 4: MATLAB processed beam images.
SUMMARY
The beam imaging system is useful for many accelera-
tor applications and beam parameter measurements. The
single shot beam images were taken by the Prosilica GigE
CCD camera using MATLAB in conjunction with areaD-
etector. The beam images were transferred from the cam-
era to MATLAB. In MATLAB the beam images were ana-
lyzed and the relevant data extracted. The combination of
MATLAB and EPICS allows for the control of accelerator
equipment, access to higher level programming, and auto-
matic beam parameter measurements, such as beam size
and transverse beam emittance. The beam imaging system
was used to optimize the production of THz radiation at the
IAC [7,8].
ACKNOWLEDGEMENTS
We would also like to give our sincere thanks to Dr.
Mark Rivers of APS for his advice and guidance on AreaD-
etector and MCA. In addition, we would like to thank Dr.
Henrik Loos of SLAC for his strong interest, advice and
encouragement in this project.
REFERENCES
[1] http://www.iac.isu.edu
[2] http://www.thorlabs.us/index.cfm
[3] http://www.alliedvisiontec.com/us/products/cameras/gigabit-
ethernet/prosilica-gc/gc1290.html
[4] A. Andrews et al.., in these proceedings.
[5] A. Terebilo et al.., in Proc. ICALEPCS2001, THAP030, San
Jose, CA, USA.
[6] C. Eckman et al.., in Proc. IPAC2012, TUPPC055,New Or-
leans,LA
[7] Y. Kim et al.., in these proceedings.
[8] A. V. Smirnov et al.., in these proceedings.

Beam Imaging System for IAC RadiaBeam THz Project

  • 1.
    EPICS, MATLAB, GigECCD CAMERA BASED BEAM IMAGING SYSTEM FOR THE IAC-RadiaBeam THz PROJECT Chris Eckman∗ , Y. Kim, A. Andrews, T. Downer, and P. Buaphad Idaho State University, Pocatello, ID 83209, USA Abstract At the Idaho Accelerator Center (IAC) of Idaho State University (ISU), we have been operating an L-band RF linear accelerator running at low energies (4 - 44 MeV) for the IAC-RadiaBeam THz project [1]. We have designed and implemented a beam image acquisition and analysis system that can be used for real time observation of the electron beam, tuning of THz radiation production, and measurement of transverse beam emittance. In this paper, we describe the components of the imaging system, the ac- quisition of real time beam images, the remote acquisition of single shot beam images, and the processing of the beam images in MATLAB to measure beam size and transverse beam emittance. INTRODUCTION Due to a 1.2 mm wide slit at the entrance of the THz radiator, experiments for the IAC-RadiaBeam THz project require the implementation of an optics system to control the beam shape for obtaining optimal beam transmission. To accomplish this, the ISU Advanced Accelerator and Ul- trafast beam Lab (AAUL) has developed an advanced beam imaging system that acquires real time beam images as well as single shot beam images. Real time beam imag- ing is achieved through use of the software application, SampleViewer in conjunction with the beam imaging sys- tem. Single shot beam images can be acquired remotely using Experimental Physics and Industrial Control System (EPICS), MATLAB, and the EPICS modules: areaDetector and MATLAB Channel Access (MCA). The beam imaging system, taking single shot beam images, allows for measur- ing beam size as well as transverse beam emittance. THE IMAGING SYSTEM The components of the beam imaging system are as fol- lows: an Yttrium Aluminium Garnet (YAG) screen on an actuator, a Prosilica GC1290 GigE CCD camera with a mounted adjustable Fujinon HF50SA-1 lens, a screen LED illuminator, and optics table to mount the optics cage. The optics cage is assembled with components, manufactured by Thorlabs [2], listed in Table 1. The essentials compo- nents of the beam imaging system can be seen in Fig. 1. The light generated from the interaction of the beam on the ∗ cryptoscientia@gmail.com YAG screen can be observed through a crystal window sit- uated adjacent to the YAG screen. Figure 1: Set-up of the beam imaging system. A small brightness-adjustable LED was mounted on the end of the optics cage to illuminate the YAG screen and ease in the alignment and calibration of the camera. Light picked up by the camera from sources anywhere other than the YAG screen increases the background noise on each image, thus a black covering was draped around the optics cage to shield the camera from all other light. The proxim- ity of the camera to the accelerator poses risk of radiation damage to the camera sensor, thus the camera was placed inside a lead tube, shielding it from the radiation. For extra protection, the optics cage was practically surrounded by lead bricks. PROSILICA CAMERA Beam parameter measurements rely heavily on image quality. The quality of the image is affected by the dis- tance between the camera and the YAG screen, electronic interference, broken pixels in the camera sensor, and ex- poser time. The Prosilica GC1290 GigE CCD camera was chosen for the beam imaging system for its high resolution
  • 2.
    Table 1: Maincomponents purchased through Thorlabs for the imaging cage set-up Image Description Part Number QTY Threaded cage plate LCP01T 4 Cage assembly rod ER18 4 Steel optical post TR4 2 Post holder PH4 2 Mounting base BA2T2 2 and image quality as summerised in Table 2. The Fujinon HF50SA-1 lens is focused on the YAG screen for optimal viewing and imaging, the camera and lens as shown in the bottom right of Fig. 2. The Fujinon lens allows for efficient focusing and adjusting of the equipment. Table 2: Main specifications on the Prosilica GigE CCD Camera and the Fujinon HF50SA-1 lens Parameter Value or Type Interface GigE Resolution 1280 × 960 Sensor size Type 1/3 Cell size 3.75 µm Max frame rate at full resolution 32 fps Lens focal length 50 mm Lens minimum field of view 38 mm × 28 mm The Prosilica camera has a trigger input port that re- ceives an external trigger signal from the timing system of the accelerator. The external trigger signal was added to the power cable and fed into the trigger input port of the camera. The power cable for the camera had to be physi- cally modified to add the triggering signal. Triggering the camera off of the timing system of the accelerator allows the synchronization of the camera and the beam so that the images taken are accurate depictions of the actual beam. The CCD camera features a Gigabit Ethernet interface used for transmitting beam images on the local area network to a dedicated Linux computer system running EPICS where the data is stored and processed. The EPICS host allows for remote control of the camera via the EPICS module areaD- etector. SAMPLEVIEWER SampleViewer is a free software application for the GigE CCD camera distributed by Prosilica. It has a user friendly interface that incorporates the cameras internet connection to run several diagnostics on the CCD camera as well as acquire real time beam images as shown in Fig. 2. The di- agnostics that can be performed include: checking image quality, camera alignment, camera triggering, image gain, and image exposure time. To put the CCD camera on the network, the Ethernet adapter of the computer needed to be configured to improve system performance when using the GigE CCD camera [3]. The configurations included the packet size (MTU of 8228), interrupt moderate rate, trans- mit buffers, and receive buffers. The camera also uses a companion program, IPConfig, to change the dynamically allocated IP address of the camera to a static IP address allowing it to be used in EPICS. Figure 2: Contorl panels of SampleViewer, a beam image, and the Prosilica GC1290 camera with Fujinon lens. EPICS AND AREADETECTOR To more precisely control the CCD camera and extract data from the images, a programmable method was em- ployed. EPICS provides a platform that allows for camera control in an accelerator system [4]. EPICS also provides a Graphic User Interface (GUI) for user interaction when needed, such as the main areaDetector GUI as shown in Fig. 3. Each button and input box on the GUI has an asso- ciated Process Variable (PV). PVs are named pieces of data associated with a machine, things like status, readback and physical parameters. Images are taken by the CCD camera using “Start” button in areaDetector GUI panel. The PV as- sociated with that button is named “13PS1:cam1:Acquire”. All PVs in areaDetector can be controlled in MATLAB through MCA. MATLAB CHANNEL ACCESS MCA creates a channel from MATLAB to EPICS, this link allows for communication between the two different programs [5]. With MCA, we are able to send information
  • 3.
    Figure 3: MainGUI screen of areaDetector. in the form of PVs between EPICS and MATLAB by means of the channel access, thus the accelerator can be controlled with MATLAB directly. MCA is an extension of EPICS that can be downloaded and installed in both EPICS and MATLAB. When installed properly, code can be entered into MATLAB to control equipment in EPICS. The MCA code MCAOPEN, MCAGET, and MCAPUT allow MATLAB to open a channel to EPICS, to read information from EPICS, and to write information to PVs. An example of the MCA and MATLAB code is as follows: CameraAcquire=MCAOPEN(’13PS1:cam1:Acquire’); AcquireData=MCAGET(CameraAcquire); MCAPUT(CameraAcquire,1); MCACLOSE(CameraAcquire); MCAGET retrieves the status of the PV associated with the camera shutter. If the CameraAcquire is 0, then the camera shutter is closed. However if the CameraAc- quire is 1, then the shutter is open, and the camera starts taking images. MCAPUT writes values into the PV, such as 1 or 0, and MCACLOSE closes the channel of the PVs. These images are then transferred to the hard drive to be saved in a designated file path, which is also a PV. These MCA commands are used in MATLAB to control all aspects of the camera as well as other equipment such as power supplies [4]. Once an image is in MATLAB it can be processed to remove background, plot projections, filter the image, and extract data for parameter measurement. Fig. 4 (left) shows a background subtracted and color enhanced version of the image in Fig. 2. The image to the right is used by an automatic emittance measurement program running in MATLAB and shows the horizontal and vertical projections on the image directly [6]. Figure 4: MATLAB processed beam images. SUMMARY The beam imaging system is useful for many accelera- tor applications and beam parameter measurements. The single shot beam images were taken by the Prosilica GigE CCD camera using MATLAB in conjunction with areaD- etector. The beam images were transferred from the cam- era to MATLAB. In MATLAB the beam images were ana- lyzed and the relevant data extracted. The combination of MATLAB and EPICS allows for the control of accelerator equipment, access to higher level programming, and auto- matic beam parameter measurements, such as beam size and transverse beam emittance. The beam imaging system was used to optimize the production of THz radiation at the IAC [7,8]. ACKNOWLEDGEMENTS We would also like to give our sincere thanks to Dr. Mark Rivers of APS for his advice and guidance on AreaD- etector and MCA. In addition, we would like to thank Dr. Henrik Loos of SLAC for his strong interest, advice and encouragement in this project. REFERENCES [1] http://www.iac.isu.edu [2] http://www.thorlabs.us/index.cfm [3] http://www.alliedvisiontec.com/us/products/cameras/gigabit- ethernet/prosilica-gc/gc1290.html [4] A. Andrews et al.., in these proceedings. [5] A. Terebilo et al.., in Proc. ICALEPCS2001, THAP030, San Jose, CA, USA. [6] C. Eckman et al.., in Proc. IPAC2012, TUPPC055,New Or- leans,LA [7] Y. Kim et al.., in these proceedings. [8] A. V. Smirnov et al.., in these proceedings.