How to build the software

This page just explains how to build the software needed for OpenSPIM. For an overview of the source code, please have a look at this page.

= Obtaining the source code =

The easy way
First, make sure you have your camera driver installed!

Download & run the OpenSPIM development environment installer (it is actually a self-extracting archive, you can use 7-Zip to extract the archive instead if you feel uncomfortable with an installer). This will set up everything you need and perform the initial build.

Note: this installer will clone and download additional packages, at the time of writing totaling to about 450 megabyte. You have been warned.

Manually
First, make sure you have your camera driver installed!

You need Git
First of all, you need to make sure that you have the version control software Git installed. If in doubt, just install Git for Windows.

Cloning the Micro-Manager and support sources
Wherever you like, e.g. in your home directory, call these commands:


 * 1) git clone git://github.com/openspim/micromanager
 * 2) git clone git://github.com/openspim/3rdpartypublic

Setting JAVA_HOME
Make sure that the environment variable JAVA_HOME is set and points to a valid JDK (you can add environment variables by right-clicking on the "Start" menu button, choosing "Open Windows Explorer", opening the context menu of "My Computer", selecting "Properties" and in the "Advanced mode" click on the "Environment variables" button. You need to restart the Visual Studio after adding the environment variable).

= Building Micro-Manager =

After installing Visual Studio Express 2008, start the development environment via the OpenSPIM Dev Env desktop icon created by the development environment installer. Launch Visual Studio by calling

vcexpress.sh

and then open the µManager project via File>Open>Project/Solution.... The file to load is located in \src\micromanager\MMCoreJ_wrap and is called MMCoreJ_wrap.sln (there is a "solution" and a "project", you want the "solution"). If you only have Visual Studio Express 2010, you might want to load MMCoreJ_wrapvc10.sln instead.

Build all of the software by clicking on Build>Build Solution or by pressing the F7 key.

For full details, see the instructions on the µManager Wiki.

Why Microsoft Visual C++?
There exists a free and Open Source alternative to Microsoft Visual C++: GNU C++.

Unfortunately, it is impossible to build µManager on Windows with the GNU C++ compiler. The reason is that Microsoft Visual C++ uses an Application Binary Interface (ABI) which predates, and is incompatible with, the standard defined by the C++ consortium, but GNU C++ abides by the standard. All of the shared libraries provided by vendors were compiled for Microsoft Visual C++, though, so linking using GNU C++ is impossible.

= µManager scripting/plugins =

One of the coolest things in µManager is the Beanshell Scripting support. You can launch it through the Tools>Script Panel menu item. Those Beanshell scripts can interact with the GUI of µManager through the global gui variable which is actually an instance of org.micromanager.MMStudioMainFrame, and with the MMCore through the global mmc variable which is an instance of mmcorej.CMMCore (the binding to the C++ core).

When prototyping, it is best to start out with Beanshell scripts and once things get polished enough, turn them into µManager plugins. Such plugins are connected to the µManager application through the method setApp which must be implemented when implementing the org.micromanager.api.MMPlugin interface. This method is passed an instance of org.micromanager.api.ScriptInterface which has a method getMMCore. Unfortunately, it has no method to retrieve a reference to the MMStudioMainFrame, but you can use the static method getInstance of said class to retrieve the singleton.

To provide ease of transition between scripting and plugin coding, we do the following in the OpenSPIM plugin: we have two fields, unsurprisingly called mmc and gui, which are initialized in the setApp method.

= Debugging =

See the Frequently Asked Questions.

= Further reading =

A birds-eye view of the OpenSPIM source code