selection

Window to pick selection type/color, load/export ROIs and clear ROIS

class pdsspect.selection.SelectionController(image_set, view)[source]

Bases: object

Controller for Selection

Parameters:
image_set

PDSSpectImageSet – pdsspect model

view

Selection – View to control

add_ROI(coordinates, color, image_set=None)[source]

Add ROI with the given coordinates and color

Parameters:
  • coordinates (numpy.ndarray or tuple) –

    Either a (m x 2) array or a tuple of two arrays

    If an array, the first column are the x coordinates and the second are the y coordinates. If a tuple of arrays, the first array are x coordinates and the second are the corresponding y coordinates.

  • color (str) – The name a color in colors
change_alpha(new_alpha)[source]

Change the alpha value to a new alpha value

Parameters:new_alpha (float) – Value between 0 and 100
change_current_color_index(index)[source]

Change the current color index to a new index

Parameters:index (int) – The new color index
change_selection_index(index)[source]

Change the selection index to a new index

Parameters:index (int) – The new selection index
clear_all()[source]

Clear all ROIs

clear_current_color()[source]

Clear all the ROIs with the currently selcted color

class pdsspect.selection.Selection(image_set, parent=None)[source]

Bases: PyQt5.QtWidgets.QWidget, pdsspect.pdsspect_image_set.PDSSpectImageSetViewBase

Window to make/clear/load/export ROIs and choose selection mode/color

Parameters:
image_set

PDSSpectImageSet – pdsspect model

parent

None – Parent of the view

controller

SelectionController – View controller

type_label

QtWidgets.QLabel – Label for the selection menu

selection_menu

QtWidgets.QComboBox – Drop down menu of selection types

type_layout

QtWidgets.QHBoxLayout – Horizontal box layout for selection

color_label

QtWidgets.QLabel – Label for the color_menu

color_menu

QtWidgets.QComboBox – Drop down menu for color selection

color_layout

QtWidgets.QHBoxLayout – Horizontal box layout for color selection

opacity_label

QtWidgets.QLabel – Label for the opacity_slider

opacity_slider

QtWidgets.QSlider – Slider to determine opacity for ROIs

opacity_layout

QtWidgets.QHBoxLayout – Horizontal box layout for opacity slider

clear_current_color_btn

QtWidgets.QPushButton – Button to clear all ROIs will the current color

clear_all_btn

QtWidgets.QPushButton – Button to clear all ROIs

export_btn

QtWidgets.QPushButton – Export ROIs to .npz file

load_btn

QtWidgets.QPushButton – Load ROIs from .npz file

simultaneous_roi_box

QtWidgets.QPushButton – When checked, new ROIs appear in every window

main_layout

QtWidgets.QVBoxLayout – Vertical Box layout for main layout

change_alpha(new_alpha)[source]

Change alpha value when opacity_slider value changes

change_color(index)[source]

Change the color when color selected in color_menu

change_selection_type(index)[source]

Change selection type when selected in selection_menu

clear_all()[source]

Clear all ROIs

clear_current_color()[source]

Clear all ROIs with current color

export(save_file)[source]

Export ROIS to the given filename

Parameters:save_file (str) – File with .npz extension to save ROIs
load_selections(selected_files)[source]

Load ROIs from selected files

Parameters:selected_files (list of str) – Paths to files storing ROIs
open_save_dialog()[source]

Open save file dialog and save rois to given filename

show_open_dialog()[source]

Open file dialog to select .npz files to load ROIs