Title: Fixed ImageStatsTool displaying "No available data" for `XYImageItem` and `MaskedXYImageItem` · Issue #50 · PlotPyStack/PlotPy · GitHub
Open Graph Title: Fixed ImageStatsTool displaying "No available data" for `XYImageItem` and `MaskedXYImageItem` · Issue #50 · PlotPyStack/PlotPy
X Title: Fixed ImageStatsTool displaying "No available data" for `XYImageItem` and `MaskedXYImageItem` · Issue #50 · PlotPyStack/PlotPy
Description: Description Problem The ImageStatsTool displays "No available data" instead of showing statistics when used on XYImageItem or MaskedXYImageItem objects (images with non-uniform coordinates). Steps to Reproduce Create an XYImageItem with ...
Open Graph Description: Description Problem The ImageStatsTool displays "No available data" instead of showing statistics when used on XYImageItem or MaskedXYImageItem objects (images with non-uniform coordinates). Steps ...
X Description: Description Problem The ImageStatsTool displays "No available data" instead of showing statistics when used on XYImageItem or MaskedXYImageItem objects (images with non-uniform coordinate...
Opengraph URL: https://github.com/PlotPyStack/PlotPy/issues/50
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Fixed ImageStatsTool displaying \"No available data\" for `XYImageItem` and `MaskedXYImageItem`","articleBody":"## Description\n\n### Problem\nThe ImageStatsTool displays \"No available data\" instead of showing statistics when used on `XYImageItem` or `MaskedXYImageItem` objects (images with non-uniform coordinates).\n\n### Steps to Reproduce\n1. Create an XYImageItem with non-uniform x/y coordinates\n2. Add it to a plot\n3. Activate the ImageStatsTool\n4. Draw a rectangle over the image\n5. Expected: Statistics should be displayed in the rectangle\n6. Actual: \"No available data\" is shown\n\n### Minimal Example\n```python\nimport numpy as np\nfrom plotpy.builder import make\nfrom plotpy.plot import PlotDialog\nfrom plotpy.tools import ImageStatsTool\n\n# Create test data\ndata = np.random.rand(100, 100)\nx = np.linspace(0, 10, 100)\ny = np.linspace(0, 20, 100)\n\n# Create an XY image item (non-uniform coordinates)\nimage = make.xyimage(x, y, data, title=\"Test XY Image\")\n\n# Create a plot with the image\nwin = PlotDialog(edit=False, toolbar=True)\nplot = win.manager.get_plot()\nplot.add_item(image)\n\n# Add ImageStatsTool\ntool = ImageStatsTool(win.manager)\nwin.manager.add_tool(tool)\n\nwin.exec()\n```\n\n### Root Cause\nThe `ImageStatsRectangle.get_info()` method calls `get_items_in_rectangle()` which filters items by calling `plot.get_items(item_type=IExportROIImageItemType)`. This method checks if `item_type in item.types()`.\n\n`XYImageItem.types()` was missing `IExportROIImageItemType`, causing XY images to be filtered out during the search, resulting in no items being found and the \"No available data\" message.\n\n### Solution\nAdd `IExportROIImageItemType` to the tuple returned by `XYImageItem.types()`.\n\nAdditionally, update `__implements__` tuples for consistency:\n- Add `IHistDataSource`, `IVoiImageItemType`, and `IExportROIImageItemType` to `XYImageItem.__implements__`\n- Add `IExportROIImageItemType` to `MaskedXYImageItem.__implements__`\n- Add `IExportROIImageItemType` to `MaskedImageItem.__implements__`\n\n### Files to Modify\n- `plotpy/items/image/standard.py` - XYImageItem.types() and __implements__\n- `plotpy/items/image/masked.py` - MaskedXYImageItem.__implements__ and MaskedImageItem.__implements__\n\n### Additional Context\n- Regular `ImageItem` works correctly because it inherits from `RawImageItem` which inherits from `BaseImageItem`, and `BaseImageItem.types()` includes `IExportROIImageItemType`\n- XYImageItem overrides `types()` but was missing this interface type\n- The underlying methods (`get_closest_index_rect()`, `export_roi()`) work correctly for XY images; only the interface declaration was missing\n","author":{"url":"https://github.com/PierreRaybaut","@type":"Person","name":"PierreRaybaut"},"datePublished":"2025-10-30T17:43:17.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/50/PlotPy/issues/50"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a49effc2-4e09-ef30-de0e-d99011756990 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E882:18F725:45FE0FA:5F0C8D3:6973042B |
| html-safe-nonce | 866ebf7372e4b8287d4860282e42d6ceed9acad77b641e8b3bc4cd507ae0766a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFODgyOjE4RjcyNTo0NUZFMEZBOjVGMEM4RDM6Njk3MzA0MkIiLCJ2aXNpdG9yX2lkIjoiNTYyNDEzODI0NDI3MDc4NTU3OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | fe6b0839b530d55f368628ccf232cde63e9451a431cd836de4e826695fc8e854 |
| hovercard-subject-tag | issue:3571848375 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PlotPyStack/PlotPy/50/issue_layout |
| twitter:image | https://opengraph.githubassets.com/575d64e221db8ebc0a16748b2635c7895f31f4b0746a75af34e8cd829316e2c4/PlotPyStack/PlotPy/issues/50 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/575d64e221db8ebc0a16748b2635c7895f31f4b0746a75af34e8cd829316e2c4/PlotPyStack/PlotPy/issues/50 |
| og:image:alt | Description Problem The ImageStatsTool displays "No available data" instead of showing statistics when used on XYImageItem or MaskedXYImageItem objects (images with non-uniform coordinates). Steps ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | PierreRaybaut |
| hostname | github.com |
| expected-hostname | github.com |
| None | 44ab3188c1dcfe3be0f9c3feca2e04e14fb79f120939ce2395e4f15ab96ec1d4 |
| turbo-cache-control | no-preview |
| go-import | github.com/PlotPyStack/PlotPy git https://github.com/PlotPyStack/PlotPy.git |
| octolytics-dimension-user_id | 145201262 |
| octolytics-dimension-user_login | PlotPyStack |
| octolytics-dimension-repository_id | 671159499 |
| octolytics-dimension-repository_nwo | PlotPyStack/PlotPy |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 671159499 |
| octolytics-dimension-repository_network_root_nwo | PlotPyStack/PlotPy |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | a5e2b48bd1260476599758f5d253b5d24092ab84 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width