Skip to main content

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 plane
  • method: Interpolation method ('linear' or 'nearest', default: 'linear')
  • threshold: Threshold for cropping out the 'black' parts of the plane
  • fill_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 slice
  • slice_u: U coordinates of the slice grid
  • slice_v: V coordinates of the slice grid
  • coords_3D: 3D coordinates for every point in the slice

Requirements

  • numpy
  • scipy

License

MIT License

Author

Juna Santos (junapsantos@tecnico.ulisboa.pt)

Project details


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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

obliqueslice-0.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

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

Hashes for obliqueslice-0.1.tar.gz
Algorithm Hash digest
SHA256 1610df4539886851f61fe49aae919b8370a2248396453222a1f85581d5873dfa
MD5 82e1477b976bb23d455403d6956e70d6
BLAKE2b-256 17b4940119a5a8a5e807aa20aeba8cec48dcf46508d98a670b48fa5ee741a6a0

See more details on using hashes here.

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

Hashes for obliqueslice-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5fc9d50bf058f16ef7f4c4947a234f3e5bcaaf98f51bb130e55d4dd2734ba3d1
MD5 fe05cf2a21eb4cbb9c1aeb0c0d307596
BLAKE2b-256 e0a0e51da832435a5e9eb42b976541baa49ec6913b1b8689f9176291c2b077fa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page