Skip to content

NonUniformImage improvements#2764

Merged
j9ac9k merged 5 commits intopyqtgraph:masterfrom
pijyoi:nuimg-lut-compat
Jul 8, 2023
Merged

NonUniformImage improvements#2764
j9ac9k merged 5 commits intopyqtgraph:masterfrom
pijyoi:nuimg-lut-compat

Conversation

@pijyoi
Copy link
Copy Markdown
Contributor

@pijyoi pijyoi commented Jul 5, 2023

Behavior changes:

  1. NonUniformImage::setLookupTable was previously implemented to take in a HistogramLUTItem. Now it takes in a numpy array, like ImageItem.

Improvements:

  1. NonUniformImage can be used with both HistogramLUTItem and ColorBarItem, in the same way that an ImageItem is used.
  2. Change the example to use ColorBarItem. This also removes the hack of inserting a custom colormap into GradientEditorItem.
  3. Speed up the drawing with drawRects. The speed up can be observed with the example at
    BarGraphItem: calculate boundingRect without drawing #2599 (comment)

Bugs fixed:

  1. default color map was specified wrongly with floats
  2. non-normalized QRectF: negative height was being computed
  3. HistogramLUTItem was not using ImageItem::getLevels() accessor

@pijyoi pijyoi force-pushed the nuimg-lut-compat branch from 07ca7f5 to 79bb9fc Compare July 6, 2023 12:15
self.update()

x, y, z = self.data
def getLevels(self):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be renamed to just levels() (with setLevels() being the setter)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ColorBarItem is looking for getLevels. To change to "levels()" would require corresponding changes to ColorBarItem, ImageItem, PColorMeshItem, HistogramLUTItem.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Outside the scope of this PR to change all those other objects, but I'd like to deprecate that at point; but that's a future issue 👍

@pijyoi pijyoi force-pushed the nuimg-lut-compat branch from 79bb9fc to b283293 Compare July 7, 2023 09:17
@pijyoi pijyoi mentioned this pull request Jul 7, 2023
@pijyoi pijyoi marked this pull request as ready for review July 8, 2023 00:35
@j9ac9k
Copy link
Copy Markdown
Member

j9ac9k commented Jul 8, 2023

Thanks @pijyoi for revitalizing this plot type! I'll rebase #2614 so I can add docs to methods.

@j9ac9k j9ac9k merged commit d780572 into pyqtgraph:master Jul 8, 2023
@pijyoi pijyoi deleted the nuimg-lut-compat branch July 8, 2023 02:19
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