Skip to main content

Read the NIfTI file and resample it into a 3D NumPy array.

Project description

read_nii_to_numpy

Read the NIfTI file and resample it into a 3D NumPy array.

Installation

pip install read_nii_to_numpy

Usage

from read_nii_to_numpy import nii_file_original_zoom, nii_file_to_numpy

# Get original zoom
#   the output (x_len, y_len, z_len) means:
#     1 voxel in x direction corresponds to x_len (mm)
#     1 voxel in y direction corresponds to y_len (mm)
#     1 voxel in z direction corresponds to z_len (mm)
print(nii_file_original_zoom("CT.nii"))

# Get original data matrix
odm = nii_file_to_numpy("CT.nii")
print(odm.shape)

# Get reshaped data matrix
rdm = nii_file_to_numpy("CT.nii", 1.0, 1.0, 1.0)
print(rdm.shape)

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

read_nii_to_numpy-0.1.0.tar.gz (2.1 kB view details)

Uploaded Source

Built Distribution

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

read_nii_to_numpy-0.1.0-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file read_nii_to_numpy-0.1.0.tar.gz.

File metadata

  • Download URL: read_nii_to_numpy-0.1.0.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.4 CPython/3.10.20 Windows/10

File hashes

Hashes for read_nii_to_numpy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3887b52bd79c1ca5b9a67ef307c837220cc1d03dc4863fc6ab0623d4127bb535
MD5 4fafad5faf7a025abc0ef9445ee0e540
BLAKE2b-256 298e72f1dac138ddd2a57a632ca3ede89d2954de4dfd36386078b30dab18660b

See more details on using hashes here.

File details

Details for the file read_nii_to_numpy-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: read_nii_to_numpy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.4 CPython/3.10.20 Windows/10

File hashes

Hashes for read_nii_to_numpy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 54a28250401aa2defa6e27f402fd5f6196e35d04a1d5b26c9bb07aeb204c9060
MD5 8325a93134b8fb2b564e6f7ebaf27a57
BLAKE2b-256 af7258869c891a868414439fd1150edb5a5440b1aea72e864ec5e99250c3c569

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