Skip to main content

rotate_volume

An efficient volume rotation algorithm based on Cupy.

GitHub repo: https://github.com/GGN-2015/rotate_volume

Installation

pip install rotate_volume

Usage

import cupy as cp
from rotate_volume import rotate_volume, create_rotation_matrix

# Create test volume data, replace the data with your own 3d cupy array
# in volume data, zero means empty, one means valid voxel
test_volume = cp.ones((20, 20, 20), dtype=cp.float32)

# make rotation matrix
rotation_x   = create_rotation_matrix('x', angle_deg=10)
rotation_y   = create_rotation_matrix('y', angle_deg=20)
rotation_z   = create_rotation_matrix('z', angle_deg=30)
rotation_all = rotation_z @ rotation_y @ rotation_x

# Rotate
rotated_cropped = rotate_volume(test_volume, rotation_all)

# Verify results
print(f"Original data shape: {test_volume.shape}")
print(f"Rotated and cropped data shape: {rotated_cropped.shape}")
print(f"Original valid data count: {cp.count_nonzero(test_volume >= 0.5)}")
print(f"Rotated and cropped valid data count: {cp.count_nonzero(rotated_cropped >= 0.5)}")

# If you want to visualize the 3d data, you can use `visualize_volume`
# Use `pip install visualize_volume` to install it before using it
from visualize_volume import visualize_volume
visualize_volume(cp.asnumpy(rotated_cropped))

Metadata

Release files for rotate-volume 0.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rotate-volume 0.0.0
File Size Uploaded
rotate_volume-0.0.0.tar.gz 4.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rotate-volume 0.0.0
File Interpreter ABI Platform
rotate_volume-0.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.4 kB

Release files / rotate_volume-0.0.0.tar.gz

Download URL rotate_volume-0.0.0.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
557b188d735fc2f1cd575095247f150d7bd3acdab74cad7df3b4b1974e1ce17b
BLAKE2b-256 checksum
How to use checksums
ad71c73b3077d8c3d9cb2ffc706728f150b3c70c6318f8c98e89e04746761b9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.10.18 Linux/6.17.7-aosc-main

Release files / rotate_volume-0.0.0-py3-none-any.whl

Download URL rotate_volume-0.0.0-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ae0b8d7f4d1be79f45d0f6bb07999d059f459fa541effa3d92ccf54cbfce464c
BLAKE2b-256 checksum
How to use checksums
d6cf2c572b7c43b5811b8bd5b43b568cb95bbb86fdab4f875a734cd3ed83fcd9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.10.18 Linux/6.17.7-aosc-main

Release history Release notifications | RSS feed

This release

0.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page