Saturday, January 31, 2015

Using pynrrd to read nrrd files into Python

Another in the series of posts about file types! This time, a quick note about importing .nrrd image stacks into Python. Download and unzip pynrrd from here. In a terminal, cd into the directory, and run

python install

In Python the usage is very straightforward:

import nrrd
frames, options =


lana frankle said...

I'm getting the following error:

TypeError: coercing to Unicode: need string or buffer, module found

Can you help me? I entered:

frames, options =

Peter Weir said...

Hi Lana,

In order to read a file named 'filename.nrrd' you need to navigate to the directory the file is in, then enter:

import nrrd
frames, options ='filename.nrrd')

Note that in your case you gave the same variable name, nrrd, to both the module you imported and the file name you are trying to open.

DevRabbit IT Solutions Inc. said...

The Article on Using pynrrd to read nrrd files into Python is nice.It give detail information about Phython,Thanks for Sharing for Sharing the information about it. data science consulting