Skip to main content
`Ctrl`+`K`

# `ROIStatsWidget`: Display a set of statistics for couples (plot items, roi)

An example of the usage is given in examples/plotRoiStats.py

This module provides widget for displaying statistics relative to a Region of interest and an item

## `ROIStatsWidget` class

class ROIStatsWidget(parent=None, plot=None, stats=None, rois=None)

  Bases: `QMainWindow`

  Widget used to define stats item for a couple(roi, plotItem). Stats will be computing on a given item (curve, image…) in the given region of interest.

  It also provide an interface for adding and removing items.

  Parameters:

    - parent (Union[qt.QWidget,None]) – parent qWidget

    - plot (PlotWindow) – plot widget containing the items

    - stats – stats to display

    - rois (tuple) – tuple of rois to manage

  registerROI(roi)

    For now there is no direct link between roi and plot. That is why we need to add/register them to be able to associate them

  setPlot(plot)

    Define the plot to interact with

    Parameters:

      plot (Union[PlotWidget,SceneWidget,None]) – The plot containing the items on which statistics are applied

  setStats(stats)

    Set which stats to display and the associated formatting.

    Parameters:

      statsHandler (StatsHandler) – Set the statistics to be displayed and how to format them using

  getStatsHandler()

    Returns the `StatsHandler` in use.

    Return type:

      StatsHandler

  addItem(plotItem, roi)

    Add a row of statitstic regarding the couple (plotItem, roi)

    Parameters:

      - plotItem (Item) – item to use for statistics

      - roi – region of interest to limit the statistic.

    Type:

      Union[ROI, RegionOfInterest]

    Returns:

      None of failed to add the item

    Return type:

      Union[None,ROIStatsItemHelper]

  removeItem(plotItem, roi)

    Remove the row associated to the couple (plotItem, roi)

    Parameters:

      - plotItem (Item) – item to use for statistics

      - roi – region of interest to limit the statistic.

    Type:

      Union[ROI,RegionOfInterest]

## `ROIStatsItemHelper` class

class ROIStatsItemHelper(plot_item, roi)

  Bases: `object`

  Item utils to associate a plot item and a roi

  Display on one row statistics regarding the couple (Item (plot item) / roi).

  Parameters:

    - plot_item (Item) – item for which we want statistics

    - Union[ROI,RegionOfInterest] – region of interest to use for statistics.

  property roi
  property roi_kind

    roi class

  item_kind()

    item kind

  property item_legend

    legend of the plot Item

  id_key()

    unique key to represent the couple (item, roi)