micro-manager / pymmcore

Python bindings for MMCore, Micro-Manager's device control layer
https://pypi.org/project/pymmcore/
GNU Lesser General Public License v2.1
32 stars 8 forks source link

`setSLMImage()` with `np.arrays` #88

Closed hinderling closed 8 months ago

hinderling commented 9 months ago

This code should fix issues with setSLMImage(). Until now, images had to be converted to char * which lead to issues with values > '\x7f' (127) because they don't match to valid ASCII characters (see discussion). For the genericSLMDevice, this meant that gray is the brightest color that could be achieved. Allowing for np.arrays removes one data conversion step for the user, and matches the behaviour of pycro-manager.

Accepted inputs with this PR:

Input formats I chose not to accept:

Thoughts on further improvement:

Caught errors:

I chose not to highlight that also char * is supported because of the above mentioned issues.

Tested on Windows with genericSLMDevice, Andor Mosaic 3, Mightex Polygon1000.

marktsuchida commented 8 months ago

@hinderling Many thanks for the patch and for the meticulous description, too! The remaining issues (regarding bit depth differences etc.) need to be solved first in MMDevice and MMCore (and each device); I've added a note to micro-manager/mmCoreAndDevices#34 but feel free to add any thoughts there.