mantidimaging.gui.windows.spectrum_viewer.spectrum_widget module#

class mantidimaging.gui.windows.spectrum_viewer.spectrum_widget.CustomViewBox(*args, **kwds)[source]#

Bases: ViewBox

keyPressEvent(event: QEvent) None[source]#

This routine should capture key presses in the current view box. Key presses are used only when mouse mode is RectMode The following events are implemented: ctrl-A : zooms out to the default “full” view of the plot ctrl-+ : moves forward in the zooming stack (if it exists) ctrl– : moves backward in the zooming stack (if it exists)

keyReleaseEvent(self, event: Optional[QKeyEvent])[source]#
mouseClickEvent(ev: QEvent) None[source]#
mouseDragEvent(ev: QEvent, axis: int | None = None) None[source]#
class mantidimaging.gui.windows.spectrum_viewer.spectrum_widget.SpectrumPlotWidget[source]#

Bases: GraphicsLayoutWidget

add_range(range_min: int | float, range_max: int | float) None[source]#
get_tof_range() tuple[float, float][source]#
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#
set_image_index_range_label(range_min: int, range_max: int) None[source]#
set_tof_axis_label(tof_axis_label: str) None[source]#
set_tof_range_label(range_min: float, range_max: float) None[source]#
spectrum: PlotItem#
class mantidimaging.gui.windows.spectrum_viewer.spectrum_widget.SpectrumProjectionWidget(main_window: MainWindowView)[source]#

Bases: GraphicsLayoutWidget

image: MIMiniImageView#
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

adjust_spec_roi(roi: SensibleROI) None[source]#
check_color_valid(get_colour: QColor) bool[source]#
property colour: tuple[int, int, int, int]#
contextMenuEnabled() bool[source]#
property name: str#
onChangeColor() None[source]#
openColorDialog(current_color: QColor) QColor[source]#
rename_roi(new_name: str) None[source]#
property roi: ROI#
property selected_row: int | None#
set_visibility(visible: bool) None[source]#

Set the visibility of the ROI and its handles.

sig_colour_change#

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.

class mantidimaging.gui.windows.spectrum_viewer.spectrum_widget.SpectrumWidget(main_window: MainWindowView)[source]#

Bases: QWidget

The widget containing the spectrum plot and the image projection.

@param parent: The parent widget

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.

adjust_roi(new_roi: SensibleROI, roi_name: str) None[source]#

Adjust the existing ROI with the given name. @param new_roi: The new SpectrumROI to replace the existing SpectrumROI @param roi_name: The name of the existing ROI.

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

Change the colour of an existing ROI

cleanup() None[source]#
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)

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.

image: MIMiniImageView#
image_widget: SpectrumProjectionWidget#
last_clicked_roi: str#
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’.

roiColorChangeRequested#

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_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_clicked#

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, 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.

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

spectrum: PlotItem#
spectrum_plot_widget: SpectrumPlotWidget#