Search code examples
pythonimageimage-processingfile-formatnrrd

Troubleshooting Multi-Slice Volume Loading Issues in NRRD Files


What's wrong with this NRRD file? When loading a single slice, it works correctly, but when loading multiple slices to generate a volume, it fails to load. The file is:

NRRD0004
# Complete NRRD file format specification at:
# http://teem.sourceforge.net/nrrd/format.html
type: short
dimension: 3
space: left-posterior-superior
sizes: 272 272 9
space directions: (0.59, 0.0, 0.0) (0.0, 0.59, 0.0) (0.0, 0.0, 2.5)
kinds: domain domain domain
endian: little
encoding: raw
space origin: (0.0, 0.0, 0.0)
byte skip: 1609
data file:  I0023679.M01 
I0023679.M02 
I0023679.M03 
I0023679.M04 
I0023679.M05 
I0023679.M06 
I0023679.M07 
I0023679.M08 
I0023679.M09 

Solution

  • Linked spec says:

    1. data file: LIST [<subdim>]

    Textual description says LIST is to be taken literally. So you should write that literally.

    1. There are multiple detached data files, and their filenames are given explicitly, in the NRRD header, one filename per line, in the line starting after data file field specification, until the end of file. Thus, this form of the field specification must be the last specification of the header. If you have a single detached datafile whose name is unfortunate enough to be "LIST", you can still refer to it by "data file: ./LIST".

    I would suggest this:

    data file: LIST
    I0023679.M01
    I0023679.M02
    I0023679.M03
    I0023679.M04
    I0023679.M05
    I0023679.M06
    I0023679.M07
    I0023679.M08
    I0023679.M09