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.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.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file obliqueslice-0.1.1.tar.gz.

File metadata

  • Download URL: obliqueslice-0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 c94f8e6fa56bcb80f8a2a0e874cb8089e3d9811e41fa67546e73d10f077f7436
MD5 5f43db734b1fd70be361317f14f5c687
BLAKE2b-256 8fc29fae48fc29beb0bb7a4f92786d6266e794c473ce5c644c0ae008d96b531c

See more details on using hashes here.

File details

Details for the file obliqueslice-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: obliqueslice-0.1.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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 812293444f21deb4c6f5880432b7374fe33183ffef5c57cce203666d9249c175
MD5 b1ae65a8144882781d0297709d6669ce
BLAKE2b-256 b6706a912428c0a3eec860ad5cb240edc0aba2bc573c95b87cc3b66778141fa0

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