mantidimaging.gui.windows.spectrum_viewer.presenter module#

class mantidimaging.gui.windows.spectrum_viewer.presenter.ExportMode(value)[source]#

Bases: Enum

An enumeration.

IMAGE_MODE = 1#
ROI_MODE = 0#
class mantidimaging.gui.windows.spectrum_viewer.presenter.SpectrumViewerWindowPresenter(view: SpectrumViewerWindowView, main_window: MainWindowView)[source]#

Bases: BasePresenter

The presenter for the spectrum viewer window.

This presenter is responsible for handling user interaction with the view and updating the model and view accordingly to look after the state of the window.

add_rits_roi() None[source]#
auto_find_flat_stack(new_dataset_id: UUID) None[source]#
change_roi_colour(roi_name: str, new_colour: tuple[int, int, int]) None[source]#

Change the colour of a given ROI in both the spectrum widget and the table.

@param roi_name: Name of the ROI to change color. @param new_colour: The new color for the ROI.

change_selected_menu_option(opt: str) None[source]#
static check_action(action: QAction, param: bool) None[source]#
convert_spinbox_roi_to_SensibleROI(spinboxes: dict[str, QSpinBox]) SensibleROI[source]#
current_norm_stack_uuid: UUID | None = None#
current_stack_uuid: UUID | None = None#
do_add_roi() None[source]#

Add a new ROI to the spectrum

do_add_roi_to_table(roi_name: str) None[source]#

Add a given ROI to the table by ROI name

@param roi_name: Name of the ROI to add

do_adjust_roi() None[source]#
do_remove_roi(roi_name: str | None = None) None[source]#

Remove a given ROI from the table by ROI name or all ROIs from the table if no name is passed as an argument

@param roi_name: Name of the ROI to remove

export_mode: ExportMode#
get_dataset_id_for_stack(stack_id: UUID | None) UUID | None[source]#
get_roi_names() list[str][source]#

Return a list of ROI names

@return: list of ROI names

handle_button_enabled() None[source]#

Enable the export button if the current stack is not None and normalisation is valid

handle_enable_normalised(enabled: bool) None[source]#
handle_export_csv() None[source]#
handle_export_tab_change(index: int) None[source]#
handle_flight_path_change() None[source]#
handle_normalise_stack_change(normalise_uuid: UUID | None) None[source]#
handle_range_slide_moved(tof_range: tuple[float, float] | tuple[int, int]) None[source]#
handle_rits_export() None[source]#

Handle the export of the current spectrum to a RITS file format

handle_roi_clicked(roi: SpectrumROI) None[source]#
handle_roi_moved(force_new_spectrums: bool = False) None[source]#

Handle changes to any ROI position and size.

handle_sample_change(uuid: UUID | None) None[source]#

Called when the stack has been changed in the stack selector.

handle_stack_modified() None[source]#

Called when an image stack is modified somewhere else in MI, for example in the operations window

handle_storing_current_roi_name_on_tab_change() None[source]#
handle_time_delay_change() None[source]#
handle_tof_unit_change() None[source]#
handle_tof_unit_change_via_menu() None[source]#
model: SpectrumViewerWindowModel#
redraw_all_rois() None[source]#

Redraw all ROIs and spectrum plots

redraw_spectrum(name: str) None[source]#

Redraw the spectrum with the given name

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

Rename a given ROI from the table by ROI name

@param old_name: Name of the ROI to rename @param new_name: New name of the ROI

reset_units_menu() None[source]#
set_shuttercount_error(enabled: bool = False) None[source]#

Set ShutterCount error message when a valid normalisation stack has been selected and shuttercount correction has been toggled on and redraw all ROIs to ensure the spectrum is updated when ShutterCount correction is toggled between enabled and disabled states.

show_new_sample() None[source]#

Show the new sample in the view and update the spectrum and image view accordingly. Resets the ROIs.

spectrum_mode: SpecType = 1#
view: SpectrumViewerWindowView#