Beanshell Scripting & Projector Plugin

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

Beanshell Scripting & Projector Plugin

StevenF
Hello Micromanager community,

I have been struggling the past few days trying to understand beanshell
scripting and i cannot find a way to do what i want as i am not really
familiar with beanshell or java. I would like to access the projector plugin
object in order to extract the affine transform that is generated by doing a
calibration.

I have tried looking around the example scripts but i can't find one example
that directly interacts with a plugin to extract some value. Also, how would
i go about scripting the Calibration itself for example?

Thanks in advance,

Steven Fletcher



--
Sent from: http://micro-manager.3463995.n2.nabble.com/

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
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: Beanshell Scripting & Projector Plugin

Nico Stuurman-2
Hi Steven,

> I have been struggling the past few days trying to understand beanshell
> scripting and i cannot find a way to do what i want as i am not really
> familiar with beanshell or java. I would like to access the projector plugin
> object in order to extract the affine transform that is generated by doing a
> calibration.

It may help to describe what you actually try to do, since you may be
following a difficult path.  Also, with these kind of questions, it
really helps to indicate which version of Micro-Manager you are working
with.  In 2.0 gamma (found through
http://valelab4.ucsf.edu/~nstuurman/fom/ , and possibly some beta
version as well), the following beanshell script does what you ask for:


---------------------------------------------
import org.micromanager.projector.internal.*;

setAccessibility(true);  // Needed because mapping_ is private, this is
a Beanshell hack, be careful!

pcf = ProjectorControlForm.getSingleton();  // Open the Projector plugin
first and calibrate

mm.scripter().message("" + pcf.mapping_.size());   // pcf.mapping_ is
Map<Polygon, AffineTransform>

---------------------------------------------


Note that there is no single AffineTransform.  There are many of them,
and the code uses the local one.

> I have tried looking around the example scripts but i can't find one example
> that directly interacts with a plugin to extract some value. Also, how would
> i go about scripting the Calibration itself for example?

Things were certainly not designed to do so, but look at the code in
ProjectorControlForm.java, especially the function
generateNonlinearMapping(), and the functions called in there.


Hope this helps!


Best,

Nico



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
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: Beanshell Scripting & Projector Plugin

StevenF
Thanks Nico for the quick reply and sorry for the late one on my part,

What i am looking to do is extract the AffineTransform generated by the
calibrate plugin in order to be able to correctly map which pixel on the
picture is which pixel on the DMD. this value needs to be extracted as i am
looking to use it outside Micromanager in my own script.

I use for the moment Micromanager 1.4.23 (a nightly build). Is there a
reason for me not to move to Micromanager 2.0 beta appart from the obvious
bugs that can be associated with a beta build? (will most drivers be
available with the beta?)

Thanks for the quick script Nico, i had looked around in the projector
plugin but the fact that i lack any java knowledge was really making it hard
for me to solve my problem rapidly!

Thanks again,

Steven



--
Sent from: http://micro-manager.3463995.n2.nabble.com/

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
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: Beanshell Scripting & Projector Plugin

StevenF
Hey Nico,

I had a quick question regarding the AffineTransform and more precisely why there are more than one.
If i understand correctly there is one AffineTransform for each Polygon cell. What are those polygon cells? is it something along the lines of :
the images is segmented into polygon cells and each cell has it's own AffineTransform to make it the most accurate possible?

Thanks in advance nico,

Steven

----- Mail original -----
> De: "Steven Fletcher" <[hidden email]>
> À: [hidden email]
> Envoyé: Mercredi 2 Mai 2018 10:00:14
> Objet: Re: [micro-manager-general] Beanshell Scripting & Projector Plugin

> Thanks Nico for the quick reply and sorry for the late one on my part,
>
> What i am looking to do is extract the AffineTransform generated by the
> calibrate plugin in order to be able to correctly map which pixel on the
> picture is which pixel on the DMD. this value needs to be extracted as i am
> looking to use it outside Micromanager in my own script.
>
> I use for the moment Micromanager 1.4.23 (a nightly build). Is there a
> reason for me not to move to Micromanager 2.0 beta appart from the obvious
> bugs that can be associated with a beta build? (will most drivers be
> available with the beta?)
>
> Thanks for the quick script Nico, i had looked around in the projector
> plugin but the fact that i lack any java knowledge was really making it hard
> for me to solve my problem rapidly!
>
> Thanks again,
>
> Steven
>
>
>
> --
> Sent from: http://micro-manager.3463995.n2.nabble.com/
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> micro-manager-general mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/micro-manager-general

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general