1 : |
jhr |
5597 |
The ASCII lines in the header end with '\n'.
|
2 : |
|
|
|
3 : |
|
|
First line should be the magic:
|
4 : |
|
|
NRRD0004
|
5 : |
|
|
|
6 : |
|
|
Rest of header will be a sequence of plain text lines, terminated by
|
7 : |
|
|
an empty line ('\n' alone). Some header lines give per-array
|
8 : |
|
|
information, some give per-axis information.
|
9 : |
|
|
|
10 : |
|
|
Note that the distinction between scalar and non-scalar images is
|
11 : |
|
|
given by the per-axis "kinds" field, so that is where further
|
12 : |
|
|
information is given about the constraints associated iwth non-scalar
|
13 : |
|
|
image data.
|
14 : |
|
|
|
15 : |
|
|
============================================================
|
16 : |
|
|
The basic fields that should be there are:
|
17 : |
|
|
|
18 : |
|
|
----------------
|
19 : |
|
|
type: <string>
|
20 : |
|
|
|
21 : |
|
|
Gives the type of the scalar values in the array. Current values are:
|
22 : |
|
|
signed char
|
23 : |
|
|
unsigned char
|
24 : |
|
|
short
|
25 : |
|
|
unsigned short
|
26 : |
|
|
int
|
27 : |
|
|
unsigned int
|
28 : |
|
|
long long int
|
29 : |
|
|
unsigned long long int
|
30 : |
|
|
float
|
31 : |
|
|
double
|
32 : |
|
|
|
33 : |
|
|
----------------
|
34 : |
|
|
dimension: <int>
|
35 : |
|
|
|
36 : |
|
|
Gives the dimension of the array. Must be greater than 0. Current
|
37 : |
|
|
code has a #define that limits the value to <= 16. The per-axis fields
|
38 : |
|
|
will have this many pieces of information.
|
39 : |
|
|
|
40 : |
|
|
----------------
|
41 : |
|
|
encoding: <string>
|
42 : |
|
|
|
43 : |
|
|
How scalar values are encoded on disk. Currently, should only see
|
44 : |
|
|
"encoding: raw".
|
45 : |
|
|
|
46 : |
|
|
----------------
|
47 : |
|
|
endian: <string>
|
48 : |
|
|
|
49 : |
|
|
Endian-ness of raw values saved on disk. Possibilities are:
|
50 : |
|
|
little
|
51 : |
|
|
big
|
52 : |
|
|
|
53 : |
|
|
----------------
|
54 : |
|
|
space dimension: <int>
|
55 : |
|
|
|
56 : |
|
|
Gives the dimension of the world-space in which the array or oriented
|
57 : |
|
|
(For now we're not allowing the named spaces that are given with the
|
58 : |
|
|
"space: " field). The points and vectors given by "space origin"
|
59 : |
|
|
and "space directions" will have this many coefficients, so this
|
60 : |
|
|
field has to precede "space origin" and "space directions".
|
61 : |
|
|
|
62 : |
|
|
----------------
|
63 : |
|
|
space origin: (<float1>,<float2>,...,<floatN>)
|
64 : |
|
|
|
65 : |
|
|
Gives the location of the center of the first sample (with index
|
66 : |
|
|
space coordinates (0,0,0,...,0). The number of coefficients
|
67 : |
|
|
separated by commas and bounded by parens (with optional whitespace
|
68 : |
|
|
throughout) is given by the "space dimension" field. Each coefficient
|
69 : |
|
|
is a floating point value (of the sort produced by printf("%g", val))
|
70 : |
|
|
|
71 : |
|
|
============================================================
|
72 : |
|
|
The per-axis fields that should be there are as follows. The ordering
|
73 : |
|
|
of these fields is always *fast* to *slow*, and the number of pieces
|
74 : |
|
|
of information is always equal to the image dimension.
|
75 : |
|
|
|
76 : |
|
|
----------------
|
77 : |
|
|
sizes: <int1> <int2> ... <intD>
|
78 : |
|
|
|
79 : |
|
|
The number of samples along each axis. Each integer value must be >= 0.
|
80 : |
|
|
|
81 : |
|
|
----------------
|
82 : |
|
|
kinds: <string1> <string2> ... <stringD>
|
83 : |
|
|
|
84 : |
|
|
The kind of information represented by the samples along each axis. The
|
85 : |
|
|
possible values are:
|
86 : |
|
|
|
87 : |
|
|
2-vector
|
88 : |
|
|
3-vector
|
89 : |
|
|
4-vector
|
90 : |
|
|
2D-symmetric-matrix
|
91 : |
|
|
2D-matrix
|
92 : |
|
|
3D-symmetric-matrix
|
93 : |
|
|
3D-matrix
|
94 : |
|
|
space
|
95 : |
|
|
|
96 : |
|
|
The "space" kind is for a typical axis of the image, with samples that
|
97 : |
|
|
subtend some region of the spatial domain of the image. All the other
|
98 : |
|
|
kinds are the sequence of scalar values that compose a non-scalar
|
99 : |
|
|
image value (vectors and tensors).
|
100 : |
|
|
|
101 : |
|
|
We currently allow there to be *at* *most* *one* axis with a
|
102 : |
|
|
non-"space" kind. We can have non-scalar image values, but we don't
|
103 : |
|
|
have cartesian products of non-scalar image values. The non-"space"
|
104 : |
|
|
kind can be anywhere in the axis ordering. If all the axis kinds are
|
105 : |
|
|
"space", then then image data is for scalars, else it is for
|
106 : |
|
|
non-scalar data.
|
107 : |
|
|
|
108 : |
|
|
In scalar data, the image "dimension" must equal the "space dimension".
|
109 : |
|
|
In non-scalar data, the image "dimension" must equal *one* plus
|
110 : |
|
|
the "space dimension". That is, the spatial axes have to form a
|
111 : |
|
|
basis, not necessarily orthonormal, for world space (the vectors
|
112 : |
|
|
are defined by the "space directions" field, below). Thus, a
|
113 : |
|
|
3-D scalar image can't reside in a 2-D or 4-D world space, nor can
|
114 : |
|
|
a 3-D vector image reside in a 3-D or 5-D world space.
|
115 : |
|
|
|
116 : |
|
|
We are currently not allowing the "measurement frame" field that
|
117 : |
|
|
identifies the coordinate system in which these are measured relative
|
118 : |
|
|
to the image orientation, so nothing should be assumed about the space
|
119 : |
|
|
in which these coefficients are measured. The order of coefficients
|
120 : |
|
|
for these non-scalar kinds is:
|
121 : |
|
|
|
122 : |
|
|
2D-symmetric-matrix: Mxx Mxy Myy
|
123 : |
|
|
2D-matrix: Mxx Mxy Myx Myy
|
124 : |
|
|
3D-symmetric-matrix: Mxx Mxy Mxz Myy Myz Mzz
|
125 : |
|
|
3D-matrix: Mxx Mxy Mxz Myx Myy Myz Mzx Mzy Mzz
|
126 : |
|
|
|
127 : |
|
|
----------------
|
128 : |
|
|
space directions: (<x1>,<x2>,...,<xN>) (<x1>,<x2>,...,<xN>) ...
|
129 : |
|
|
(and at most one of these vectors is actually "none")
|
130 : |
|
|
|
131 : |
|
|
These give the "direction" in world-space between successive samples
|
132 : |
|
|
along each axis: the columns of the index-to-world transform matrix.
|
133 : |
|
|
There is one per image axis, even for the axis of coefficients of
|
134 : |
|
|
non-scalar image values. Because such an axis really has no spatial
|
135 : |
|
|
extent, for this and only this axis, the space direction vector is
|
136 : |
|
|
instead the string "none".
|
137 : |
|
|
|
138 : |
|
|
============================================================
|
139 : |
|
|
Field ordering:
|
140 : |
|
|
|
141 : |
|
|
The fields should appear in this order:
|
142 : |
|
|
type
|
143 : |
|
|
dimension
|
144 : |
|
|
space dimension
|
145 : |
|
|
sizes
|
146 : |
|
|
space directions
|
147 : |
|
|
kinds
|
148 : |
|
|
endian
|
149 : |
|
|
encoding
|
150 : |
|
|
space origin
|