Quantcast

MM circular buffer issue

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

MM circular buffer issue

Bryant, Jason
Hi, am trying to get a live video mode working with MM1.4.23.     It worked fine in 1.4.22.  Im using matlab
 
    import mmcorej.*;
    mmc=CMMCore;
    mmc.stopSequenceAcquisition();
    %set Exposure for Live Capture
    ex=str2num(get(handles.edit1,'String'));
    mmc.setExposure('Camera-1',ex);
 
    %start Live Capture
    mmc.startContinuousSequenceAcquisition(10)
    b=mmc.isSequenceRunning()
 
    while b == 1
 
      b=mmc.isSequenceRunning();
      IM=mmc.getLastImage();
      width=mmc.getImageWidth();
      height=mmc.getImageHeight();
 
      if mmc.getBytesPerPixel==2
         pixelType='uint16';
      else
         pixelType='uint8';
      end
 
      img=typecast(IM,pixelType);
      img=reshape(img, [width, height]);
      img=transpose(img);
 
      %display image
       axes(handles.axes1)
      [high,low]=Autoscaleimage(handles,img,2);
      imshow(img,[low, high]);     
      drawnow;
 
 
I am now getting a complaint over the circular buffer being empty?
Any advice please.
Thanks
 
 
Java exception occurred:
java.lang.Exception: Circular buffer is empty.
 
        at mmcorej.MMCoreJJNI.CMMCore_getLastImage(Native Method)
 
        at mmcorej.CMMCore.getLastImage(CMMCore.java:1001)
 
 
Dr Jason Bryant
Illumina UK
Chesterford Research Park
Nr Saffron Walden
Essex
CB10 1XL
 
 
 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MM circular buffer issue

gwitz
Your while loop might be faster than the acquisition time and the camera hasn't had yet time to put a new image in the circular buffer.
Bryant, Jason wrote
    %start Live Capture
    mmc.startContinuousSequenceAcquisition(10)
    b=mmc.isSequenceRunning()

    while b == 1

      b=mmc.isSequenceRunning();
      IM=mmc.getLastImage();
In your while loop you should also verify that there's already a new image in there (and also grab any remaining image even if the sequence is done). Something like this should work:

while mmc.getRemainingImageCount() > 0 || mmc.isSequenceRunning()
   if (mmc.getRemainingImageCount() > 0) {
      IM=mmc.getLastImage();
      ...


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MM circular buffer issue

Bryant, Jason
Thankyou - that was the issue.
Not sure why it worked in 1.4.22 but not 1.4.23 though :-)
Jason

-----Original Message-----
From: gwitz [mailto:[hidden email]]
Sent: 16 February 2017 16:20
To: [hidden email]
Subject: Re: [micro-manager-general] MM circular buffer issue

Your while loop might be faster than the acquisition time and the camera hasn't had yet time to put a new image in the circular buffer.

Bryant, Jason wrote
>     %start Live Capture
>     mmc.startContinuousSequenceAcquisition(10)
>     b=mmc.isSequenceRunning()
>
>     while b == 1
>
>       b=mmc.isSequenceRunning();
>       IM=mmc.getLastImage();

In your while loop you should also verify that there's already a new image in there (and also grab any remaining image even if the sequence is done).
Something like this should work:

while mmc.getRemainingImageCount() > 0 || mmc.isSequenceRunning()
   if (mmc.getRemainingImageCount() > 0) {
      IM=mmc.getLastImage();
      ...






--
View this message in context: https://urldefense.proofpoint.com/v2/url?u=http-3A__micro-2Dmanager.3463995.n2.nabble.com_MM-2Dcircular-2Dbuffer-2Dissue-2Dtp7588122p7588124.html&d=DwICAg&c=-czJP1j3ADhzrHyCFvd7gA&r=XVbS4o2OTD0hVUvNfwj40LwBrnbC9jVkgtPj7IGmz7c&m=OOL_YJ-WSSNP6oN-UwJPG9QZJWBnJ-ch-nQpGhpaxAo&s=Id1-JdQM7tScSkNTbNr4fxMpc99Ecr6o8q7xTu5bEgY&e=
Sent from the Micro-Manager mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! https://urldefense.proofpoint.com/v2/url?u=http-3A__sdm.link_slashdot&d=DwICAg&c=-czJP1j3ADhzrHyCFvd7gA&r=XVbS4o2OTD0hVUvNfwj40LwBrnbC9jVkgtPj7IGmz7c&m=OOL_YJ-WSSNP6oN-UwJPG9QZJWBnJ-ch-nQpGhpaxAo&s=hT618DOhBWENVeQHwCvxuVeWLwiFqF8vLUHNHU9KoCg&e=
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.sourceforge.net_lists_listinfo_micro-2Dmanager-2Dgeneral&d=DwICAg&c=-czJP1j3ADhzrHyCFvd7gA&r=XVbS4o2OTD0hVUvNfwj40LwBrnbC9jVkgtPj7IGmz7c&m=OOL_YJ-WSSNP6oN-UwJPG9QZJWBnJ-ch-nQpGhpaxAo&s=ZYq5vtTe6Gm_YNzuKf-1lpDsry3MUr5Jh0vAjiAiKBM&e= 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MM circular buffer issue

JonD
I am seeing the same error with live mode.  It occurs almost immediately when Multi Camera is being used (even with two DemoCam devices).  This error occurs in the 20170129 nightly build but not before, and from the code timeline I see that aspects of the circular buffer code were changed on that date.  The error eventually occurs (after minutes) with a single actual camera as well (I tested with two different sCMOS cameras full-frame).  I'm running a few more tests and will send the developers some debug log files.

Jon

-------------------------------------------
Jon Daniels
Applied Scientific Instrumentation
29391 West Enid Rd, Eugene, OR 97402
Phone: (541) 461-8181 x118
-------------------------------------------
Loading...