Skip to content

Commit 77c210a

Browse files
committed
Fix ImageStatsTool not working with XYImageItem and MaskedXYImageItem
Add IExportROIImageItemType to XYImageItem.types() so that get_items_in_rectangle() can find XY image items when filtering by interface type. Also update __implements__ tuples for consistency. Fixes regression where ImageStatsTool displayed "No available data" instead of statistics for images with non-uniform coordinates.
1 parent 761cf36 commit 77c210a

File tree

3 files changed

+33
-3
lines changed

3 files changed

+33
-3
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog #
22

3+
## Version 2.8.1 ##
4+
5+
🛠️ Bug fixes:
6+
7+
* [Issue #50](https://github.com/PlotPyStack/PlotPy/issues/50) - Fixed ImageStatsTool displaying "No available data" for `XYImageItem` and `MaskedXYImageItem`:
8+
* Added `IExportROIImageItemType` to `XYImageItem.types()` so that `get_items_in_rectangle()` can properly identify XY image items
9+
* Updated `__implements__` tuples for consistency across `XYImageItem`, `MaskedXYImageItem`, and `MaskedImageItem`
10+
* The tool now correctly displays statistics for images with non-uniform coordinates
11+
312
## Version 2.8.0 ##
413

514
💥 New features / Enhancements:

plotpy/items/image/masked.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from plotpy.interfaces import (
1616
IBaseImageItem,
1717
IBasePlotItem,
18+
IExportROIImageItemType,
1819
IHistDataSource,
1920
IVoiImageItemType,
2021
)
@@ -406,7 +407,13 @@ class MaskedImageItem(ImageItem, MaskedImageMixin):
406407
param: image parameters
407408
"""
408409

409-
__implements__ = (IBasePlotItem, IBaseImageItem, IHistDataSource, IVoiImageItemType)
410+
__implements__ = (
411+
IBasePlotItem,
412+
IBaseImageItem,
413+
IHistDataSource,
414+
IVoiImageItemType,
415+
IExportROIImageItemType,
416+
)
410417

411418
def __init__(
412419
self,
@@ -570,7 +577,13 @@ class MaskedXYImageItem(XYImageItem, MaskedImageMixin):
570577
param: image parameters
571578
"""
572579

573-
__implements__ = (IBasePlotItem, IBaseImageItem, IHistDataSource, IVoiImageItemType)
580+
__implements__ = (
581+
IBasePlotItem,
582+
IBaseImageItem,
583+
IHistDataSource,
584+
IVoiImageItemType,
585+
IExportROIImageItemType,
586+
)
574587

575588
def __init__(
576589
self,

plotpy/items/image/standard.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,14 @@ class XYImageItem(RawImageItem):
522522
them from the stored bin edges.
523523
"""
524524

525-
__implements__ = (IBasePlotItem, IBaseImageItem, ISerializableType)
525+
__implements__ = (
526+
IBasePlotItem,
527+
IBaseImageItem,
528+
IHistDataSource,
529+
IVoiImageItemType,
530+
IExportROIImageItemType,
531+
ISerializableType,
532+
)
526533

527534
def __init__(
528535
self,
@@ -788,6 +795,7 @@ def types(self) -> tuple[type[IItemType], ...]:
788795
ITrackableItemType,
789796
ISerializableType,
790797
ICSImageItemType,
798+
IExportROIImageItemType,
791799
)
792800

793801
# ---- IBaseImageItem API --------------------------------------------------

0 commit comments

Comments
 (0)