1 / 15

EPICS IOC Using MATLAB for Image Analysis of Diagnostic Applications

EPICS IOC Using MATLAB for Image Analysis of Diagnostic Applications. Speaker: Chih-Yu, Liao ( 廖志裕 ) Instrumentation & Control Group, NSRRC, Taiwan. EPICS Collaboration Meeting Spring 2011. Outline. Motivation Overview of infrastructure Application in image analysis Summary. Motivation.

kalli
Download Presentation

EPICS IOC Using MATLAB for Image Analysis of Diagnostic Applications

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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 • Motivation • Overview of infrastructure • Application in image analysis • 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 (MATLABChannel 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 Client OPI Application (EDM, MATLAB) Channel Access Client Ethernet Channel Access Server/Client LabCA Database Instrumentations Device Support TCP (raw), Modbus/TCP, VXI-11, … • 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 LabCARead the database, Analyze it, then Store the results back to the database EPICS IOC + MATLAB MATLAB 7

  8. Application in Image Acquisition and Analysis Client OPI Application (EDM, MATLAB) Camera Control Panel MATLAB Display GUI TPS Control Network Analysis EPICS IOC . MATLAB Private Ethernet Instrumentations … … … GigE Vision Cameras Acquisition EPICS IOC • Two EPICS IOC: One for image acquisition, one for image analysis (running MATLAB app) • Devices: GigEvision 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)

  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 Colorbar Fitting Elapsed Time 11

  12. Flow Chart of MATLAB Analysis GUI MATLAB Program START “No Camera Active” “Screen Not Ready” 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 Find Center & Tilt Gaussian Fitting 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 Gaussian Fitting Find Center & Tilt Get Analyzed Data from Analysis IOC 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 < 60 ms • Fitting program < 80 ms • Updating GUI < 40 ms • Total < 180 ms • Max. processing rate > 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!

More Related