EPICS IOC Using MATLAB for Image Analysis of Diagnostic Applications - PowerPoint PPT Presentation

About This Presentation
Title:

EPICS IOC Using MATLAB for Image Analysis of Diagnostic Applications

Description:

... (EDM, MATLAB) Camera Control ... 200 X sigma: 20 Y sigma 10 Tilt angle: 5 Background noise: 100 Calibration Marks on Screen 2.5 mm x 0.7 30 pixel * Resolution: ... – PowerPoint PPT presentation

Number of Views:53
Avg rating:3.0/5.0
Slides: 16
Provided by: kt886
Learn more at: https://epics.anl.gov
Category:

less

Transcript and Presenter's Notes

Title: EPICS IOC Using MATLAB for Image Analysis of Diagnostic Applications


1
EPICS IOC Using MATLAB forImage Analysis of
Diagnostic Applications
  • Speaker Chih-Yu, Liao (???)
  • Instrumentation Control Group, NSRRC, Taiwan

EPICS Collaboration Meeting Spring 2011
2
Outline
  1. Motivation
  2. Overview of infrastructure
  3. Application in image analysis
  4. Summary

3
Motivation
  • The most of machine parameters will be accessible
    as EPICS PV in future TPS (Taiwan Photon Source)
    facility.
  • We need a tool with the complex calculation and
    display ability that use EPICS PV as inputs.
  • Could we implement it by using current existing
    resources?
  • In this moment, we chose the MATLAB

4
Why MATLAB ?
  • MATLAB offers a familiar environment
  • Regular use of MATLAB in our group
  • Save development time and manpower
  • High level programming language
  • Extensive built-in functions and toolboxes
  • Powerful graphics capability
  • Adequate GUI capabilities
  • MATLAB's GUI Development Environment (GUIDE)
  • There are many resources available in internet
  • Easy communication with the EPICS

5
How EPICS interacts with MATLAB?
  • Tools for low level channel access to EPICS
  • LabCA (MATLAB Channel Access)
  • MCA (MATLAB Channel Access) Have not tried!
  • SCA (Simple Channel Access) Have not
    tried!
  • What is LabCA?
  • The LabCA package is one of the EPICS extensions,
    which provides an interface to the EPICS channel
    access client library and can be integrated with
    the MATLAB applications.

5
6
Channel Access in MATLAB via LabCA
  • Start matlab matlab
  • Add the LabCA library
  • addpath /opt/epics/extensions/src/ labca_3_1/
    bin/linux-x86/labca
  • Read value from PV
  • lcaGet(PV name)
  • Write value into PV
  • lcaPut(PV name, value)
  • Advanced functions
  • lcaGetRetryCount, lcaSetTimeout
  • lcaGetTimeout, lcaSetRetryCount,

6
7
Overview of infrastructure
  • Components
  • PC, Ethernet, EPICS environment
  • IOC, Compiled MATLAB program
  • EPICS IOC Controlling devices and collecting
    data.
  • Client OPI Monitoring/setting the devices and
    the MATLAB program
  • MATLAB program Through the LabCA Read the
    database, Analyze it, then Store the results back
    to the database

EPICS IOC MATLAB
MATLAB
7
8
Application in Image Acquisition and Analysis
Acquisition EPICS IOC
  • Two EPICS IOC One for image acquisition, one for
    image analysis (running MATLAB app)
  • Devices GigE vision cameras
  • Networks One for cameras, one for control
  • Clients Remote control the camera parameters,
    display the analysis results

8
9
EPICS IOC Record Usage
  • Image Acquisition IOC
  • waveform (Image Raw Data)
  • ai (Exposure Time)
  • bi (Camera Control)
  • mbbi (Trigger Mode)
  • Image Analysis IOC
  • stringin (Status Display)
  • waveform (Profiles)
  • ai (Results)

Image Acquisition IOC Image Acquisition IOC Image Acquisition IOC
waveform LI-DI-SMimageArrayData Image Raw Data
ai LI-DI-SMcamAcquireTime 01sec
bi LI-DI-SMimageEnableCallbacks YES/NO
bi LI-DI-SMcamAcquire 1/0
mbbi LI-DI-SMcamTriggerMode Soft/Free/Ext.
Image Analysis IOC Image Analysis IOC Image Analysis IOC
stringin LI-DI-SMStatus Status
ai LI-DI-SMCenterX Beam Center X
ai LI-DI-SMCenterY Beam Center Y
ai LI-DI-SMTiltAng Beam Tilt Angle
ai LI-DI-SMSigmaX Beam Sigma X
ai LI-DI-SMSigmaY Beam Sigma Y
ai LI-DI-SMFactor mm/pixel
ai LI-DI-SMRMSEx Goodness of fit X
ai LI-DI-SMRMSEy Goodness of fit Y
waveform LI-DI-SMprofileX Image X Projection
waveform LI-DI-SMprofileY Image Y Projection
waveform LI-DI-SMprofileFitX Fitting X Projection
waveform LI-DI-SMprofileFitY Fitting Y Projection
10
Features of the MATLAB GUI
  • Two MATLAB GUIs (same interface, different
    functionality)
  • Analysis GUI, running only in dedicated computer
  • Display GUI, running in multiple clients
    simultaneously
  • Analysis GUI (analytical work)
  • Analysis beam parameters (Center, Sigma, Tilt
    angle)
  • Specify adjustable region-of-interest (ROI)
  • Optional background subtraction Software
    multiple exposure
  • Store all analysis results into IOC PVs
  • Display GUI (display only)
  • Read / display the analysis results (PVs)
  • Export the data (raw image and analysis results)
  • Create a simulated beam profile

11
Analysis/Display GUI
Menu Save, Colormap, ROI, Simulation, Reset,
Close
Toolbar Zoom in/out
Control Panel
Fitting Results
Capture Date
Hor. Projected Profile Gree Raw, Blue Fit
Enable/Disable Fitting Threshold
Camera ID
Raw Image
Ver. Projected Profile Gree Raw, Blue Fit
Fitting Parameters RMSE, Offset, Slope, Max
Fitting Elapsed Time
Colorbar
11
12
Flow Chart of MATLAB Analysis GUI
MATLAB Program START
Screen Not Ready
No Camera Active
Camera Active?
Camera EnableCallbacks Camera Acquired
No
Yes
Screen Ready?
Screen Position in/out Pixel Mapping Factor
No
Yes
Image Data Array Image Size X,Y
Get Image Data from Acquisition IOC
Reshape Image Array RIO selection Projection
process
Image Process
Gaussian Fitting
Find Center Tilt
Display Results and Store into Analysis IOC
SM ID, Image Projected Profiles X, Y Sigma,
Central Position, Tilt Angle Fitting Parameters
Profiles
13
Flow Chart of MATLAB Display GUI
MATLAB Program START
Enable Simulation ?
No
Yes
Create a Simulated Beam Image
Get Analyzed Data from Analysis IOC
Gaussian Fitting Find Center Tilt
Display Results in GUI
SM ID, Image Projected Profiles X, Y Sigma,
Central Position, Tilt Angle Fitting Parameters
Profiles
14
Performance
  • MATLAB Analysis GUI
  • Read/Write data lt 60 ms
  • Fitting program lt 80 ms
  • Updating GUI lt 40 ms
  • Total lt 180 ms
  • Max. processing rate gt 5 Hz
  • For TPS is OK!!

15
Summary
  • Using MATLAB to assist EPICS IOC
  • Improve the IOC calculation ability
  • An alternative solution for complex data analysis
  • Saves considerable time and effort
  • From performance point of view, there would be no
    problem running the application (screen monitor
    image analysis) on TPS (Injector repetition rate
    is 3Hz).
  • Extended applications
  • Real-time oscilloscope waveform analysis
  • Synchrotron radiation monitor image analysis
  • Other equipments data processing

Thanks for Your Attention!
16
Appendix
17
(No Transcript)
18
(No Transcript)
19
Specifications of Camera
Very small VGA CCD camera with GigE Vision
Prosilica GC 650
Interface IEEE 802.3 1000baseT
Resolution 659 x 493
Sensor Sony ICX424
Type CCD Progressive
Sensor Size Type 1/3
Cell size 7.4 µm
Lens mount C/CS
Max frame rate at full resolution 90 fps
A/D 12 bit
On-board FIFO 16 MB
Output
Bit depth 8/12 bit
Mono modes Mono8, Mono12, Mono16
Color modes YUV YUV411, YUV422, YUV444
Color modes RGB RGB24, BGR24, RGBA24, BGRA24
Raw modes Bayer8, Bayer12, Bayer16
General purpose inputs/outputs (GPIOs)
TTL I/Os 1 input, 1 output
Opto-coupled I/Os 1 input, 1 output
RS-232 1
Power/Mass/Dimensions/Regulations
Power requirements (DC) 5-16 V
Power consumption (12 V) 3 W
Mass 99 g
Body Dimensions (L x W x H in mm) 59x46x33 including connectors, w/o tripod and lens
Regulations CE, FCC, Class A, RoHS
  • The GC650 is a fast, VGA-resolution,
    high-performance machine vision camera with
    Gigabit Ethernet interface (GigE Vision). The
    CCD sensor has excellent image quality and
    sensitivity. The camera is suitable for
    applications where speed and excellent image
    quality are key requirements.
  • 90 fps at 659x493
  • Sony ICX424 CCD Sensor

http//www.alliedvisiontec.com/us/products/cameras
/gigabit-ethernet/prosilica-gc/gc650.html
20
Many Applications Need Camera for TPS
  • Screen monitor
  • Linac x 5
  • LTB x 6 ?
  • Booster x 6 ?
  • BTS x 5 ?
  • Storage ring x 1 (2?)
  • Synchrotron radiation monitor
  • LTB x 1 ?
  • Booster x 2
  • BTS x 1 ?
  • Storage ring x 2 ?

21
MATLAB Functions Usage
  • Gaussian Fitting
  • options optimset('MaxIter',10,'MaxFunEvals',
    60)
  • X lsqcurvefit('Function',XO,profi
    leX,profileY, options)
  • (Least-Squares Curve Fit)
  • Center Tilt Angle
  • s regionprops(imag,
    'Centroid','Area','Orientation)
  • (Properties of Region)

22
Projected Beam Profile Fitting Equation
Where a baseline offset gt Background light
b baseline slope gt Background light
c amplitude of the Gaussian
distribution gt Beam s beam size (1 sigma) gt
Beam u position of the center of the profile
gt Beam
23
Parameters of Simulated Beam Image
24
Real Beam of 150MeV Linac
SM1
SM4
SM2
SM3
SM5
25
Subtraction Function
Before
Background
After
(Before Background)
26
ROI Selection
Diffraction due to edge of the YAGCe crystal disk
27
3D Image Viewing
28
Multiple Exposure
  • Parameters Setting
  • Amplitude 0.5
  • X center 300
  • Y center 200
  • X sigma 20
  • Y sigma 10
  • Tilt angle 5
  • Background noise 100

29
Calibration Marks on Screen
Resolution 2.5 mm x 0.7 / 30 pixel 60
um/pixel
30
Camera Lighting Design
Controller Galil-DMC4040 (same as SLIT
controller) Rack LTB rack in test site IOC
IP 172.20.24.60 -gt 192.168.24.81 Output
port Number 1 PV List LI-DI-SLIT-motoroffLE
D (command SB1) LI-DI-SLIT-motoronLED (command
CB1)
Write a Comment
User Comments (0)
About PowerShow.com