mantidimaging.gui.windows.spectrum_viewer.spectrum_widget module

class mantidimaging.gui.windows.spectrum_viewer.spectrum_widget.SpectrumROI(name: str, sensible_roi: SensibleROI, *args, **kwargs)[source]

Bases: ROI

Spectrum ROI object subclassed from pyqtgraph ROI containing ROI and associated data.

@param name: Name of the ROI @param sensible_roi: Sensible ROI object containing the ROI data @param args: Arguments to pass to the ROI object @param kwargs: Keyword arguments to pass to the ROI object

property colour: tuple[int, int, int, int]
property name: str
property roi: ROI
property selected_row: int | None
class mantidimaging.gui.windows.spectrum_viewer.spectrum_widget.SpectrumWidget[source]

Bases: GraphicsLayoutWidget

The widget containing the spectrum plot and the image projection.

@param parent: The parent widget

add_range(range_min: int, range_max: int) None[source]
add_roi(roi: SensibleROI, name: str) None[source]

Add an ROI to the image view.

@param roi: The ROI to add. @param name: The name of the ROI.

change_roi_colour(name: str, colour: tuple[int, int, int, int]) None[source]

Change the colour of an existing ROI

@param name: The name of the ROI. @param colour: The new colour of the ROI.

get_roi(roi_name: str) SensibleROI[source]

Get the ROI with the given name. If no name is given, the default ROI is returned.

@param roi_name: The name of the ROI to return. @return: The ROI with the given name.

get_tof_range() tuple[int, int][source]
image: MIMiniImageView
random_colour_generator() tuple[int, int, int, int][source]

A random colour generator to colour ROIs boarders. Generates colours that are easy to see for colour blind people if colour_blind_friendly is True. By default colour_blind_friendly is set to False

@return: A random colour in RGBA format. (0-255, 0-255, 0-255, 0-255)

range_changed

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

range_control: LinearRegionItem
remove_roi(roi_name: str) None[source]

Remove a given ROI by name unless it is ‘roi’ or ‘all’.

@param roi_name: The name of the ROI to remove.

rename_roi(old_name: str, new_name: str) None[source]

Rename a given ROI and corresponding spectrum by name unless it is called ‘roi’ or ‘all’

@param old_name: The name of the ROI to rename. @param new_name: The new name of the ROI. @raise KeyError: If the new name is already in use or equal to ‘roi’ or ‘all’.

roi_changed

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

roi_dict: dict[str | None, ROI]
set_roi_alpha(name: str, alpha: float) None[source]

Change the alpha value of an existing ROI

@param name: The name of the ROI. @param alpha: The new alpha value of the ROI.

set_roi_visibility_flags(name: str, visible: bool) None[source]

Change the visibility of an existing ROI including handles and update the ROI dictionary, sending a signal to the main window.

@param name: The name of the ROI. @param visible: The new visibility of the ROI.

spectrum: PlotItem