Commit ff702cd8 authored by Thomas Dowrick's avatar Thomas Dowrick
Browse files

Add button/callback to use cropping functions

parent 0b37b55e
Pipeline #1847 failed with stages
in 20 minutes and 22 seconds
......@@ -42,6 +42,7 @@ class UI(QWidget):
self.layout.addLayout(self.other_buttons)
self.add_exit_button()
self.add_record_buttons()
self.add_crop_buttons()
self.screen = None
self.screen_geometry = None
......@@ -95,6 +96,11 @@ class UI(QWidget):
self.record_buttons_layout.addWidget(self.record_button)
self.other_buttons.addLayout(self.record_buttons_layout)
def add_crop_buttons(self):
""" Add buttons to crop the video stream. """
self.crop_button = QPushButton('Crop')
self.other_buttons.addWidget(self.crop_button)
def on_exit_clicked(self):
""" Close the application when the exit button has been clicked"""
......
......@@ -5,6 +5,7 @@ from PySide2 import QtWidgets
from sksurgeryvtk.widgets.vtk_overlay_window import VTKOverlayWindow
from sksurgeryutils.common_overlay_apps import OverlayOnVideoFeed
from sksurgeryutils.utils.screen_utils import ScreenController
from sksurgeryimage.processing.crop import ImageCropper
from sksurgerydavinci.ui.gui import UI
LOGGER = logging.getLogger(__name__)
......@@ -58,6 +59,7 @@ class MonoViewer(QtWidgets.QWidget):
self.UI = UI(self.overlay_window)
self.UI.screenshot_button.clicked.connect(self.on_screenshot_clicked)
self.UI.record_button.clicked.connect(self.on_record_start_clicked)
self.UI.crop_button.clicked.connect(self.on_crop_clicked)
def add_vtk_models(self, models):
"""
......@@ -90,6 +92,14 @@ class MonoViewer(QtWidgets.QWidget):
self.UI.record_button.clicked.disconnect()
self.UI.record_button.clicked.connect(self.on_record_start_clicked)
def on_crop_clicked(self):
""" Crop the incoming video stream using ImageCropper. """
roi = ImageCropper().crop(self.overlay_window.img)
self.overlay_window.set_roi(roi)
class StereoViewerBase(QtWidgets.QWidget):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment