Snap/Live window freezes using Matlab

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

Snap/Live window freezes using Matlab

yiftachd
 Hi,

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?

Thanks in advance,
Yiftach


_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: Snap/Live window freezes using Matlab

yiftachd
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?



--
Sent from: http://micro-manager.3463995.n2.nabble.com/


_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: Snap/Live window freezes using Matlab

Konstantin Neuhaus
Hi Yiftach,
 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;
else
    pixelType = 'uint8';
    img.bits = 2^8-1;
end
im = typecast(im, pixelType); % pixels must be interpreted as unsigned
integers
im = reshape(im, [width, height]); % image should be interpreted as a 2D
array
img.data = transpose(im); % make column-major order for MATLAB

Could you share the specific code you use to interact with the micromanager
Snap/Live function?

Best,
Konstantin




--
Sent from: http://micro-manager.3463995.n2.nabble.com/


_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: Snap/Live window freezes using Matlab

JonD
Administrator
In reply to this post by yiftachd
Hi Yiftach,


yiftachd wrote
> I'm trying to use Micro-Manager through matlab.

It would help to specify:
- the Micro-Manager version/build
- the Matlab version
- the camera device adapter

I suggest trying the latest nightly build whether you are on 1.4 or 2.0
beta/gamma in case there has been some bug fixed.

Jon



--
Sent from: http://micro-manager.3463995.n2.nabble.com/


_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: Snap/Live window freezes using Matlab

yiftachd
In reply to this post by Konstantin Neuhaus
Hi Konstantin,

Even right after initialization, without snapping any image, I get this
problem. i.e. after this code in the OpeningFcn callback function:

import org.micromanager.MMStudio;
handles.gui = MMStudio(false);
handles.mmc = handles.gui.getCore;

the micromanager GUI opens up, I click on the "Live" or the "Snap" button,
and I get a Snap/Live window which doesn't update (I attached a printscreen)
<http://micro-manager.3463995.n2.nabble.com/file/t396394/printscreen.png>

I use Micromanager 1.4.23, Zeiss axio observer Z1 microscope with Andor iXon
Ultra897, Matlab R2019a

Yiftach



--
Sent from: http://micro-manager.3463995.n2.nabble.com/


_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: Snap/Live window freezes using Matlab

yiftachd
In reply to this post by JonD
Hi Jon,
I'm using Micro-Manager 1.4.23 20190529, Matlab R2019a, and Andor iXon Ultra
897 camera.

Thanks,
Yiftach



--
Sent from: http://micro-manager.3463995.n2.nabble.com/


_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: Snap/Live window freezes using Matlab

MORRISON Harris
Hi,

It may be a silly suggestion but how much memory are you allocating to ImageJ? Perhaps something worth checking.

Cheers,


Harris

From: yiftachd <[hidden email]>
Sent: 19 June 2019 11:52
To: [hidden email]
Subject: Re: [micro-manager-general] Snap/Live window freezes using Matlab
 
Hi Jon,
I'm using Micro-Manager 1.4.23 20190529, Matlab R2019a, and Andor iXon Ultra
897 camera.

Thanks,
Yiftach



--
Sent from: http://micro-manager.3463995.n2.nabble.com/


_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336.

_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: Snap/Live window freezes using Matlab

yiftachd
Where do I check it?

בתאריך 19 ביוני 2019 14:00,‏ "MORRISON Harris" <[hidden email]> כתב:
Hi,

It may be a silly suggestion but how much memory are you allocating to ImageJ? Perhaps something worth checking.

Cheers,


Harris

From: yiftachd <[hidden email]>
Sent: 19 June 2019 11:52
To: [hidden email]
Subject: Re: [micro-manager-general] Snap/Live window freezes using Matlab
 
Hi Jon,
I'm using Micro-Manager 1.4.23 20190529, Matlab R2019a, and Andor iXon Ultra
897 camera.

Thanks,
Yiftach



--
Sent from: http://micro-manager.3463995.n2.nabble.com/


_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336.


_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general



_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: Snap/Live window freezes using Matlab

MORRISON Harris
Hi,

Message sent earlier being held up as too big!

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.

Cheers,

H



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
 
Where do I check it?

בתאריך 19 ביוני 2019 14:00,‏ "MORRISON Harris" <[hidden email]> כתב:
Hi,

It may be a silly suggestion but how much memory are you allocating to ImageJ? Perhaps something worth checking.

Cheers,


Harris

From: yiftachd <[hidden email]>
Sent: 19 June 2019 11:52
To: [hidden email]
Subject: Re: [micro-manager-general] Snap/Live window freezes using Matlab
 
Hi Jon,
I'm using Micro-Manager 1.4.23 20190529, Matlab R2019a, and Andor iXon Ultra
897 camera.

Thanks,
Yiftach



--
Sent from: http://micro-manager.3463995.n2.nabble.com/


_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336.


_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general



_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: Snap/Live window freezes using Matlab

yiftachd
Hi,
I have 16GB RAM. I've increased it to 8000 from 2000, but it still doesn't
seem to work...
It's weird that the message sent earlier is held up as too big, since the
size of the print screen image is 60Kb. I'll try again...
<http://micro-manager.3463995.n2.nabble.com/file/t396394/prntscrn.jpg>

Yiftach



--
Sent from: http://micro-manager.3463995.n2.nabble.com/


_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: Snap/Live window freezes using Matlab

JonD
Administrator
In reply to this post by yiftachd
yiftachd wrote
> I'm using Micro-Manager 1.4.23 20190529, Matlab R2019a, and Andor iXon
> Ultra
> 897 camera.

I suggest trying the most recent nightly build of 1.4, and if that doesn't
work then the nightly build from May 15.  It would be great to report your
experience.

There was a change to the circular buffer code on May 16 which caused live
mode to hang on some cameras.  The live display code was fixed
correspondingly on June 6 in 1.4 (and I think sooner in 2.0).

I'm not sure why the issue would manifest itself via Matlab but not the
Micro-Manager GUI, but it's worth trying.

Jon



--
Sent from: http://micro-manager.3463995.n2.nabble.com/


_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: Snap/Live window freezes using Matlab

yiftachd
Interesting... the latest build doesn't work, but the May 15 build does work!
Thank you very much!

Yiftach



--
Sent from: http://micro-manager.3463995.n2.nabble.com/


_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: Snap/Live window freezes using Matlab

yiftachd
Sorry.. I probably opened an instance outside matlab which worked, but it seems that the May 15 build also doesn't work... 

‫בתאריך יום ד׳, 19 ביוני 2019 ב-18:06 מאת ‪yiftachd‬‏ <‪[hidden email]‬‏>:‬
Interesting... the latest build doesn't work, but the May 15 build does work!
Thank you very much!

Yiftach



--
Sent from: http://micro-manager.3463995.n2.nabble.com/


_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general


_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: Snap/Live window freezes using Matlab

Stuurman, Nico
In reply to this post by yiftachd
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
happening.

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).

Best,


Nico




_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: Snap/Live window freezes using Matlab

yiftachd
Hi,
For the sake of closure, it seems it really was the problem. I was advised
to move the GUI from GUIDE to matlab's App Designer, which doesn't use EDT,
and there are no problems anymore.

Thanks everybody for the help

Yiftach



--
Sent from: http://micro-manager.3463995.n2.nabble.com/


_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general