Group Abstract

Message Boards

Does Mathematica support Nearly Raw Raster Data NRRD file fomat?

I am willing to use M's image processing APIs on some MRI scans from http://insight-journal.org/midas/collection/view/171 which makes available information in NRRD file format. But I don't see this extension in file formats supported by Mathematica. Is it possible to convert nrrd to some format that Mathematica can work with ?

I see your scans from Insight are 2-byte signed integer voxels encoded (within the NRRD file) with GZIP. I'm guessing you just want to get to the raster datacube, and don't care about all the interpolation and sampling management stuff that the NRRD Library provides (http://teem.sourceforge.net/nrrd/).

One possible option, that I didn't try because I don't feel like building the "unu" command line utility (http://teem.sourceforge.net/unrrdu/index.html) from source code, is to use unu to convert your NRRD files to VTK format (http://teem.sourceforge.net/nrrd/otherformat.html) which Mathematica does import (see Help on Import). But "unu" conversion support is incomplete, and I don't know how completely M supports VTK.

The other is to take an NRRD file from Insight, then use a hex editor to chop out its header, (chop right before the "1f 8b" gzip hex lead-in) then save-as .gzip. Then use 7-Zip to extract the .gzip file into a binary file. From here, I can read and display in M, as so:

Since Mathematica itself can decode GZIP, the entire process should be able to be able to be automated within M, i.e. no need to externally use a hex editor and GZIP. If you can't take it from here, let me know, and if I'm not too busy, I'll finish a set of Mathematica commands to automate everything (that is, ignoring generality; only specifically handling these 5 files).

@Frank Iannarilli : I am very thankful to you for this suggestion as it worked for me. I was able to generate slices though initially I faced problem because I had to rename my extracted file as *.nrrd and than only M was able to get it.Your offer to spend time on helping me automate was very kind.