Move through this tutorial using the arrow keys.
Code looks like this.
Try to write the requested lines or scripts yourself, before looking at one of the many possible solutions. Use the web resources provided to find the appropriate functions. If you can not easily figure things out, do not hesitate to look at the answer, and use the example given to make your code work.
The Micro-Manager wiki has a Programming Guide, which contains loads of useful information. In particular, the 2.0 Core API reference on the sidebar will be helpful in this tutorial.
There are two versions of the API reference, that contain the same information, but are built for different language bindings to the core (i.e. C++ or Java). Either one can work for this tutorial since they define the same functions. But one or the other might be easier to read depending on your programming background .
The C++ Core API Reference has the nice feature that the functions are grouped according to their function. The Java Core API Reference may have slightly more readable functions because the argument and return types are the ones you use in Beanshell, making it easier to figure out how to call a particular function. Refering to one (or both) of these will be useful throughout this tutorial.
Use the REPL to do the following:
mmc.getExposure();
mmc.setExposure(2 * mmc.getExposure());
Shutter and Autoshutter
if (mmc.getAutoShutter()) mmc.setAutoShutter(false); mmc.setShutterOpen(true); mmc.snapImage(); mmc.setShutterOpen(false);
mm.app().refreshGUIFromCache();
XY stage position
p = mmc.getXYStagePosition(); mmc.setXYPosition(p.getX() + 1000.0, p.getY() + 200.0); mm.app().refreshGUIFromCache();
In addition to these generic microscope functions, micro-manager has a generic system for exposing hardware functionality through Device properties. In this system, every Device has a set of Properties which have certain allowed Values.
For example, an XY stage device might have properties for accelleration and velocity, which accept positive floating point numbers as values. A Camera device might have a property for bit depth, which accepts 8, 10, 12, 14, or 16 as values. Properties can be controlled through the core. Every unique property is identified by the device name and the property name.
devices = mmc.getLoadedDevices(); for (device: devices) mm.scripter().message(device);
camera = mmc.getCameraDevice(); props = mmc.getDevicePropertyNames(camera); propString = ""; for (prop: props) propString += prop + ", "; mm.scripter().message(propString);
mmc.getProperty(camera, "Binning");
mmc.setProperty(camera, "Binning", "2"); mm.app().refreshGUIFromCache();
In order to avoid having to control each property individually, Config groups allow you to group multiple properties together, and define Presets, which have a single value for each property in the group. Usually, you will save these groups to a Micro-Manager configuration file, so that they will be automatically present when restarting the application. Since you're using the demo configuration here, there are already config groups defined.
configs = mmc.getAvailableConfigGroups(); configString = ""; for (config: configs) configString += config + ", "; mm.scripter().message(configString);
presets = mmc.getAvailableConfigs("Channel"); presetString = ""; for (preset : presets) presetString += preset + ", "; mm.scripter().message(presetString);
mmc.setConfig("Channel", "FITC"); mm.app().refreshGUIFromCache();