Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IMAQdxCamera: optional autoscaling, and background subtraction #87

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chrisjbillington
Copy link
Member

Add optional autoscaling to IMAQdxCamera. Previously, autoscaling was
always on.

Add basic background subtraction. A background can be set, which will be
subtracted from subsequent images in manual mode.

Peek 2021-08-20 14-49

Add optional autoscaling to IMAQdxCamera. Previously, autoscaling was
always on.

Add basic background subtraction. A background can be set, which will be
subtracted from subsequent images in manual mode.
@zakv
Copy link

zakv commented Aug 22, 2021

This looks great! I tested it with our PCO camera which inherits from the IMAQdxCamera classes and it worked well. I just have a few questions/comments

  • One small issue is that the "Set background" feature currently runs into trouble if it is clicked before any images have been acquired. When it is pressed before an image is acquired, image_receiver.image gets set to None and then image_receiver.update_image() gets called, which throws AttributeError: 'NoneType' object has no attribute 'swapaxes'.
    • A solution to this would be to have image_receiver.set_bg_image() only set the background image and call self.update_image() if self.image is not None.
    • image_receiver.set_bg_image() should probably also return True or False indicating whether or not it updated the background image. Then IMAQdxCameraTab.on_set_bg_clicked() should only show/hide buttons if the background image was actually set.
    • Maybe an error message window should pop up indicating to the user that their button click was detected but no background was set? Otherwise their input would be silently ignored which might look like a bug.
  • It might be nice to save/restore the background image when blacs is closed/opened.
  • The background subtraction is for the display only; the copies of the images taken during a shot and saved to the hdf5 file don't have the background image subtracted.
    • I wonder if there is a good way to indicate this to the user? Maybe mention it in a tooltip? I'm not attached to this idea but thought I'd mention it in case you can think of a better solution.
  • This merged fine with Make IMAQdx camera tab restore more of the display's settings #63. I thought that there might be a conflict since both edit IMAQdxCameraTab.get_save_data() and IMAQdxCameraTab.get_save_data(), but git handled the merge just fine without any manual intervention.
  • At first I thought that the background subtraction might already be implemented by the "Subtract" option in the "Normalization" tab of the ImageView (see screenshot below), but I think I was wrong.
    • From digging around the source code (see the normalize() method in particular) it looks like it's designed for image arrays that are 3D (e.g. a series of images displayed together) so it doesn't do exactly what is done by the code in this PR.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants