MicroManager hub device adapter development

I’m currently writing a device adapter (and eventually a configuration GUI) for Prior’s PureFocus 850 laser autofocus system. I’m running into some strangeness with hub device adapters though.

The autofocus system of course does autofocussing. It can also apply an offset to Z-stack. And it stores 6 presets for different objectives, selectable from the PC (in MM) or a keypad. The MM documentation says that this is where you’d use a hub, with all the various features configured/managed as child device adapters which are peripherals under that hub. So that’s what I’ve done.

Where this has gone strange is that I’m adding this to the existing “Prior” adapter project. When I register the hub device (InitializeModuleData() calling RegisterDevice() for the various supported devices), all the existing Prior devices vanish from the hardware configuration wizard, and only the hub is visible. When I comment out registering the hub, all the existing devices come back again.

Is this some undocumented (or at least obscure) feature of MM where a hub automatically hides everything else from the same DLL, on the assumption that everything in that DLL will be a peripheral of that hub? I can’t see anything about this in the manuals, or in the example Arduino project.

Also on a similar theme of hubs, it would be good if the device type set in RegisterDevice() (used when searching for a device) did not have to tie up with the device type reported by the adapter (used to tell MMCore what features it supports). I would ideally like people searching for the PureFocus to find it under “Autofocus”, not under “Hub”.

Or am I going about this the wrong way, and there’s an easier way to skin this particular cat?

Hi @GrahamBartlettPrior,

Great to hear that you are working on this! My memory is a bit hazy about the details of Hub devices. It is possible that only showing the Hub device in the HCW is a GUI “feature”. You could test that by trying to load an old config file (i.e one without a Hub device) with your new device adapter and see if that works.

However, in general the Hub is mainly meant to facilitate configuring a system for users. For instance, the users know they have a Prior device, find it in the list, add the “Hub” (confusing name for users, is it possible to name it “Controller” or something?), which then will present a list of devices within this “Hub” device. Especially when the devices inside the controller are auto-detected, this is a nice workflow for configuration.

A Hub device is not the only way that devices can communicate with each other. It sounds like you want one device (the objective selector) to set a property in the Autofocus device (objective-related preset). Having these presets as a property in your Autofocus device would make it possible to use it with other objective switchers (like the objective turrets in integrated microscopes from other vendors). There are ways of automating this for the Prior objective switcher, none very elegant. You can make a property in the Prior objective switcher that sets the “Autofocus” device. That property needs to be set by the user in the Startup group, and will give the Objective Switcher a handle to the Autofocus device so that it can set the Autofocus Preset property correctly whenever it switches objectives. See the Utilities device adapter for many examples how to do that.

How does “applying an offset to a Z-stack” work? In Micro-Manager the Z_drive and Autofocus device are usually separate devices. For several autofocus devices (Nikon and Zeiss if I remember correctly) we have implemented both an autofocus device and an “autofocus Z-drive”. The Autofocus Z-drive is seen by MM as any other Z-drive, but in reality it will set the offest of the autofocus. This offset needs to be in microns (which it is not in the case of the Nikon). The use can then select the “autofocus Z” drive as the Z-drive and MM will use that to collect Z stacks.
Lots to digest. Hope this gives some ideas!

Thanks Nico. Maybe this isn’t the right way to go about it, then. I’ll go back and have another think.

Yes, the Z-drive will be a separate device. If this isn’t a hub-child system then it’ll need a property for the related autofocus device, as you say.