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 [2019/11/12 00:41] Jon Daniels [Bug reports] edited for clarity |
software:micro-manager [2024/04/15 23:19] (current) Jon Daniels [Micro-manager diSPIM Plugin] |
||
---|---|---|---|
Line 5: | Line 5: | ||
Details about the plugin operation can be found in the manual section of this website in the [[: | Details about the plugin operation can be found in the manual section of this website in the [[: | ||
- | Currently the diSPIM plugin is supported in 1.4.x only, although | + | 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 |
- | 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 343: | Line 343: | ||
==== Runnables in the plugin ==== | ==== Runnables in the plugin ==== | ||
- | As of July 2019 limited support | + | Support |
+ | |||
+ | These runnables are normally defined in a Beanshell script executed from Micro-Manager' | ||
+ | |||
+ | Currently there are six times when runnables can be inserted: | ||
+ | - Start of acquisition | ||
+ | - End of acquisition | ||
- Start of timepoint | - Start of timepoint | ||
- End of timepoint | - End of timepoint | ||
Line 349: | Line 355: | ||
- End of position | - End of position | ||
- | Note that these would be called only once each for an acquisition without timepoints nor positions selected. | + | Note that these would be called only once each for an acquisition without timepoints nor positions selected. |
- | Here is an example adding a runnable to each of these possible invocation points: | + | Here is an example adding a runnable to each of these possible invocation points. Note the use of global variables in the script so that state can be passed between runnables, as well as local variables within a runnable that cannot be changed by another runnable (e.g. reset at the start of the acquisition). |
<code java> | <code java> | ||
Line 362: | Line 368: | ||
// note that the plugin must be launched for this to work | // note that the plugin must be launched for this to work | ||
ASIdiSPIMInterface diSPIM = new ASIdiSPIMImplementation(); | ASIdiSPIMInterface diSPIM = new ASIdiSPIMImplementation(); | ||
+ | int runnableTimepointCounter; | ||
+ | int runnablePositionCounter; | ||
+ | |||
+ | taskStartAcquisition = new Runnable() { | ||
+ | public void run() { | ||
+ | // test code which will raise dialog; should be replaced | ||
+ | gui.showError(" | ||
+ | runnableTimepointCounter = 0; | ||
+ | runnablePositionCounter = 0; | ||
+ | } | ||
+ | }; | ||
+ | |||
+ | taskEndAcquisition = new Runnable() { | ||
+ | public void run() { | ||
+ | // test code which will raise dialog; should be replaced | ||
+ | gui.showError(" | ||
+ | } | ||
+ | }; | ||
+ | |||
taskStartPosition = new Runnable() { | taskStartPosition = new Runnable() { | ||
- | int i = 0; | ||
public void run() { | public void run() { | ||
+ | runnablePositionCounter++; | ||
// test code which will raise dialog; should be replaced | // test code which will raise dialog; should be replaced | ||
- | gui.showError(" | + | gui.showError(" |
- | i++; | + | |
} | } | ||
}; | }; | ||
taskEndPosition = new Runnable() { | taskEndPosition = new Runnable() { | ||
+ | int localCounter = 0; | ||
public void run() { | public void run() { | ||
+ | localCounter++; | ||
// test code which will raise dialog; should be replaced | // test code which will raise dialog; should be replaced | ||
- | gui.showError(" | + | gui.showError(" |
} | } | ||
}; | }; | ||
taskStartTimepoint = new Runnable() { | taskStartTimepoint = new Runnable() { | ||
- | int i = 0; | ||
public void run() { | public void run() { | ||
+ | runnablePositionCounter = 0; | ||
+ | runnableTimepointCounter++; | ||
// test code which will raise dialog; should be replaced | // test code which will raise dialog; should be replaced | ||
- | gui.showError(" | + | gui.showError(" |
- | i++; | + | |
} | } | ||
}; | }; | ||
taskEndTimepoint = new Runnable() { | taskEndTimepoint = new Runnable() { | ||
+ | int localCounter = 0; | ||
public void run() { | public void run() { | ||
+ | localCounter++; | ||
// test code which will raise dialog; should be replaced | // test code which will raise dialog; should be replaced | ||
- | gui.showError(" | + | gui.showError(" |
} | } | ||
}; | }; | ||
Line 397: | Line 425: | ||
// add all run | // add all run | ||
diSPIM.clearAllRunnables(); | diSPIM.clearAllRunnables(); | ||
+ | diSPIM.attachRunnable(taskStartAcquisition, | ||
+ | diSPIM.attachRunnable(taskEndAcquisition, | ||
diSPIM.attachRunnable(taskStartPosition, | diSPIM.attachRunnable(taskStartPosition, | ||
diSPIM.attachRunnable(taskEndPosition, | diSPIM.attachRunnable(taskEndPosition, | ||
diSPIM.attachRunnable(taskStartTimepoint, | diSPIM.attachRunnable(taskStartTimepoint, | ||
diSPIM.attachRunnable(taskEndTimepoint, | diSPIM.attachRunnable(taskEndTimepoint, | ||
- | |||
- | diSPIM.runAcquisition(); | ||
- | |||
</ | </ |