Common Overlay Apps [Temp Change]

Common use cases for vtk_overlay_window

class sksurgeryutils.common_overlay_apps.DuplicateOverlayWindow[source]

Bases: sksurgeryutils.common_overlay_apps.OverlayOnVideoFeedCropRecord

Set the background of vtk_overlay_window to duplicate that of another vtk_overlay_window.

Example usage: video_source = 0 source_window = OverlayOnVideoFeedCropRecord(video_source)

duplicate_window = DuplicateOverlayWindow() duplicate_window.set_source_window(source_window)

on_record_start()[source]

Don’t want to call the base class version, so override.

on_record_stop()[source]

Don’t want to call the base class version, so override.

set_roi()[source]

Don’t want to call the base class version, so override.

set_source_window(source_window)[source]

Set the source window. :param source_window: The window that contains the image to copy.

update()[source]

Update the frame with a new background image.

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

Bases: object

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)
add_vtk_models_from_dir(directory)[source]

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

start()[source]

Show the overlay widget and set a timer running

stop()[source]

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

update()[source]

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

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

Bases: sksurgeryutils.common_overlay_apps.OverlayBaseApp

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

update()[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: sksurgeryutils.common_overlay_apps.OverlayBaseApp

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.

update()[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