Troubleshooting Image Corruption in NRRD Files When Concatenating Multiple Raw Files into a Single Volume

I am using NDDR files to load a volume, each file references a consecutively numbered raw file type from 1 to 10; my idea to avoid having to create ten NDDR files is to concatenate all the files into a single one named data.raw and read it with a single NDDR file. I believe this is possible, but when I try it, the image gets corrupted.
The content of each file is as follows:
NRRD0004

Complete NRRD file format specification at:

Teem: nrrd: Definition of NRRD File Format

type: short
dimension: 3
space: left-posterior-superior
sizes: 271 271 1
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: I0024241.M0X

where .M0X ranges from .M01 to .M10

and what I want to implement with the single file is:
NRRD0004

Complete NRRD file format specification at:

Teem: nrrd: Definition of NRRD File Format

type: short
dimension: 3
space: left-posterior-superior
sizes: 271 271 10
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: data.raw

data.raw contains the concatenated files I0024241.M01 to I0024241.M10

Thank you in advance for any help you can provide.

There’s a lot of useful debugging advice here:

https://teem.sourceforge.net/nrrd/format.html

Thank you, pieper, I have based my work on that documentation to generate the NRRD file. I believe my problem lies in how to merge the image files into a single one. Should I only keep the portion corresponding to the image data, or can the complete files be concatenated with their headers? That is, is the “byte skip” command used on each of the slices stored in the file, or only at the beginning of its reading?

As I recall byte skip only refers to the start of a single file and I don’t think there’s a way to skip the headers of each of the files in a data file list, but I could be wrong about that. As I recall there’s also an option to give a -1 for byte skip so that it figures out from the file size and expected image size how big the header is. If you want to merge all the files into a single raw file you almost certainly need to concatenate only the image parts (uncompressed). Also if you are working with named files be sure to check the option of giving a printf-style string to create the filenames from the number pattern.

I pointed to the nrrd documentation also so you would have a look at unu and the rest of the nrrd utility set. There are lots of ways to create and manipulate nrrd files and with some experiments you can pretty much do anything.