python-microscope / microscope

Python library for control of microscope devices, supporting hardware triggers and distribution of devices over the network for performance and flexibility.
https://www.python-microscope.org
GNU General Public License v3.0
69 stars 41 forks source link

pvcam: wrong frame dimensions in circular buffer mode #220

Open dstoychev opened 3 years ago

dstoychev commented 3 years ago

This bug only affects circular buffer mode and only when a non-square ROI is used.

https://github.com/python-microscope/microscope/blob/ef280c3402606941d1427b72950b472feb2b6cae/microscope/cameras/pvcam.py#L1510-L1522

The problem is with line 1518, where the frame buffer is cast to a numpy array. The shape of the array is supposed to be (height, width), so the dimensions need to be swapped like this:

frame_p, (self.roi[3], self.roi[2])
dstoychev commented 3 years ago

Implemented in https://github.com/dstoychev/microscope/commit/965fa39588c281ad5194024f094c71eeba7b2b8f.