medscope
Medical Intraoperative Real-time Visualization System.
Demo
Installation
pip install medscope
Usage
from medscope import MedScopeWindow, MedScopeSystem
import numpy as np
import sys
# Generate a random 3x3 rotation matrix uniformly distributed over SO(3).
def random_rotation_matrix() -> np.ndarray:
phi = np.random.uniform(0, 2 * np.pi)
theta = np.random.uniform(0, np.pi)
psi = np.random.uniform(0, 2 * np.pi)
cos_phi, sin_phi = np.cos(phi), np.sin(phi)
cos_theta, sin_theta = np.cos(theta), np.sin(theta)
cos_psi, sin_psi = np.cos(psi), np.sin(psi)
R = np.array([
[cos_phi*cos_theta*cos_psi - sin_phi*sin_psi,
-cos_phi*cos_theta*sin_psi - sin_phi*cos_psi,
cos_phi*sin_theta],
[sin_phi*cos_theta*cos_psi + cos_phi*sin_psi,
-sin_phi*cos_theta*sin_psi + cos_phi*cos_psi,
sin_phi*sin_theta],
[-sin_theta*cos_psi,
sin_theta*sin_psi,
cos_theta]
])
return R
# Initialize app and window
app = MedScopeSystem(sys.argv)
window = MedScopeWindow()
# Add a 3D model
window.add_model_from_file(
"bone_model",
"BONE-1.real.stl",
(1.0, 1.0, 1.0)) # white, random if not given
# Set model color
window.set_model_color("bone_model", (1.0, 0.0, 0.0))
# Check intersection (True)
print(window.check_model_intersect("bone_model", "bone_model"))
# Set the pose of camera
# you can change camera pos in callback function with add_timer
window.set_camera_pose(
(0, 0, -500),
(0, 0, 0),
(0, 1, 0)
)
# Volume data should be given in 3D np.ndarray
# and dtype should be np.uint8
# RGB channel image 3 * N * M * L
# window.set_volume(np.random.randint(0, 255, (3, 256, 256, 256)).astype(np.uint8))
# use N * M * L to achieve grey image
window.set_volume(np.random.randint(0, 255, (256, 256, 256)).astype(np.uint8))
# calculate every 1.0s
import time
lp = time.time()
pp = 1.0
# Create a callback function to move your model
def move_model():
import random
global lp
if time.time() - lp >= pp:
lp = time.time()
x = random.random() * 256
y = random.random() * 256
z = random.random() * 256
window.set_slice_positions(x, y, z)
window.set_model_pose(
"bone_model",
(x - 128, y - 128, z - 128),
random_rotation_matrix()
)
# Call move_model every 1ms (as quickly as the processor can)
window.add_timer("move_model", 1, move_model)
sys.exit(app.exec_())
Metadata
Release files for medscope 0.1.25
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| medscope-0.1.25.tar.gz | 9.2 kB | Without provenance | Details for medscope-0.1.25.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| medscope-0.1.25-py3-none-any.whl | Python 3 | none | any | Details for medscope-0.1.25-py3-none-any.whl |
Total release size: 19.4 kB
Release files / medscope-0.1.25.tar.gz
| Download URL | medscope-0.1.25.tar.gz |
|---|---|
| Size | 9.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2577bdf2f2c96c3bd0927c5c5b36b72c02459b4f4ce11aaca917089746d329b6
|
|
BLAKE2b-256 checksum How to use checksums |
0b9be065c629e3204d58ff2944253db91e07744db662498cac40d192f3bf0772
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.13.12 Windows/11
|
Release files / medscope-0.1.25-py3-none-any.whl
| Download URL | medscope-0.1.25-py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
78116837f69502b7d1f5901bb253585bafe1b1612abbcf3742e5ab8dd39cceb7
|
|
BLAKE2b-256 checksum How to use checksums |
b92b9e178fded5a8a793bccfe98f6eb68e330a26ce3a13b40dc0ba1f8bd34a10
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.13.12 Windows/11
|
Security for medscope 0.1.25
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.