GuckLab / impose

Align microscopy images using custom-defined structural patterns and superimpose those on data from other imaging modalities.
GNU General Public License v3.0
1 stars 0 forks source link

Properly handle nan-valued data #25

Closed paulmueller closed 2 years ago

paulmueller commented 2 years ago

If you open e.g. the test brillouin file from bmlab, you get cryptic error messages about nan values and ranges. This is because the brillouin shift in that dataset contains all-nans or is empty. impose should not complain about it:

Unhandled exception in Impose version 0.2.0.post7:
Traceback (most recent call last):
  File "/home/paul/repos/impose/impose/gui/collect.py", line 141, in on_dataset_selected
    self.vis.set_data_source(self.current_data_source)
  File "/home/paul/repos/impose/impose/gui/visualize.py", line 203, in set_data_source
    self.__setstate__(data_source.metadata)
  File "/home/paul/repos/impose/impose/gui/visualize.py", line 131, in __setstate__
    self.update_image()
  File "/home/paul/repos/impose/impose/gui/visualize.py", line 227, in update_image
    self.imageView.setImage(image,
  File "/home/paul/repos/impose/.env/lib/python3.10/site-packages/pyqtgraph/imageview/ImageView.py", line 334, in setImage
    self.updateImage(autoHistogramRange=autoHistogramRange)
  File "/home/paul/repos/impose/.env/lib/python3.10/site-packages/pyqtgraph/imageview/ImageView.py", line 750, in updateImage
    self.ui.histogram.setHistogramRange(self.levelMin, self.levelMax)
  File "/home/paul/repos/impose/.env/lib/python3.10/site-packages/pyqtgraph/graphicsItems/HistogramLUTItem.py", line 260, in setHistogramRange
    self.vb.setYRange(mn, mx, padding)
  File "/home/paul/repos/impose/.env/lib/python3.10/site-packages/pyqtgraph/graphicsItems/ViewBox/ViewBox.py", line 668, in setYRange
    self.setRange(yRange=[min, max], update=update, padding=padding)
  File "/home/paul/repos/impose/.env/lib/python3.10/site-packages/pyqtgraph/graphicsItems/ViewBox/ViewBox.py", line 592, in setRange
    raise Exception("Cannot set range [%s, %s]" % (str(mn), str(mx)))
Exception: Cannot set range [nan, nan]