Common Overlay Apps [Temp Change]

Common use cases for vtk_overlay_window

class sksurgeryutils.common_overlay_apps.OverlayBaseWidget(video_source, dims=None, init_vtk_widget=True)[source]

Bases: QWidget

Base class for applications that use vtk_overlay_window. The update() method should be implemented in the child class.

Parameters:
  • video_source – OpenCV compatible video source (int or filename)

  • dims – size of video feed

add_vtk_models_from_dir(directory)[source]

Add VTK models to the foreground. :param: directory, location of models

start()[source]

Starts the timer, which repeatedly triggers the update_view() method.

staticMetaObject = PySide6.QtCore.QMetaObject("OverlayBaseWidget" inherits "QWidget": )
stop()[source]

Stops the timer.

terminate()[source]

Make sure that the VTK Interactor terminates nicely, otherwise it can throw some error messages, depending on the usage.

update_view()[source]

Update the scene background and/or foreground. Should be implemented by sub class

class sksurgeryutils.common_overlay_apps.OverlayOnVideoFeed(video_source, dims=None, init_vtk_widget=True)[source]

Bases: OverlayBaseWidget

Uses the acquired video feed as the background image, with no additional processing.

staticMetaObject = PySide6.QtCore.QMetaObject("OverlayOnVideoFeed" inherits "OverlayBaseWidget": )
update_view()[source]

Get the next frame of input and display it.

class sksurgeryutils.common_overlay_apps.OverlayOnVideoFeedCropRecord(video_source, output_filename=None, dims=None)[source]

Bases: OverlayBaseWidget

Add cropping of the incoming video feed, and the ability to

record the vtk_overlay_window.

Parameters:
  • video_source – OpenCV compatible video source (int or filename)

  • output_filename – Location of output video file when recording. If none specified, the current date/time is used as the filename.

get_output_frame()[source]

Get the output frame to write in numpy format.

on_record_start()[source]

Start recording data on each frame update. It is expected that this will be triggered using a Qt signal e.g. from a button click. (see sksurgerydavinci.ui.Viewers for examples)

on_record_stop()[source]

Stop recording data.

set_roi()[source]

Crop the incoming video stream using ImageCropper. Function is depreciated due to moving to opencv-headless in sksurgeryvtk. I’ve left it in for the minute in case any one is using it without my knowlegde

staticMetaObject = PySide6.QtCore.QMetaObject("OverlayOnVideoFeedCropRecord" inherits "OverlayBaseWidget": )
update_view()[source]

Get the next frame of input, crop and/or write to file (if either enabled).

Misc Utilities

Various image utilities that might be useful in this package.

sksurgeryutils.utils.image_utils.image_to_pixmap(rgb_image)[source]

Converts an OpenCV image to a Qt pixmap.

Parameters:

rgb_image – OpenCV image, 3 channel, RGB.

Returns:

QPixmap

Any useful utilities relating to displays/screens.

class sksurgeryutils.utils.screen_utils.ScreenController[source]

Bases: object

This class detects the connected screens/monitors, and returns the primary screen and a list of any secondary screens.

list_of_screens()[source]

Return the primary screen and list of other available screens