silx icon indicating copy to clipboard operation
silx copied to clipboard

CompareImages: Error when using colormap fixed scale on ROI

Open vallsv opened this issue 2 years ago • 3 comments

The composite item does not store the data the way it is expected by the ColormapDialog.

As result it fails when we use the fixed scale tool from the ColormapDialog

We could fix that by

  • Creating a dedicated API for that use case in Item
  • Disabling the tool for the CompareImages
  • Skipping unknown items from the ColormapDialog
Traceback (most recent call last):
  File "/nobackup/lvalls1/valls/workspace/silx.git/build/lib.linux-x86_64-3.7/silx/gui/dialog/ColormapDialog.py", line 1836, in __roiFinalized
    self.setColormapRangeFromDataBounds((ox, ox+width, oy, oy+height))
  File "/nobackup/lvalls1/valls/workspace/silx.git/build/lib.linux-x86_64-3.7/silx/gui/dialog/ColormapDialog.py", line 1458, in setColormapRangeFromDataBounds
    subset = data[ystart:ystop, xstart:xstop]
IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed

vallsv avatar Jun 14 '23 15:06 vallsv

I prefer the 1st approach because it makes it clean for a scatter or an image, or anything else.

vallsv avatar Jun 14 '23 15:06 vallsv

I prefer the 1st approach because it makes it clean for a scatter or an image

+1

It sounds possible to extend ColormapMixIn.getColormappedRange and pass it the bounds: def getColormappedData(self, copy=True, bounds=None)

Thus code specific to Image and Scatter item in ColormapDialog.setColormapRangeFromDataBounds would move to each item.

t20100 avatar Jul 11 '23 15:07 t20100

Let's keep it open to keep it mind a proper way to solve this

t20100 avatar Jul 11 '23 15:07 t20100