190 likes | 403 Views
CLIP. Instrument Control SW. Pipeline DRS. „ “ C ommon L ibrary for I mage P rocessing“. Overview. Definition and Goals. CLIP is the new standard online image processing tool for the VLT Instrumentation Software. Goals
E N D
CLIP Instrument Control SW Pipeline DRS „“Common Library for Image Processing“
Overview Definition and Goals • CLIP is the new standard online image processing tool for the VLT Instrumentation Software. • Goals • To provide an image processing toolkit, flexible and well integrated with the INS SW. • To share the same image processing algorithms whenever possible between INS SW and pipeline DRS • To implement some specialized image processing routines which are generally required during the instrument acquisition process.
Overview Package • Image Processing Library • clipm extending CPL • C++ VLTSW Library • clipv • Tcl VLTSW Library • clipvTcl • Real Time Display • rtdc • Image Acquisition Simulator • clipias • Template modules • xxclipv, xxclipm
Image Processing Library Goals • Cover common image processing needs, for example • star centroiding and object characterisation, • image alignment, • focusing etc. • Serve as temporary development platform (until routines are accepted for CPL), • thus providing flexibility by separating DFS and INS SW development cycles • Thus instrument-only
Image Processing Library Functions • Image Analysis Mathematics • Full bad pixel support • Background Estimation • Point-Source Centroiding • Fitting • Barycentre • Alignment • Cross-correlation • Transformation • Aperture Characterisation • Variously shaped objects • Automatic region of interest • Optimised results • Statistics in- & outside • Focusing (pending) • Linear Regression • Random Number Generation • Gaussian • Poisson 2d-pattern • Pattern Alignment • Different degrees of freedom • Transformation • Interface • ANSI-C • Error Message History • CPL Objects in Memory
C++ VLTSW Library Features • Main Features: • Direct access of images from shared memory • C++ wrappers for some CPL objects • Automatic initialization and cleaning up of CPL • Verbose and logging facilities • Byte swapping and data conversion. • VLTSW standard error handling
Server Mode Register RTD App. Notify Read Shared Memory Shared Memory Write Clipv Server Create/ Remove C++ VLTSW Library Shared Memory Client Mode Acq. Process RTD Server Notify Register/ Notify Notify Create/ Write Clipv Client Read
C++ VLTSW Library Interface Example // Initialize the connection to the RTD server registering // as the CCS process name and attaching to the image events // generated by the acquisition process. clipvRTD_EVT_RECV *rtdEvtRecv; rtdEvtRecv = new clipvRTD_EVT_RECV(ccsGetMyNameInt(), ”fierab”); rtdEvtRecv->Attach(); // Receives the image event and store it in the internal // structure. rtdEvtRecv->ReceiveImageInfo(); More examples in the test directory of module clipv
TclVLTSW Library Functions TCL Commands: General Purpose, e.g. verbose, version, subcommands, etc. RTD Image Events, e.g. rtd_attach, rtd_detach, rtd_image_wait, etc. Image Basic Operations, e.g image_add_scalar, image_add, etc. Image Statistics, e.g. image_get_min, image_get_mean, etc. Image Processing Recipes, e.g. image_center_gauss, image_slit, etc. Others Services Image Store Data by Reference
Tcl VLTSW Library Interface Example • Instrument Templates • Asynchronous exposure wait • New class: tplCLIP # object declaration tplCLIP clip # Attach to the image events from camera clip Attach fiera set cmdId [obsWaitAsync $expId "-detId [fiera Subsystem]"] # Wait until image is complete clip Wait 20000 fiera # Compute mean value from shared memory tplLog "Image MeanLevel: [clip MeanLevelfiera]“ # Check the reply from asynchronous wait obsRecvReply $cmdId
Real Time Display • Display image in real-time • Like a normal RTD • Display superimposed graphics. • Ovals, • Lines, • Rectangles • Crosses • Text • User interaction. • Pickup Object • Get Rectangle
Image Acquisition Simulator • Commands: SETUP, START, STOP. • Modes: BIAS, SKY and FILE • Supported sky objects: Gaussian star • Supported star parameters: pos, sigma, maxflux and gaussian norm. shell> msgSend “” clipiasControl_IR SETUP “-function CIAS.MODE SKY CIAS.SKY.STAR.NUM 3 CIAS.SKY.STAR1.POSX 300 CIAS.SKY.STAR1.POSY 512 CIAS.SKY.STAR1.MAXFLUX 5000 CIAS.SKY.STAR1.SIGMAX 6 CIAS.SKY.STAR2.POSX 200 CIAS.SKY.STAR2.POSY 100 CIAS.SKY.STAR3.POSX 700 CIAS.SKY.STAR3.POSY 700 CIAS.SKY.STAR3.SIGMAX 8” shell> msgSend “” clipiasControl_IR START “”
Extendability Requirements & Templates • Requirements to be served: instrument specific needs: • control software-only image processing tasks, and/or • shared functions for pipeline and control software • Template modules: • Interface Templates (C++ and Tcl) • Image Processing Library Template
<xx>clipm DRL (Master) DFS CLIP Responsible Copy Slave <xx>clipm Extendability Image Processing - Development Strategy Consortium ESO Repositories Observatory CVS Pipeline World DRL Developer Pipeline Responsible Pipeline DRL Pipeline Integration CMM INS World INS Developer <xx>clipv (Wrappers) INS / RTD Integration
Extendability Image Processing - Adding new functions (1) cpl_image *xxclipm_something( cpl_image *img_in, double some_param) { cpl_image *img_out = NULL; XXCLIPM_TRY { XXCLIPM_TRY_CHECK_AUTOMSG( img_in != NULL, CPL_ERROR_NULL_INPUT); XXCLIPM_TRY_CHECK_AUTOMSG( some_param > 1.5, CPL_ERROR_ILLEGAL_INPUT); /* do some processing here */ XXCLIPM_TRY_CHECK_ERROR_STATE(); } XXCLIPM_CATCH { cpl_image_delete(img_out); /* clean up if error happened */ img_out = NULL; } return img_out; }
Extendability Image Processing - Adding new functions (2) cpl_error_code xxclipm_something( cpl_image *img_in, double *out_value) { cpl_image *img_tmp = NULL; XXCLIPM_TRY { XXCLIPM_TRY_CHECK_AUTOMSG( img_in != NULL, CPL_ERROR_NULL_INPUT); XXCLIPM_TRY_CHECK_AUTOMSG( out_value != NULL, CPL_ERROR_NULL_INPUT); /* do some processing here */ } XXCLIPM_CATCH { if (out_param != NULL) *out_param = -1; } cpl_image_delete(img_tmp); /* delete temporary stuff in any case */ return XXCLIPM_ERROR_GET_NEW_SINCE_TRY(); }
Extendability TCL - Adding new commands // Declare the command in the constructor NewSubCmd(string("image_app") ,this, &xxclipvTCL_APP::CmdApp); vltINT32 xxclipvTCL_APP::CmdApp(int argc, char *argv[]) { clipvLOG_3(("xxclipvTCL_APP::CmdApp - begin")); // defining subcommand parameters clipvTCL_LINE_ARG tclArg(&par_file, &par_scalar, NULL); // parsing subcommand parameters if (tclArg.ParseArgs(_interp, argc, argv) != TCL_OK) clipvTCL_ERR_RETURN(tclArg.Usage(tclArg.GetStrError())); // adding image processing here clipvLOG_3(("xxclipvTCL_APP::CmdApp - end")); return(TclSetResult("XXXX sample command executed !")); }
Extendability TCL – Parameter Handling • Predefined classes for main built-in types: int, double, logical and string • Class for handling the list of parameters objects. static clipvTCL_ARG_STRpar_mode('m', "mode", "alignment mode", "SHIFT", "SHIFT SHIFT_ROBUST UNIT EQUAL FREE", (clipvTCL_ARG::OPTIONAL_ARG| clipvTCL_ARG::MANDATORY_VAL_ARG)); // Define the subcommand line arguments clipvTCL_LINE_ARGtclArg(&par_mode,NULL); // Parse the subcommand line arguments if (tclArg.ParseArgs(_interp, argc, argv) != TCL_OK) clipvTCL_ERR_RETURN(tclArg.Usage(tclArg.GetStrError()));
Status & Outlook • Status • CLIP Version 1.0 with VLTSW release 2009 • Instruments using CLIP • HAWKI • XSHOOTER • KMOS • SPHERE • MUSE? • Outlook • Address instruments which still use MIDAS