I've been working on a device adapter for Basler USB cameras and I'm having trouble properly setting up the circular buffer.
Overall the device adapter successfully communicates with Basler's API and returns images without causing micromanager to crash. However, if I call popNextImage() or popNextImageMD() via the CMMCore API (called from MATLAB, in my case) the getRemainingImageCount() counter never decreases. In otherwords, it appears that the images are stuck in the circular buffer queue.
I've tried to write the device adapter with as few overrides to the virtual functions defined in CCameraBase as possible.
Pixel data is stored in a MicroManager ImageBuffer named img_, which is set during SnapImage()
Besides action interfaces and internal methods for communicating with Basler's API I've only implemented the following Methods:
//MM API - Image Properties
const unsigned char* GetImageBuffer(); // returns pointer to data in img_
long GetImageBufferSize() const; //size of data in img_
unsigned GetImageWidth() const; //get width of img_
unsigned GetImageHeight() const; //image height of img_
unsigned GetImageBytesPerPixel() const; //get bytes per pixel for img_
unsigned GetBitDepth() const; //bitdepth of img_
//MM API - Camera Interface
int Initialize(); //connect to Basler Pylon Library, setup camera
int Shutdown(); //shutdown camera, dissconnect from library
void GetName(char* name) const;
int SnapImage(); //locks imgLock_, calls camera.RetrieveResult(...), copies data to img_ buffer
In other words, I don't create a custom acquisition thread and don't re-define