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.
Dependencies
The module’s only dependency is numpy.
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
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
Hashes for pynrrd-0.4.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27ef001f959470aa935d0af03d5243587d17d9cc648a1c83a88218471b018e40 |
|
MD5 | 808c74b5bd02aa7453e7df612dec0237 |
|
BLAKE2b-256 | 8377afb60173b5247431cd93ef226ab0568c4ef6771c7e4db733d03cb0485e9e |