snappysonic.overlay_widget.overlay module

Main loop for tracking visualisation

class snappysonic.overlay_widget.overlay.OverlayApp(config)[source]

Bases: sksurgeryutils.common_overlay_apps.OverlayBaseWidget

Inherits from OverlayBaseWidget, adding code to read in video buffers, and display a frame of data that depends on the position of an external tracking system, e.g. surgeryarucotracker

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

Update the background renderer with a new frame, move the model and render

snappysonic.overlay_widget.overlay.circle(img, center, radius, color[, thickness[, lineType[, shift]]]) → img

. @brief Draws a circle. . . The function cv::circle draws a simple or filled circle with a given center and radius. . @param img Image where the circle is drawn. . @param center Center of the circle. . @param radius Radius of the circle. . @param color Circle color. . @param thickness Thickness of the circle outline, if positive. Negative values, like #FILLED, . mean that a filled circle is to be drawn. . @param lineType Type of the circle boundary. See #LineTypes . @param shift Number of fractional bits in the coordinates of the center and in the radius value.

snappysonic.overlay_widget.overlay.imread(filename[, flags]) → retval

. @brief Loads an image from a file. . . @anchor imread . . The function imread loads an image from the specified file and returns it. If the image cannot be . read (because of missing file, improper permissions, unsupported or invalid format), the function . returns an empty matrix ( Mat::data==NULL ). . . Currently, the following file formats are supported: . . - Windows bitmaps - *.bmp, *.dib (always supported) . - JPEG files - *.jpeg, *.jpg, *.jpe (see the Note section) . - JPEG 2000 files - *.jp2 (see the Note section) . - Portable Network Graphics - *.png (see the Note section) . - WebP - *.webp (see the Note section) . - Portable image format - *.pbm, *.pgm, *.ppm *.pxm, *.pnm (always supported) . - PFM files - *.pfm (see the Note section) . - Sun rasters - *.sr, *.ras (always supported) . - TIFF files - *.tiff, *.tif (see the Note section) . - OpenEXR Image files - *.exr (see the Note section) . - Radiance HDR - *.hdr, *.pic (always supported) . - Raster and Vector geospatial data supported by GDAL (see the Note section) . . @note . - The function determines the type of an image by the content, not by the file extension. . - In the case of color images, the decoded images will have the channels stored in B G R order. . - When using IMREAD_GRAYSCALE, the codec’s internal grayscale conversion will be used, if available. . Results may differ to the output of cvtColor() . - On Microsoft Windows* OS and MacOSX*, the codecs shipped with an OpenCV image (libjpeg, . libpng, libtiff, and libjasper) are used by default. So, OpenCV can always read JPEGs, PNGs, . and TIFFs. On MacOSX, there is also an option to use native MacOSX image readers. But beware . that currently these native image loaders give images with different pixel values because of . the color management embedded into MacOSX. . - On Linux*, BSD flavors and other Unix-like open-source operating systems, OpenCV looks for . codecs supplied with an OS image. Install the relevant packages (do not forget the development . files, for example, “libjpeg-dev”, in Debian* and Ubuntu*) to get the codec support or turn . on the OPENCV_BUILD_3RDPARTY_LIBS flag in CMake. . - In the case you set WITH_GDAL flag to true in CMake and @ref IMREAD_LOAD_GDAL to load the image, . then the [GDAL](http://www.gdal.org) driver will be used in order to decode the image, supporting . the following formats: [Raster](http://www.gdal.org/formats_list.html), . [Vector](http://www.gdal.org/ogr_formats.html). . - If EXIF information is embedded in the image file, the EXIF orientation will be taken into account . and thus the image will be rotated accordingly except if the flags @ref IMREAD_IGNORE_ORIENTATION . or @ref IMREAD_UNCHANGED are passed. . - Use the IMREAD_UNCHANGED flag to keep the floating point values from PFM image. . - By default number of pixels must be less than 2^30. Limit can be set using system . variable OPENCV_IO_MAX_IMAGE_PIXELS . . @param filename Name of file to be loaded. . @param flags Flag that can take values of cv::ImreadModes

snappysonic.overlay_widget.overlay.putText(img, text, org, fontFace, fontScale, color[, thickness[, lineType[, bottomLeftOrigin]]]) → img

. @brief Draws a text string. . . The function cv::putText renders the specified text string in the image. Symbols that cannot be rendered . using the specified font are replaced by question marks. See #getTextSize for a text rendering code . example. . . @param img Image. . @param text Text string to be drawn. . @param org Bottom-left corner of the text string in the image. . @param fontFace Font type, see #HersheyFonts. . @param fontScale Font scale factor that is multiplied by the font-specific base size. . @param color Text color. . @param thickness Thickness of the lines used to draw a text. . @param lineType Line type. See #LineTypes . @param bottomLeftOrigin When true, the image data origin is at the bottom-left corner. Otherwise, . it is at the top-left corner.

snappysonic.overlay_widget.overlay.rectangle(img, pt1, pt2, color[, thickness[, lineType[, shift]]]) → img

. @brief Draws a simple, thick, or filled up-right rectangle. . . The function cv::rectangle draws a rectangle outline or a filled rectangle whose two opposite corners . are pt1 and pt2. . . @param img Image. . @param pt1 Vertex of the rectangle. . @param pt2 Vertex of the rectangle opposite to pt1 . . @param color Rectangle color or brightness (grayscale image). . @param thickness Thickness of lines that make up the rectangle. Negative values, like #FILLED, . mean that the function has to draw a filled rectangle. . @param lineType Type of the line. See #LineTypes . @param shift Number of fractional bits in the point coordinates.

rectangle(img, rec, color[, thickness[, lineType[, shift]]]) -> img . @overload . . use rec parameter as alternative specification of the drawn rectangle: r.tl() and . r.br()-Point(1,1) are opposite corners