Pure python module for reading and writing NRRD files.
Project description
pynrrd
pynrrd is a pure-Python module for reading and writing NRRD files into and from numpy arrays.
Requirements
typing_extensions
v1.0+ requires Python 3.7 or above. If you have an older Python version, please install a v0.x release instead.
Installation
Install via pip and PyPi repository (recommended)
pip install pynrrd
Install via pip and GitHub
pip install git+https://github.com/mhe/pynrrd.git
Install from source (recommended for contributing to pynrrd)
For developers that want to contribute to pynrrd, you can clone the pynrrd repository and install it using the following commands:
git clone https://github.com/mhe/pynrrd.git
cd pynrrd
pip install .
or, for the last line, instead use:
pip install -e .
to install in ‘develop’ or ‘editable’ mode, where changes can be made to the local working code and Python will use the updated pynrrd code.
Tests
The tests can be run via the following command from the base directory:
python -m unittest discover -v nrrd/tests
Format and Lint code
This repository uses pre-commit hooks to run format and lint the code and they are enforced in CI. See [pre-commit](https://pre-commit.com)
Example usage
import numpy as np
import nrrd
# Some sample numpy data
data = np.zeros((5,4,3,2))
filename = 'testdata.nrrd'
# Write to a NRRD file
nrrd.write(filename, data)
# Read the data back from file
readdata, header = nrrd.read(filename)
print(readdata.shape)
print(header)
Next Steps
For more information, see the documentation.
License
See the LICENSE for more information.
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
File details
Details for the file pynrrd-1.1.1.tar.gz
.
File metadata
- Download URL: pynrrd-1.1.1.tar.gz
- Upload date:
- Size: 21.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dafd98d778263b1c90eac1d42779886153daa97a4577dea9590f74dab18b4ca2 |
|
MD5 | d67e3682c703397e34056bfd9e883db8 |
|
BLAKE2b-256 | 5b20b4e76ebc1fe2e0652f1cce8f3fa2e8887c0d57c55229ea93ebf555ae5108 |
File details
Details for the file pynrrd-1.1.1-py3-none-any.whl
.
File metadata
- Download URL: pynrrd-1.1.1-py3-none-any.whl
- Upload date:
- Size: 23.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e65ae7ac53583ad5d71a03845c9247ff2238415b91980f1fd9486d4ec3d62c43 |
|
MD5 | c501be80f65c44f48d76979d14ea4006 |
|
BLAKE2b-256 | 7bfe532e4899c5a19d51e4aae7fe2e8689380a27b8fb3b53560541f84c283445 |