Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
software:micro-manager [2023/08/16 21:03] Jon Daniels [Micro-manager diSPIM Plugin] |
software:micro-manager [2025/03/12 00:22] (current) Jon Daniels [Scripting the plugin] |
||
---|---|---|---|
Line 7: | Line 7: | ||
Currently the diSPIM plugin is supported in 1.4.x only. In 2023 there have been efforts to create a new plugin in Micro-Manager 2.0 called [[https:// | Currently the diSPIM plugin is supported in 1.4.x only. In 2023 there have been efforts to create a new plugin in Micro-Manager 2.0 called [[https:// | ||
- | You can download the nightly builds of Micro-manager 1.4 for Windows [[http://valelab4.ucsf.edu/~MM/ | + | You can download the nightly builds of Micro-manager 1.4 for Windows [[https://download.micro-manager.org/nightly/ |
Line 89: | Line 89: | ||
==== Scripting the plugin ==== | ==== Scripting the plugin ==== | ||
- | The Micro-Manager plugin has an API that allows most of its functionality to be accessed via Beanshell scripts run from within Micro-Manager. | + | The Micro-Manager plugin has an API that allows most of its functionality to be accessed via Beanshell scripts run from within Micro-Manager. |
Here is a bare-bones example script: | Here is a bare-bones example script: | ||
Line 127: | Line 127: | ||
// gets a reference to the plugin; use this to call the plugin' | // gets a reference to the plugin; use this to call the plugin' | ||
// API documented in ASIdiSPIMInterface.java in source code | // API documented in ASIdiSPIMInterface.java in source code | ||
- | // | + | // |
// note that the plugin must be launched | // note that the plugin must be launched | ||
ASIdiSPIMInterface diSPIM = new ASIdiSPIMImplementation(); | ASIdiSPIMInterface diSPIM = new ASIdiSPIMImplementation(); | ||
Line 431: | Line 431: | ||
diSPIM.attachRunnable(taskStartTimepoint, | diSPIM.attachRunnable(taskStartTimepoint, | ||
diSPIM.attachRunnable(taskEndTimepoint, | diSPIM.attachRunnable(taskEndTimepoint, | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | Here is another example that runs autofocus periodically, | ||
+ | |||
+ | < | ||
+ | |||
+ | // runs autofocus once on the first position and periodically afterwards based on period set in script (currently every 13th position) | ||
+ | // script assumes that CRISP is already set up and is the default focus device | ||
+ | // run this script after launching the plugin and before beginning the acquisition | ||
+ | |||
+ | // required imports | ||
+ | import org.micromanager.asidispim.api.*; | ||
+ | |||
+ | // get a reference to the plugin; use this to call the plugins API methods | ||
+ | ASIdiSPIMInterface diSPIM = new ASIdiSPIMImplementation(); | ||
+ | |||
+ | // local variables | ||
+ | int runnablePositionCounter; | ||
+ | int counterPeriod = 13; | ||
+ | |||
+ | // initialize the counter when the acquisition begins | ||
+ | taskStartAcquisition = new Runnable() { | ||
+ | public void run() { | ||
+ | runnablePositionCounter = 0; | ||
+ | } | ||
+ | }; | ||
+ | |||
+ | // at each position see if it's time to run autofocus, plus also increment the counter | ||
+ | taskStartPosition = new Runnable() { | ||
+ | public void run() { | ||
+ | // | ||
+ | if ((runnablePositionCounter % counterPeriod)< | ||
+ | mmc.fullFocus(); | ||
+ | } | ||
+ | runnablePositionCounter++; | ||
+ | } | ||
+ | }; | ||
+ | |||
+ | |||
+ | // add the runnables to the diSPIM plugin' | ||
+ | diSPIM.clearAllRunnables(); | ||
+ | diSPIM.attachRunnable(taskStartAcquisition, | ||
+ | diSPIM.attachRunnable(taskStartPosition, | ||
+ | |||
</ | </ |