sksurgerydavinci.widgets.Viewers module

Mono/Stereo viewing windows for Ardavinci

class sksurgerydavinci.widgets.Viewers.FakeOverlayOnVideoFeed[source]

Bases: object

Implement empty methods to replicate OverlayOnVideoFeed.

on_record_start()[source]

Intentionally Blank.

on_record_stop()[source]

Intentionally Blank.

set_roi()[source]

Intentionally Blank.

start()[source]

Intentionally Blank.

stop()[source]

Intentionally Blank.

class sksurgerydavinci.widgets.Viewers.FakeVTKOverlayWindow[source]

Bases: object

Implement empty methods to replicate VTKOverlayWindow.

add_vtk_models(models)[source]

Intentionally Blank.

get_foreground_camera()[source]

Intentionally Blank.

save_scene_to_file(fname)[source]

Intentionally Blank.

set_foreground_camera(camera)[source]

Intentionally Blank.

set_geometry()[source]

Intentionally Blank.

set_screen()[source]

Intentionally Blank.

class sksurgerydavinci.widgets.Viewers.MockStereoViewer(video_source)[source]

Bases: sksurgerydavinci.widgets.Viewers.StereoViewerBase

Mock stereo viewer, duplicating a single camera input to multiple screens.

Parameters:video_source – OpenCV compatible video source (int or filename)
staticMetaObject = <PySide2.QtCore.QMetaObject object>
class sksurgerydavinci.widgets.Viewers.MonoViewer(video_source)[source]

Bases: sksurgerydavinci.widgets.Viewers.StereoViewerBase

Generates a VTK interactor UI with a single video stream as background. :param video_source: OpenCV compatible video source (int or filename)

Only use the left_view of StereoViewerBase. Set the other views to non-existent views.

staticMetaObject = <PySide2.QtCore.QMetaObject object>
class sksurgerydavinci.widgets.Viewers.StereoViewer(left_source, right_source)[source]

Bases: sksurgerydavinci.widgets.Viewers.StereoViewerBase

Stereo viewer, creates an overlay window for each video input.

Parameters:
  • left_source – OpenCV compatible video source (int or filename)
  • right_source – OpenCV compatible video source (int or filename)
staticMetaObject = <PySide2.QtCore.QMetaObject object>
class sksurgerydavinci.widgets.Viewers.StereoViewerBase[source]

Bases: PySide2.QtWidgets.QWidget

Base class for StereoViewers.

Child classes implment the left/right/ui video feeds as appropriate.

add_vtk_models(models)[source]

Add VTK models to all widgets.

Parameters:models (VTKSurfaceModel) – List of models to add.
are_widgets_on_different_screens(screens)[source]

Check if each widget has been placed on it’s own screen. :param screens: List of screen numbers corresponding to the screen

each widget is displayed on.
maximize_left_and_right_widgets()[source]

Fullscreen view for each widget. QWidget.setFullScreen() isn’t working properly in all cases, so resizing maunally instead.

on_autocrop_started()[source]

Start auto cropping.

on_autocrop_stopped()[source]

Stop auto cropping.

on_crop_clicked()[source]

Set the ROI on the left view, and copy it to the right.

on_record_start_clicked()[source]

Start recording a video. In the MockStereoViewer we only need to record the ‘left’ input, as the right view is a duplicate of the left. The proper StereoViewer class extends this method to also record the right view.

on_record_stop_clicked()[source]

Stop recording data to file and restore button settings.

on_screenshot_clicked()[source]

Save a screenshot to disk, using date and time as filename

run_before_quit()[source]

Clean up the VTK interactor instances before quitting

set_all_roi(roi)[source]

Set the roi for left/right views.

set_external_screens(output_screens)[source]
Set the display screens for each widget, if

external monitors are available.

Parameters:output_screens (List of ints) – List of screens on which to put widgets
set_widget_screens(screens_to_use)[source]

Move each of the widgets to a particular screen. If each widget is on it’s own screen, run fullscreen.

Parameters:screens_to_use – List of QScreen objects.
start()[source]

Start all widgets.

staticMetaObject = <PySide2.QtCore.QMetaObject object>
sufficent_displays_for_stereo_view()[source]

Check if there are enough additional displays to give each window it’s own screen.

sync_camera_view_between_windows()[source]

Set all the foreground cameras to the same vtkCamera, so that camera changes are synchronised.

update_autocrop()[source]

Automatically crop the incoming video stream using AutoCropper.