Microscope Middleware Stand 29. Mai 2012
Microscope Manager Design Java SWIG MMCoreJ_wrap C++ MMCore C++ Device Drivers 1 class, 244 methods 6306 loc, 199kByte
Redesign Java, … SWIG Wrapper C++ Microscope Middleware C++ Minimal MM::Core C++ Device Drivers
Core Device Loader Library Search Paths Device Drivers Device Driver Properties Device Manager Devices Device Properties
Change / read device properties Holds Device Loader / Device Manager Loads / holds / unloads devices Interact with actual devices Loads libraries, enumerates drivers Core Device Loader Library Search Paths Device Drivers Device Driver Properties Device Manager Devices Device Properties Responsibilities Enable loading of devices by device manager
CoreDevice Loader Library Search Paths Device Drivers Device Driver Properties Device Manager Devices Device Properties Interface / Implementation Implementation Interface: Implemented by proxies to the actual implementation CoreDevice Loader Library Search Paths Device Drivers Device Driver Properties Device Manager Devices Device Properties
Proxy design Proxies hold weak pointers (tr1::weak_ptr) to the shared pointers used within the implementation (tr1::shared_ptr) – Devices may be unloaded while in use weak_ptr is then NULL Proxies throw Exception Exception: Proxy to core holds shared_ptr. – When core implementation is no longer used by any proxy (all proxies garbage collected), entire core implementation is unloaded automatically
Wrapping MM::Devices
MM::Devices have a «Core» callback – Used e.g. for continuous imaging – Also used by devices in order to get The default camera, shutter, … Access to serial ports Microscope Middleware implements a minimal per-device version of this – Default devices are user-configurable (and not set by default)
Device Interfaces Each device gets its own interface Devices of unknown type have a generic interface (e.g. Arduino boards) Device Camera Shutter State Axis Stage SerialPort AutoFocus SignalIO Magnifier ProgrammableIO SLM Hub Galvo Generic
Device Interfaces Implementation Priorities: 1.Camera 2.SerialPort, Hub 3.State, Stage, Axis 4.Everything else Device Camera Shutter State Axis Stage SerialPort AutoFocus SignalIO Magnifier ProgrammableIO SLM Hub Galvo Generic
Unsupported devices MM::ImageProcessor MM::ImageStreamer – Both not supported as they are not actual devices MM::CommandDispatch – This is a logger, not a device!
Unsupported device features Sequenceability – Automatization should happen on top of Microscope Middleware, not within the device drivers! Programmable delays – Java/Python/… can sleep, too «Auto Shutter Mode»
To Do List Add support for all of the previously mentioned device types SWIG Wrapper Make project cross-compilable (CMake) – Testing on POSIX systems Write & Compile doxygen documentation
To Do List (cont’d) Swallow/redirect exceptions from device drivers – Some device drivers throw strings or ints, how to handle this? – catch(…) Bad, because all information about the exception (except that it occurred) is lost… Allow for Java/… listeners – If we pass a derived object to Java, it may believe it is an object of the base class SWIG has no way of knowing what we pass in a Base* pointer
Time Planning?