Rotate / Flip live image
Hello,
The camera chip I am using is not square and I would like to Flip and rotate the image, I can do that after acquisition in the engine but I wonder if there is an option to rotate the image on the live view as well?
Thanks! Cedric
Curious what @tlambert03 thinks but I think I'd prefer to implement such functionality in pymmcore-plus instead of here. Something like:
core.image_transforms.append(np.flip)
and then we could create a widget that allows for re-ordering, adding, and deleting transforms
As a hack for live view you can monkey patch core.getLastImage with a function that calls the original function and then returns the flipped image. See https://github.com/ianhi/mda-simulator/blob/3ba66e729931a92e463f2ce1cf8a5a5241c898d2/mda_simulator/mmcore/_mmcore.py#L90
an untested guess at this would be:
orig_getLastImage = core.getLastImage
def getLastImageFlipped()->np.ndarray:
return np.flip(orig_getLastImage())
core.getLastImage = getLastImageFlipped
Curious what @tlambert03 thinks but I think I'd prefer to implement such functionality in pymmcore-plus instead of here. Something like:
love that idea. Maybe it's time to generally attack adding functional hooks to the engine?
love that idea. Maybe it's time to generally attack adding functional hooks to the engine?
When you say "functional hooks" what does that mean?
Meaning: it's one thing to be able to connect callbacks to events emitted by the MDA... but that's one way communication: we can't modify the events and or the image in the process. A functional hook would provide a way to modify either the event object and or the image itself before further processing and/or event emission
Ahh gotcha. Is this something that we should use a library (a la psygnal) for, or is better to go simpler with something like keeping a list of functions to evaluate?