Re: [micro-manager-general] Programmatic autofocus calling issues
Status: Beta
Brought to you by:
nicost
|
From: Nico S. <nic...@uc...> - 2020-03-30 17:58:47
|
Hi Sunil,
Sorry for the confusion. Many years ago, the idea was to put the
autofocus capability in the core, but realized that most people find it
easier to write autofocus code in Java rather than C++. The result was
that there are two mechanisms (one in C++, the other in Java). The C++
mechanism is not commonly used (and may or may not work), the Java
mechanisms is used in the MM UI, hence more thoroughly tested.
Best,
Nico
On 3/30/2020 4:47 AM, Kumar, Sunil wrote:
>
> Hi all,
>
> After some useful discussions, it looks like trying to go straight
> through the core is the main issue with this. An approach that seems
> to work for accessing software AF via scripts is as follows:
>
> afMgr = mm.getAutofocusManager();
>
> afMethod = afMgr.getAutofocusMethod();
>
> zFocus = afMethod.fullFocus();
>
> Where zFocus is given a value that looks to be the distance the focus
> was adjusted by.
>
> Regards,
>
> Sunil
>
> *From:* Kumar, Sunil
> *Sent:* 19 March 2020 22:04
> *To:* mic...@li...
> <mailto:mic...@li...>
> *Subject:* Programmatic autofocus calling issues
>
> Hi all,
>
> I’ve been trying to call the software autofocus functionality
> programmatically in MicroManager (originally on 20200120, but have
> also tested on the current nightly build from 20200318 just in case)
> gamma, but seem to be running into a snag – although pressing the
> button on the GUI works, this code run in the Script Panel initially
> does not:
>
> =====
>
> try{
>
> mm.core().fullFocus();
>
> } catch (Exception e){
>
> print(e);
>
> }
>
> print("AF done");
>
> =====
>
> This looked to be returning instantly after doing nothing. After
> looking in the Device Property Browser, I found that there was only a
> blank option for the “Core-Autofocus” property. I tried installing the
> SimpleAutofocus device as a plan B, and that added an item to the
> “Core-Autofocus” property (the blank option is also still there), but
> unfortunately SimpleAutofocus appears to generate an exception after
> running that derails everything else around it:
>
> =====
>
> 2020-03-19T18:12:34.767910 tid18564 [ERR,Core:dev:HamamatsuHam_DCAM]
> Cannot set property "Binning" to "1" [ Error in device
> "HamamatsuHam_DCAM": Invalid property value: Binning (3) ]
>
> 2020-03-19T18:12:34.767910 tid18564 [IFO,dev:SimpleAutofocus] Error in
> Setting of Binning exiting FullFocus
>
> =====
>
> I’ve tried this with the “Binning” property in the SimpleAutofocus set
> to both “1” (which matches the camera default binning), and “0”, which
> I’m under the impression leaves the binning as-is.
>
> Am I missing something here?
>
>
> Thanks,
>
> Sunil
>
>
>
> _______________________________________________
> micro-manager-general mailing list
> mic...@li...
> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.sourceforge.net_lists_listinfo_micro-2Dmanager-2Dgeneral&d=DwICAg&c=iORugZls2LlYyCAZRB3XLg&r=UwP8SWqih8VHO1LwZpgcx83I4o21yLj6V6QD-25Dt4I&m=HhJGuAbhER_EJqcBYLRf5oZwK-O7S8ZrMvzMLlSaTM4&s=MxfUGcy32CjcPtjy6O1qAbyh_OCi0htm9OQQY6X-yoA&e=
|