top bar

Matlab and the Micro-Manager GUI

Revision as of 15:27, 18 October 2012 by Roy (Talk | contribs)

You can use Matlab to run and control the Micro-Manager gui and core. Here's how:

1. In Matlab, type

>> edit classpath.txt

and add the following lines:

C:/Program Files/Micro-Manager-1.4.11/ij.jar
C:/Program Files/Micro-Manager-1.4.11/plugins/Micro-Manager/MMCoreJ.jar
C:/Program Files/Micro-Manager-1.4.11/plugins/Micro-Manager/MMJ_.jar
C:/Program Files/Micro-Manager-1.4.11/plugins/Micro-Manager/bsh-2.0b4.jar
C:/Program Files/Micro-Manager-1.4.11/plugins/Micro-Manager/swingx-0.9.5.jar

you will need the additional items below in the classpath.txt to use the multi-image file format:

C:/Program Files/Micro-Manager-1.4.11/plugins/Micro-Manager/ome-xml.jar
C:/Program Files/Micro-Manager-1.4.11/plugins/Micro-Manager/loci-common.jar
C:/Program Files/Micro-Manager-1.4.11/plugins/Micro-Manager/scifio.jar
C:/Program Files/Micro-Manager-1.4.11/plugins/Micro-Manager/slf4j-api-1.7.1.jar

2. Again in Matlab, type

>> edit librarypath.txt

and add the line:

C:/Program Files/Micro-Manager-1.3

3. Restart Matlab. Now type the following at the command prompt:

>> cd 'c:/program files/Micro-Manager-1.3'
>> import org.micromanager.MMStudioMainFrame;
>> gui = MMStudioMainFrame(false);
>> gui.show;
>> mmc = gui.getCore;
>> acq = gui.getAcquisitionEngine;

Now you have gui, mmc, and acq objects that you can control from Matlab, very similar to how you would in Beanshell scripts.

On Mac OS X, current versions of Matlab have a bug that causes Micro-Manager to fail on startup. To work around this bug, issue the following command before starting the Micro-Manager GUI:

>> java.lang.System.clearProperty('java.util.prefs.PreferencesFactory')

(Reported by Paul Andrews, work around suggested by The Mathworks support).

© Micro-Manager : Vale Lab, UCSF 2006-2011 | All Rights Reserved | Contact