pynrrd

Build Status DOI Python version PyPi version https://codecov.io/gh/mhe/pynrrd/branch/master/graph/badge.svg

pynrrd is a pure-Python module for reading and writing NRRD files into and from numpy arrays.

Requirements

  • numpy

  • nptyping

  • 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 GitHub

pip install git+https://github.com/mhe/pynrrd.git

Quick Start

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)

Contents

Examples