aics-int / microscope_automation

Automation software for the AICS Microscopes.
Other
4 stars 0 forks source link

BUG: Catch error if image has more than two dimensions #32

Closed wiegraebe closed 3 years ago

wiegraebe commented 3 years ago

Description

At https://github.com/aics-int/microscope_automation/blob/abecb45022636498489af32098b5ebbfee689661/microscope_automation/samples/interactive_location_picker_pyqtgraph.py#L114 code crashes if self.image.shape has more than two dimensions

In the standard workflow, image should have only two dimensions. The error occurred when image was returned with a third dimension of size 1. A short-term fix could be to squeeze the np array: self.image.squeeze().shape

Expected Behavior

Be able to handle any number of dimensions.

Reproduction

Run code with preferences file Pipeline5.2.yml

fletchapin commented 3 years ago

Another example of this occurs in:

https://github.com/aics-int/microscope_automation/blob/abecb45022636498489af32098b5ebbfee689661/microscope_automation/microscope_automation.py#L2110

Short term solution: imsave(image_path, image_data_save.squeeze().T, cmap="gray")