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
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
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3887b52bd79c1ca5b9a67ef307c837220cc1d03dc4863fc6ab0623d4127bb535
|
|
| MD5 |
4fafad5faf7a025abc0ef9445ee0e540
|
|
| BLAKE2b-256 |
298e72f1dac138ddd2a57a632ca3ede89d2954de4dfd36386078b30dab18660b
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
54a28250401aa2defa6e27f402fd5f6196e35d04a1d5b26c9bb07aeb204c9060
|
|
| MD5 |
8325a93134b8fb2b564e6f7ebaf27a57
|
|
| BLAKE2b-256 |
af7258869c891a868414439fd1150edb5a5440b1aea72e864ec5e99250c3c569
|