A package for slicing 3D numpy arrays along an oblique plane. Equivalent to obliqueslice in MATLAB.
Project description
obliqueslice
A Python package for slicing 3D numpy arrays along an oblique plane. Equivalent to obliqueslice in MATLAB.
Installation
pip install obliqueslice
Usage
import numpy as np
from obliqueslice import obliqueslice
# Create a 3D volume
volume = np.random.rand(100, 100, 100)
# Define a point and normal vector for the slice
point = [50, 50, 50] # Point on the plane (x, y, z)
normal = [1, 1, 1] # Normal vector to the plane
# Extract the oblique slice
slice_img, slice_u, slice_v, coords_3D = obliqueslice(volume, point, normal)
Parameters
V: 3D numpy array with shape (rows, cols, depths) indexed as (y, x, z)point: Point on the plane in world coordinates (x, y, z)normal: Normal vector to the planemethod: Interpolation method ('linear' or 'nearest', default: 'linear')threshold: Threshold for cropping out the 'black' parts of the planefill_value: Value to use for points outside the volume (default: 0)interp_order: Interpolation order (default: None, auto-determined from method)
Returns
slice_img: The extracted 2D sliceslice_u: U coordinates of the slice gridslice_v: V coordinates of the slice gridcoords_3D: 3D coordinates for every point in the slice
Requirements
- numpy
- scipy
License
MIT License
Author
Juna Santos (junapsantos@tecnico.ulisboa.pt)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
obliqueslice-0.1.tar.gz
(3.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file obliqueslice-0.1.tar.gz.
File metadata
- Download URL: obliqueslice-0.1.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1610df4539886851f61fe49aae919b8370a2248396453222a1f85581d5873dfa
|
|
| MD5 |
82e1477b976bb23d455403d6956e70d6
|
|
| BLAKE2b-256 |
17b4940119a5a8a5e807aa20aeba8cec48dcf46508d98a670b48fa5ee741a6a0
|
File details
Details for the file obliqueslice-0.1-py3-none-any.whl.
File metadata
- Download URL: obliqueslice-0.1-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fc9d50bf058f16ef7f4c4947a234f3e5bcaaf98f51bb130e55d4dd2734ba3d1
|
|
| MD5 |
fe05cf2a21eb4cbb9c1aeb0c0d307596
|
|
| BLAKE2b-256 |
e0a0e51da832435a5e9eb42b976541baa49ec6913b1b8689f9176291c2b077fa
|