I'm trying to use Micro-Manager through matlab. When I open the Micro-Manager GUI through matlab, and I open the Snap/Live window, it seems to be frozen (i.e., I see all the windows that are open behind it, even if I move the snap/live window, stop the live mode and resume it, or even if I snap an image). When I open the GUI and core through matlab I don't see any errors. When I open the micro-manager manually without matlab the snap/live window seems to work great, so I guess it's not a problem with the microscope/camera. Can you please help me?
More specifically, it seems that the problem happens when I create my own GUI
in matlab using GUIDE. I think I saw somewhere that matlab GUI and
micromanager run on the same thread or something like that, could that be
the reason? If so what can I do?
in our Lab we use almost exclusevly Matlab to contol our experiments via
micromanager. Our Matlab Control Software uses a GUI created by GUIDE and i
never observed problems with snapping in image.
We just use the following commands from the micromanager core to achieve
snapping of images:
mmc = handles.MM.mmc;
mmc.snapImage(); im = mmc.getImage(); % returned as a 1D array of signed
integers in row-major order width = mmc.getImageWidth();
height = mmc.getImageHeight();
if mmc.getBytesPerPixel == 2
pixelType = 'uint16';
img.bits = 2^16-1;
pixelType = 'uint8';
img.bits = 2^8-1;
im = typecast(im, pixelType); % pixels must be interpreted as unsigned
im = reshape(im, [width, height]); % image should be interpreted as a 2D
img.data = transpose(im); % make column-major order for MATLAB
Could you share the specific code you use to interact with the micromanager
Before changing, check how much RAM your PC has. Go to ImageJ window when you've opening micro-manager. Click on Edit --> Options --> Memory & Threads. In the window that opens, change the allocation. I usually enter around 60 to 70% of my total RAM, i.e. 8000.
We only use those PC's for MM so nothing else is going to interfere or be affected by larger memory allocation, ymmv.
From: Yiftach Divon <[hidden email]> Sent: 19 June 2019 12:04 To: Micro-Manager General Subject: Re: [micro-manager-general] Snap/Live window freezes using Matlab
On 6/17/19 11:36 PM, yiftachd wrote:
> More specifically, it seems that the problem happens when I create my own GUI
> in matlab using GUIDE. I think I saw somewhere that matlab GUI and
> micromanager run on the same thread or something like that, could that be
> the reason? If so what can I do?
I suspect this to be the reason for MM GUI no longer updating. I do not
know anything about the threading model of Matlab, but Micro-Manager
depends on the EDT (the Event Dispatch Thread) doing screen updates, so
if that one is blocked for one reason or another, then not much will be
You can try to spin up a different thread and start your GUI from that
thread (search for "Java Threads" to learn how to do so, or scoure the
Micro-Manager source code for many examples).