New kind of device in Micro-Manager

Hello,

I would like to use Micro-Manager to control a photon counting board and use it in a FCS (fluorescence correlation spectroscopy) experiment. The board transfers large amounts of data through a USB port; this data is then processed to calculate correlation functions. I understand I need to write a custom adapter for this device but I am not sure which device base to choose. Ideally this device should resemble a camera and be able to snap blocks of data or stream them in the live mode. The displays, however, are different since each block of data does not represent an image and has to be processed to be useful.

If my impression is correct and there currently isn’t a device type appropriate for my purposes, can I try to add a new device type to MMCore? I have some C programming skills and am comfortable writing a regular device adapter. This new project, however, is taking me out of my comfort zone and I would appreciate expert opinion on how difficult I can expect this to be.

Any piece of advice would be greatly appreciated
Thank you
Artem

Hi Artem,

Your best option is probably to write a generic device adapter (inherit from the CGenericBase class). If you search through the code base you will find many examples of generic device adapters that don’t fit in with one of the specific device types.

–Nick

Hi Nick,

Thank you for your advice. As you suggested, I was able to find many examples of generic devices of different types. However, they all seem to communicate with micro-manager java core through properties that pass simple data types like numbers or strings, and I was hoping to have a MM plugin that can get arrays of data from my device adapter .

In other words, I can tell the device adapter to acquire an array of data but I don’t know how to access that array from the java layer. Is there an example of such a device I could learn from?

Thank you
Artem

Hi Artem,

I think you’re right that the generic device adapters don’t have any efficient way of transferring arrays between the C++ and Java layer. I suppose if it is important for you to have a live view of the data then the best option is to implement the device adapter as a camera device.

If you don’t need a live view of the data you could also potentially write a generic adapter that handles saving the data to file completely in the C++ layer.

If you do end up going the route of implementing a camera device adapter you may be able to write a ProcessorPlugin to transform the data into a useful visualization. https://micro-manager.org/wiki/Version_2.0_Plugins#ProcessorPlugin

–Nick

Thank you for all your suggestions and for pointing me in the right direction with the device adapters, I have a much better understanding now of what my options are for this project.
Artem

I do believe that your initial idea to develop a new device type also certainly has merit. I do believe that there is a need for a mechanism to transfer large data sets other than images in Micro-Manager. For instance, there should be a mechanism to capture the output of an analog to digital converter that outputs a signal during an extended period of time (correct me if I am wrong, but your photon counting board in essence sounds like it is an AD that outputs a stream of samples taken at regular time intervals to the computer).

Introducing a new device type is certainly possible, the biggest issue is that this should not be done lightly, and that we should try to capture as many devices and their use cases as possible. There is a ticket open on github concerning DA and AD devices (https://github.com/micro-manager/micro-manager/issues/985), and I am curious to hear (either here or on github), how your photon counting board would fit in the scheme proposed there.

Once we decide what the interface should look like, coding it up is a bit of work, but not an incredible lot of work.

Hi Nico,
I am glad to hear that you’ve been thinking about a new device type dedicated to streaming input data. In my opinion, it would be a very valuable addition to the MM device family. I have some specific thoughts on the subject that I’ll try to condense and post to the open ticket you mentioned in the next few days.
Thank you for your reply
Artem