• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

SciKit-Surgery / scikit-surgeryutils / 4374254380

pending completion
4374254380

push

github-actions

Miguel Xochicale
:heavy_check_mark: 19 local unit tests in ubuntu-latest; comments tests/utils/test_image_utils.py::test_image_to_pixel_valid_rgb_example (#53)

345 of 803 relevant lines covered (42.96%)

5.16 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

72.73
/sksurgeryutils/utils/image_utils.py
1
# coding=utf-8
2

3
"""
12✔
4
Various image utilities that might be useful in this package.
5
"""
6

7
import numpy as np
12✔
8
from PySide6 import QtGui
12✔
9

10

11
def image_to_pixmap(rgb_image):
12✔
12
    """
13
    Converts an OpenCV image to a Qt pixmap.
14

15
    :param rgb_image: OpenCV image, 3 channel, RGB.
16
    :return: QPixmap
17
    """
18
    if not isinstance(rgb_image, np.ndarray):
12✔
19
        raise TypeError('Input should be a numpy nd.array')
12✔
20
    if rgb_image.shape[2] != 3:
12✔
21
        raise ValueError('Input should be 3 channel RGB')
12✔
22

23
    # If you see a memory leak.
24
    # See: https://bugreports.qt.io/browse/PYSIDE-140
25
    # Should be fixed properly in PySide 5.11.3.
26
    # As of this commit, we should be on 5.12.0.
27
    # You could double check your environment.
28
    q_image = QtGui.QImage(rgb_image.data,
×
29
                           rgb_image.shape[1],
30
                           rgb_image.shape[0],
31
                           rgb_image.shape[1] * 3,
32
                           QtGui.QImage.Format.Format_RGB888)
33

34
    pix = QtGui.QPixmap(q_image)
×
35
    return pix
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc