using AutoFocus computeScore method in Beanshell

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

using AutoFocus computeScore method in Beanshell

C.N.McMurray

Hi,


I am currently trying to use the computeScore method to take score readings at fixed time intervals. However the result of this method is always NaN. If I run the OghtaFocus autofocus  however the scores recorded in the core logs are found to be reasonable values regardless of weather the images are in focus or not. I was wondering if the ImageProcessor impro object passed as the only parameter must be of a certain type? at the moment my script uses the depth to either select and create a BytepProcessor object of a shrotProcessor object 


the method in question from https://valelab4.ucsf.edu/~MM/doc/mmstudio/org/micromanager/api/Autofocus.html#computeScore(ij.process.ImageProcessor)


double computeScore(ij.process.ImageProcessor impro)

If anyone knows of a better way of getting an autofocus score without actually autofocusing and retreiving the score from the core logs I'd be happy to follow such an alternative method.


thanks


Conor



_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: using AutoFocus computeScore method in Beanshell

Vikram Kopuri
Hi Conor, 

Here is a bit of code snippet I use, 

gui.getAutofocusManager().selectDevice("OughtaFocus");
gui.getAutofocus().setPropertyValue("Maximize","SharpEdges"); // other options , "FFTBandpass", "Edges", "Mean", "StdDev", "NormalizedVariance", "SharpEdges", "Redondo", "Volath", "Volath5"
gui.getAutofocus().applySettings();
gui.snapSingleImage();
ImagePlus iplus = IJ.getImage();
iplus.setPosition(1, 1, 1);
ImageProcessor ip = iplus.getProcessor();

Score = gui.getAutofocus().computeScore(ip)

Hope that helps



~~~~~~~~~~~~~~~~~~~~~~
Vikram G Kopuri



On Mon, Mar 11, 2019 at 9:38 AM C.N.McMurray <[hidden email]> wrote:

Hi,


I am currently trying to use the computeScore method to take score readings at fixed time intervals. However the result of this method is always NaN. If I run the OghtaFocus autofocus  however the scores recorded in the core logs are found to be reasonable values regardless of weather the images are in focus or not. I was wondering if the ImageProcessor impro object passed as the only parameter must be of a certain type? at the moment my script uses the depth to either select and create a BytepProcessor object of a shrotProcessor object 


the method in question from https://valelab4.ucsf.edu/~MM/doc/mmstudio/org/micromanager/api/Autofocus.html#computeScore(ij.process.ImageProcessor)

setProperty void setProperty(org.micromanager.utils.PropertyItem p) throws org.micromanager.utils.MMException Throws: org.micromanager.utils.MMException

double computeScore(ij.process.ImageProcessor impro)

If anyone knows of a better way of getting an autofocus score without actually autofocusing and retreiving the score from the core logs I'd be happy to follow such an alternative method.


thanks


Conor

_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general


_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general