pygrife.GUI package#
Module containing a GUI to aid in segmentation map modification.
pygrife.GUI.GUI_main module#
- class pygrife.GUI.GUI_main.ExtractorGUI(field_root='nis-wfss', detection_filter='ir', filters=['F115W', 'F150W', 'F200W'], new_dir_name='ForcedExtractions', new_dir_path=None, **kwargs)#
Bases:
SegMapViewer- open_files_window(event=None)#
- open_terminal_window(event=None)#
- save_output(event=None)#
- receiver_fn(queue, progress_callback=None)#
- extraction_handler(event=None)#
- finish_extractions()#
- extract_object(event=None, progress_callback=None)#
- class pygrife.GUI.GUI_main.GrizliFilesWindow(root)#
Bases:
FilesWindow- select_from_directory(event=None)#
- pygrife.GUI.GUI_main.run_GUI(name='extractor', **kwargs)#
pygrife.GUI.qt_utils module#
QtImageViewer.py: PyQt image viewer widget based on QGraphicsView with mouse zooming/panning and ROIs. Original version by Marcel Goldschen-Ohm, modified by PJW (scroll direction, zoom location, etc). Also includes worker and signals to allow multithreading.
- class pygrife.GUI.qt_utils.QtImageViewer#
Bases:
QGraphicsViewA PyQt image viewer widget based on QGraphicsView.
This widget includes mouse zooming/panning and ROIs.
- sizeHint()#
Returns a hint for the size of the current scene.
- Returns:
PyQt6.QtCore.QSizeA suggested size.
- hasImage()#
Check if the scene contains an image pixmap.
- Returns:
- bool
Trueif the scene contains an image.
- clearImage()#
Removes the current image pixmap from the scene if it exists.
- pixmap()#
Returns the scene’s current image pixmap.
- Returns:
PyQt6.QtGui.QPixmaporNoneThe current scene image, if it exists.
- image()#
Returns the scene’s current image as a QImage.
- Returns:
PyQt6.QtGui.QImageorNoneThe current scene image, if it exists.
- setImage(image)#
Set the scene’s current image pixmap to the input.
- Parameters:
- imagePyQt.QtGui.QImage or PyQt.QtGui.QPixmap
The input image.
- Raises:
RuntimeErrorRaised if the input image has type other than
PyQt6.QtGui.QImageorPyQt6.QtGui.QPixmap.
- open(filepath=None)#
Load an image from file.
- Parameters:
- filepath
stroros.PathLike, optional The filepath of the image to load. If no image is supplied, a file dialogue will be opened to choose the image file.
- filepath
- updateViewer()#
Show the current zoom.
If the entire image is visible, apply current aspect ratio mode.
- clearZoom()#
Clear the zoom status of the scene.
- resizeEvent(event)#
Maintain the current zoom on resize.
- mousePressEvent(event)#
Start either the mouse pan or zoom mode.
- Parameters:
- event
PyQt6.QtGui.QMouseEvent The event that triggered this, i.e. a mouse press.
- event
- mouseReleaseEvent(event)#
Stop mouse pan or zoom mode, and apply zoom if valid.
- Parameters:
- event
PyQt6.QtGui.QMouseEvent The event that triggered this, i.e. a mouse release.
- event
- mouseDoubleClickEvent(event)#
Reset the zoom to show the entire image.
- Parameters:
- event
PyQt6.QtGui.QMouseEvent The event that triggered this, i.e. a double click.
- event
- wheelEvent(event)#
Handle all mouse wheel scroll events.
If the shift key is pressed, zoom into/out of the image; else scroll around the image in the current zoom state.
- Parameters:
- event
PyQt6.QtGui.QWheelEvent The event that triggered this, i.e. a mouse wheel scroll.
- event
- mouseMoveEvent(event)#
Handle all mouse movement in the scene.
Emit the mouse position, and change the view if panning.
- Parameters:
- event
PyQt6.QtGui.QMouseEvent The mouse move event.
- event
- enterEvent(event)#
Change the cursor shape when the mouse enters the scene.
- Parameters:
- event
PyQt6.QtGui.QEnterEvent The triggering event.
- event
- leaveEvent(event)#
Change the cursor shape when the mouse leaves the scene.
- Parameters:
- event
PyQt6.QtCore.QEvent The triggering event.
- event
- addROIs(rois)#
Add ROIs to the scene.
- Parameters:
- roisPyQt6.QtWidgets.QtGraphicsItem
The regions of interest to add to the scene.
- deleteROIs(rois)#
Remove ROIs from the scene.
- Parameters:
- roisPyQt6.QtWidgets.QtGraphicsItem
The regions of interest to remove from the scene.
- clearROIs()#
Remove all ROIs from the scene.
- roiClicked(roi)#
Emit a signal when a ROI is clicked.
- Parameters:
- roiPyQt6.QtWidgets.QtGraphicsItem
The selected ROI.
- class pygrife.GUI.qt_utils.EllipseROI(viewer)#
Bases:
QGraphicsEllipseItem
- class pygrife.GUI.qt_utils.RectROI(viewer)#
Bases:
QGraphicsRectItem
- class pygrife.GUI.qt_utils.LineROI(viewer)#
Bases:
QGraphicsLineItem
- class pygrife.GUI.qt_utils.PolygonROI(viewer)#
Bases:
QGraphicsPolygonItem
- class pygrife.GUI.qt_utils.WorkerSignals#
Bases:
QObjectDefines the signals available from a running worker thread.
Supported signals are:
- finished
No data
- error
tuple (exctype, value, traceback.format_exc() )
- result
object data returned from processing, anything
- progress
int indicating % progress
- class pygrife.GUI.qt_utils.Worker(fn, *args, **kwargs)#
Bases:
QRunnableWorker thread
Inherits from QRunnable to handler worker thread setup, signals and wrap-up.
- Parameters:
callback (function) – The function callback to run on this worker thread. Supplied args and kwargs will be passed through to the runner.
args – Arguments to pass to the callback function
kwargs – Keywords to pass to the callback function
- run()#
Initialise the runner function with passed args, kwargs.
- class pygrife.GUI.qt_utils.TerminalWindow(root)#
Bases:
QWidget
pygrife.GUI.seg_map_viewer module#
- class pygrife.GUI.seg_map_viewer.SegMapViewer(field_root='nis-wfss', detection_filter='ir', filters=['F115W', 'F150W', 'F200W'], **kwargs)#
Bases:
QMainWindowA Qt-based viewer for segmentation maps.
This composites together an RGB image from three separate images, and overlays a segmentation map on top, which can be modified through the supplied tools.
- Parameters:
- QMainWindow
_type_ _description_
- QMainWindow
- open_files_window(event=None)#
- click_location(modifiers, x, y)#
- highlight_section(seg_id)#
- seg_text_update(pos)#
- interval_update(value)#
- stretch_update(value)#
- opacity_update(event=None)#
- reload_image()#
- loader_fn(**kwargs)#
- update_progress(value, text)#
- test_path(key, value, is_dir=False)#
- load_from_dir()#
- load_image(progress_callback=None, **kwargs)#
- set_img(img)#
- calc_interval_limits(percentiles)#
- choose_background_colour(event=None)#
- combine_ids(event=None)#
- save_output(event=None)#
- class pygrife.GUI.seg_map_viewer.Separator#
Bases:
QFrame
- class pygrife.GUI.seg_map_viewer.LineBrowse(parent, is_dir=False, root_name='')#
Bases:
QWidget- 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.
- browse_filesystem(QMouseEvent)#